@oxyhq/contracts 0.7.0 → 0.8.0

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.
@@ -0,0 +1,165 @@
1
+ import { z } from 'zod';
2
+ export declare const sessionAccountSchema: z.ZodObject<{
3
+ accountId: z.ZodString;
4
+ sessionId: z.ZodString;
5
+ authuser: z.ZodNumber;
6
+ operatedByUserId: z.ZodOptional<z.ZodString>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ accountId: string;
9
+ sessionId: string;
10
+ authuser: number;
11
+ operatedByUserId?: string | undefined;
12
+ }, {
13
+ accountId: string;
14
+ sessionId: string;
15
+ authuser: number;
16
+ operatedByUserId?: string | undefined;
17
+ }>;
18
+ export declare const deviceSessionStateSchema: z.ZodObject<{
19
+ deviceId: z.ZodString;
20
+ accounts: z.ZodArray<z.ZodObject<{
21
+ accountId: z.ZodString;
22
+ sessionId: z.ZodString;
23
+ authuser: z.ZodNumber;
24
+ operatedByUserId: z.ZodOptional<z.ZodString>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ accountId: string;
27
+ sessionId: string;
28
+ authuser: number;
29
+ operatedByUserId?: string | undefined;
30
+ }, {
31
+ accountId: string;
32
+ sessionId: string;
33
+ authuser: number;
34
+ operatedByUserId?: string | undefined;
35
+ }>, "many">;
36
+ activeAccountId: z.ZodNullable<z.ZodString>;
37
+ revision: z.ZodNumber;
38
+ updatedAt: z.ZodNumber;
39
+ }, "strip", z.ZodTypeAny, {
40
+ updatedAt: number;
41
+ deviceId: string;
42
+ accounts: {
43
+ accountId: string;
44
+ sessionId: string;
45
+ authuser: number;
46
+ operatedByUserId?: string | undefined;
47
+ }[];
48
+ activeAccountId: string | null;
49
+ revision: number;
50
+ }, {
51
+ updatedAt: number;
52
+ deviceId: string;
53
+ accounts: {
54
+ accountId: string;
55
+ sessionId: string;
56
+ authuser: number;
57
+ operatedByUserId?: string | undefined;
58
+ }[];
59
+ activeAccountId: string | null;
60
+ revision: number;
61
+ }>;
62
+ export declare const activeTokenSchema: z.ZodObject<{
63
+ accessToken: z.ZodString;
64
+ expiresAt: z.ZodString;
65
+ }, "strip", z.ZodTypeAny, {
66
+ expiresAt: string;
67
+ accessToken: string;
68
+ }, {
69
+ expiresAt: string;
70
+ accessToken: string;
71
+ }>;
72
+ export declare const deviceSessionSyncSchema: z.ZodObject<{
73
+ state: z.ZodObject<{
74
+ deviceId: z.ZodString;
75
+ accounts: z.ZodArray<z.ZodObject<{
76
+ accountId: z.ZodString;
77
+ sessionId: z.ZodString;
78
+ authuser: z.ZodNumber;
79
+ operatedByUserId: z.ZodOptional<z.ZodString>;
80
+ }, "strip", z.ZodTypeAny, {
81
+ accountId: string;
82
+ sessionId: string;
83
+ authuser: number;
84
+ operatedByUserId?: string | undefined;
85
+ }, {
86
+ accountId: string;
87
+ sessionId: string;
88
+ authuser: number;
89
+ operatedByUserId?: string | undefined;
90
+ }>, "many">;
91
+ activeAccountId: z.ZodNullable<z.ZodString>;
92
+ revision: z.ZodNumber;
93
+ updatedAt: z.ZodNumber;
94
+ }, "strip", z.ZodTypeAny, {
95
+ updatedAt: number;
96
+ deviceId: string;
97
+ accounts: {
98
+ accountId: string;
99
+ sessionId: string;
100
+ authuser: number;
101
+ operatedByUserId?: string | undefined;
102
+ }[];
103
+ activeAccountId: string | null;
104
+ revision: number;
105
+ }, {
106
+ updatedAt: number;
107
+ deviceId: string;
108
+ accounts: {
109
+ accountId: string;
110
+ sessionId: string;
111
+ authuser: number;
112
+ operatedByUserId?: string | undefined;
113
+ }[];
114
+ activeAccountId: string | null;
115
+ revision: number;
116
+ }>;
117
+ activeToken: z.ZodNullable<z.ZodObject<{
118
+ accessToken: z.ZodString;
119
+ expiresAt: z.ZodString;
120
+ }, "strip", z.ZodTypeAny, {
121
+ expiresAt: string;
122
+ accessToken: string;
123
+ }, {
124
+ expiresAt: string;
125
+ accessToken: string;
126
+ }>>;
127
+ }, "strip", z.ZodTypeAny, {
128
+ state: {
129
+ updatedAt: number;
130
+ deviceId: string;
131
+ accounts: {
132
+ accountId: string;
133
+ sessionId: string;
134
+ authuser: number;
135
+ operatedByUserId?: string | undefined;
136
+ }[];
137
+ activeAccountId: string | null;
138
+ revision: number;
139
+ };
140
+ activeToken: {
141
+ expiresAt: string;
142
+ accessToken: string;
143
+ } | null;
144
+ }, {
145
+ state: {
146
+ updatedAt: number;
147
+ deviceId: string;
148
+ accounts: {
149
+ accountId: string;
150
+ sessionId: string;
151
+ authuser: number;
152
+ operatedByUserId?: string | undefined;
153
+ }[];
154
+ activeAccountId: string | null;
155
+ revision: number;
156
+ };
157
+ activeToken: {
158
+ expiresAt: string;
159
+ accessToken: string;
160
+ } | null;
161
+ }>;
162
+ export type SessionAccount = z.infer<typeof sessionAccountSchema>;
163
+ export type DeviceSessionState = z.infer<typeof deviceSessionStateSchema>;
164
+ export type ActiveToken = z.infer<typeof activeTokenSchema>;
165
+ export type DeviceSessionSync = z.infer<typeof deviceSessionSyncSchema>;
@@ -41,6 +41,13 @@ export declare const fedcmTokenPayloadSchema: z.ZodObject<{
41
41
  exp: z.ZodOptional<z.ZodNumber>;
42
42
  iat: z.ZodOptional<z.ZodNumber>;
43
43
  nonce: z.ZodOptional<z.ZodString>;
44
+ /**
45
+ * An explicit central deviceId minted by the IdP, threaded through so the
46
+ * RP session can inherit a unified device id instead of deriving one from
47
+ * the (userId, RP origin) stableDeviceKey. Optional and additive — omitted
48
+ * tokens fall back to the existing stableDeviceKey/UA-IP derivation.
49
+ */
50
+ deviceId: z.ZodOptional<z.ZodString>;
44
51
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
45
52
  iss: z.ZodOptional<z.ZodString>;
46
53
  sub: z.ZodOptional<z.ZodString>;
@@ -48,6 +55,13 @@ export declare const fedcmTokenPayloadSchema: z.ZodObject<{
48
55
  exp: z.ZodOptional<z.ZodNumber>;
49
56
  iat: z.ZodOptional<z.ZodNumber>;
50
57
  nonce: z.ZodOptional<z.ZodString>;
58
+ /**
59
+ * An explicit central deviceId minted by the IdP, threaded through so the
60
+ * RP session can inherit a unified device id instead of deriving one from
61
+ * the (userId, RP origin) stableDeviceKey. Optional and additive — omitted
62
+ * tokens fall back to the existing stableDeviceKey/UA-IP derivation.
63
+ */
64
+ deviceId: z.ZodOptional<z.ZodString>;
51
65
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
52
66
  iss: z.ZodOptional<z.ZodString>;
53
67
  sub: z.ZodOptional<z.ZodString>;
@@ -55,5 +69,12 @@ export declare const fedcmTokenPayloadSchema: z.ZodObject<{
55
69
  exp: z.ZodOptional<z.ZodNumber>;
56
70
  iat: z.ZodOptional<z.ZodNumber>;
57
71
  nonce: z.ZodOptional<z.ZodString>;
72
+ /**
73
+ * An explicit central deviceId minted by the IdP, threaded through so the
74
+ * RP session can inherit a unified device id instead of deriving one from
75
+ * the (userId, RP origin) stableDeviceKey. Optional and additive — omitted
76
+ * tokens fall back to the existing stableDeviceKey/UA-IP derivation.
77
+ */
78
+ deviceId: z.ZodOptional<z.ZodString>;
58
79
  }, z.ZodTypeAny, "passthrough">>;
59
80
  export type FedcmTokenPayload = z.infer<typeof fedcmTokenPayloadSchema>;
@@ -39,19 +39,74 @@
39
39
  */
40
40
  import { z } from 'zod';
41
41
  /**
42
- * A single DID verification method. Mirrors the secp256k1 key entries the API
43
- * derives from `User.publicKey` + each `authMethods[]` of type `identity`.
44
- * `id` is a fragment reference within the DID document (e.g.
45
- * `did:web:oxy.so:u:<id>#key-1`); `controller` is the controlling DID;
46
- * `publicKeyHex` is the uncompressed/compressed secp256k1 public key in hex.
42
+ * A `EcdsaSecp256k1VerificationKey2019` verification method the canonical Oxy
43
+ * key form. Mirrors the secp256k1 key entries the API derives from
44
+ * `User.publicKey` + each `authMethods[]` of type `identity`. `id` is a fragment
45
+ * reference within the DID document (e.g. `did:web:oxy.so:u:<id>#key-1`);
46
+ * `controller` is the controlling DID; `publicKeyHex` is the (uncompressed)
47
+ * secp256k1 public key in hex.
47
48
  */
48
- export interface VerificationMethod {
49
+ export interface Secp256k1VerificationMethod {
49
50
  id: string;
50
51
  type: 'EcdsaSecp256k1VerificationKey2019';
51
52
  controller: string;
52
53
  publicKeyHex: string;
53
54
  }
54
- export declare const verificationMethodSchema: z.ZodType<VerificationMethod>;
55
+ /**
56
+ * A `Multikey` verification method — the AtProto/Bluesky key form. The SAME
57
+ * secp256k1 key as an account's {@link Secp256k1VerificationMethod}, re-encoded
58
+ * the way atproto expects: `publicKeyMultibase` is the `did:key`-style multibase
59
+ * (`base58btc`, leading `z`) of the multicodec-prefixed (`0xe7 0x01`, secp256k1)
60
+ * COMPRESSED public key. This is the verification method a foreign Bluesky
61
+ * AppView reads when it routes to the user's bridge PDS; it is additive and only
62
+ * present for atproto-bridged self-sovereign accounts.
63
+ */
64
+ export interface MultikeyVerificationMethod {
65
+ id: string;
66
+ type: 'Multikey';
67
+ controller: string;
68
+ publicKeyMultibase: string;
69
+ }
70
+ /**
71
+ * A single DID verification method — either the canonical Oxy secp256k1 form
72
+ * ({@link Secp256k1VerificationMethod}) or the atproto `Multikey` form
73
+ * ({@link MultikeyVerificationMethod}). Discriminated on `type`, so an
74
+ * `EcdsaSecp256k1VerificationKey2019` entry keeps its exact `publicKeyHex` shape
75
+ * (every document already served verifies byte-identically) and the `Multikey`
76
+ * entry carries `publicKeyMultibase`.
77
+ */
78
+ export type VerificationMethod = Secp256k1VerificationMethod | MultikeyVerificationMethod;
79
+ export declare const verificationMethodSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
80
+ id: z.ZodString;
81
+ type: z.ZodLiteral<"EcdsaSecp256k1VerificationKey2019">;
82
+ controller: z.ZodString;
83
+ publicKeyHex: z.ZodString;
84
+ }, "strip", z.ZodTypeAny, {
85
+ id: string;
86
+ type: "EcdsaSecp256k1VerificationKey2019";
87
+ controller: string;
88
+ publicKeyHex: string;
89
+ }, {
90
+ id: string;
91
+ type: "EcdsaSecp256k1VerificationKey2019";
92
+ controller: string;
93
+ publicKeyHex: string;
94
+ }>, z.ZodObject<{
95
+ id: z.ZodString;
96
+ type: z.ZodLiteral<"Multikey">;
97
+ controller: z.ZodString;
98
+ publicKeyMultibase: z.ZodString;
99
+ }, "strip", z.ZodTypeAny, {
100
+ id: string;
101
+ type: "Multikey";
102
+ controller: string;
103
+ publicKeyMultibase: string;
104
+ }, {
105
+ id: string;
106
+ type: "Multikey";
107
+ controller: string;
108
+ publicKeyMultibase: string;
109
+ }>]>;
55
110
  /**
56
111
  * A DID service entry (the `service[]` array). Oxy publishes its API root and
57
112
  * profile endpoints here so a resolver can discover where to fetch the user's
@@ -18,7 +18,7 @@ export type { FedcmTokenPayload, } from './fedcmToken';
18
18
  export { recommendationExcludeTypeSchema, recommendationBoostSchema, recommendationSignalWeightsSchema, recommendationRequestSchema, recommendationCountSchema, recommendationItemSchema, recommendationResponseSchema, appEndorsementInputSchema, appInterestInputSchema, appUserSignalIngestSchema, } from './recommendations';
19
19
  export type { RecommendationExcludeType, RecommendationBoost, RecommendationSignalWeights, RecommendationRequest, RecommendationCount, RecommendationItem, RecommendationResponse, AppEndorsementInput, AppInterestInput, AppUserSignalIngest, } from './recommendations';
20
20
  export { verificationMethodSchema, didServiceSchema, didDocumentSchema, signedRecordEnvelopeSchema, verifiedDomainSchema, domainVerificationRequestSchema, domainVerificationInstructionsSchema, authMethodEntrySchema, authMethodsResponseSchema, exportAttestationSchema, exportBundleSchema, } from './identity';
21
- export type { VerificationMethod, DidService, DidDocument, SignedRecordEnvelope, VerifiedDomain, DomainVerificationRequest, DomainVerificationInstructions, AuthMethodEntry, AuthMethodsResponse, ExportAttestation, ExportBundle, } from './identity';
21
+ export type { VerificationMethod, Secp256k1VerificationMethod, MultikeyVerificationMethod, DidService, DidDocument, SignedRecordEnvelope, VerifiedDomain, DomainVerificationRequest, DomainVerificationInstructions, AuthMethodEntry, AuthMethodsResponse, ExportAttestation, ExportBundle, } from './identity';
22
22
  export { oxySignedRecordTypeSchema, } from './oxyRecordTypes';
23
23
  export type { OxySignedRecordType, } from './oxyRecordTypes';
24
24
  export { chainHeadResponseSchema, logPageResponseSchema, } from './protocol';
@@ -27,3 +27,5 @@ export { publicCardSchema, signedPublicCardSchema, realLifeAttestationRecordSche
27
27
  export type { CardTrustTier, PersonhoodStatus, PublicCard, SignedPublicCard, RealLifeAttestationRecord, RealLifeAttestationResult, ValidationVerdict, ValidationRequestStatus, ValidationVerdictRecord, ValidationOpenRequest, ValidationOpenResult, ValidationRequestSummary, ValidationVoteResult, PersonhoodVouchRecord, PersonhoodBreakdown, PersonhoodStatusResult, VouchResult, CredentialStatus, CredentialRecord, VerifiableCredentialResponse, CredentialIssueResult, CredentialListResult, CredentialVerifyResult, } from './civic';
28
28
  export { linkPreviewSchema, linkPreviewBatchRequestSchema, linkPreviewBatchResponseSchema, linkPreviewResponseSchema, } from './links';
29
29
  export type { LinkPreviewStatus, LinkPreview, LinkPreviewBatchRequest, LinkPreviewBatchResponse, } from './links';
30
+ export { sessionAccountSchema, deviceSessionStateSchema, activeTokenSchema, deviceSessionSyncSchema, } from './deviceSession';
31
+ export type { SessionAccount, DeviceSessionState, ActiveToken, DeviceSessionSync, } from './deviceSession';
@@ -64,8 +64,8 @@ export declare const publicApplicationSchema: z.ZodObject<{
64
64
  scopes: z.ZodArray<z.ZodString, "many">;
65
65
  developerName: z.ZodOptional<z.ZodString>;
66
66
  }, "strip", z.ZodTypeAny, {
67
- type: "first_party" | "third_party" | "internal" | "system";
68
67
  id: string;
68
+ type: "first_party" | "third_party" | "internal" | "system";
69
69
  name: string;
70
70
  isOfficial: boolean;
71
71
  isInternal: boolean;
@@ -75,8 +75,8 @@ export declare const publicApplicationSchema: z.ZodObject<{
75
75
  websiteUrl?: string | undefined;
76
76
  developerName?: string | undefined;
77
77
  }, {
78
- type: "first_party" | "third_party" | "internal" | "system";
79
78
  id: string;
79
+ type: "first_party" | "third_party" | "internal" | "system";
80
80
  name: string;
81
81
  isOfficial: boolean;
82
82
  isInternal: boolean;
@@ -122,8 +122,8 @@ export declare const sessionStatusSchema: z.ZodObject<{
122
122
  scopes: z.ZodArray<z.ZodString, "many">;
123
123
  developerName: z.ZodOptional<z.ZodString>;
124
124
  }, "strip", z.ZodTypeAny, {
125
- type: "first_party" | "third_party" | "internal" | "system";
126
125
  id: string;
126
+ type: "first_party" | "third_party" | "internal" | "system";
127
127
  name: string;
128
128
  isOfficial: boolean;
129
129
  isInternal: boolean;
@@ -133,8 +133,8 @@ export declare const sessionStatusSchema: z.ZodObject<{
133
133
  websiteUrl?: string | undefined;
134
134
  developerName?: string | undefined;
135
135
  }, {
136
- type: "first_party" | "third_party" | "internal" | "system";
137
136
  id: string;
137
+ type: "first_party" | "third_party" | "internal" | "system";
138
138
  name: string;
139
139
  isOfficial: boolean;
140
140
  isInternal: boolean;
@@ -157,8 +157,8 @@ export declare const sessionStatusSchema: z.ZodObject<{
157
157
  authorized?: boolean | undefined;
158
158
  sessionToken?: string | undefined;
159
159
  application?: {
160
- type: "first_party" | "third_party" | "internal" | "system";
161
160
  id: string;
161
+ type: "first_party" | "third_party" | "internal" | "system";
162
162
  name: string;
163
163
  isOfficial: boolean;
164
164
  isInternal: boolean;
@@ -177,8 +177,8 @@ export declare const sessionStatusSchema: z.ZodObject<{
177
177
  authorized?: boolean | undefined;
178
178
  sessionToken?: string | undefined;
179
179
  application?: {
180
- type: "first_party" | "third_party" | "internal" | "system";
181
180
  id: string;
181
+ type: "first_party" | "third_party" | "internal" | "system";
182
182
  name: string;
183
183
  isOfficial: boolean;
184
184
  isInternal: boolean;
@@ -419,9 +419,9 @@ export declare const refreshAllAccountSchema: z.ZodObject<{
419
419
  }, z.ZodTypeAny, "passthrough">>;
420
420
  }, "strip", z.ZodTypeAny, {
421
421
  expiresAt: string;
422
+ sessionId: string;
422
423
  authuser: number;
423
424
  accessToken: string;
424
- sessionId: string;
425
425
  user: {
426
426
  name: UserNameResponse;
427
427
  id?: string | undefined;
@@ -443,9 +443,9 @@ export declare const refreshAllAccountSchema: z.ZodObject<{
443
443
  };
444
444
  }, {
445
445
  expiresAt: string;
446
+ sessionId: string;
446
447
  authuser: number;
447
448
  accessToken: string;
448
- sessionId: string;
449
449
  user: {
450
450
  name: UserNameResponse;
451
451
  id?: string | undefined;
@@ -568,9 +568,9 @@ export declare const refreshAllResponseSchema: z.ZodObject<{
568
568
  }, z.ZodTypeAny, "passthrough">>;
569
569
  }, "strip", z.ZodTypeAny, {
570
570
  expiresAt: string;
571
+ sessionId: string;
571
572
  authuser: number;
572
573
  accessToken: string;
573
- sessionId: string;
574
574
  user: {
575
575
  name: UserNameResponse;
576
576
  id?: string | undefined;
@@ -592,9 +592,9 @@ export declare const refreshAllResponseSchema: z.ZodObject<{
592
592
  };
593
593
  }, {
594
594
  expiresAt: string;
595
+ sessionId: string;
595
596
  authuser: number;
596
597
  accessToken: string;
597
- sessionId: string;
598
598
  user: {
599
599
  name: UserNameResponse;
600
600
  id?: string | undefined;
@@ -618,9 +618,9 @@ export declare const refreshAllResponseSchema: z.ZodObject<{
618
618
  }, "strip", z.ZodTypeAny, {
619
619
  accounts: {
620
620
  expiresAt: string;
621
+ sessionId: string;
621
622
  authuser: number;
622
623
  accessToken: string;
623
- sessionId: string;
624
624
  user: {
625
625
  name: UserNameResponse;
626
626
  id?: string | undefined;
@@ -644,9 +644,9 @@ export declare const refreshAllResponseSchema: z.ZodObject<{
644
644
  }, {
645
645
  accounts: {
646
646
  expiresAt: string;
647
+ sessionId: string;
647
648
  authuser: number;
648
649
  accessToken: string;
649
- sessionId: string;
650
650
  user: {
651
651
  name: UserNameResponse;
652
652
  id?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxyhq/contracts",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "OxyHQ API contracts — single source of truth for request/response Zod schemas and inferred types, shared by the backend and the client SDKs",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",