diff --git a/app/app.go b/app/app.go index 9094e30..3ed8756 100644 --- a/app/app.go +++ b/app/app.go @@ -8,7 +8,7 @@ import ( config "github.com/onsonr/hway/config" hwayorm "github.com/onsonr/hway/internal/models" "github.com/onsonr/hway/pkg/common" - "github.com/onsonr/hway/pkg/context" + // "github.com/onsonr/hway/pkg/context" ) type Gateway = *echo.Echo diff --git a/internal/models/models.go b/internal/models/models.go index 418f717..a9c53ba 100644 --- a/internal/models/models.go +++ b/internal/models/models.go @@ -81,7 +81,7 @@ type Session struct { Challenge string `json:"challenge"` IsHumanFirst bool `json:"is_human_first"` IsHumanLast bool `json:"is_human_last"` - ProfileID int64 `json:"profile_id"` + ProfileID string `json:"profile_id"` } type Vault struct { diff --git a/internal/models/query.sql.go b/internal/models/query.sql.go index 46436c4..23125aa 100644 --- a/internal/models/query.sql.go +++ b/internal/models/query.sql.go @@ -56,7 +56,7 @@ type CreateSessionParams struct { Challenge string `json:"challenge"` IsHumanFirst bool `json:"is_human_first"` IsHumanLast bool `json:"is_human_last"` - ProfileID int64 `json:"profile_id"` + ProfileID string `json:"profile_id"` } func (q *Queries) CreateSession(ctx context.Context, arg CreateSessionParams) (Session, error) { @@ -551,7 +551,7 @@ RETURNING id, created_at, updated_at, deleted_at, browser_name, browser_version, ` type UpdateSessionWithProfileIDParams struct { - ProfileID int64 `json:"profile_id"` + ProfileID string `json:"profile_id"` ID string `json:"id"` } diff --git a/internal/sink/schema.sql b/internal/sink/schema.sql index 912d465..e789067 100644 --- a/internal/sink/schema.sql +++ b/internal/sink/schema.sql @@ -77,7 +77,7 @@ CREATE TABLE sessions ( challenge TEXT NOT NULL, is_human_first BOOLEAN NOT NULL DEFAULT FALSE CHECK(is_human_first IN (0,1)), is_human_last BOOLEAN NOT NULL DEFAULT FALSE CHECK(is_human_last IN (0,1)), - profile_id INTEGER NOT NULL + profile_id TEXT NOT NULL ); -- Vaults store encrypted data diff --git a/pkg/common/ucan_store.go b/pkg/common/ucan_store.go index 506b075..7658e90 100644 --- a/pkg/common/ucan_store.go +++ b/pkg/common/ucan_store.go @@ -8,6 +8,7 @@ import ( "github.com/golang-jwt/jwt" "github.com/ipfs/go-cid" + "github.com/onsonr/crypto/keys" "github.com/onsonr/crypto/ucan" ) diff --git a/pkg/context/middleware.go b/pkg/context/middleware.go index 486b3c3..598e8ed 100644 --- a/pkg/context/middleware.go +++ b/pkg/context/middleware.go @@ -37,13 +37,13 @@ func UseGateway(env hway.Hway, ipc common.IPFS, db *hwayorm.Queries) echo.Middle return func(c echo.Context) error { ua := useragent.NewParser() ctx := &GatewayContext{ - Context: c, - Querier: db, - ipfsClient: ipc, - agent: ua.Parse(c.Request().UserAgent()), - grpcAddr: env.GetSonrGrpcUrl(), - tokenStore: common.NewUCANStore(ipc), - turnstileSiteKey: env.GetTurnstileSiteKey(), + Context: c, + Querier: db, + ipfsClient: ipc, + agent: ua.Parse(c.Request().UserAgent()), + grpcAddr: env.GetSonrGrpcUrl(), + tokenStore: common.NewUCANStore(ipc), + // turnstileSiteKey: env.GetTurnstileSiteKey(), } return next(ctx) } diff --git a/pkg/context/profiles.go b/pkg/context/profiles.go index 6de4f37..9082da1 100644 --- a/pkg/context/profiles.go +++ b/pkg/context/profiles.go @@ -23,7 +23,7 @@ func UpdateProfile(c echo.Context) (*hwayorm.Profile, error) { if err != nil { return nil, err } - return profile, nil + return &profile, nil } func ReadProfile(c echo.Context) (*hwayorm.Profile, error) { @@ -36,7 +36,7 @@ func ReadProfile(c echo.Context) (*hwayorm.Profile, error) { if err != nil { return nil, err } - return profile, nil + return &profile, nil } func DeleteProfile(c echo.Context) error {