@flow-industries/id 0.26.3 → 0.26.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +38 -0
  2. package/contracts/v1/sdk-exports.json +95 -0
  3. package/dist/sdk/caller.d.ts +29 -0
  4. package/dist/sdk/caller.js +37 -0
  5. package/dist/sdk/client/atproto-resolver.d.ts +8 -0
  6. package/dist/sdk/client/atproto-resolver.js +87 -0
  7. package/dist/sdk/client/atproto.js +9 -1
  8. package/dist/sdk/client/create-flow.js +10 -0
  9. package/dist/sdk/client/index.d.ts +6 -1
  10. package/dist/sdk/client/index.js +4 -0
  11. package/dist/sdk/client/note-transport.d.ts +15 -0
  12. package/dist/sdk/client/note-transport.js +104 -0
  13. package/dist/sdk/client/passkey-prf.d.ts +8 -0
  14. package/dist/sdk/client/passkey-prf.js +67 -0
  15. package/dist/sdk/client/session.d.ts +2 -0
  16. package/dist/sdk/client/session.js +23 -0
  17. package/dist/sdk/client/static-flow.js +2 -0
  18. package/dist/sdk/db/invitations.d.ts +310 -0
  19. package/dist/sdk/db/invitations.js +42 -0
  20. package/dist/sdk/db/schema.d.ts +248 -0
  21. package/dist/sdk/db/schema.js +25 -0
  22. package/dist/sdk/session-view.d.ts +15 -0
  23. package/dist/sdk/session-view.js +32 -0
  24. package/dist/sdk/types/atproto-resolver.d.ts +46 -0
  25. package/dist/sdk/types/atproto-resolver.js +0 -0
  26. package/dist/sdk/types/atproto.d.ts +24 -0
  27. package/dist/sdk/types/auth.d.ts +4 -0
  28. package/dist/sdk/types/dialog.d.ts +3 -0
  29. package/dist/sdk/types/hosted-oauth.d.ts +23 -0
  30. package/dist/sdk/types/hosted-oauth.js +0 -0
  31. package/dist/sdk/types/hosting-quota.d.ts +28 -0
  32. package/dist/sdk/types/hosting-quota.js +0 -0
  33. package/dist/sdk/types/index.d.ts +7 -2
  34. package/dist/sdk/types/managed-provisioning.d.ts +51 -0
  35. package/dist/sdk/types/managed-provisioning.js +0 -0
  36. package/dist/sdk/types/note-transport.d.ts +140 -0
  37. package/dist/sdk/types/note-transport.js +0 -0
  38. package/dist/sdk/types/sdk.d.ts +7 -0
  39. package/package.json +4 -2
@@ -0,0 +1,15 @@
1
+ import type { SessionUser } from "./types";
2
+ /** The audience a session was minted for. */
3
+ export declare const audienceOf: <T>(session: T) => string | undefined;
4
+ /** A session's own id. */
5
+ export declare const sessionIdOf: <T>(session: T) => string | undefined;
6
+ /** Whether the account is a guest. Absent means "not a guest". */
7
+ export declare const isGuestOf: <T>(user: T) => boolean;
8
+ /** The account's username. */
9
+ export declare const usernameOf: <T>(user: T) => string | undefined;
10
+ /**
11
+ * better-auth types `session.user` from its own base schema. Flow declares the extra columns
12
+ * through `additionalFields`, so every user row this server reads or writes carries them; the
13
+ * assertion names that configured shape rather than guessing at one.
14
+ */
15
+ export declare function sessionUserOf<T>(user: T): SessionUser;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * better-auth types `User` and `Session` from its own schema, so the fields Flow adds through
3
+ * `additionalFields` (audience, isGuest, username, walletAddress) are absent from those types.
4
+ *
5
+ * These read the added fields off the value without asserting a shape onto it, so a missing or
6
+ * wrongly-typed field answers `undefined` rather than becoming a lie the compiler believes.
7
+ * `String(x) === x` holds only for string primitives, which is the check without a `typeof`.
8
+ */
9
+ function textField(value, key) {
10
+ const found = Object.entries(Object(value)).find(([k]) => k === key)?.[1];
11
+ return String(found) === found ? found : undefined;
12
+ }
13
+ function boolField(value, key) {
14
+ return Object.entries(Object(value)).find(([k]) => k === key)?.[1] === true;
15
+ }
16
+ /** The audience a session was minted for. */
17
+ export const audienceOf = (session) => textField(session, "audience");
18
+ /** A session's own id. */
19
+ export const sessionIdOf = (session) => textField(session, "id");
20
+ /** Whether the account is a guest. Absent means "not a guest". */
21
+ export const isGuestOf = (user) => boolField(user, "isGuest");
22
+ /** The account's username. */
23
+ export const usernameOf = (user) => textField(user, "username");
24
+ /**
25
+ * better-auth types `session.user` from its own base schema. Flow declares the extra columns
26
+ * through `additionalFields`, so every user row this server reads or writes carries them; the
27
+ * assertion names that configured shape rather than guessing at one.
28
+ */
29
+ export function sessionUserOf(user) {
30
+ // SAFETY: the fields are declared in the plugin config; see the doc comment.
31
+ return user;
32
+ }
@@ -0,0 +1,46 @@
1
+ import type { Context } from "hono";
2
+ import type { Caller } from "../caller";
3
+ import type { AtprotoResolution } from "./atproto";
4
+ import type { ManagedPdsState } from "./managed-provisioning";
5
+ export type AtprotoMapping = Pick<AtprotoResolution, "flowUserId" | "did" | "identityVersion" | "lifecycle">;
6
+ export type DidDocumentInput = {
7
+ id: string;
8
+ service?: unknown[];
9
+ };
10
+ export type AtprotoResolverDeps = {
11
+ testOrigin?: string;
12
+ resolveIdentity: (did: string, options: {
13
+ noCache: boolean;
14
+ signal: AbortSignal;
15
+ }) => Promise<{
16
+ did: string;
17
+ didDoc: DidDocumentInput;
18
+ handle: string;
19
+ }>;
20
+ assertPublicEndpoint: (endpoint: string) => Promise<void>;
21
+ authorization: (did: string, endpoint: string, signal: AbortSignal) => Promise<AtprotoResolution["authorization"]>;
22
+ flowPdsOrigins: ReadonlySet<string>;
23
+ ttlMs: number;
24
+ now?: () => number;
25
+ };
26
+ export type ManagedResolverState = {
27
+ lifecycle: ManagedPdsState;
28
+ identityVersion: number;
29
+ };
30
+ export type AtprotoResolverRouteDeps = {
31
+ admit: (userId: string) => Promise<boolean>;
32
+ resolveCaller: (context: Context) => Promise<Caller | null>;
33
+ activeAccountOf?: (headers: Headers) => Promise<string | null | undefined>;
34
+ readMapping: (userId: string) => Promise<AtprotoMapping>;
35
+ resolve: (mapping: AtprotoMapping, freshness: "cached" | "refresh", signal?: AbortSignal) => Promise<AtprotoResolution>;
36
+ };
37
+ export type AtprotoResolverAdmissionCaps = {
38
+ userHourly: number;
39
+ globalHourly: number;
40
+ };
41
+ export type AtprotoStoredGrant = {
42
+ sub: string;
43
+ aud: string;
44
+ iss: string;
45
+ expires_at?: string;
46
+ };
File without changes
@@ -1,8 +1,10 @@
1
1
  export type AtprotoStartRequest = {
2
2
  identifier: string;
3
+ invitationCode?: string;
3
4
  intent: "login" | "link";
4
5
  transaction?: string;
5
6
  expectedUserId?: string;
7
+ noteConsent?: true;
6
8
  };
7
9
  export type AtprotoCompletion = {
8
10
  user: {
@@ -14,6 +16,7 @@ export type AtprotoCompletion = {
14
16
  linked: true;
15
17
  };
16
18
  export type AtprotoStatus = {
19
+ noteConsentEnabled?: boolean;
17
20
  enabled: boolean;
18
21
  connection: {
19
22
  did: string;
@@ -23,3 +26,24 @@ export type AtprotoStatus = {
23
26
  canUnlink: boolean;
24
27
  unlinkBlockReason: string | null;
25
28
  };
29
+ export type AtprotoResolutionFailure = "SIGN_IN_REQUIRED" | "NO_AT_IDENTITY" | "PROVISIONING_PENDING" | "PROVISIONING_FAILED" | "ACCOUNT_CHANGED" | "UNSUPPORTED_DID_METHOD" | "IDENTITY_INVALID" | "RESOLUTION_UNAVAILABLE";
30
+ export type AtprotoResolution = {
31
+ flowUserId: string;
32
+ did: string;
33
+ handle: string | null;
34
+ pdsUrl: string;
35
+ hosting: "flow" | "external";
36
+ lifecycle: "active" | "suspended" | "migrated" | "deletion_pending";
37
+ authorization: "connected" | "reconnect_required";
38
+ resolvedAt: string;
39
+ expiresAt: string;
40
+ identityVersion: string;
41
+ };
42
+ export type AtprotoResolveOptions = {
43
+ freshness?: "cached" | "refresh";
44
+ signal?: AbortSignal;
45
+ };
46
+ export type AtprotoApi = {
47
+ resolve(options?: AtprotoResolveOptions): Promise<AtprotoResolution>;
48
+ invalidate(): void;
49
+ };
@@ -1,5 +1,6 @@
1
1
  import type { JWTPayload } from "jose";
2
2
  import type { AuthEventName } from "./events";
3
+ import type { ManagedPdsEnrollment } from "./managed-provisioning";
3
4
  export type FlowUser = {
4
5
  id: string;
5
6
  username: string;
@@ -74,6 +75,7 @@ export type AuthResponse = {
74
75
  additionalSessions?: AdditionalSession[];
75
76
  };
76
77
  export type AuthConfig = {
78
+ managedPdsEnabled?: boolean;
77
79
  atprotoEnabled?: boolean;
78
80
  rpId: string;
79
81
  rpName: string;
@@ -96,6 +98,7 @@ export type AuthResponseWithWebAuthn = AuthResponse & {
96
98
  export type PasskeyPluginOptions = {
97
99
  rpId: string;
98
100
  rpName?: string;
101
+ enrollManagedPds?: ManagedPdsEnrollment;
99
102
  };
100
103
  export type VerifyOptions = {
101
104
  audience: string;
@@ -169,6 +172,7 @@ export type PasskeyEnrollment = {
169
172
  credential: FlowCredential;
170
173
  };
171
174
  export type AccountRegistration = {
175
+ invitationCode?: string;
172
176
  username: string;
173
177
  email: string;
174
178
  subscribedToNews: boolean;
@@ -90,6 +90,9 @@ export type DialogState = {
90
90
  customLabels?: DialogCustomLabels;
91
91
  };
92
92
  export type SignUpProps = {
93
+ managedPdsEnabled?: boolean;
94
+ invitationCode?: string;
95
+ invitation?: import("react").ReactNode;
93
96
  verifiedEmail?: {
94
97
  email: string;
95
98
  nonce: string;
@@ -0,0 +1,23 @@
1
+ import type { AppDb } from "../db/handle";
2
+ export interface HostedOAuthTransaction {
3
+ issuer: string;
4
+ pds: string;
5
+ requestUri: string;
6
+ deviceId: string;
7
+ clientId: string;
8
+ }
9
+ export interface HostedOAuthMapping {
10
+ did: string;
11
+ pds: string;
12
+ version: string;
13
+ }
14
+ /** Called under the canonical user lock; returns only active managed identities. */
15
+ export type HostedOAuthMappingReader = (database: AppDb, userId: string) => Promise<HostedOAuthMapping | null>;
16
+ export interface HostedOAuthProofOptions {
17
+ testOrigin?: string;
18
+ issuer: string;
19
+ pds: string;
20
+ lifetimeMs: number;
21
+ maximumPendingProofs: number;
22
+ readMapping: HostedOAuthMappingReader;
23
+ }
File without changes
@@ -0,0 +1,28 @@
1
+ export interface HostingQuotaPolicy {
2
+ totalBytes: number;
3
+ uploadBytes: number;
4
+ scratchBytes: number;
5
+ concurrentUploads: number;
6
+ }
7
+ export interface HostingQuotaReservation {
8
+ bytes: number;
9
+ fence: number;
10
+ expiresAt: number;
11
+ state: "active" | "cleanup";
12
+ }
13
+ export interface HostingQuotaLedger {
14
+ revision: number;
15
+ nextFence: number;
16
+ certain: boolean;
17
+ recordBytes: number;
18
+ blobs: Record<string, number>;
19
+ deletionDebt: Record<string, {
20
+ bytes: number;
21
+ fence: number;
22
+ }>;
23
+ reservations: Record<string, HostingQuotaReservation>;
24
+ }
25
+ export interface HostingQuotaAdmission {
26
+ ledger: HostingQuotaLedger;
27
+ fence: number;
28
+ }
File without changes
@@ -1,6 +1,7 @@
1
1
  export type { AccountDeleteRequest, AccountDeleteResponse, AccountErasureCounts, AccountErasureEntry, AccountErasureFeed, AccountErasureResult, AccountExport, AccountExportAccount, AccountExportActionEvent, AccountExportActionSession, AccountExportAttendance, AccountExportAuthoredEvent, AccountExportCharacterStateTime, AccountExportFollow, AccountExportGameEvent, AccountExportNotification, AccountExportOtherService, AccountExportOwnedRoom, AccountExportPasskey, AccountExportRoomEvents, AccountExportRoomMembership, AccountExportRoomPlayerState, AccountExportRoomPresence, AccountExportRoomRestriction, AccountExportRoomSettings, AccountExportRooms, AccountExportRsvp, AccountExportSettingsSurface, AccountExportStudySubject, AccountExportXpGrant, AccountExportXpSummary, } from "./account-data";
2
2
  export type { ActionCurve, ActionEventRequest, ActionEventResponse, ActionsApi, ActiveActionState, FinishActionRequest, ListStudySessionsOptions, ListStudySubjectsOptions, StartActionInput, StartActionResult, StudyApi, StudySubjectResponse, UseActiveActionOptions, XpEstimateContext, } from "./actions";
3
- export type { AtprotoCompletion, AtprotoStartRequest, AtprotoStatus, } from "./atproto";
3
+ export type { AtprotoApi, AtprotoCompletion, AtprotoResolution, AtprotoResolutionFailure, AtprotoResolveOptions, AtprotoStartRequest, AtprotoStatus, } from "./atproto";
4
+ export type { AtprotoMapping, AtprotoResolverAdmissionCaps, AtprotoResolverDeps, AtprotoResolverRouteDeps, AtprotoStoredGrant, DidDocumentInput, ManagedResolverState, } from "./atproto-resolver";
4
5
  export type { AccountRegistration, AccountSession, AccountSessionsResponse, AdditionalSession, AuthConfig, AuthorizationTransaction, AuthPageBootstrap, AuthResponse, AuthResponseWithWebAuthn, BioNormalization, BioRejection, BioWriteRefusal, BioWriteResult, FlowCredential, FlowUser, PasskeyEnrollment, PasskeyPluginOptions, RevokeAllSessionsResponse, RevokeSessionResponse, SecurityActivityEntry, SecurityActivityResponse, SessionUser, VerifiedFlowJWT, VerifyOptions, WebAuthnSignature, } from "./auth";
5
6
  export type { BrowserAccount, BrowserAccounts } from "./browser-accounts";
6
7
  export type { BodyRegion, CosmeticItem, CosmeticMaterial, CosmeticPaint, CosmeticSlot, EquipConflict, EquippedCosmetic, EquippedCosmetics, EquipRegion, PaintSlot, SettingsConflict, } from "./cosmetics";
@@ -10,8 +11,12 @@ export type { AuthErrorCode, AuthEventName, AuthEventRecord, AuthMode, AuthOutco
10
11
  export type { ActiveAction, CatalogFieldRef, ClockAnchor, FinishedSummary, FocusApi, FocusPhase, FocusSessionEvent, FocusSessionState, StartFocusRequest, StudySearchHit, } from "./focus";
11
12
  export type { GameEventReport, GameLifecycleEventName, GameLifecycleFeedEvent, GameLifecycleFeedPage, GamePlayerSession, } from "./game";
12
13
  export { GAME_LIFECYCLE_EVENT_NAMES } from "./game";
14
+ export type { HostedOAuthMapping, HostedOAuthMappingReader, HostedOAuthProofOptions, HostedOAuthTransaction, } from "./hosted-oauth";
15
+ export type { HostingQuotaAdmission, HostingQuotaLedger, HostingQuotaPolicy, HostingQuotaReservation, } from "./hosting-quota";
13
16
  export type { AccountProfileData } from "./landing";
17
+ export type * from "./managed-provisioning";
14
18
  export type { Bridge, BridgeParameters, FlowAccount, FlowRemote, FlowRemoteConfig, FromWindowOptions, MessageResponse, Messenger, OneOf, Payload, QueuedRequest, ReadyOptions, RemoteFlowState, RemoteState, Schema, Storage, Topic, WithReady, } from "./messenger";
19
+ export type { NoteBlob, NoteCollection, NoteOperation, NoteRecord, NoteResponses, NoteStoredRecord, NoteTransportDeps, NoteVaultHeader, } from "./note-transport";
15
20
  export type { MarkNotificationsReadInput, NotificationCounts, NotificationEntry, NotificationPage, NotificationReadResult, NotificationRefusal, } from "./notifications";
16
21
  export type { OtpVerificationFailure, OtpVerificationResult, VerificationAdapter, } from "./otp";
17
22
  export type { Call, ConnectCapabilities, ConnectResponse, MethodName, MethodParams, MethodResult, RestoreResponse, RpcRequest, SendCallsParams, SendCallsRequest, SendCallsResponse, SendTransactionParams, SendTransactionRequest, SendTransactionResponse, SignMessageRequest, SignMessageResponse, SignTypedDataRequest, SignTypedDataResponse, TransactionArgs, TypedData, TypedDataDomain, TypedDataField, } from "./protocol";
@@ -19,7 +24,7 @@ export { isPersonalSignParams, isSendCallsParams, isSendTransactionParams, } fro
19
24
  export type { ReportOperation, ReportRequest, ReportResponse, ReportsApi, ReportTransport, } from "./reports";
20
25
  export type { CreateRoomEventInput, RoomEventArchive, RoomEventAttendance, RoomEventFrequency, RoomEventInstance, RoomEventInterest, RoomEventInterestState, RoomEventList, RoomEventOccurrence, RoomEventRecurrence, RoomEventRoomRef, RoomEventRun, RoomEventSeries, RoomEventStatus, SetInterestInput, UpdateRoomEventInput, } from "./room-events";
21
26
  export type { CreateRoomInput, GlobalRole, ModerationSubject, MyRooms, PlayerPositionReport, RoleChangeVerdict, RoomCapabilities, RoomCapability, RoomChannel, RoomDetail, RoomList, RoomMemberEntry, RoomMembers, RoomOccupancy, RoomOwner, RoomPlayerPosition, RoomPresenceEntry, RoomPresenceSnapshot, RoomRestrictionKind, RoomRole, RoomSummary, RoomSurfaceSettings, RoomsApi, RoomVisibility, StaffEntry, UpdateRoomInput, VerifyRoomContext, Viewer, VoiceDecisionReason, VoiceDecisionSubject, VoiceRoomDecision, } from "./rooms";
22
- export type { AccessKeyOptions, AccessKeyPreparation, AccountMenuProps, Address, ColorScheme, CreateDialogHostOptions, CreateFlowOptions, DialogHost, DialogOpenOptions, FinalizeAccessKeyParams, Flow, FlowConnectorParameters, FlowCookieNames, FlowIdProviderProps, FlowProfileButtonProps, FlowSessionState, FlowState, FlowWidgetHandle, FlowWidgetName, FlowWidgetProps, Listener, LoginOptions, MountFlowWidgetOptions, MountProfileOptions, OpenProfileOptions, PrepareArgsWithAuth, PrepareTransactionRequestPhase, ProfileButtonHandle, ProfileButtonProps, ProfileMenuMountOptions, ProfilePosition, ResolveAccountParams, ResolvedAccessKeyOptions, RootCredential, SendCallsArgs, SendTransactionArgs, Session, SigningContext, SignMessageArgs, SignTypedDataArgs, Store, StoredAccessKey, SwitchAccountOptions, UseOpenProfileOptions, WagmiConnectCapabilities, WagmiConnectParams, } from "./sdk";
27
+ export type { AccessKeyOptions, AccessKeyPreparation, AccountMenuProps, Address, ColorScheme, CreateDialogHostOptions, CreateFlowOptions, DialogHost, DialogOpenOptions, FinalizeAccessKeyParams, Flow, FlowConnectorParameters, FlowCookieNames, FlowIdProviderProps, FlowProfileButtonProps, FlowSessionState, FlowState, FlowWidgetHandle, FlowWidgetName, FlowWidgetProps, Listener, LoginOptions, MountFlowWidgetOptions, MountProfileOptions, OpenProfileOptions, PasskeyPrfOptions, PrepareArgsWithAuth, PrepareTransactionRequestPhase, ProfileButtonHandle, ProfileButtonProps, ProfileMenuMountOptions, ProfilePosition, ResolveAccountParams, ResolvedAccessKeyOptions, RootCredential, SendCallsArgs, SendTransactionArgs, Session, SigningContext, SignMessageArgs, SignTypedDataArgs, Store, StoredAccessKey, SwitchAccountOptions, UseOpenProfileOptions, WagmiConnectCapabilities, WagmiConnectParams, } from "./sdk";
23
28
  export type { GracefulShutdownCleanup, GracefulShutdownOptions, GracefulShutdownServer, GracefulShutdownSignal, ResolvedFlowSession, ResolveSessionOptions, SessionRouteOptions, SessionRouteResponse, SessionRouteSession, } from "./server";
24
29
  export type { CosmeticOffer, PaintDescriptor, SettingDescriptor, Settings, SettingsMigration, StoredSettings, SurfaceRegistry, } from "./settings";
25
30
  export type { CreateStudySubjectInput, ListStudySessionsInput, StudyCatalog, StudyCategory, StudyCategoryTotals, StudyField, StudyRange, StudySessionEntry, StudySessionPage, StudySessionsResult, StudySubject, StudySubjectCreation, StudySubjectList, StudySubjectRefusal, StudySubjectRemoval, StudySubjectRemovalResponse, StudySubjectTotals, StudySubjectUpdate, StudySummary, UpdateStudySubjectInput, } from "./study";
@@ -0,0 +1,51 @@
1
+ import type { AppDb } from "../db/handle";
2
+ /** Queues a reservation in the enrollment transaction; remote provisioning runs after commit. */
3
+ export type ManagedPdsEnrollment = (database: AppDb, userId: string) => Promise<void>;
4
+ export type ManagedPdsState = "queued" | "provisioning" | "active" | "failed" | "suspended" | "migrated" | "deletion_pending";
5
+ export interface ManagedPdsReservation {
6
+ operationId: string;
7
+ handle: string;
8
+ pdsEndpoint: string;
9
+ inviteReference: string;
10
+ }
11
+ export interface ManagedPdsIdentity {
12
+ did: string;
13
+ handle: string;
14
+ pdsEndpoint: string;
15
+ }
16
+ export type ManagedPdsRecovery = {
17
+ outcome: "committed";
18
+ identity: ManagedPdsIdentity;
19
+ } | {
20
+ outcome: "absent";
21
+ } | {
22
+ outcome: "pending";
23
+ };
24
+ /**
25
+ * Server-only adapter for an authenticated operator API. It must durably bind
26
+ * operationId to key material before PLC publication and replay the same DID
27
+ * through every crash boundary. Stock createAccount does not implement this.
28
+ */
29
+ export interface ManagedPdsProvisioner {
30
+ contract: "durable-operation-idempotency-v1";
31
+ remove?(reservation: ManagedPdsReservation & {
32
+ did: string | null;
33
+ }): Promise<void>;
34
+ recover(reservation: ManagedPdsReservation): Promise<ManagedPdsRecovery>;
35
+ create(reservation: ManagedPdsReservation): Promise<ManagedPdsIdentity>;
36
+ }
37
+ export interface ManagedPdsWorkerLimits {
38
+ leaseMs: number;
39
+ maxAttempts: number;
40
+ }
41
+ export type ManagedPdsConfig = {
42
+ endpoint: string;
43
+ operatorEndpoint: string;
44
+ operatorToken: string;
45
+ };
46
+ export interface ManagedPdsTickReport {
47
+ active: number;
48
+ failed: number;
49
+ idle: number;
50
+ deleted?: number;
51
+ }
File without changes
@@ -0,0 +1,140 @@
1
+ import type { Context } from "hono";
2
+ import type { Caller } from "../caller";
3
+ import type { AtprotoResolution } from "./atproto";
4
+ import type { AtprotoMapping } from "./atproto-resolver";
5
+ export type NoteCollection = "game.flow.note.item" | "game.flow.note.tombstone" | "game.flow.note.vault";
6
+ export type NoteBlob = {
7
+ $type: "blob";
8
+ ref: {
9
+ $link: string;
10
+ };
11
+ mimeType: "application/octet-stream";
12
+ size: number;
13
+ };
14
+ export type NoteItemRecord = {
15
+ $type: "game.flow.note.item" | "game.flow.note.tombstone";
16
+ id: string;
17
+ revision: string;
18
+ envelope: {
19
+ version: 1;
20
+ nonce: string;
21
+ ciphertext: string;
22
+ };
23
+ blobs: NoteBlob[];
24
+ chunkHashes?: string[];
25
+ };
26
+ export type NoteVaultHeader = {
27
+ verifier: {
28
+ version: 1;
29
+ nonce: string;
30
+ ciphertext: string;
31
+ };
32
+ version: 1;
33
+ vault: string;
34
+ epoch: number;
35
+ access: {
36
+ keyId: string;
37
+ prfInput: number[];
38
+ wrapped: {
39
+ version: 1;
40
+ salt: string;
41
+ envelope: {
42
+ version: 1;
43
+ nonce: string;
44
+ ciphertext: string;
45
+ };
46
+ };
47
+ }[];
48
+ };
49
+ export type NoteRecord = NoteItemRecord | {
50
+ $type: "game.flow.note.vault";
51
+ header: NoteVaultHeader;
52
+ };
53
+ export type NoteOperation = {
54
+ method: "head";
55
+ } | {
56
+ method: "list";
57
+ collection: NoteCollection;
58
+ cursor?: string;
59
+ } | {
60
+ method: "read";
61
+ collection: NoteCollection;
62
+ rkey: string;
63
+ } | {
64
+ method: "put";
65
+ collection: NoteCollection;
66
+ rkey: string;
67
+ record: NoteRecord;
68
+ swapRecord: string | null;
69
+ } | {
70
+ method: "delete";
71
+ collection: NoteCollection;
72
+ rkey: string;
73
+ swapRecord: string;
74
+ } | {
75
+ method: "batch";
76
+ swapCommit: string;
77
+ writes: ({
78
+ action: "create" | "update";
79
+ collection: NoteCollection;
80
+ rkey: string;
81
+ record: NoteRecord;
82
+ } | {
83
+ action: "delete";
84
+ collection: NoteCollection;
85
+ rkey: string;
86
+ })[];
87
+ };
88
+ export type NoteTransportDeps = {
89
+ enabled: boolean;
90
+ originAllowed: (origin: string) => boolean;
91
+ resolveCaller: (context: Context) => Promise<Caller | null>;
92
+ admit: (userId: string) => Promise<boolean>;
93
+ readMapping: (userId: string) => Promise<AtprotoMapping>;
94
+ resolve: (mapping: AtprotoMapping, signal: AbortSignal) => Promise<AtprotoResolution>;
95
+ session: (resolution: AtprotoResolution) => Promise<{
96
+ info: () => Promise<{
97
+ sub: string;
98
+ aud: string;
99
+ scope: string;
100
+ }>;
101
+ fetch: (path: string, init: RequestInit) => Promise<Response>;
102
+ }>;
103
+ };
104
+ export type NoteStoredRecord = {
105
+ uri: string;
106
+ cid: string;
107
+ value: NoteRecord;
108
+ };
109
+ export type NoteResponses = {
110
+ head: {
111
+ cid: string;
112
+ rev: string;
113
+ };
114
+ read: NoteStoredRecord;
115
+ list: {
116
+ records: NoteStoredRecord[];
117
+ cursor?: string;
118
+ };
119
+ put: {
120
+ uri: string;
121
+ cid: string;
122
+ };
123
+ delete: {
124
+ commit?: {
125
+ cid: string;
126
+ rev: string;
127
+ };
128
+ };
129
+ batch: {
130
+ commit: {
131
+ cid: string;
132
+ rev: string;
133
+ };
134
+ results: {
135
+ $type: string;
136
+ uri?: string;
137
+ cid?: string;
138
+ }[];
139
+ };
140
+ };
File without changes
@@ -2,6 +2,7 @@ import type { ReactNode } from "react";
2
2
  import type { Chain, Hex, PrepareTransactionRequestParameters, SendTransactionParameters, SignTypedDataParameters, Transport, WalletClient } from "viem";
3
3
  import type { SendCallsParameters } from "viem/actions";
4
4
  import type { RawValue } from "../json";
5
+ import type { AtprotoApi } from "./atproto";
5
6
  import type { AdditionalSession, FlowCredential, FlowUser, WebAuthnSignature } from "./auth";
6
7
  import type { BrowserAccount, BrowserAccounts } from "./browser-accounts";
7
8
  import type { ConnectCapabilities } from "./protocol";
@@ -377,6 +378,7 @@ export type Flow = {
377
378
  }): Promise<WalletClient>;
378
379
  /** Typed client for the room registry (browse, membership, settings, moderation). */
379
380
  rooms: RoomsApi;
381
+ atproto: AtprotoApi;
380
382
  subscribe(listener: Listener<FlowState>): () => void;
381
383
  getState(): FlowState;
382
384
  dialog: DialogHost;
@@ -448,3 +450,8 @@ export type FlowProfileButtonProps = ProfileButtonProps & {
448
450
  flow: Flow;
449
451
  };
450
452
  export type ProfileMenuMountOptions = Omit<FlowProfileButtonProps, "className">;
453
+ export type PasskeyPrfOptions = {
454
+ rpId: string;
455
+ input: Uint8Array<ArrayBuffer>;
456
+ signal?: AbortSignal;
457
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flow-industries/id",
3
- "version": "0.26.3",
3
+ "version": "0.26.5",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -76,6 +76,7 @@
76
76
  "prepublishOnly": "bun run build:sdk",
77
77
  "start": "bun run src/index.ts",
78
78
  "worker": "bun run src/worker.ts",
79
+ "worker:managed-pds": "bun run src/managed-pds-worker.ts",
79
80
  "db:generate": "bunx @better-auth/cli generate",
80
81
  "db:migrate:gen": "bunx drizzle-kit generate",
81
82
  "db:migrate": "bun scripts/db-migrate.ts",
@@ -149,10 +150,11 @@
149
150
  ],
150
151
  "dependencies": {
151
152
  "@atproto-labs/handle-resolver": "^0.4.9",
153
+ "@atproto-labs/identity-resolver": "0.4.9",
152
154
  "@atproto/jwk-jose": "^0.2.4",
153
155
  "@atproto/oauth-client": "^0.8.7",
154
156
  "@aws-sdk/client-s3": "^3.1073.0",
155
- "@flow-industries/ui": "^0.23.3",
157
+ "@flow-industries/ui": "0.23.4",
156
158
  "@hono/otel": "^1.1.2",
157
159
  "@openobserve/browser-logs": "^0.3.1",
158
160
  "@openobserve/browser-rum": "^0.3.1",