@oxyhq/contracts 0.24.0 → 0.26.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.
- package/LICENSE +202 -0
- package/NOTICE +16 -0
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/browserHub.js +215 -0
- package/dist/cjs/deviceDirectory.js +189 -0
- package/dist/cjs/index.js +30 -2
- package/dist/cjs/oauth.js +66 -0
- package/dist/cjs/oxyRecordTypes.js +44 -13
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/browserHub.js +212 -0
- package/dist/esm/deviceDirectory.js +186 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/oauth.js +63 -0
- package/dist/esm/oxyRecordTypes.js +44 -13
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/browserHub.d.ts +856 -0
- package/dist/types/deviceDirectory.d.ts +1317 -0
- package/dist/types/deviceSession.d.ts +46 -46
- package/dist/types/followGraph.d.ts +6 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/oauth.d.ts +86 -0
- package/dist/types/oxyRecordTypes.d.ts +42 -14
- package/dist/types/sessionStatus.d.ts +8 -8
- package/dist/types/userResponse.d.ts +8 -8
- package/package.json +3 -2
|
@@ -5,13 +5,13 @@ export declare const sessionAccountSchema: z.ZodObject<{
|
|
|
5
5
|
authuser: z.ZodNumber;
|
|
6
6
|
operatedByUserId: z.ZodOptional<z.ZodString>;
|
|
7
7
|
}, "strip", z.ZodTypeAny, {
|
|
8
|
-
sessionId: string;
|
|
9
8
|
accountId: string;
|
|
9
|
+
sessionId: string;
|
|
10
10
|
authuser: number;
|
|
11
11
|
operatedByUserId?: string | undefined;
|
|
12
12
|
}, {
|
|
13
|
-
sessionId: string;
|
|
14
13
|
accountId: string;
|
|
14
|
+
sessionId: string;
|
|
15
15
|
authuser: number;
|
|
16
16
|
operatedByUserId?: string | undefined;
|
|
17
17
|
}>;
|
|
@@ -23,13 +23,13 @@ export declare const deviceSessionStateSchema: z.ZodObject<{
|
|
|
23
23
|
authuser: z.ZodNumber;
|
|
24
24
|
operatedByUserId: z.ZodOptional<z.ZodString>;
|
|
25
25
|
}, "strip", z.ZodTypeAny, {
|
|
26
|
-
sessionId: string;
|
|
27
26
|
accountId: string;
|
|
27
|
+
sessionId: string;
|
|
28
28
|
authuser: number;
|
|
29
29
|
operatedByUserId?: string | undefined;
|
|
30
30
|
}, {
|
|
31
|
-
sessionId: string;
|
|
32
31
|
accountId: string;
|
|
32
|
+
sessionId: string;
|
|
33
33
|
authuser: number;
|
|
34
34
|
operatedByUserId?: string | undefined;
|
|
35
35
|
}>, "many">;
|
|
@@ -37,37 +37,37 @@ export declare const deviceSessionStateSchema: z.ZodObject<{
|
|
|
37
37
|
revision: z.ZodNumber;
|
|
38
38
|
updatedAt: z.ZodNumber;
|
|
39
39
|
}, "strip", z.ZodTypeAny, {
|
|
40
|
-
updatedAt: number;
|
|
41
40
|
deviceId: string;
|
|
42
41
|
accounts: {
|
|
43
|
-
sessionId: string;
|
|
44
42
|
accountId: string;
|
|
43
|
+
sessionId: string;
|
|
45
44
|
authuser: number;
|
|
46
45
|
operatedByUserId?: string | undefined;
|
|
47
46
|
}[];
|
|
48
47
|
activeAccountId: string | null;
|
|
49
48
|
revision: number;
|
|
50
|
-
}, {
|
|
51
49
|
updatedAt: number;
|
|
50
|
+
}, {
|
|
52
51
|
deviceId: string;
|
|
53
52
|
accounts: {
|
|
54
|
-
sessionId: string;
|
|
55
53
|
accountId: string;
|
|
54
|
+
sessionId: string;
|
|
56
55
|
authuser: number;
|
|
57
56
|
operatedByUserId?: string | undefined;
|
|
58
57
|
}[];
|
|
59
58
|
activeAccountId: string | null;
|
|
60
59
|
revision: number;
|
|
60
|
+
updatedAt: number;
|
|
61
61
|
}>;
|
|
62
62
|
export declare const activeTokenSchema: z.ZodObject<{
|
|
63
63
|
accessToken: z.ZodString;
|
|
64
64
|
expiresAt: z.ZodString;
|
|
65
65
|
}, "strip", z.ZodTypeAny, {
|
|
66
|
-
expiresAt: string;
|
|
67
66
|
accessToken: string;
|
|
68
|
-
}, {
|
|
69
67
|
expiresAt: string;
|
|
68
|
+
}, {
|
|
70
69
|
accessToken: string;
|
|
70
|
+
expiresAt: string;
|
|
71
71
|
}>;
|
|
72
72
|
export declare const deviceSessionSyncSchema: z.ZodObject<{
|
|
73
73
|
state: z.ZodObject<{
|
|
@@ -78,13 +78,13 @@ export declare const deviceSessionSyncSchema: z.ZodObject<{
|
|
|
78
78
|
authuser: z.ZodNumber;
|
|
79
79
|
operatedByUserId: z.ZodOptional<z.ZodString>;
|
|
80
80
|
}, "strip", z.ZodTypeAny, {
|
|
81
|
-
sessionId: string;
|
|
82
81
|
accountId: string;
|
|
82
|
+
sessionId: string;
|
|
83
83
|
authuser: number;
|
|
84
84
|
operatedByUserId?: string | undefined;
|
|
85
85
|
}, {
|
|
86
|
-
sessionId: string;
|
|
87
86
|
accountId: string;
|
|
87
|
+
sessionId: string;
|
|
88
88
|
authuser: number;
|
|
89
89
|
operatedByUserId?: string | undefined;
|
|
90
90
|
}>, "many">;
|
|
@@ -92,71 +92,71 @@ export declare const deviceSessionSyncSchema: z.ZodObject<{
|
|
|
92
92
|
revision: z.ZodNumber;
|
|
93
93
|
updatedAt: z.ZodNumber;
|
|
94
94
|
}, "strip", z.ZodTypeAny, {
|
|
95
|
-
updatedAt: number;
|
|
96
95
|
deviceId: string;
|
|
97
96
|
accounts: {
|
|
98
|
-
sessionId: string;
|
|
99
97
|
accountId: string;
|
|
98
|
+
sessionId: string;
|
|
100
99
|
authuser: number;
|
|
101
100
|
operatedByUserId?: string | undefined;
|
|
102
101
|
}[];
|
|
103
102
|
activeAccountId: string | null;
|
|
104
103
|
revision: number;
|
|
105
|
-
}, {
|
|
106
104
|
updatedAt: number;
|
|
105
|
+
}, {
|
|
107
106
|
deviceId: string;
|
|
108
107
|
accounts: {
|
|
109
|
-
sessionId: string;
|
|
110
108
|
accountId: string;
|
|
109
|
+
sessionId: string;
|
|
111
110
|
authuser: number;
|
|
112
111
|
operatedByUserId?: string | undefined;
|
|
113
112
|
}[];
|
|
114
113
|
activeAccountId: string | null;
|
|
115
114
|
revision: number;
|
|
115
|
+
updatedAt: number;
|
|
116
116
|
}>;
|
|
117
117
|
activeToken: z.ZodNullable<z.ZodObject<{
|
|
118
118
|
accessToken: z.ZodString;
|
|
119
119
|
expiresAt: z.ZodString;
|
|
120
120
|
}, "strip", z.ZodTypeAny, {
|
|
121
|
-
expiresAt: string;
|
|
122
121
|
accessToken: string;
|
|
123
|
-
}, {
|
|
124
122
|
expiresAt: string;
|
|
123
|
+
}, {
|
|
125
124
|
accessToken: string;
|
|
125
|
+
expiresAt: string;
|
|
126
126
|
}>>;
|
|
127
127
|
}, "strip", z.ZodTypeAny, {
|
|
128
128
|
state: {
|
|
129
|
-
updatedAt: number;
|
|
130
129
|
deviceId: string;
|
|
131
130
|
accounts: {
|
|
132
|
-
sessionId: string;
|
|
133
131
|
accountId: string;
|
|
132
|
+
sessionId: string;
|
|
134
133
|
authuser: number;
|
|
135
134
|
operatedByUserId?: string | undefined;
|
|
136
135
|
}[];
|
|
137
136
|
activeAccountId: string | null;
|
|
138
137
|
revision: number;
|
|
138
|
+
updatedAt: number;
|
|
139
139
|
};
|
|
140
140
|
activeToken: {
|
|
141
|
-
expiresAt: string;
|
|
142
141
|
accessToken: string;
|
|
142
|
+
expiresAt: string;
|
|
143
143
|
} | null;
|
|
144
144
|
}, {
|
|
145
145
|
state: {
|
|
146
|
-
updatedAt: number;
|
|
147
146
|
deviceId: string;
|
|
148
147
|
accounts: {
|
|
149
|
-
sessionId: string;
|
|
150
148
|
accountId: string;
|
|
149
|
+
sessionId: string;
|
|
151
150
|
authuser: number;
|
|
152
151
|
operatedByUserId?: string | undefined;
|
|
153
152
|
}[];
|
|
154
153
|
activeAccountId: string | null;
|
|
155
154
|
revision: number;
|
|
155
|
+
updatedAt: number;
|
|
156
156
|
};
|
|
157
157
|
activeToken: {
|
|
158
|
-
expiresAt: string;
|
|
159
158
|
accessToken: string;
|
|
159
|
+
expiresAt: string;
|
|
160
160
|
} | null;
|
|
161
161
|
}>;
|
|
162
162
|
export type SessionAccount = z.infer<typeof sessionAccountSchema>;
|
|
@@ -211,13 +211,13 @@ export declare const deviceTokenMintResponseSchema: z.ZodObject<{
|
|
|
211
211
|
authuser: z.ZodNumber;
|
|
212
212
|
operatedByUserId: z.ZodOptional<z.ZodString>;
|
|
213
213
|
}, "strip", z.ZodTypeAny, {
|
|
214
|
-
sessionId: string;
|
|
215
214
|
accountId: string;
|
|
215
|
+
sessionId: string;
|
|
216
216
|
authuser: number;
|
|
217
217
|
operatedByUserId?: string | undefined;
|
|
218
218
|
}, {
|
|
219
|
-
sessionId: string;
|
|
220
219
|
accountId: string;
|
|
220
|
+
sessionId: string;
|
|
221
221
|
authuser: number;
|
|
222
222
|
operatedByUserId?: string | undefined;
|
|
223
223
|
}>, "many">;
|
|
@@ -225,58 +225,58 @@ export declare const deviceTokenMintResponseSchema: z.ZodObject<{
|
|
|
225
225
|
revision: z.ZodNumber;
|
|
226
226
|
updatedAt: z.ZodNumber;
|
|
227
227
|
}, "strip", z.ZodTypeAny, {
|
|
228
|
-
updatedAt: number;
|
|
229
228
|
deviceId: string;
|
|
230
229
|
accounts: {
|
|
231
|
-
sessionId: string;
|
|
232
230
|
accountId: string;
|
|
231
|
+
sessionId: string;
|
|
233
232
|
authuser: number;
|
|
234
233
|
operatedByUserId?: string | undefined;
|
|
235
234
|
}[];
|
|
236
235
|
activeAccountId: string | null;
|
|
237
236
|
revision: number;
|
|
238
|
-
}, {
|
|
239
237
|
updatedAt: number;
|
|
238
|
+
}, {
|
|
240
239
|
deviceId: string;
|
|
241
240
|
accounts: {
|
|
242
|
-
sessionId: string;
|
|
243
241
|
accountId: string;
|
|
242
|
+
sessionId: string;
|
|
244
243
|
authuser: number;
|
|
245
244
|
operatedByUserId?: string | undefined;
|
|
246
245
|
}[];
|
|
247
246
|
activeAccountId: string | null;
|
|
248
247
|
revision: number;
|
|
248
|
+
updatedAt: number;
|
|
249
249
|
}>;
|
|
250
250
|
}, "strip", z.ZodTypeAny, {
|
|
251
|
-
expiresAt: string;
|
|
252
251
|
accessToken: string;
|
|
252
|
+
expiresAt: string;
|
|
253
253
|
state: {
|
|
254
|
-
updatedAt: number;
|
|
255
254
|
deviceId: string;
|
|
256
255
|
accounts: {
|
|
257
|
-
sessionId: string;
|
|
258
256
|
accountId: string;
|
|
257
|
+
sessionId: string;
|
|
259
258
|
authuser: number;
|
|
260
259
|
operatedByUserId?: string | undefined;
|
|
261
260
|
}[];
|
|
262
261
|
activeAccountId: string | null;
|
|
263
262
|
revision: number;
|
|
263
|
+
updatedAt: number;
|
|
264
264
|
};
|
|
265
265
|
nextDeviceSecret: string;
|
|
266
266
|
}, {
|
|
267
|
-
expiresAt: string;
|
|
268
267
|
accessToken: string;
|
|
268
|
+
expiresAt: string;
|
|
269
269
|
state: {
|
|
270
|
-
updatedAt: number;
|
|
271
270
|
deviceId: string;
|
|
272
271
|
accounts: {
|
|
273
|
-
sessionId: string;
|
|
274
272
|
accountId: string;
|
|
273
|
+
sessionId: string;
|
|
275
274
|
authuser: number;
|
|
276
275
|
operatedByUserId?: string | undefined;
|
|
277
276
|
}[];
|
|
278
277
|
activeAccountId: string | null;
|
|
279
278
|
revision: number;
|
|
279
|
+
updatedAt: number;
|
|
280
280
|
};
|
|
281
281
|
nextDeviceSecret: string;
|
|
282
282
|
}>;
|
|
@@ -314,13 +314,13 @@ export declare const sessionAccountsChangedEventSchema: z.ZodObject<{
|
|
|
314
314
|
revision: z.ZodNumber;
|
|
315
315
|
reason: z.ZodEnum<["login", "add", "switch", "signout", "revoke"]>;
|
|
316
316
|
}, "strip", z.ZodTypeAny, {
|
|
317
|
+
revision: number;
|
|
317
318
|
userId: string;
|
|
318
319
|
reason: "login" | "add" | "switch" | "signout" | "revoke";
|
|
319
|
-
revision: number;
|
|
320
320
|
}, {
|
|
321
|
+
revision: number;
|
|
321
322
|
userId: string;
|
|
322
323
|
reason: "login" | "add" | "switch" | "signout" | "revoke";
|
|
323
|
-
revision: number;
|
|
324
324
|
}>;
|
|
325
325
|
export type SessionAccountsChangedReason = z.infer<typeof sessionAccountsChangedReasonSchema>;
|
|
326
326
|
export type SessionAccountsChangedEvent = z.infer<typeof sessionAccountsChangedEventSchema>;
|
|
@@ -353,14 +353,14 @@ export declare const deviceBackgroundCredentialResponseSchema: z.ZodObject<{
|
|
|
353
353
|
accountId: z.ZodString;
|
|
354
354
|
expiresAt: z.ZodString;
|
|
355
355
|
}, "strip", z.ZodTypeAny, {
|
|
356
|
-
expiresAt: string;
|
|
357
|
-
deviceId: string;
|
|
358
356
|
accountId: string;
|
|
357
|
+
deviceId: string;
|
|
358
|
+
expiresAt: string;
|
|
359
359
|
secret: string;
|
|
360
360
|
}, {
|
|
361
|
-
expiresAt: string;
|
|
362
|
-
deviceId: string;
|
|
363
361
|
accountId: string;
|
|
362
|
+
deviceId: string;
|
|
363
|
+
expiresAt: string;
|
|
364
364
|
secret: string;
|
|
365
365
|
}>;
|
|
366
366
|
/**
|
|
@@ -398,13 +398,13 @@ export declare const deviceBackgroundTokenResponseSchema: z.ZodObject<{
|
|
|
398
398
|
expiresAt: z.ZodString;
|
|
399
399
|
accountId: z.ZodString;
|
|
400
400
|
}, "strip", z.ZodTypeAny, {
|
|
401
|
-
expiresAt: string;
|
|
402
|
-
accessToken: string;
|
|
403
401
|
accountId: string;
|
|
404
|
-
}, {
|
|
405
|
-
expiresAt: string;
|
|
406
402
|
accessToken: string;
|
|
403
|
+
expiresAt: string;
|
|
404
|
+
}, {
|
|
407
405
|
accountId: string;
|
|
406
|
+
accessToken: string;
|
|
407
|
+
expiresAt: string;
|
|
408
408
|
}>;
|
|
409
409
|
export type DeviceBackgroundCredentialResponse = z.infer<typeof deviceBackgroundCredentialResponseSchema>;
|
|
410
410
|
export type DeviceBackgroundTokenRequest = z.infer<typeof deviceBackgroundTokenRequestSchema>;
|
|
@@ -82,6 +82,12 @@ export interface FollowRecord {
|
|
|
82
82
|
target: FollowTarget;
|
|
83
83
|
globalState: FollowState;
|
|
84
84
|
applicationMode: FollowApplicationMode;
|
|
85
|
+
/**
|
|
86
|
+
* Whether this follow acts in the requesting application right now — the
|
|
87
|
+
* same field a button renders. List rows carry it so a follow list can seed
|
|
88
|
+
* `FollowTargetButton` without recomputing the server's derivation.
|
|
89
|
+
*/
|
|
90
|
+
effectiveState: FollowEffectiveState;
|
|
85
91
|
/**
|
|
86
92
|
* Where the user was when they followed. Provenance for the audit trail and
|
|
87
93
|
* for notification routing — never authority: this application cannot undo
|
package/dist/types/index.d.ts
CHANGED
|
@@ -40,6 +40,12 @@ export type { LinkPreviewStatus, LinkPreview, LinkPreviewBatchRequest, LinkPrevi
|
|
|
40
40
|
export type { FollowTargetKind, FollowState, FollowEffectiveState, FollowApplicationMode, FollowTarget, FollowRecord, FollowStatus, FollowMutation, UnfollowMutation, FollowListPage, FollowOptions, } from './followGraph';
|
|
41
41
|
export { sessionAccountSchema, deviceSessionStateSchema, activeTokenSchema, deviceSessionSyncSchema, deviceTokenMintRequestSchema, deviceTokenMintResponseSchema, deviceBackgroundCredentialResponseSchema, deviceBackgroundTokenRequestSchema, deviceBackgroundTokenResponseSchema, SESSION_ACCOUNTS_CHANGED_EVENT, sessionAccountsChangedReasonSchema, sessionAccountsChangedEventSchema, } from './deviceSession';
|
|
42
42
|
export type { SessionAccount, DeviceSessionState, ActiveToken, DeviceSessionSync, DeviceTokenMintRequest, DeviceTokenMintResponse, DeviceBackgroundCredentialResponse, DeviceBackgroundTokenRequest, DeviceBackgroundTokenResponse, SessionAccountsChangedReason, SessionAccountsChangedEvent, } from './deviceSession';
|
|
43
|
+
export { deviceContextRelationshipSchema, deviceDirectoryProfileSchema, deviceAccountContextSchema, devicePrincipalSchema, deviceDirectorySchema, deviceActivateRequestSchema, deviceActivateResponseSchema, deviceDirectorySyncSchema, } from './deviceDirectory';
|
|
44
|
+
export type { DeviceContextRelationship, DeviceDirectoryProfile, DeviceAccountContext, DevicePrincipal, DeviceDirectory, DeviceActivateRequest, DeviceActivateResponse, DeviceDirectorySync, } from './deviceDirectory';
|
|
45
|
+
export { oauthConsentDecisionSchema, oauthAuthorizeCodeResponseSchema, } from './oauth';
|
|
46
|
+
export type { OauthConsentDecision, OauthAuthorizeCodeResponse, } from './oauth';
|
|
47
|
+
export { BROWSER_HUB_COOKIE_NAME, BROWSER_HUB_COOKIE_ATTRIBUTES, BROWSER_HUB_HANDLE_TTL_MS, browserHubHandleSchema, browserHubHandleRequestSchema, browserHubHandleResponseSchema, browserHubResolveResponseSchema, browserHubErrorSchema, browserHubRevokeResponseSchema, hubSessionSchema, hubClaimRequestSchema, hubActivateRequestSchema, hubAuthorizeRequestSchema, hubAuthorizeResultSchema, } from './browserHub';
|
|
48
|
+
export type { BrowserHubHandleRequest, BrowserHubHandleResponse, BrowserHubResolveResponse, BrowserHubError, BrowserHubRevokeResponse, HubSession, HubClaimRequest, HubActivateRequest, HubAuthorizeRequest, HubAuthorizeResult, } from './browserHub';
|
|
43
49
|
export { loginResultSchema, } from './deviceBoot';
|
|
44
50
|
export type { LoginSessionResult, LoginResult, SecurityAlert, SecurityAlertAnomaly, } from './deviceBoot';
|
|
45
51
|
export { rotateKeyChallengeResponseSchema, rotateKeyCompleteRequestSchema, rotateKeyCompleteResponseSchema, } from './keyRotation';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* The two `/auth/oauth/*` responses the browser hub's edge layer reads.
|
|
4
|
+
*
|
|
5
|
+
* They existed on the wire long before this file — `GET /auth/oauth/consent`
|
|
6
|
+
* and `POST /auth/oauth/authorize` are the surface `auth.oxy.so` has always
|
|
7
|
+
* driven with a bearer. What is new (issue #937 Phase 5) is a SECOND consumer
|
|
8
|
+
* that is not the SPA: the IdP's edge layer runs both calls server-side so the
|
|
9
|
+
* device-wide bearer never enters the browser's script context. A shape read by
|
|
10
|
+
* two independently deployed consumers is a contract, so it is written down
|
|
11
|
+
* once here and validated on both sides rather than transcribed into the edge.
|
|
12
|
+
*
|
|
13
|
+
* These are NOT the RFC 6749 token/userinfo responses. Those two speak flat
|
|
14
|
+
* OAuth/OIDC on the wire and are the one place in the API that does not use the
|
|
15
|
+
* `{ data }` envelope; these two are ordinary internal API responses that happen
|
|
16
|
+
* to be about OAuth.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Server-authoritative answer to "must this user be shown a consent screen".
|
|
20
|
+
*
|
|
21
|
+
* Discriminated on `consentRequired` so the two arms cannot be confused by a
|
|
22
|
+
* consumer that reads `reason` first: `trusted`/`granted` are reasons NOT to
|
|
23
|
+
* ask, `new`/`scope_changed` are reasons to ask, and a flat object would let a
|
|
24
|
+
* typo in one produce a plausible value of the other.
|
|
25
|
+
*
|
|
26
|
+
* - `trusted` — the application is first-party/internal/system/official
|
|
27
|
+
* by the REGISTRY's verdict (`isTrustedApplication`), and
|
|
28
|
+
* the request names no scope over the user's own follow
|
|
29
|
+
* graph. Never inferred from a hostname.
|
|
30
|
+
* - `granted` — a prior `AppGrant` already covers every requested scope.
|
|
31
|
+
* - `scope_changed` — a prior grant exists and is missing one.
|
|
32
|
+
* - `new` — no prior grant.
|
|
33
|
+
*
|
|
34
|
+
* `userConsentScopes` names the scopes that FORCED the screen, so the consent UI
|
|
35
|
+
* can say which one it is asking about. Present only on the `true` arm, and only
|
|
36
|
+
* when such a scope exists — a trusted app asked for one is still asked.
|
|
37
|
+
*/
|
|
38
|
+
export declare const oauthConsentDecisionSchema: z.ZodDiscriminatedUnion<"consentRequired", [z.ZodObject<{
|
|
39
|
+
consentRequired: z.ZodLiteral<false>;
|
|
40
|
+
reason: z.ZodEnum<["trusted", "granted"]>;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
reason: "trusted" | "granted";
|
|
43
|
+
consentRequired: false;
|
|
44
|
+
}, {
|
|
45
|
+
reason: "trusted" | "granted";
|
|
46
|
+
consentRequired: false;
|
|
47
|
+
}>, z.ZodObject<{
|
|
48
|
+
consentRequired: z.ZodLiteral<true>;
|
|
49
|
+
reason: z.ZodEnum<["new", "scope_changed"]>;
|
|
50
|
+
userConsentScopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
reason: "new" | "scope_changed";
|
|
53
|
+
consentRequired: true;
|
|
54
|
+
userConsentScopes?: string[] | undefined;
|
|
55
|
+
}, {
|
|
56
|
+
reason: "new" | "scope_changed";
|
|
57
|
+
consentRequired: true;
|
|
58
|
+
userConsentScopes?: string[] | undefined;
|
|
59
|
+
}>]>;
|
|
60
|
+
/**
|
|
61
|
+
* A minted authorization code.
|
|
62
|
+
*
|
|
63
|
+
* `state` is echoed back as the caller sent it and is `null` when they sent
|
|
64
|
+
* none — never omitted, so a consumer cannot read "the server dropped my state"
|
|
65
|
+
* as "I sent none". `redirectUri` is echoed for the same reason the code is
|
|
66
|
+
* bound to it server-side: the caller must be able to see that the value the
|
|
67
|
+
* code was issued against is the one it registered.
|
|
68
|
+
*/
|
|
69
|
+
export declare const oauthAuthorizeCodeResponseSchema: z.ZodObject<{
|
|
70
|
+
code: z.ZodString;
|
|
71
|
+
state: z.ZodNullable<z.ZodString>;
|
|
72
|
+
redirectUri: z.ZodString;
|
|
73
|
+
expiresIn: z.ZodNumber;
|
|
74
|
+
}, "strip", z.ZodTypeAny, {
|
|
75
|
+
code: string;
|
|
76
|
+
state: string | null;
|
|
77
|
+
redirectUri: string;
|
|
78
|
+
expiresIn: number;
|
|
79
|
+
}, {
|
|
80
|
+
code: string;
|
|
81
|
+
state: string | null;
|
|
82
|
+
redirectUri: string;
|
|
83
|
+
expiresIn: number;
|
|
84
|
+
}>;
|
|
85
|
+
export type OauthConsentDecision = z.infer<typeof oauthConsentDecisionSchema>;
|
|
86
|
+
export type OauthAuthorizeCodeResponse = z.infer<typeof oauthAuthorizeCodeResponseSchema>;
|
|
@@ -1,31 +1,59 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Oxy-scoped signed-record types.
|
|
3
3
|
*
|
|
4
|
-
* The base `signedRecordEnvelopeSchema` (`./identity`)
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* it knows how to verify and materialize — this module is that closed set.
|
|
4
|
+
* The base `signedRecordEnvelopeSchema` (`./identity`) treats `type` as an OPEN,
|
|
5
|
+
* non-empty string so ANY Oxy app may sign on the shared envelope grammar. The
|
|
6
|
+
* Oxy STORE re-narrows it to the closed set in this module — a `type` outside it
|
|
7
|
+
* is rejected as `invalid_envelope`.
|
|
9
8
|
*
|
|
10
|
-
* `oxySignedRecordTypeSchema` is
|
|
11
|
-
*
|
|
12
|
-
* `
|
|
13
|
-
* the matching compile-time union the SDK
|
|
9
|
+
* `oxySignedRecordTypeSchema` is that runtime gate (the API's `verifyEnvelope`
|
|
10
|
+
* re-narrows with it; the Mongoose `SignedRecord.type` enum and the Postgres
|
|
11
|
+
* CHECK on `signed_records.type` are both derived from `.options`);
|
|
12
|
+
* `OxySignedRecordType` is the matching compile-time union the SDK
|
|
13
|
+
* identity/civic mixins type against.
|
|
14
14
|
*
|
|
15
15
|
* The signing input INCLUDES `type`, so this set is part of the signed bytes —
|
|
16
|
-
* a record cannot have its category swapped after signing
|
|
16
|
+
* a record cannot have its category swapped after signing, and a value once
|
|
17
|
+
* signed can never be renamed.
|
|
17
18
|
*
|
|
18
19
|
* v1 only ever carried `identity` / `profile` (already in production); v2 added
|
|
19
20
|
* the civic record types (reputation attestations, real-life / peer validations,
|
|
20
21
|
* personhood vouches, verifiable credentials) and the user-node registration
|
|
21
|
-
* record.
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* record.
|
|
23
|
+
*
|
|
24
|
+
* ## Why `app_record` is here, when it deliberately was not
|
|
25
|
+
*
|
|
26
|
+
* This set used to hold Oxy's own categories only, and said so: an app's `type`
|
|
27
|
+
* was "intentionally NOT in this set". The reason given was that the store
|
|
28
|
+
* accepts only what it knows how to **verify and materialize**. Verification
|
|
29
|
+
* turned out not to argue for the exclusion — the engine verifies a signature
|
|
30
|
+
* against the subject's keys whatever the category says — and materialization
|
|
31
|
+
* is the app's job, not the store's: an app projects its own feed tables from
|
|
32
|
+
* records it reads back.
|
|
33
|
+
*
|
|
34
|
+
* What changed is the decision the exclusion blocked. One chain per PERSON, held
|
|
35
|
+
* by Oxy, is the ecosystem substrate: apps append their records to the subject's
|
|
36
|
+
* one chain instead of each keeping a private chain for the same person. A
|
|
37
|
+
* closed set that admits no app category makes that unrepresentable.
|
|
38
|
+
*
|
|
39
|
+
* `app_record` is ONE value rather than an open lane, and the lexicon lives in
|
|
40
|
+
* the envelope's `collection` (`app.mention.feed.post`, `app.syra.*`), which the
|
|
41
|
+
* store denormalizes to `signed_records.nsid` and indexes. So a new app needs no
|
|
42
|
+
* change here — it picks its own collection namespace and signs `app_record`,
|
|
43
|
+
* exactly as Mention already does in production. Keeping the set closed is what
|
|
44
|
+
* keeps the CHECK a real constraint.
|
|
45
|
+
*
|
|
46
|
+
* **Admitting the category is not the whole of that decision.** Two gates sit
|
|
47
|
+
* beside it and are unchanged: an app record must arrive as a v2 (chained)
|
|
48
|
+
* envelope, and `oxyVerificationResolver` accepts exactly one custodial issuer
|
|
49
|
+
* (`OXY_DID`). So a record a user signs themselves verifies here today, while
|
|
50
|
+
* one an app signs custodially under its OWN issuer DID does not — that needs a
|
|
51
|
+
* separate, deliberate answer about which issuers may write to a person's chain.
|
|
24
52
|
*
|
|
25
53
|
* Platform-agnostic — zod only, no react/react-native/expo, ESM-safe.
|
|
26
54
|
*/
|
|
27
55
|
import { z } from 'zod';
|
|
28
|
-
export declare const oxySignedRecordTypeSchema: z.ZodEnum<["identity", "profile", "reputation_attestation", "real_life_attestation", "validation_verdict", "personhood_vouch", "credential", "node"]>;
|
|
56
|
+
export declare const oxySignedRecordTypeSchema: z.ZodEnum<["identity", "profile", "reputation_attestation", "real_life_attestation", "validation_verdict", "personhood_vouch", "credential", "node", "app_record"]>;
|
|
29
57
|
/**
|
|
30
58
|
* The closed set of record categories the Oxy identity/civic/node store accepts.
|
|
31
59
|
* The base envelope `type` is an open string; this is what the Oxy store
|
|
@@ -179,12 +179,12 @@ export declare const sessionStatusSchema: z.ZodObject<{
|
|
|
179
179
|
openedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
180
180
|
}, "strip", z.ZodTypeAny, {
|
|
181
181
|
status: string;
|
|
182
|
-
publicKey?: string | null | undefined;
|
|
183
|
-
userId?: string | null | undefined;
|
|
184
|
-
expiresAt?: string | undefined;
|
|
185
182
|
sessionId?: string | null | undefined;
|
|
186
|
-
|
|
183
|
+
expiresAt?: string | undefined;
|
|
184
|
+
userId?: string | null | undefined;
|
|
185
|
+
publicKey?: string | null | undefined;
|
|
187
186
|
sessionToken?: string | undefined;
|
|
187
|
+
authorized?: boolean | undefined;
|
|
188
188
|
application?: {
|
|
189
189
|
type: "system" | "first_party" | "third_party" | "internal";
|
|
190
190
|
name: string;
|
|
@@ -204,12 +204,12 @@ export declare const sessionStatusSchema: z.ZodObject<{
|
|
|
204
204
|
openedAt?: string | null | undefined;
|
|
205
205
|
}, {
|
|
206
206
|
status: string;
|
|
207
|
-
publicKey?: string | null | undefined;
|
|
208
|
-
userId?: string | null | undefined;
|
|
209
|
-
expiresAt?: string | undefined;
|
|
210
207
|
sessionId?: string | null | undefined;
|
|
211
|
-
|
|
208
|
+
expiresAt?: string | undefined;
|
|
209
|
+
userId?: string | null | undefined;
|
|
210
|
+
publicKey?: string | null | undefined;
|
|
212
211
|
sessionToken?: string | undefined;
|
|
212
|
+
authorized?: boolean | undefined;
|
|
213
213
|
application?: {
|
|
214
214
|
type: "system" | "first_party" | "third_party" | "internal";
|
|
215
215
|
name: string;
|
|
@@ -813,13 +813,13 @@ export declare const currentUserResponseSchema: z.ZodObject<{
|
|
|
813
813
|
publicKey?: string | undefined;
|
|
814
814
|
did?: string | undefined;
|
|
815
815
|
verifiedDomains?: import("./identity").VerifiedDomain[] | undefined;
|
|
816
|
-
verified?: boolean | undefined;
|
|
817
|
-
email?: string | undefined;
|
|
818
816
|
_id?: string | undefined;
|
|
817
|
+
email?: string | undefined;
|
|
819
818
|
phone?: string | undefined;
|
|
820
819
|
address?: string | undefined;
|
|
821
820
|
birthday?: string | undefined;
|
|
822
821
|
color?: string | null | undefined;
|
|
822
|
+
verified?: boolean | undefined;
|
|
823
823
|
languages?: string[] | undefined;
|
|
824
824
|
relationship?: UserRelationship | undefined;
|
|
825
825
|
themePreference?: ThemePreference | undefined;
|
|
@@ -837,13 +837,13 @@ export declare const currentUserResponseSchema: z.ZodObject<{
|
|
|
837
837
|
publicKey?: string | undefined;
|
|
838
838
|
did?: string | undefined;
|
|
839
839
|
verifiedDomains?: import("./identity").VerifiedDomain[] | undefined;
|
|
840
|
-
verified?: boolean | undefined;
|
|
841
|
-
email?: string | undefined;
|
|
842
840
|
_id?: string | undefined;
|
|
841
|
+
email?: string | undefined;
|
|
843
842
|
phone?: string | undefined;
|
|
844
843
|
address?: string | undefined;
|
|
845
844
|
birthday?: string | undefined;
|
|
846
845
|
color?: string | null | undefined;
|
|
846
|
+
verified?: boolean | undefined;
|
|
847
847
|
languages?: string[] | undefined;
|
|
848
848
|
relationship?: UserRelationship | undefined;
|
|
849
849
|
themePreference?: ThemePreference | undefined;
|
|
@@ -1107,6 +1107,7 @@ export declare const deviceLinkedSessionSchema: z.ZodObject<{
|
|
|
1107
1107
|
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1108
1108
|
}, "strip", z.ZodTypeAny, {
|
|
1109
1109
|
sessionId: string;
|
|
1110
|
+
isCurrent?: boolean | undefined;
|
|
1110
1111
|
user?: z.objectOutputType<{
|
|
1111
1112
|
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
1112
1113
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -1189,9 +1190,9 @@ export declare const deviceLinkedSessionSchema: z.ZodObject<{
|
|
|
1189
1190
|
*/
|
|
1190
1191
|
themePreference: z.ZodOptional<z.ZodType<ThemePreference, z.ZodTypeDef, ThemePreference>>;
|
|
1191
1192
|
}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
1192
|
-
isCurrent?: boolean | undefined;
|
|
1193
1193
|
}, {
|
|
1194
1194
|
sessionId: string;
|
|
1195
|
+
isCurrent?: boolean | undefined;
|
|
1195
1196
|
user?: z.objectInputType<{
|
|
1196
1197
|
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
1197
1198
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -1274,7 +1275,6 @@ export declare const deviceLinkedSessionSchema: z.ZodObject<{
|
|
|
1274
1275
|
*/
|
|
1275
1276
|
themePreference: z.ZodOptional<z.ZodType<ThemePreference, z.ZodTypeDef, ThemePreference>>;
|
|
1276
1277
|
}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
1277
|
-
isCurrent?: boolean | undefined;
|
|
1278
1278
|
}>;
|
|
1279
1279
|
export type DeviceLinkedSessionResponse = z.infer<typeof deviceLinkedSessionSchema>;
|
|
1280
1280
|
/** Wire shape of `GET /session/device/sessions/:sessionId` (an array). */
|
|
@@ -1527,6 +1527,7 @@ export declare const deviceLinkedSessionsResponseSchema: z.ZodArray<z.ZodObject<
|
|
|
1527
1527
|
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1528
1528
|
}, "strip", z.ZodTypeAny, {
|
|
1529
1529
|
sessionId: string;
|
|
1530
|
+
isCurrent?: boolean | undefined;
|
|
1530
1531
|
user?: z.objectOutputType<{
|
|
1531
1532
|
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
1532
1533
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -1609,9 +1610,9 @@ export declare const deviceLinkedSessionsResponseSchema: z.ZodArray<z.ZodObject<
|
|
|
1609
1610
|
*/
|
|
1610
1611
|
themePreference: z.ZodOptional<z.ZodType<ThemePreference, z.ZodTypeDef, ThemePreference>>;
|
|
1611
1612
|
}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
1612
|
-
isCurrent?: boolean | undefined;
|
|
1613
1613
|
}, {
|
|
1614
1614
|
sessionId: string;
|
|
1615
|
+
isCurrent?: boolean | undefined;
|
|
1615
1616
|
user?: z.objectInputType<{
|
|
1616
1617
|
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
1617
1618
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -1694,7 +1695,6 @@ export declare const deviceLinkedSessionsResponseSchema: z.ZodArray<z.ZodObject<
|
|
|
1694
1695
|
*/
|
|
1695
1696
|
themePreference: z.ZodOptional<z.ZodType<ThemePreference, z.ZodTypeDef, ThemePreference>>;
|
|
1696
1697
|
}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
1697
|
-
isCurrent?: boolean | undefined;
|
|
1698
1698
|
}>, "many">;
|
|
1699
1699
|
export type DeviceLinkedSessionsResponseContract = z.infer<typeof deviceLinkedSessionsResponseSchema>;
|
|
1700
1700
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxyhq/contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.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",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"./package.json": "./package.json"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
|
+
"NOTICE",
|
|
29
30
|
"dist"
|
|
30
31
|
],
|
|
31
32
|
"keywords": [
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
"directory": "packages/contracts"
|
|
43
44
|
},
|
|
44
45
|
"author": "OxyHQ",
|
|
45
|
-
"license": "
|
|
46
|
+
"license": "Apache-2.0",
|
|
46
47
|
"homepage": "https://oxy.so",
|
|
47
48
|
"engines": {
|
|
48
49
|
"node": ">=18.0.0"
|