@oxy.so/contracts 4.16.0 → 4.21.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/dist/cjs/accountAccess.js +72 -0
- package/dist/cjs/accountEmail.js +12 -34
- package/dist/cjs/accountGraph.js +22 -320
- package/dist/cjs/agency.js +112 -1
- package/dist/cjs/agentKeys.js +11 -13
- package/dist/cjs/applicationRoles.js +211 -0
- package/dist/cjs/client/accountEmail.js +48 -0
- package/dist/cjs/client/accountGraph.js +323 -0
- package/dist/cjs/client/agentKeys.js +77 -0
- package/dist/cjs/client/check.js +475 -0
- package/dist/cjs/client/deviceBoot.js +22 -0
- package/dist/cjs/client/deviceDirectory.js +51 -0
- package/dist/cjs/client/deviceSession.js +63 -0
- package/dist/cjs/client/externalIdentity.js +19 -0
- package/dist/cjs/client/identity.js +45 -0
- package/dist/cjs/client/identityLink.js +55 -0
- package/dist/cjs/client/identityProof.js +109 -0
- package/dist/cjs/client/index.js +211 -0
- package/dist/cjs/client/organizations.js +114 -0
- package/dist/cjs/client/products.js +153 -0
- package/dist/cjs/client/recommendations.js +33 -0
- package/dist/cjs/client/reputation.js +41 -0
- package/dist/cjs/client/safety.js +196 -0
- package/dist/cjs/client/sessionStatus.js +23 -0
- package/dist/cjs/client/signIn.js +159 -0
- package/dist/cjs/client/userResponse.js +15 -0
- package/dist/cjs/client/username.js +173 -0
- package/dist/cjs/deviceSession.js +3 -16
- package/dist/cjs/identityLink.js +13 -34
- package/dist/cjs/identityProof.js +18 -106
- package/dist/cjs/index.js +13 -3
- package/dist/cjs/organizations.js +21 -41
- package/dist/cjs/reputation.js +3 -34
- package/dist/cjs/safety.js +430 -1
- package/dist/cjs/serviceToken.js +14 -0
- package/dist/cjs/signIn.js +33 -111
- package/dist/cjs/username.js +23 -158
- package/dist/esm/accountAccess.js +69 -0
- package/dist/esm/accountEmail.js +4 -32
- package/dist/esm/accountGraph.js +4 -309
- package/dist/esm/agency.js +111 -0
- package/dist/esm/agentKeys.js +4 -10
- package/dist/esm/applicationRoles.js +207 -0
- package/dist/esm/client/accountEmail.js +45 -0
- package/dist/esm/client/accountGraph.js +314 -0
- package/dist/esm/client/agentKeys.js +74 -0
- package/dist/esm/client/check.js +436 -0
- package/dist/esm/client/deviceBoot.js +19 -0
- package/dist/esm/client/deviceDirectory.js +48 -0
- package/dist/esm/client/deviceSession.js +60 -0
- package/dist/esm/client/externalIdentity.js +16 -0
- package/dist/esm/client/identity.js +42 -0
- package/dist/esm/client/identityLink.js +50 -0
- package/dist/esm/client/identityProof.js +104 -0
- package/dist/esm/client/index.js +37 -0
- package/dist/esm/client/organizations.js +111 -0
- package/dist/esm/client/products.js +150 -0
- package/dist/esm/client/recommendations.js +30 -0
- package/dist/esm/client/reputation.js +37 -0
- package/dist/esm/client/safety.js +193 -0
- package/dist/esm/client/sessionStatus.js +20 -0
- package/dist/esm/client/signIn.js +153 -0
- package/dist/esm/client/userResponse.js +12 -0
- package/dist/esm/client/username.js +167 -0
- package/dist/esm/deviceSession.js +1 -15
- package/dist/esm/identityLink.js +4 -27
- package/dist/esm/identityProof.js +4 -99
- package/dist/esm/index.js +4 -1
- package/dist/esm/organizations.js +4 -31
- package/dist/esm/reputation.js +1 -32
- package/dist/esm/safety.js +423 -0
- package/dist/esm/serviceToken.js +11 -0
- package/dist/esm/signIn.js +4 -96
- package/dist/esm/username.js +4 -148
- package/dist/types/accountAccess.d.ts +128 -0
- package/dist/types/accountEmail.d.ts +4 -36
- package/dist/types/accountGraph.d.ts +12 -208
- package/dist/types/agency.d.ts +351 -26
- package/dist/types/agentKeys.d.ts +14 -12
- package/dist/types/applicationRoles.d.ts +438 -0
- package/dist/types/client/accountEmail.d.ts +44 -0
- package/dist/types/client/accountGraph.d.ts +203 -0
- package/dist/types/client/agentKeys.d.ts +113 -0
- package/dist/types/client/check.d.ts +187 -0
- package/dist/types/client/deviceBoot.d.ts +6 -0
- package/dist/types/client/deviceDirectory.d.ts +134 -0
- package/dist/types/client/deviceSession.d.ts +91 -0
- package/dist/types/client/externalIdentity.d.ts +14 -0
- package/dist/types/client/identity.d.ts +8 -0
- package/dist/types/client/identityLink.d.ts +21 -0
- package/dist/types/client/identityProof.d.ts +73 -0
- package/dist/types/client/index.d.ts +37 -0
- package/dist/types/client/organizations.d.ts +167 -0
- package/dist/types/client/products.d.ts +145 -0
- package/dist/types/client/recommendations.d.ts +27 -0
- package/dist/types/client/reputation.d.ts +28 -0
- package/dist/types/client/safety.d.ts +213 -0
- package/dist/types/client/sessionStatus.d.ts +19 -0
- package/dist/types/client/signIn.d.ts +107 -0
- package/dist/types/client/userResponse.d.ts +7 -0
- package/dist/types/client/username.d.ts +126 -0
- package/dist/types/deviceDirectory.d.ts +28 -28
- package/dist/types/deviceSession.d.ts +5 -16
- package/dist/types/email/messages.d.ts +2 -2
- package/dist/types/externalIdentity.d.ts +15 -15
- package/dist/types/identityLink.d.ts +3 -11
- package/dist/types/identityProof.d.ts +2 -65
- package/dist/types/index.d.ts +5 -2
- package/dist/types/inference/accountBilling.d.ts +2 -2
- package/dist/types/inference/catalogue.d.ts +22 -22
- package/dist/types/inference/decisions.d.ts +10 -10
- package/dist/types/inference/embeddings.d.ts +16 -16
- package/dist/types/inference/errors.d.ts +8 -8
- package/dist/types/inference/inbox.d.ts +8 -8
- package/dist/types/inference/privateAutoExecution.d.ts +6 -6
- package/dist/types/inference/providerConnection.d.ts +4 -4
- package/dist/types/inference/realtime.d.ts +92 -92
- package/dist/types/inference/request.d.ts +48 -48
- package/dist/types/inference/streamEvents.d.ts +16 -16
- package/dist/types/inference/usage.d.ts +4 -4
- package/dist/types/oauth.d.ts +2 -2
- package/dist/types/organizations.d.ts +8 -10
- package/dist/types/products/access.d.ts +4 -4
- package/dist/types/products/billing.d.ts +3 -0
- package/dist/types/reputation.d.ts +1 -11
- package/dist/types/safety.d.ts +2374 -2
- package/dist/types/serviceToken.d.ts +11 -0
- package/dist/types/sessionStatus.d.ts +2 -2
- package/dist/types/signIn.d.ts +11 -94
- package/dist/types/userResponse.d.ts +22 -22
- package/dist/types/username.d.ts +1 -96
- package/package.json +24 -20
- package/dist/cjs/.tsbuildinfo +0 -1
- package/dist/esm/.tsbuildinfo +0 -1
- package/dist/types/.tsbuildinfo +0 -1
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/** Autonomous runtime proof. No private key crosses this contract. */
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export declare const AGENT_PROOF_ACTIONS: readonly ["agent_signin", "agent_enroll", "agent_rotate", "agent_recover", "agent_governance"];
|
|
6
|
-
export type AgentProofAction = (typeof AGENT_PROOF_ACTIONS)[number];
|
|
3
|
+
export { AGENT_PROOF_AUDIENCE, AGENT_PROOF_TTL_MS, AGENT_PROOF_ACTIONS, ACCOUNT_AUTH_METHODS, } from './client/agentKeys';
|
|
4
|
+
export type { AgentProofAction, AccountAuthMethod } from './client/agentKeys';
|
|
7
5
|
export declare const agentProofClaimsSchema: z.ZodObject<{
|
|
8
6
|
version: z.ZodLiteral<1>;
|
|
9
7
|
audience: z.ZodLiteral<"oxy-api/agent">;
|
|
@@ -16,8 +14,8 @@ export declare const agentProofClaimsSchema: z.ZodObject<{
|
|
|
16
14
|
challenge: z.ZodString;
|
|
17
15
|
expiresAt: z.ZodNumber;
|
|
18
16
|
}, "strict", z.ZodTypeAny, {
|
|
19
|
-
expiresAt: number;
|
|
20
17
|
accountId: string;
|
|
18
|
+
expiresAt: number;
|
|
21
19
|
version: 1;
|
|
22
20
|
audience: "oxy-api/agent";
|
|
23
21
|
action: "agent_signin" | "agent_enroll" | "agent_rotate" | "agent_recover" | "agent_governance";
|
|
@@ -27,8 +25,8 @@ export declare const agentProofClaimsSchema: z.ZodObject<{
|
|
|
27
25
|
publicKey: string;
|
|
28
26
|
payloadDigest: string;
|
|
29
27
|
}, {
|
|
30
|
-
expiresAt: number;
|
|
31
28
|
accountId: string;
|
|
29
|
+
expiresAt: number;
|
|
32
30
|
version: 1;
|
|
33
31
|
audience: "oxy-api/agent";
|
|
34
32
|
action: "agent_signin" | "agent_enroll" | "agent_rotate" | "agent_recover" | "agent_governance";
|
|
@@ -62,6 +60,7 @@ export declare const agentChallengeRequestSchema: z.ZodObject<{
|
|
|
62
60
|
}, {
|
|
63
61
|
publicKey: string;
|
|
64
62
|
}>;
|
|
63
|
+
export type AgentChallengeRequest = z.infer<typeof agentChallengeRequestSchema>;
|
|
65
64
|
export declare const agentVerifyRequestSchema: z.ZodObject<{
|
|
66
65
|
challenge: z.ZodString;
|
|
67
66
|
signature: z.ZodString;
|
|
@@ -79,6 +78,7 @@ export declare const agentVerifyRequestSchema: z.ZodObject<{
|
|
|
79
78
|
publicKey: string;
|
|
80
79
|
timestamp: number;
|
|
81
80
|
}>;
|
|
81
|
+
export type AgentVerifyRequest = z.infer<typeof agentVerifyRequestSchema>;
|
|
82
82
|
export declare const agentKeyOperationSchema: z.ZodDiscriminatedUnion<"operation", [z.ZodObject<{
|
|
83
83
|
publicKey: z.ZodString;
|
|
84
84
|
label: z.ZodString;
|
|
@@ -393,6 +393,7 @@ export declare const executeAgentKeyOperationSchema: z.ZodObject<{
|
|
|
393
393
|
governorSignature?: string | undefined;
|
|
394
394
|
};
|
|
395
395
|
}>;
|
|
396
|
+
export type ExecuteAgentKeyOperation = z.infer<typeof executeAgentKeyOperationSchema>;
|
|
396
397
|
export declare const agentKeyOperationChallengeSchema: z.ZodObject<{
|
|
397
398
|
claims: z.ZodObject<{
|
|
398
399
|
version: z.ZodLiteral<1>;
|
|
@@ -406,8 +407,8 @@ export declare const agentKeyOperationChallengeSchema: z.ZodObject<{
|
|
|
406
407
|
challenge: z.ZodString;
|
|
407
408
|
expiresAt: z.ZodNumber;
|
|
408
409
|
}, "strict", z.ZodTypeAny, {
|
|
409
|
-
expiresAt: number;
|
|
410
410
|
accountId: string;
|
|
411
|
+
expiresAt: number;
|
|
411
412
|
version: 1;
|
|
412
413
|
audience: "oxy-api/agent";
|
|
413
414
|
action: "agent_signin" | "agent_enroll" | "agent_rotate" | "agent_recover" | "agent_governance";
|
|
@@ -417,8 +418,8 @@ export declare const agentKeyOperationChallengeSchema: z.ZodObject<{
|
|
|
417
418
|
publicKey: string;
|
|
418
419
|
payloadDigest: string;
|
|
419
420
|
}, {
|
|
420
|
-
expiresAt: number;
|
|
421
421
|
accountId: string;
|
|
422
|
+
expiresAt: number;
|
|
422
423
|
version: 1;
|
|
423
424
|
audience: "oxy-api/agent";
|
|
424
425
|
action: "agent_signin" | "agent_enroll" | "agent_rotate" | "agent_recover" | "agent_governance";
|
|
@@ -431,8 +432,8 @@ export declare const agentKeyOperationChallengeSchema: z.ZodObject<{
|
|
|
431
432
|
governorPublicKey: z.ZodNullable<z.ZodString>;
|
|
432
433
|
}, "strict", z.ZodTypeAny, {
|
|
433
434
|
claims: {
|
|
434
|
-
expiresAt: number;
|
|
435
435
|
accountId: string;
|
|
436
|
+
expiresAt: number;
|
|
436
437
|
version: 1;
|
|
437
438
|
audience: "oxy-api/agent";
|
|
438
439
|
action: "agent_signin" | "agent_enroll" | "agent_rotate" | "agent_recover" | "agent_governance";
|
|
@@ -445,8 +446,8 @@ export declare const agentKeyOperationChallengeSchema: z.ZodObject<{
|
|
|
445
446
|
governorPublicKey: string | null;
|
|
446
447
|
}, {
|
|
447
448
|
claims: {
|
|
448
|
-
expiresAt: number;
|
|
449
449
|
accountId: string;
|
|
450
|
+
expiresAt: number;
|
|
450
451
|
version: 1;
|
|
451
452
|
audience: "oxy-api/agent";
|
|
452
453
|
action: "agent_signin" | "agent_enroll" | "agent_rotate" | "agent_recover" | "agent_governance";
|
|
@@ -458,6 +459,7 @@ export declare const agentKeyOperationChallengeSchema: z.ZodObject<{
|
|
|
458
459
|
};
|
|
459
460
|
governorPublicKey: string | null;
|
|
460
461
|
}>;
|
|
462
|
+
export type AgentKeyOperationChallenge = z.infer<typeof agentKeyOperationChallengeSchema>;
|
|
461
463
|
export declare const agentKeyOperationResultSchema: z.ZodObject<{
|
|
462
464
|
methodId: z.ZodNullable<z.ZodString>;
|
|
463
465
|
revokedMethodIds: z.ZodArray<z.ZodString, "many">;
|
|
@@ -468,8 +470,7 @@ export declare const agentKeyOperationResultSchema: z.ZodObject<{
|
|
|
468
470
|
methodId: string | null;
|
|
469
471
|
revokedMethodIds: string[];
|
|
470
472
|
}>;
|
|
471
|
-
export
|
|
472
|
-
export type AccountAuthMethod = (typeof ACCOUNT_AUTH_METHODS)[number];
|
|
473
|
+
export type AgentKeyOperationResult = z.infer<typeof agentKeyOperationResultSchema>;
|
|
473
474
|
/** Public credential inventory. Never includes a proof, bearer or private key. */
|
|
474
475
|
export declare const agentKeyListResponseSchema: z.ZodObject<{
|
|
475
476
|
keys: z.ZodArray<z.ZodObject<{
|
|
@@ -523,3 +524,4 @@ export declare const agentKeyListResponseSchema: z.ZodObject<{
|
|
|
523
524
|
lastUsedAt: string | null;
|
|
524
525
|
}[];
|
|
525
526
|
}>;
|
|
527
|
+
export type AgentKeyListResponse = z.infer<typeof agentKeyListResponseSchema>;
|
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Application roles — the wire contract for permissions an APPLICATION declares
|
|
3
|
+
* about its own users, and for the grants that give them to Oxy users.
|
|
4
|
+
*
|
|
5
|
+
* Oxy decides who holds an app's operator powers (who may run Mercaria's
|
|
6
|
+
* payments desk, moderate GoWay, administer Homiio), so no app keeps an
|
|
7
|
+
* allow-list of Oxy user ids in its environment. The app declares a closed
|
|
8
|
+
* vocabulary of keys, its owners grant them to people, and the app's backend
|
|
9
|
+
* asks Oxy which of them the human behind a request holds
|
|
10
|
+
* (`GET /applications/:appId/roles/me`, read through `@oxy.so/core/server`).
|
|
11
|
+
*
|
|
12
|
+
* ## Why an application key can never collide with an Oxy permission
|
|
13
|
+
*
|
|
14
|
+
* Every permission Oxy itself checks (`app:update`, `apps:create`,
|
|
15
|
+
* `credentials:rotate`, every scope) is spelled with a COLON. An application key
|
|
16
|
+
* is dot-separated lowercase segments and cannot contain one, so the two
|
|
17
|
+
* vocabularies are disjoint by syntax, not by convention. They are also stored
|
|
18
|
+
* apart (scoped to one application id) and no Oxy gate ever reads an
|
|
19
|
+
* application key. A key means something only to the application that declared
|
|
20
|
+
* it.
|
|
21
|
+
*
|
|
22
|
+
* The pattern is exported as a SOURCE string because the API renders the same
|
|
23
|
+
* text into a Postgres CHECK; JavaScript's `RegExp` and Postgres' ARE agree on
|
|
24
|
+
* everything it uses (anchors, classes, a capturing group, a bounded repeat).
|
|
25
|
+
*
|
|
26
|
+
* Platform-agnostic — zod only, no react/react-native/expo.
|
|
27
|
+
*/
|
|
28
|
+
import { z } from 'zod';
|
|
29
|
+
/**
|
|
30
|
+
* Two to four dot-separated segments, each a lowercase letter followed by
|
|
31
|
+
* lowercase letters, digits or underscores: `payments.operate`,
|
|
32
|
+
* `catalog.review.publish`. At least two segments so a key always names an
|
|
33
|
+
* area and an action; never a colon (see the header).
|
|
34
|
+
*/
|
|
35
|
+
export declare const APPLICATION_PERMISSION_KEY_PATTERN_SOURCE = "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*){1,3}$";
|
|
36
|
+
export declare const APPLICATION_PERMISSION_KEY_PATTERN: RegExp;
|
|
37
|
+
export declare const APPLICATION_PERMISSION_KEY_MAX_LENGTH = 64;
|
|
38
|
+
export declare const APPLICATION_PERMISSION_DESCRIPTION_MAX_LENGTH = 280;
|
|
39
|
+
/** How many live keys one application may declare. Operator powers are few. */
|
|
40
|
+
export declare const APPLICATION_PERMISSIONS_MAX_DECLARED = 64;
|
|
41
|
+
export declare const APPLICATION_ROLE_REASON_MAX_LENGTH = 500;
|
|
42
|
+
export declare const APPLICATION_ROLE_GRANTS_PAGE_DEFAULT = 50;
|
|
43
|
+
export declare const APPLICATION_ROLE_GRANTS_PAGE_MAX = 200;
|
|
44
|
+
/**
|
|
45
|
+
* The `error` codes the application-roles routes answer beyond the generic
|
|
46
|
+
* ones (`BAD_REQUEST`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`). Renaming one
|
|
47
|
+
* is a breaking change.
|
|
48
|
+
*/
|
|
49
|
+
export declare const APPLICATION_ROLE_ERROR_CODES: {
|
|
50
|
+
/** 403: a grant naming yourself on an application you do not own outright. */
|
|
51
|
+
readonly selfGrantForbidden: "SELF_GRANT_FORBIDDEN";
|
|
52
|
+
/** 422: the key is not a live declared permission of this application. */
|
|
53
|
+
readonly unknownPermission: "UNKNOWN_PERMISSION";
|
|
54
|
+
/** 422: the grantee is not a person (an organization, project, bot or channel). */
|
|
55
|
+
readonly granteeNotAPerson: "GRANTEE_NOT_A_PERSON";
|
|
56
|
+
/** 409: the grantee already holds the key; `details.grantId` names the live grant. */
|
|
57
|
+
readonly alreadyGranted: "ALREADY_GRANTED";
|
|
58
|
+
/** 409: the grant was already revoked. */
|
|
59
|
+
readonly alreadyRevoked: "ALREADY_REVOKED";
|
|
60
|
+
/** 403: the bearer's session belongs to a DIFFERENT application. */
|
|
61
|
+
readonly sessionApplicationMismatch: "SESSION_APPLICATION_MISMATCH";
|
|
62
|
+
};
|
|
63
|
+
export type ApplicationRoleErrorCode = (typeof APPLICATION_ROLE_ERROR_CODES)[keyof typeof APPLICATION_ROLE_ERROR_CODES];
|
|
64
|
+
/** Whether `value` is a well-formed application permission key. */
|
|
65
|
+
export declare function isApplicationPermissionKey(value: unknown): value is string;
|
|
66
|
+
export declare const applicationPermissionKeySchema: z.ZodString;
|
|
67
|
+
/** One key as the application's owners declare it. */
|
|
68
|
+
export declare const applicationPermissionDeclarationSchema: z.ZodObject<{
|
|
69
|
+
key: z.ZodString;
|
|
70
|
+
description: z.ZodEffects<z.ZodString, string, string>;
|
|
71
|
+
}, "strict", z.ZodTypeAny, {
|
|
72
|
+
description: string;
|
|
73
|
+
key: string;
|
|
74
|
+
}, {
|
|
75
|
+
description: string;
|
|
76
|
+
key: string;
|
|
77
|
+
}>;
|
|
78
|
+
/**
|
|
79
|
+
* `PUT /applications/:appId/roles/permissions` — the WHOLE vocabulary.
|
|
80
|
+
*
|
|
81
|
+
* Declarative: a key present here and not live is added, a live key absent
|
|
82
|
+
* here is retired (and every grant of it revoked), a live key present here
|
|
83
|
+
* keeps its identity and takes the new description. Sending the same body twice
|
|
84
|
+
* changes nothing.
|
|
85
|
+
*/
|
|
86
|
+
export declare const declareApplicationPermissionsRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
87
|
+
permissions: z.ZodArray<z.ZodObject<{
|
|
88
|
+
key: z.ZodString;
|
|
89
|
+
description: z.ZodEffects<z.ZodString, string, string>;
|
|
90
|
+
}, "strict", z.ZodTypeAny, {
|
|
91
|
+
description: string;
|
|
92
|
+
key: string;
|
|
93
|
+
}, {
|
|
94
|
+
description: string;
|
|
95
|
+
key: string;
|
|
96
|
+
}>, "many">;
|
|
97
|
+
}, "strict", z.ZodTypeAny, {
|
|
98
|
+
permissions: {
|
|
99
|
+
description: string;
|
|
100
|
+
key: string;
|
|
101
|
+
}[];
|
|
102
|
+
}, {
|
|
103
|
+
permissions: {
|
|
104
|
+
description: string;
|
|
105
|
+
key: string;
|
|
106
|
+
}[];
|
|
107
|
+
}>, {
|
|
108
|
+
permissions: {
|
|
109
|
+
description: string;
|
|
110
|
+
key: string;
|
|
111
|
+
}[];
|
|
112
|
+
}, {
|
|
113
|
+
permissions: {
|
|
114
|
+
description: string;
|
|
115
|
+
key: string;
|
|
116
|
+
}[];
|
|
117
|
+
}>;
|
|
118
|
+
/** A declared key. Retired keys are history: they confer nothing. */
|
|
119
|
+
export declare const applicationPermissionSchema: z.ZodObject<{
|
|
120
|
+
key: z.ZodString;
|
|
121
|
+
description: z.ZodString;
|
|
122
|
+
declaredAt: z.ZodString;
|
|
123
|
+
declaredByUserId: z.ZodNullable<z.ZodString>;
|
|
124
|
+
retiredAt: z.ZodNullable<z.ZodString>;
|
|
125
|
+
retiredByUserId: z.ZodNullable<z.ZodString>;
|
|
126
|
+
}, "strip", z.ZodTypeAny, {
|
|
127
|
+
description: string;
|
|
128
|
+
key: string;
|
|
129
|
+
declaredAt: string;
|
|
130
|
+
declaredByUserId: string | null;
|
|
131
|
+
retiredAt: string | null;
|
|
132
|
+
retiredByUserId: string | null;
|
|
133
|
+
}, {
|
|
134
|
+
description: string;
|
|
135
|
+
key: string;
|
|
136
|
+
declaredAt: string;
|
|
137
|
+
declaredByUserId: string | null;
|
|
138
|
+
retiredAt: string | null;
|
|
139
|
+
retiredByUserId: string | null;
|
|
140
|
+
}>;
|
|
141
|
+
export declare const applicationPermissionListSchema: z.ZodObject<{
|
|
142
|
+
items: z.ZodArray<z.ZodObject<{
|
|
143
|
+
key: z.ZodString;
|
|
144
|
+
description: z.ZodString;
|
|
145
|
+
declaredAt: z.ZodString;
|
|
146
|
+
declaredByUserId: z.ZodNullable<z.ZodString>;
|
|
147
|
+
retiredAt: z.ZodNullable<z.ZodString>;
|
|
148
|
+
retiredByUserId: z.ZodNullable<z.ZodString>;
|
|
149
|
+
}, "strip", z.ZodTypeAny, {
|
|
150
|
+
description: string;
|
|
151
|
+
key: string;
|
|
152
|
+
declaredAt: string;
|
|
153
|
+
declaredByUserId: string | null;
|
|
154
|
+
retiredAt: string | null;
|
|
155
|
+
retiredByUserId: string | null;
|
|
156
|
+
}, {
|
|
157
|
+
description: string;
|
|
158
|
+
key: string;
|
|
159
|
+
declaredAt: string;
|
|
160
|
+
declaredByUserId: string | null;
|
|
161
|
+
retiredAt: string | null;
|
|
162
|
+
retiredByUserId: string | null;
|
|
163
|
+
}>, "many">;
|
|
164
|
+
}, "strip", z.ZodTypeAny, {
|
|
165
|
+
items: {
|
|
166
|
+
description: string;
|
|
167
|
+
key: string;
|
|
168
|
+
declaredAt: string;
|
|
169
|
+
declaredByUserId: string | null;
|
|
170
|
+
retiredAt: string | null;
|
|
171
|
+
retiredByUserId: string | null;
|
|
172
|
+
}[];
|
|
173
|
+
}, {
|
|
174
|
+
items: {
|
|
175
|
+
description: string;
|
|
176
|
+
key: string;
|
|
177
|
+
declaredAt: string;
|
|
178
|
+
declaredByUserId: string | null;
|
|
179
|
+
retiredAt: string | null;
|
|
180
|
+
retiredByUserId: string | null;
|
|
181
|
+
}[];
|
|
182
|
+
}>;
|
|
183
|
+
export declare const declareApplicationPermissionsResponseSchema: z.ZodObject<{
|
|
184
|
+
items: z.ZodArray<z.ZodObject<{
|
|
185
|
+
key: z.ZodString;
|
|
186
|
+
description: z.ZodString;
|
|
187
|
+
declaredAt: z.ZodString;
|
|
188
|
+
declaredByUserId: z.ZodNullable<z.ZodString>;
|
|
189
|
+
retiredAt: z.ZodNullable<z.ZodString>;
|
|
190
|
+
retiredByUserId: z.ZodNullable<z.ZodString>;
|
|
191
|
+
}, "strip", z.ZodTypeAny, {
|
|
192
|
+
description: string;
|
|
193
|
+
key: string;
|
|
194
|
+
declaredAt: string;
|
|
195
|
+
declaredByUserId: string | null;
|
|
196
|
+
retiredAt: string | null;
|
|
197
|
+
retiredByUserId: string | null;
|
|
198
|
+
}, {
|
|
199
|
+
description: string;
|
|
200
|
+
key: string;
|
|
201
|
+
declaredAt: string;
|
|
202
|
+
declaredByUserId: string | null;
|
|
203
|
+
retiredAt: string | null;
|
|
204
|
+
retiredByUserId: string | null;
|
|
205
|
+
}>, "many">;
|
|
206
|
+
} & {
|
|
207
|
+
/** Keys that became live with this declaration. */
|
|
208
|
+
added: z.ZodArray<z.ZodString, "many">;
|
|
209
|
+
/** Keys this declaration retired. */
|
|
210
|
+
retired: z.ZodArray<z.ZodString, "many">;
|
|
211
|
+
/** Live keys whose description changed. */
|
|
212
|
+
described: z.ZodArray<z.ZodString, "many">;
|
|
213
|
+
/** Live grants revoked because their key was retired. */
|
|
214
|
+
revokedGrants: z.ZodNumber;
|
|
215
|
+
}, "strip", z.ZodTypeAny, {
|
|
216
|
+
items: {
|
|
217
|
+
description: string;
|
|
218
|
+
key: string;
|
|
219
|
+
declaredAt: string;
|
|
220
|
+
declaredByUserId: string | null;
|
|
221
|
+
retiredAt: string | null;
|
|
222
|
+
retiredByUserId: string | null;
|
|
223
|
+
}[];
|
|
224
|
+
added: string[];
|
|
225
|
+
retired: string[];
|
|
226
|
+
described: string[];
|
|
227
|
+
revokedGrants: number;
|
|
228
|
+
}, {
|
|
229
|
+
items: {
|
|
230
|
+
description: string;
|
|
231
|
+
key: string;
|
|
232
|
+
declaredAt: string;
|
|
233
|
+
declaredByUserId: string | null;
|
|
234
|
+
retiredAt: string | null;
|
|
235
|
+
retiredByUserId: string | null;
|
|
236
|
+
}[];
|
|
237
|
+
added: string[];
|
|
238
|
+
retired: string[];
|
|
239
|
+
described: string[];
|
|
240
|
+
revokedGrants: number;
|
|
241
|
+
}>;
|
|
242
|
+
/** One grant of one key to one Oxy user. Revocation is a stamp, never a delete. */
|
|
243
|
+
export declare const applicationRoleGrantSchema: z.ZodObject<{
|
|
244
|
+
id: z.ZodString;
|
|
245
|
+
applicationId: z.ZodString;
|
|
246
|
+
permission: z.ZodString;
|
|
247
|
+
userId: z.ZodString;
|
|
248
|
+
/** The grantee's handle, for display. */
|
|
249
|
+
username: z.ZodNullable<z.ZodString>;
|
|
250
|
+
/** The HUMAN who granted it; null once that account was erased. */
|
|
251
|
+
grantedByUserId: z.ZodNullable<z.ZodString>;
|
|
252
|
+
grantedAt: z.ZodString;
|
|
253
|
+
grantReason: z.ZodNullable<z.ZodString>;
|
|
254
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
255
|
+
revokedByUserId: z.ZodNullable<z.ZodString>;
|
|
256
|
+
revokeReason: z.ZodNullable<z.ZodString>;
|
|
257
|
+
}, "strip", z.ZodTypeAny, {
|
|
258
|
+
username: string | null;
|
|
259
|
+
id: string;
|
|
260
|
+
applicationId: string;
|
|
261
|
+
revokedAt: string | null;
|
|
262
|
+
userId: string;
|
|
263
|
+
permission: string;
|
|
264
|
+
grantedByUserId: string | null;
|
|
265
|
+
grantedAt: string;
|
|
266
|
+
grantReason: string | null;
|
|
267
|
+
revokedByUserId: string | null;
|
|
268
|
+
revokeReason: string | null;
|
|
269
|
+
}, {
|
|
270
|
+
username: string | null;
|
|
271
|
+
id: string;
|
|
272
|
+
applicationId: string;
|
|
273
|
+
revokedAt: string | null;
|
|
274
|
+
userId: string;
|
|
275
|
+
permission: string;
|
|
276
|
+
grantedByUserId: string | null;
|
|
277
|
+
grantedAt: string;
|
|
278
|
+
grantReason: string | null;
|
|
279
|
+
revokedByUserId: string | null;
|
|
280
|
+
revokeReason: string | null;
|
|
281
|
+
}>;
|
|
282
|
+
export declare const applicationRoleGrantListSchema: z.ZodObject<{
|
|
283
|
+
items: z.ZodArray<z.ZodObject<{
|
|
284
|
+
id: z.ZodString;
|
|
285
|
+
applicationId: z.ZodString;
|
|
286
|
+
permission: z.ZodString;
|
|
287
|
+
userId: z.ZodString;
|
|
288
|
+
/** The grantee's handle, for display. */
|
|
289
|
+
username: z.ZodNullable<z.ZodString>;
|
|
290
|
+
/** The HUMAN who granted it; null once that account was erased. */
|
|
291
|
+
grantedByUserId: z.ZodNullable<z.ZodString>;
|
|
292
|
+
grantedAt: z.ZodString;
|
|
293
|
+
grantReason: z.ZodNullable<z.ZodString>;
|
|
294
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
295
|
+
revokedByUserId: z.ZodNullable<z.ZodString>;
|
|
296
|
+
revokeReason: z.ZodNullable<z.ZodString>;
|
|
297
|
+
}, "strip", z.ZodTypeAny, {
|
|
298
|
+
username: string | null;
|
|
299
|
+
id: string;
|
|
300
|
+
applicationId: string;
|
|
301
|
+
revokedAt: string | null;
|
|
302
|
+
userId: string;
|
|
303
|
+
permission: string;
|
|
304
|
+
grantedByUserId: string | null;
|
|
305
|
+
grantedAt: string;
|
|
306
|
+
grantReason: string | null;
|
|
307
|
+
revokedByUserId: string | null;
|
|
308
|
+
revokeReason: string | null;
|
|
309
|
+
}, {
|
|
310
|
+
username: string | null;
|
|
311
|
+
id: string;
|
|
312
|
+
applicationId: string;
|
|
313
|
+
revokedAt: string | null;
|
|
314
|
+
userId: string;
|
|
315
|
+
permission: string;
|
|
316
|
+
grantedByUserId: string | null;
|
|
317
|
+
grantedAt: string;
|
|
318
|
+
grantReason: string | null;
|
|
319
|
+
revokedByUserId: string | null;
|
|
320
|
+
revokeReason: string | null;
|
|
321
|
+
}>, "many">;
|
|
322
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
323
|
+
}, "strip", z.ZodTypeAny, {
|
|
324
|
+
items: {
|
|
325
|
+
username: string | null;
|
|
326
|
+
id: string;
|
|
327
|
+
applicationId: string;
|
|
328
|
+
revokedAt: string | null;
|
|
329
|
+
userId: string;
|
|
330
|
+
permission: string;
|
|
331
|
+
grantedByUserId: string | null;
|
|
332
|
+
grantedAt: string;
|
|
333
|
+
grantReason: string | null;
|
|
334
|
+
revokedByUserId: string | null;
|
|
335
|
+
revokeReason: string | null;
|
|
336
|
+
}[];
|
|
337
|
+
nextCursor: string | null;
|
|
338
|
+
}, {
|
|
339
|
+
items: {
|
|
340
|
+
username: string | null;
|
|
341
|
+
id: string;
|
|
342
|
+
applicationId: string;
|
|
343
|
+
revokedAt: string | null;
|
|
344
|
+
userId: string;
|
|
345
|
+
permission: string;
|
|
346
|
+
grantedByUserId: string | null;
|
|
347
|
+
grantedAt: string;
|
|
348
|
+
grantReason: string | null;
|
|
349
|
+
revokedByUserId: string | null;
|
|
350
|
+
revokeReason: string | null;
|
|
351
|
+
}[];
|
|
352
|
+
nextCursor: string | null;
|
|
353
|
+
}>;
|
|
354
|
+
/** `POST /applications/:appId/roles/grants` — name the grantee by id OR handle. */
|
|
355
|
+
export declare const createApplicationRoleGrantRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
356
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
357
|
+
username: z.ZodOptional<z.ZodString>;
|
|
358
|
+
permission: z.ZodString;
|
|
359
|
+
reason: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
360
|
+
}, "strict", z.ZodTypeAny, {
|
|
361
|
+
permission: string;
|
|
362
|
+
username?: string | undefined;
|
|
363
|
+
reason?: string | undefined;
|
|
364
|
+
userId?: string | undefined;
|
|
365
|
+
}, {
|
|
366
|
+
permission: string;
|
|
367
|
+
username?: string | undefined;
|
|
368
|
+
reason?: string | undefined;
|
|
369
|
+
userId?: string | undefined;
|
|
370
|
+
}>, {
|
|
371
|
+
permission: string;
|
|
372
|
+
username?: string | undefined;
|
|
373
|
+
reason?: string | undefined;
|
|
374
|
+
userId?: string | undefined;
|
|
375
|
+
}, {
|
|
376
|
+
permission: string;
|
|
377
|
+
username?: string | undefined;
|
|
378
|
+
reason?: string | undefined;
|
|
379
|
+
userId?: string | undefined;
|
|
380
|
+
}>;
|
|
381
|
+
/** `POST /applications/:appId/roles/grants/:grantId/revoke`. */
|
|
382
|
+
export declare const revokeApplicationRoleGrantRequestSchema: z.ZodObject<{
|
|
383
|
+
reason: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
384
|
+
}, "strict", z.ZodTypeAny, {
|
|
385
|
+
reason?: string | undefined;
|
|
386
|
+
}, {
|
|
387
|
+
reason?: string | undefined;
|
|
388
|
+
}>;
|
|
389
|
+
/** `GET /applications/:appId/roles/grants` query. */
|
|
390
|
+
export declare const listApplicationRoleGrantsQuerySchema: z.ZodObject<{
|
|
391
|
+
permission: z.ZodOptional<z.ZodString>;
|
|
392
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
393
|
+
includeRevoked: z.ZodOptional<z.ZodEffects<z.ZodEnum<["true", "false"]>, boolean, "true" | "false">>;
|
|
394
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
395
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
396
|
+
}, "strict", z.ZodTypeAny, {
|
|
397
|
+
limit?: number | undefined;
|
|
398
|
+
cursor?: string | undefined;
|
|
399
|
+
userId?: string | undefined;
|
|
400
|
+
permission?: string | undefined;
|
|
401
|
+
includeRevoked?: boolean | undefined;
|
|
402
|
+
}, {
|
|
403
|
+
limit?: number | undefined;
|
|
404
|
+
cursor?: string | undefined;
|
|
405
|
+
userId?: string | undefined;
|
|
406
|
+
permission?: string | undefined;
|
|
407
|
+
includeRevoked?: "true" | "false" | undefined;
|
|
408
|
+
}>;
|
|
409
|
+
/**
|
|
410
|
+
* `GET /applications/:appId/roles/me` — the keys the HUMAN behind the bearer
|
|
411
|
+
* holds for this application, in no particular order. `userId` is that human
|
|
412
|
+
* (the operator), which is NOT the account the session speaks as when a person
|
|
413
|
+
* is acting as an organization.
|
|
414
|
+
*/
|
|
415
|
+
export declare const applicationRolesMeSchema: z.ZodObject<{
|
|
416
|
+
applicationId: z.ZodString;
|
|
417
|
+
userId: z.ZodString;
|
|
418
|
+
permissions: z.ZodArray<z.ZodString, "many">;
|
|
419
|
+
}, "strip", z.ZodTypeAny, {
|
|
420
|
+
permissions: string[];
|
|
421
|
+
applicationId: string;
|
|
422
|
+
userId: string;
|
|
423
|
+
}, {
|
|
424
|
+
permissions: string[];
|
|
425
|
+
applicationId: string;
|
|
426
|
+
userId: string;
|
|
427
|
+
}>;
|
|
428
|
+
export type ApplicationPermissionDeclaration = z.infer<typeof applicationPermissionDeclarationSchema>;
|
|
429
|
+
export type DeclareApplicationPermissionsRequest = z.infer<typeof declareApplicationPermissionsRequestSchema>;
|
|
430
|
+
export type ApplicationPermissionDefinition = z.infer<typeof applicationPermissionSchema>;
|
|
431
|
+
export type ApplicationPermissionList = z.infer<typeof applicationPermissionListSchema>;
|
|
432
|
+
export type DeclareApplicationPermissionsResponse = z.infer<typeof declareApplicationPermissionsResponseSchema>;
|
|
433
|
+
export type ApplicationRoleGrant = z.infer<typeof applicationRoleGrantSchema>;
|
|
434
|
+
export type ApplicationRoleGrantList = z.infer<typeof applicationRoleGrantListSchema>;
|
|
435
|
+
export type CreateApplicationRoleGrantRequest = z.infer<typeof createApplicationRoleGrantRequestSchema>;
|
|
436
|
+
export type RevokeApplicationRoleGrantRequest = z.infer<typeof revokeApplicationRoleGrantRequestSchema>;
|
|
437
|
+
export type ListApplicationRoleGrantsQuery = z.infer<typeof listApplicationRoleGrantsQuerySchema>;
|
|
438
|
+
export type ApplicationRolesMe = z.infer<typeof applicationRolesMeSchema>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account-email constants and response checks, without Zod. Schemas: `../accountEmail.ts`.
|
|
3
|
+
*
|
|
4
|
+
* Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
|
|
5
|
+
*/
|
|
6
|
+
import type { EmailVerificationConfirmResponse, EmailVerificationStartResponse } from '../accountEmail';
|
|
7
|
+
/**
|
|
8
|
+
* - `signup`: above.
|
|
9
|
+
* - `signin`: the code (and link) of an email sign-in (`POST /auth/signin/email/start`).
|
|
10
|
+
* - `reauth`: a signed-in person proving it is them before a sensitive step
|
|
11
|
+
* (`POST /users/me/reauth/email`): a password, an authenticator, deleting the
|
|
12
|
+
* account, linking Commons.
|
|
13
|
+
*/
|
|
14
|
+
export declare const EMAIL_VERIFICATION_PURPOSES: readonly ["signup", "signin", "reauth"];
|
|
15
|
+
export type EmailVerificationPurpose = (typeof EMAIL_VERIFICATION_PURPOSES)[number];
|
|
16
|
+
/** Digits in a code. */
|
|
17
|
+
export declare const EMAIL_CODE_LENGTH = 6;
|
|
18
|
+
/** How long a code can be confirmed. */
|
|
19
|
+
export declare const EMAIL_CODE_TTL_MS: number;
|
|
20
|
+
/** Wrong codes before a verification is spent and a new code is needed. */
|
|
21
|
+
export declare const EMAIL_CODE_MAX_ATTEMPTS = 5;
|
|
22
|
+
/** How long a confirmed code's ticket can be spent. */
|
|
23
|
+
export declare const EMAIL_TICKET_TTL_MS: number;
|
|
24
|
+
/**
|
|
25
|
+
* Stable error codes (`error.code` in the API error body). Clients map these
|
|
26
|
+
* through their localization, never the English message.
|
|
27
|
+
*/
|
|
28
|
+
export declare const EMAIL_VERIFICATION_ERROR_CODES: {
|
|
29
|
+
/** The code is wrong, or its verification expired or was spent. */
|
|
30
|
+
readonly codeInvalid: "EMAIL_CODE_INVALID";
|
|
31
|
+
/** Too many wrong codes: request a new one. */
|
|
32
|
+
readonly tooManyAttempts: "EMAIL_CODE_TOO_MANY_ATTEMPTS";
|
|
33
|
+
/** The ticket is unknown, expired, spent, or for another email or purpose. */
|
|
34
|
+
readonly ticketInvalid: "EMAIL_TICKET_INVALID";
|
|
35
|
+
/** A sign-up without a confirmed email. */
|
|
36
|
+
readonly ticketRequired: "EMAIL_TICKET_REQUIRED";
|
|
37
|
+
/** This server cannot send mail. */
|
|
38
|
+
readonly unavailable: "EMAIL_UNAVAILABLE";
|
|
39
|
+
};
|
|
40
|
+
export type EmailVerificationErrorCode = (typeof EMAIL_VERIFICATION_ERROR_CODES)[keyof typeof EMAIL_VERIFICATION_ERROR_CODES];
|
|
41
|
+
export declare const emailAddressCheck: import("./check").Check<string>;
|
|
42
|
+
export declare const emailTicketCheck: import("./check").Check<string>;
|
|
43
|
+
export declare const emailVerificationStartResponseCheck: import("./check").Check<EmailVerificationStartResponse>;
|
|
44
|
+
export declare const emailVerificationConfirmResponseCheck: import("./check").Check<EmailVerificationConfirmResponse>;
|