feat(identity): add browser setup and user accounts

This commit is contained in:
sam committed 2026-10-16 02:41:24 +11:00
1 parent cf3455ef2e
commit aa012a7c6e
91 files changed
+6823 -636

No files matched your search

@@ -558,6 +558,11 @@ ON CONFLICT (session_id) DO UPDATE SET
created_at = EXCLUDED.created_at,
last_active_at = EXCLUDED.last_active_at
WHERE sessions.org_id = EXCLUDED.org_id
AND (
(sessions.platform = '' AND sessions.bot_user = '' AND sessions.channel_id = '' AND sessions.thread_id = '')
OR (sessions.platform = EXCLUDED.platform AND sessions.bot_user = EXCLUDED.bot_user
AND sessions.channel_id = EXCLUDED.channel_id AND sessions.thread_id = EXCLUDED.thread_id)
)
`
type SaveSessionParams struct {
@@ -577,8 +582,9 @@ type SaveSessionParams struct {
// Gateway conversation queries: sessions, messages, turns, full-text search.
// These back internal/gateway's PostgreSQL SessionStore.
// ── Sessions ────────────────────────────────────────────────────────────────
// Updates only a session the writing org owns: another org's session of the
// same id is left untouched and the zero row count refuses the write.
// A saved session keeps its organization and conversation identity. Empty
// placeholder rows may be completed; an existing conversation cannot be claimed
// by overwriting its source with another person's thread.
func (q *Queries) SaveSession(ctx context.Context, arg SaveSessionParams) (int64, error) {
result, err := q.db.Exec(ctx, saveSession,
arg.SessionID,
@@ -44,6 +44,22 @@ type AccessPolicyVersion struct {
UpdatedAt time.Time
}
type Account struct {
IdentityID string
Email string
PasswordHash string
RecoveryHash pgtype.Text
FailedAttempts int32
LockedUntil pgtype.Timestamptz
}
type AccountSession struct {
TokenHash string
IdentityID string
ExpiresAt time.Time
IssuedAt time.Time
}
type Alert struct {
ID int64
OrgID string
@@ -89,6 +105,14 @@ type ApplyStatus struct {
ReportedAt time.Time
}
type AuthenticationSetting struct {
Singleton bool
PublicUrl string
OidcIssuer string
OidcAudience string
OidcClientID string
}
type Binding struct {
ID string
Name string
@@ -344,6 +368,22 @@ type OrgUpgrade struct {
CompletedAt time.Time
}
type Passkey struct {
CredentialID string
IdentityID string
Name string
Credential []byte
CreatedAt time.Time
}
type PasskeyCeremony struct {
TokenHash string
IdentityID string
Registration bool
SessionData []byte
ExpiresAt time.Time
}
type PlaybookDispatch struct {
PlaybookID string
PlaybookVersion string