@andco/protocol 0.0.4 → 0.0.6
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/README.md +18 -0
- package/dist/api-errors.d.ts +5 -0
- package/dist/api-errors.d.ts.map +1 -1
- package/dist/api-errors.js +5 -0
- package/dist/authorization-preparation.d.ts +85 -2
- package/dist/authorization-preparation.d.ts.map +1 -1
- package/dist/authorization-preparation.js +42 -1
- package/dist/consent.d.ts +82 -7
- package/dist/consent.d.ts.map +1 -1
- package/dist/consent.js +63 -5
- package/dist/errors.d.ts +5 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +5 -2
- package/dist/intent-input.d.ts +21 -18
- package/dist/intent-input.d.ts.map +1 -1
- package/dist/intent-input.js +31 -15
- package/dist/native-copy.js +38 -18
- package/dist/transport/generated/oauth-api.d.ts +35 -12
- package/dist/transport/generated/oauth-api.d.ts.map +1 -1
- package/dist/transport/rest.d.ts +2 -1
- package/dist/transport/rest.d.ts.map +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -72,3 +72,21 @@ parseAndcoGrantRequest({
|
|
|
72
72
|
|
|
73
73
|
The root intentionally does not reexport `transport`, which prevents protocol
|
|
74
74
|
consumers from pulling `openapi-fetch` into bundles accidentally.
|
|
75
|
+
|
|
76
|
+
## Conformance vectors
|
|
77
|
+
|
|
78
|
+
The Python, Ruby and Go SDKs do not reimplement this package's rules from prose:
|
|
79
|
+
they test against vectors generated from it. `scripts/rar-fixture-cases.mjs`
|
|
80
|
+
(valid and invalid authorization details) and
|
|
81
|
+
`scripts/account-matcher-containment-cases.mjs` are the shared fixtures; this
|
|
82
|
+
package's vitest suite checks them, and
|
|
83
|
+
`scripts/generate-conformance-vectors.mjs` publishes them, with the money, alias,
|
|
84
|
+
Organization and identifier syntaxes and the members of each Signed Instruction
|
|
85
|
+
(read from `openapi/oauth-api.yaml`), as one JSON document:
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
pnpm --filter @andco/protocol build
|
|
89
|
+
pnpm --filter @andco/protocol run generate:conformance # writes into the three sibling SDK repos
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Add a case to a fixture, never to only one suite.
|
package/dist/api-errors.d.ts
CHANGED
|
@@ -46,6 +46,11 @@ export declare const ANDCO_API_ERROR_CODES: {
|
|
|
46
46
|
readonly AMBIGUOUS_GRANT: "ambiguous_grant";
|
|
47
47
|
/** The request body or parameters did not satisfy the contract. `error.details` names the fields. */
|
|
48
48
|
readonly INVALID_REQUEST: "invalid_request";
|
|
49
|
+
/**
|
|
50
|
+
* An identifier in the path (an account, an Intent) is not well formed. The SDKs check it before
|
|
51
|
+
* any request and fail with this same code, so a typo never reads as `not_found`.
|
|
52
|
+
*/
|
|
53
|
+
readonly INVALID_IDENTIFIER: "invalid_identifier";
|
|
49
54
|
/** The addressed resource does not exist, or exists outside what this Grant can see. */
|
|
50
55
|
readonly NOT_FOUND: "not_found";
|
|
51
56
|
/** The route exists and this case of it is not built yet. Not a client error: do not retry. */
|
package/dist/api-errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-errors.d.ts","sourceRoot":"","sources":["../src/api-errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB;IAEhC;;;OAGG;;IAEH;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH,4EAA4E;;IAE5E;;;OAGG;;IAEH;;;OAGG;;IAIH,qGAAqG;;IAErG,wFAAwF;;IAExF,+FAA+F;;IAE/F,2DAA2D;;IAE3D,qEAAqE;;IAIrE;;;;OAIG;;IAEH;;;;OAIG;;IAEH,gGAAgG;;IAEhG;;;OAGG;;IAEH,uEAAuE;;IAEvE,kGAAkG;;IAElG;;;OAGG;;IAEH,iHAAiH;;IAEjH,uEAAuE;;IAEvE,sGAAsG;;IAEtG,gGAAgG;;IAEhG,gGAAgG;;IAIhG,0FAA0F;;IAE1F,0DAA0D;;IAE1D,qDAAqD;;IAIrD;;;OAGG;;CAEK,CAAC;AAEX,iEAAiE;AACjE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"api-errors.d.ts","sourceRoot":"","sources":["../src/api-errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB;IAEhC;;;OAGG;;IAEH;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH,4EAA4E;;IAE5E;;;OAGG;;IAEH;;;OAGG;;IAIH,qGAAqG;;IAErG;;;OAGG;;IAEH,wFAAwF;;IAExF,+FAA+F;;IAE/F,2DAA2D;;IAE3D,qEAAqE;;IAIrE;;;;OAIG;;IAEH;;;;OAIG;;IAEH,gGAAgG;;IAEhG;;;OAGG;;IAEH,uEAAuE;;IAEvE,kGAAkG;;IAElG;;;OAGG;;IAEH,iHAAiH;;IAEjH,uEAAuE;;IAEvE,sGAAsG;;IAEtG,gGAAgG;;IAEhG,gGAAgG;;IAIhG,0FAA0F;;IAE1F,0DAA0D;;IAE1D,qDAAqD;;IAIrD;;;OAGG;;CAEK,CAAC;AAEX,iEAAiE;AACjE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC"}
|
package/dist/api-errors.js
CHANGED
|
@@ -48,6 +48,11 @@ export const ANDCO_API_ERROR_CODES = {
|
|
|
48
48
|
// -- Request ---------------------------------------------------------------------------------
|
|
49
49
|
/** The request body or parameters did not satisfy the contract. `error.details` names the fields. */
|
|
50
50
|
INVALID_REQUEST: "invalid_request",
|
|
51
|
+
/**
|
|
52
|
+
* An identifier in the path (an account, an Intent) is not well formed. The SDKs check it before
|
|
53
|
+
* any request and fail with this same code, so a typo never reads as `not_found`.
|
|
54
|
+
*/
|
|
55
|
+
INVALID_IDENTIFIER: "invalid_identifier",
|
|
51
56
|
/** The addressed resource does not exist, or exists outside what this Grant can see. */
|
|
52
57
|
NOT_FOUND: "not_found",
|
|
53
58
|
/** The route exists and this case of it is not built yet. Not a client error: do not retry. */
|
|
@@ -39,6 +39,27 @@ export declare const AndCoResourceConsentSchema: v.ObjectSchema<{
|
|
|
39
39
|
readonly resourceName: v.StringSchema<undefined>;
|
|
40
40
|
readonly resource: v.StringSchema<undefined>;
|
|
41
41
|
}, undefined>;
|
|
42
|
+
/**
|
|
43
|
+
* One Resource Server a pending authorization names (ADR 0033), in the order of its `resource`
|
|
44
|
+
* parameters: who it is, whether the person may leave it out of the consent (only in an
|
|
45
|
+
* authorization naming several, and only when the Client's policies on it list no required scope)
|
|
46
|
+
* and which requested authorization details are its own (zero-based request positions).
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* const optional = consent.resourceServers.filter((server) => server.resourceServerOptional);
|
|
50
|
+
*/
|
|
51
|
+
export declare const AndCoConsentResourceServerSchema: v.ObjectSchema<{
|
|
52
|
+
readonly resourceServerId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
|
|
53
|
+
readonly resourcePosition: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
54
|
+
readonly resourceServerName: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 255, undefined>]>;
|
|
55
|
+
readonly resource: v.StringSchema<undefined>;
|
|
56
|
+
readonly resourceProjectId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
|
|
57
|
+
readonly resourceProjectName: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 256, undefined>]>;
|
|
58
|
+
readonly resourceProjectHomeUri: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
59
|
+
readonly resourcePublisherName: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 256, undefined>]>;
|
|
60
|
+
readonly resourceServerOptional: v.BooleanSchema<undefined>;
|
|
61
|
+
readonly detailPositions: v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
62
|
+
}, undefined>;
|
|
42
63
|
/** Canonical state of one pending authorization, resolved once by the platform for every surface. */
|
|
43
64
|
export declare const AndCoAuthorizationPreparationSchema: v.VariantSchema<"status", [v.ObjectSchema<{
|
|
44
65
|
readonly status: v.LiteralSchema<"sign_in_required", undefined>;
|
|
@@ -99,7 +120,7 @@ export declare const AndCoAuthorizationPreparationSchema: v.VariantSchema<"statu
|
|
|
99
120
|
scope: string;
|
|
100
121
|
mode: "optional" | "default" | "required";
|
|
101
122
|
}[], 50, undefined>]>;
|
|
102
|
-
readonly
|
|
123
|
+
readonly resourceAuthorizations: v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
|
|
103
124
|
readonly allowed: v.BooleanSchema<undefined>;
|
|
104
125
|
readonly organizationId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
105
126
|
readonly organizationName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -119,7 +140,50 @@ export declare const AndCoAuthorizationPreparationSchema: v.VariantSchema<"statu
|
|
|
119
140
|
readonly resourcePublisherName: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
120
141
|
readonly resourceName: v.StringSchema<undefined>;
|
|
121
142
|
readonly resource: v.StringSchema<undefined>;
|
|
122
|
-
}, undefined>, undefined
|
|
143
|
+
}, undefined>, undefined>, v.MaxLengthAction<{
|
|
144
|
+
allowed: boolean;
|
|
145
|
+
organizationId: string | null;
|
|
146
|
+
organizationName: string | null;
|
|
147
|
+
details: {
|
|
148
|
+
name: string;
|
|
149
|
+
actions: {
|
|
150
|
+
id: string;
|
|
151
|
+
description: string;
|
|
152
|
+
}[];
|
|
153
|
+
}[];
|
|
154
|
+
errorCode: string | null;
|
|
155
|
+
clientProjectName: string;
|
|
156
|
+
resourceServerId?: string | undefined;
|
|
157
|
+
resourceProjectId: string;
|
|
158
|
+
resourceProjectName?: string | undefined;
|
|
159
|
+
resourceProjectHomeUri?: string | null | undefined;
|
|
160
|
+
resourcePublisherName?: string | undefined;
|
|
161
|
+
resourceName: string;
|
|
162
|
+
resource: string;
|
|
163
|
+
}[], 10, undefined>]>;
|
|
164
|
+
readonly resourceServers: v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
|
|
165
|
+
readonly resourceServerId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
|
|
166
|
+
readonly resourcePosition: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
167
|
+
readonly resourceServerName: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 255, undefined>]>;
|
|
168
|
+
readonly resource: v.StringSchema<undefined>;
|
|
169
|
+
readonly resourceProjectId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
|
|
170
|
+
readonly resourceProjectName: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 256, undefined>]>;
|
|
171
|
+
readonly resourceProjectHomeUri: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
172
|
+
readonly resourcePublisherName: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 256, undefined>]>;
|
|
173
|
+
readonly resourceServerOptional: v.BooleanSchema<undefined>;
|
|
174
|
+
readonly detailPositions: v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
175
|
+
}, undefined>, undefined>, v.MaxLengthAction<{
|
|
176
|
+
resourceServerId: string;
|
|
177
|
+
resourcePosition: number;
|
|
178
|
+
resourceServerName: string;
|
|
179
|
+
resource: string;
|
|
180
|
+
resourceProjectId: string;
|
|
181
|
+
resourceProjectName: string;
|
|
182
|
+
resourceProjectHomeUri: string | null;
|
|
183
|
+
resourcePublisherName: string;
|
|
184
|
+
resourceServerOptional: boolean;
|
|
185
|
+
detailPositions: number[];
|
|
186
|
+
}[], 10, undefined>]>;
|
|
123
187
|
readonly organizationSubject: v.OptionalSchema<v.ObjectSchema<{
|
|
124
188
|
readonly organizationId: v.NumberSchema<undefined>;
|
|
125
189
|
readonly organizationName: v.StringSchema<undefined>;
|
|
@@ -247,6 +311,21 @@ export declare const AndCoAuthorizationCompletionSchema: v.ObjectSchema<{
|
|
|
247
311
|
readonly decision: v.PicklistSchema<["approve", "deny"], undefined>;
|
|
248
312
|
readonly redirectUrl: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 8192, undefined>]>;
|
|
249
313
|
}, undefined>;
|
|
314
|
+
/**
|
|
315
|
+
* The decision a native Host submits for one pending authorization: the chosen scopes and the
|
|
316
|
+
* optional Resource Servers the person left out whole (their details and own scopes are dropped;
|
|
317
|
+
* Platform refuses leaving out a required one), or a denial.
|
|
318
|
+
*
|
|
319
|
+
* @example
|
|
320
|
+
* const decision: AndCoAuthorizationDecision = { decision: "approve", scopes: ["openid", "email"], omittedResourceServers: [casaNorteId] };
|
|
321
|
+
*/
|
|
322
|
+
export declare const AndCoAuthorizationDecisionSchema: v.VariantSchema<"decision", [v.ObjectSchema<{
|
|
323
|
+
readonly decision: v.LiteralSchema<"approve", undefined>;
|
|
324
|
+
readonly scopes: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>]>, undefined>, v.MaxLengthAction<string[], 50, undefined>]>;
|
|
325
|
+
readonly omittedResourceServers: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>, undefined>, v.MaxLengthAction<string[], 10, undefined>]>;
|
|
326
|
+
}, undefined>, v.ObjectSchema<{
|
|
327
|
+
readonly decision: v.LiteralSchema<"deny", undefined>;
|
|
328
|
+
}, undefined>], undefined>;
|
|
250
329
|
export declare const AndCoAuthorizationErrorSchema: v.ObjectSchema<{
|
|
251
330
|
readonly error: v.ObjectSchema<{
|
|
252
331
|
readonly code: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>]>;
|
|
@@ -258,6 +337,10 @@ export declare const AndCoAuthorizationErrorSchema: v.ObjectSchema<{
|
|
|
258
337
|
export type AndCoAuthorizationPreparation = v.InferOutput<typeof AndCoAuthorizationPreparationSchema>;
|
|
259
338
|
/** Completed approve or deny result containing the safe OAuth continuation URL. */
|
|
260
339
|
export type AndCoAuthorizationCompletion = v.InferOutput<typeof AndCoAuthorizationCompletionSchema>;
|
|
340
|
+
/** One Resource Server of a pending authorization, as the consent groups it. */
|
|
341
|
+
export type AndCoConsentResourceServer = v.InferOutput<typeof AndCoConsentResourceServerSchema>;
|
|
342
|
+
/** Approve (with scopes and left-out Resource Servers) or deny, as a native Host submits it. */
|
|
343
|
+
export type AndCoAuthorizationDecision = v.InferOutput<typeof AndCoAuthorizationDecisionSchema>;
|
|
261
344
|
/** Typed API failure returned by the native authorization endpoints. */
|
|
262
345
|
export type AndCoAuthorizationError = v.InferOutput<typeof AndCoAuthorizationErrorSchema>["error"];
|
|
263
346
|
//# sourceMappingURL=authorization-preparation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization-preparation.d.ts","sourceRoot":"","sources":["../src/authorization-preparation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAG7B,uEAAuE;AACvE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;aAkBlC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;aAgBrC,CAAC;
|
|
1
|
+
{"version":3,"file":"authorization-preparation.d.ts","sourceRoot":"","sources":["../src/authorization-preparation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAG7B,uEAAuE;AACvE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;aAkBlC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;aAgBrC,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;aAW3C,CAAC;AAqHH,qGAAqG;AACrG,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAS9C,CAAC;AAEH,eAAO,MAAM,kCAAkC;;;;aAI7C,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,gCAAgC;;;;;;0BAO3C,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;aAMxC,CAAC;AAEH,6EAA6E;AAC7E,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,mCAAmC,CAAC,CAAC;AACtG,mFAAmF;AACnF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,kCAAkC,CAAC,CAAC;AACpG,gFAAgF;AAChF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAChG,gGAAgG;AAChG,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAChG,wEAAwE;AACxE,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,6BAA6B,CAAC,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -40,6 +40,27 @@ export const AndCoResourceConsentSchema = /* @__PURE__ */ v.object({
|
|
|
40
40
|
resourceName: v.string(),
|
|
41
41
|
resource: v.string(),
|
|
42
42
|
});
|
|
43
|
+
/**
|
|
44
|
+
* One Resource Server a pending authorization names (ADR 0033), in the order of its `resource`
|
|
45
|
+
* parameters: who it is, whether the person may leave it out of the consent (only in an
|
|
46
|
+
* authorization naming several, and only when the Client's policies on it list no required scope)
|
|
47
|
+
* and which requested authorization details are its own (zero-based request positions).
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* const optional = consent.resourceServers.filter((server) => server.resourceServerOptional);
|
|
51
|
+
*/
|
|
52
|
+
export const AndCoConsentResourceServerSchema = /* @__PURE__ */ v.object({
|
|
53
|
+
resourceServerId: v.pipe(v.string(), v.uuid()),
|
|
54
|
+
resourcePosition: v.pipe(v.number(), v.integer(), v.minValue(0)),
|
|
55
|
+
resourceServerName: v.pipe(v.string(), v.maxLength(255)),
|
|
56
|
+
resource: v.string(),
|
|
57
|
+
resourceProjectId: v.pipe(v.string(), v.uuid()),
|
|
58
|
+
resourceProjectName: v.pipe(v.string(), v.maxLength(256)),
|
|
59
|
+
resourceProjectHomeUri: v.nullable(v.string()),
|
|
60
|
+
resourcePublisherName: v.pipe(v.string(), v.maxLength(256)),
|
|
61
|
+
resourceServerOptional: v.boolean(),
|
|
62
|
+
detailPositions: v.array(v.pipe(v.number(), v.integer(), v.minValue(0))),
|
|
63
|
+
});
|
|
43
64
|
const AndCoAuthorizationClientSchema = /* @__PURE__ */ v.object({
|
|
44
65
|
id: v.pipe(v.string(), v.minLength(1), v.maxLength(255)),
|
|
45
66
|
name: v.pipe(v.string(), v.minLength(1), v.maxLength(255)),
|
|
@@ -79,7 +100,11 @@ const AndCoAuthorizationConsentRequiredSchema = /* @__PURE__ */ v.object({
|
|
|
79
100
|
client: AndCoAuthorizationClientSchema,
|
|
80
101
|
redirectHost: v.pipe(v.string(), v.minLength(1), v.maxLength(255)),
|
|
81
102
|
scopes: v.pipe(v.array(AndCoConsentScopeSchema), v.maxLength(50)),
|
|
82
|
-
|
|
103
|
+
// One live decision per third-party Resource Server asked for authorization details; any refused
|
|
104
|
+
// one blocks approval unless the person leaves that Resource Server out.
|
|
105
|
+
resourceAuthorizations: v.pipe(v.array(AndCoResourceConsentSchema), v.maxLength(10)),
|
|
106
|
+
// Every Resource Server the authorization names; empty for a Client without registered policies.
|
|
107
|
+
resourceServers: v.pipe(v.array(AndCoConsentResourceServerSchema), v.maxLength(10)),
|
|
83
108
|
organizationSubject: v.optional(v.object({ organizationId: v.number(), organizationName: v.string() })),
|
|
84
109
|
// Kept alongside `organizationSubject` for the native producer's still-current selection UI (consent-drawer.tsx,
|
|
85
110
|
// Tauri app.tsx): `organization_subject_required` (reason: "selection") absorbs this case once the platform's
|
|
@@ -155,6 +180,22 @@ export const AndCoAuthorizationCompletionSchema = /* @__PURE__ */ v.object({
|
|
|
155
180
|
decision: v.picklist(["approve", "deny"]),
|
|
156
181
|
redirectUrl: v.pipe(v.string(), v.minLength(1), v.maxLength(8192)),
|
|
157
182
|
});
|
|
183
|
+
/**
|
|
184
|
+
* The decision a native Host submits for one pending authorization: the chosen scopes and the
|
|
185
|
+
* optional Resource Servers the person left out whole (their details and own scopes are dropped;
|
|
186
|
+
* Platform refuses leaving out a required one), or a denial.
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* const decision: AndCoAuthorizationDecision = { decision: "approve", scopes: ["openid", "email"], omittedResourceServers: [casaNorteId] };
|
|
190
|
+
*/
|
|
191
|
+
export const AndCoAuthorizationDecisionSchema = /* @__PURE__ */ v.variant("decision", [
|
|
192
|
+
v.object({
|
|
193
|
+
decision: v.literal("approve"),
|
|
194
|
+
scopes: v.pipe(v.array(v.pipe(v.string(), v.minLength(1), v.maxLength(128))), v.maxLength(50)),
|
|
195
|
+
omittedResourceServers: v.pipe(v.array(v.pipe(v.string(), v.uuid())), v.maxLength(10)),
|
|
196
|
+
}),
|
|
197
|
+
v.object({ decision: v.literal("deny") }),
|
|
198
|
+
]);
|
|
158
199
|
export const AndCoAuthorizationErrorSchema = /* @__PURE__ */ v.object({
|
|
159
200
|
error: v.object({
|
|
160
201
|
code: v.pipe(v.string(), v.minLength(1), v.maxLength(128)),
|
package/dist/consent.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { AndCoAuthorizationPreparation } from "./authorization-preparation.js";
|
|
2
|
-
type
|
|
1
|
+
import type { AndCoAuthorizationDecision, AndCoAuthorizationPreparation } from "./authorization-preparation.js";
|
|
2
|
+
type PreparedConsent = Extract<AndCoAuthorizationPreparation, {
|
|
3
3
|
status: "consent_required";
|
|
4
|
-
}
|
|
4
|
+
}>;
|
|
5
|
+
type PreparedConsentScope = PreparedConsent["scopes"][number];
|
|
5
6
|
/**
|
|
6
7
|
* Whether a Scope's checkbox may not be cleared: the Client's Scope Policy requires it, or an
|
|
7
8
|
* active OAuth Grant on this Connection already covers it and clearing the box would promise a
|
|
@@ -37,9 +38,83 @@ export type AndCoConsentScope = ReturnType<typeof ANDCO_CONSENT_SCOPES>[number];
|
|
|
37
38
|
export declare function ANDCO_CONSENT_INITIAL_SCOPES(consent: Extract<AndCoAuthorizationPreparation, {
|
|
38
39
|
status: "consent_required";
|
|
39
40
|
}>): Set<string>;
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Groups a consent by Resource Server, in the order of the request's `resource` parameters: each one
|
|
43
|
+
* with its own scopes and, for a third party asked for details, its live decision. OpenID Connect
|
|
44
|
+
* scopes come through the Andco API's policies but belong to the Identity Session, so the Andco API's
|
|
45
|
+
* group owns none of them; they stay in `consent.scopes` for the identity section.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* const groups = ANDCO_CONSENT_RESOURCE_SERVER_GROUPS(consent);
|
|
49
|
+
* groups.map((group) => group.server.resourceServerName); // ["Andco API", "Casa Norte Ecommerce"]
|
|
50
|
+
*/
|
|
51
|
+
export declare function ANDCO_CONSENT_RESOURCE_SERVER_GROUPS(consent: PreparedConsent): {
|
|
52
|
+
server: {
|
|
53
|
+
resourceServerId: string;
|
|
54
|
+
resourcePosition: number;
|
|
55
|
+
resourceServerName: string;
|
|
56
|
+
resource: string;
|
|
57
|
+
resourceProjectId: string;
|
|
58
|
+
resourceProjectName: string;
|
|
59
|
+
resourceProjectHomeUri: string | null;
|
|
60
|
+
resourcePublisherName: string;
|
|
61
|
+
resourceServerOptional: boolean;
|
|
62
|
+
detailPositions: number[];
|
|
63
|
+
};
|
|
64
|
+
scopes: {
|
|
65
|
+
resourceServerId?: string | undefined;
|
|
66
|
+
resourceServerName?: string | undefined;
|
|
67
|
+
resourceProjectId?: string | undefined;
|
|
68
|
+
resourceProjectName?: string | undefined;
|
|
69
|
+
resourceProjectHomeUri?: string | null | undefined;
|
|
70
|
+
resourcePublisherName?: string | undefined;
|
|
71
|
+
scopeDescription?: string | undefined;
|
|
72
|
+
grantedAt: string | null;
|
|
73
|
+
connectionHasPriorGrant: boolean;
|
|
74
|
+
scope: string;
|
|
75
|
+
mode: "optional" | "default" | "required";
|
|
76
|
+
}[];
|
|
77
|
+
resourceAuthorization: {
|
|
78
|
+
allowed: boolean;
|
|
79
|
+
organizationId: string | null;
|
|
80
|
+
organizationName: string | null;
|
|
81
|
+
details: {
|
|
82
|
+
name: string;
|
|
83
|
+
actions: {
|
|
84
|
+
id: string;
|
|
85
|
+
description: string;
|
|
86
|
+
}[];
|
|
87
|
+
}[];
|
|
88
|
+
errorCode: string | null;
|
|
89
|
+
clientProjectName: string;
|
|
90
|
+
resourceServerId?: string | undefined;
|
|
91
|
+
resourceProjectId: string;
|
|
92
|
+
resourceProjectName?: string | undefined;
|
|
93
|
+
resourceProjectHomeUri?: string | null | undefined;
|
|
94
|
+
resourcePublisherName?: string | undefined;
|
|
95
|
+
resourceName: string;
|
|
96
|
+
resource: string;
|
|
97
|
+
} | undefined;
|
|
98
|
+
}[];
|
|
99
|
+
/** One Resource Server group of a native consent; see {@link ANDCO_CONSENT_RESOURCE_SERVER_GROUPS}. */
|
|
100
|
+
export type AndCoConsentResourceServerGroup = ReturnType<typeof ANDCO_CONSENT_RESOURCE_SERVER_GROUPS>[number];
|
|
101
|
+
/**
|
|
102
|
+
* Whether the in-progress selection is complete enough to submit; the server still authorizes on
|
|
103
|
+
* submit. `omitted` holds the optional Resource Servers the person left out: their scopes stop
|
|
104
|
+
* counting and a refused decision of theirs stops blocking.
|
|
105
|
+
*/
|
|
106
|
+
export declare function ANDCO_CONSENT_CAN_SUBMIT(consent: PreparedConsent, scopes: ReadonlySet<string>, omitted?: ReadonlySet<string>): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Builds the approval a native Host submits: the selected scopes without those of the Resource
|
|
109
|
+
* Servers left out, and the left-out ones by id. Throws when asked to leave out a Resource Server the
|
|
110
|
+
* consent does not name or one that is required; a surface only offers optional ones.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ANDCO_CONSENT_DECISION(consent, new Set(["openid", "email", "orders:read"]), new Set([casaNorteId]));
|
|
114
|
+
* // { decision: "approve", scopes: ["openid", "email"], omittedResourceServers: [casaNorteId] }
|
|
115
|
+
*/
|
|
116
|
+
export declare function ANDCO_CONSENT_DECISION(consent: PreparedConsent, scopes: ReadonlySet<string>, omitted?: ReadonlySet<string>): Extract<AndCoAuthorizationDecision, {
|
|
117
|
+
decision: "approve";
|
|
118
|
+
}>;
|
|
44
119
|
export {};
|
|
45
120
|
//# sourceMappingURL=consent.d.ts.map
|
package/dist/consent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consent.d.ts","sourceRoot":"","sources":["../src/consent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"consent.d.ts","sourceRoot":"","sources":["../src/consent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAYhH,KAAK,eAAe,GAAG,OAAO,CAAC,6BAA6B,EAAE;IAAE,MAAM,EAAE,kBAAkB,CAAA;CAAE,CAAC,CAAC;AAC9F,KAAK,oBAAoB,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,IAAI,CAAC,oBAAoB,EAAE,MAAM,GAAG,WAAW,CAAC,WAEpG;AAED,uFAAuF;AACvF,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,CAAC,6BAA6B,EAAE;IAAE,MAAM,EAAE,kBAAkB,CAAA;CAAE,CAAC,EAC/E,MAAM,GAAE,IAAI,GAAG,IAAI,GAAG,IAAW;;;;;;;;;;;;;;;;;;IAsBlC;AAED,2DAA2D;AAC3D,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhF,uGAAuG;AACvG,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,OAAO,CAAC,6BAA6B,EAAE;IAAE,MAAM,EAAE,kBAAkB,CAAA;CAAE,CAAC,eAOhF;AAED;;;;;;;;;GASG;AACH,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAa5E;AAED,uGAAuG;AACvG,MAAM,MAAM,+BAA+B,GAAG,UAAU,CAAC,OAAO,oCAAoC,CAAC,CAAC,MAAM,CAAC,CAAC;AAW9G;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,EAC3B,OAAO,GAAE,WAAW,CAAC,MAAM,CAAa,WAczC;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,EAC3B,OAAO,GAAE,WAAW,CAAC,MAAM,CAAa,GACvC,OAAO,CAAC,0BAA0B,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,CAAC,CAc9D"}
|
package/dist/consent.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ANDCO_API_ORIGIN } from "./constants.js";
|
|
1
2
|
import { ANDCO_NATIVE_TEXT as t } from "./native-copy.js";
|
|
2
3
|
const SCOPE_LABELS = {
|
|
3
4
|
openid: "Identidad OpenID",
|
|
@@ -44,10 +45,67 @@ export function ANDCO_CONSENT_INITIAL_SCOPES(consent) {
|
|
|
44
45
|
.filter((scope) => scope.mode !== "optional" || scope.grantedAt !== null || scope.connectionHasPriorGrant)
|
|
45
46
|
.map((scope) => scope.scope));
|
|
46
47
|
}
|
|
47
|
-
/**
|
|
48
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Groups a consent by Resource Server, in the order of the request's `resource` parameters: each one
|
|
50
|
+
* with its own scopes and, for a third party asked for details, its live decision. OpenID Connect
|
|
51
|
+
* scopes come through the Andco API's policies but belong to the Identity Session, so the Andco API's
|
|
52
|
+
* group owns none of them; they stay in `consent.scopes` for the identity section.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* const groups = ANDCO_CONSENT_RESOURCE_SERVER_GROUPS(consent);
|
|
56
|
+
* groups.map((group) => group.server.resourceServerName); // ["Andco API", "Casa Norte Ecommerce"]
|
|
57
|
+
*/
|
|
58
|
+
export function ANDCO_CONSENT_RESOURCE_SERVER_GROUPS(consent) {
|
|
59
|
+
return [...consent.resourceServers]
|
|
60
|
+
.sort((left, right) => left.resourcePosition - right.resourcePosition)
|
|
61
|
+
.map((server) => ({
|
|
62
|
+
server,
|
|
63
|
+
scopes: server.resource === ANDCO_API_ORIGIN
|
|
64
|
+
? []
|
|
65
|
+
: consent.scopes.filter((scope) => scope.resourceServerId === server.resourceServerId),
|
|
66
|
+
resourceAuthorization: consent.resourceAuthorizations.find((authorization) => authorization.resourceServerId === server.resourceServerId),
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
/** The scopes owned by the Resource Servers left out, which the decision never submits. */
|
|
70
|
+
function OMITTED_SCOPES(consent, omitted) {
|
|
71
|
+
return new Set(ANDCO_CONSENT_RESOURCE_SERVER_GROUPS(consent)
|
|
72
|
+
.filter((group) => omitted.has(group.server.resourceServerId))
|
|
73
|
+
.flatMap((group) => group.scopes.map((scope) => scope.scope)));
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Whether the in-progress selection is complete enough to submit; the server still authorizes on
|
|
77
|
+
* submit. `omitted` holds the optional Resource Servers the person left out: their scopes stop
|
|
78
|
+
* counting and a refused decision of theirs stops blocking.
|
|
79
|
+
*/
|
|
80
|
+
export function ANDCO_CONSENT_CAN_SUBMIT(consent, scopes, omitted = new Set()) {
|
|
81
|
+
const droppedScopes = OMITTED_SCOPES(consent, omitted);
|
|
82
|
+
const kept = consent.resourceAuthorizations.filter((authorization) => !omitted.has(authorization.resourceServerId ?? ""));
|
|
49
83
|
return (!consent.organizationSelection &&
|
|
50
|
-
(scopes.
|
|
51
|
-
(
|
|
52
|
-
consent.scopes.every((scope) => scope.mode !== "required" || scopes.has(scope.scope)));
|
|
84
|
+
([...scopes].some((scope) => !droppedScopes.has(scope)) || kept.length > 0) &&
|
|
85
|
+
kept.every((authorization) => authorization.allowed) &&
|
|
86
|
+
consent.scopes.every((scope) => scope.mode !== "required" || droppedScopes.has(scope.scope) || scopes.has(scope.scope)));
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Builds the approval a native Host submits: the selected scopes without those of the Resource
|
|
90
|
+
* Servers left out, and the left-out ones by id. Throws when asked to leave out a Resource Server the
|
|
91
|
+
* consent does not name or one that is required; a surface only offers optional ones.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ANDCO_CONSENT_DECISION(consent, new Set(["openid", "email", "orders:read"]), new Set([casaNorteId]));
|
|
95
|
+
* // { decision: "approve", scopes: ["openid", "email"], omittedResourceServers: [casaNorteId] }
|
|
96
|
+
*/
|
|
97
|
+
export function ANDCO_CONSENT_DECISION(consent, scopes, omitted = new Set()) {
|
|
98
|
+
for (const resourceServerId of omitted) {
|
|
99
|
+
const server = consent.resourceServers.find((candidate) => candidate.resourceServerId === resourceServerId);
|
|
100
|
+
if (!server?.resourceServerOptional) {
|
|
101
|
+
throw new TypeError(`[ANDCO_CONSENT_DECISION] Resource Server ${resourceServerId} is required or not named`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const droppedScopes = OMITTED_SCOPES(consent, omitted);
|
|
105
|
+
console.debug("[ANDCO_CONSENT_DECISION] approving %s without %o", consent.authorizationId, [...omitted]);
|
|
106
|
+
return {
|
|
107
|
+
decision: "approve",
|
|
108
|
+
scopes: [...scopes].filter((scope) => !droppedScopes.has(scope)),
|
|
109
|
+
omittedResourceServers: [...omitted],
|
|
110
|
+
};
|
|
53
111
|
}
|
package/dist/errors.d.ts
CHANGED
|
@@ -114,6 +114,11 @@ export declare const ANDCO_ERROR_CODES: {
|
|
|
114
114
|
readonly INVALID_TOKEN_RESPONSE: "invalid_token_response";
|
|
115
115
|
/** An operation that needs a session ran without one. Actionable: send the person to authorize. */
|
|
116
116
|
readonly SESSION_MISSING: "session_missing";
|
|
117
|
+
/**
|
|
118
|
+
* The session holds no Resource Token for the requested Resource Indicator. Never answered with
|
|
119
|
+
* the Identity Session's token or another audience's: authorize that Resource Server first.
|
|
120
|
+
*/
|
|
121
|
+
readonly NO_TOKEN_FOR_RESOURCE: "no_token_for_resource";
|
|
117
122
|
/** Reading or writing the session store failed -- private browsing, or storage the browser denied. */
|
|
118
123
|
readonly STORAGE_FAILED: "storage_failed";
|
|
119
124
|
/**
|
|
@@ -123,8 +128,6 @@ export declare const ANDCO_ERROR_CODES: {
|
|
|
123
128
|
readonly CONFIDENTIAL_CLIENT_REQUIRED: "confidential_client_required";
|
|
124
129
|
/** The pushed authorization request (RFC 9126) answered without a usable `request_uri`. */
|
|
125
130
|
readonly INVALID_PAR_RESPONSE: "invalid_par_response";
|
|
126
|
-
/** The given Intent identifier is not a well-formed one. */
|
|
127
|
-
readonly INVALID_INTENT_ID: "invalid_intent_id";
|
|
128
131
|
/**
|
|
129
132
|
* An Intent watch was stopped, by `stop()` or its signal, before the Intent reached a terminal
|
|
130
133
|
* status. A decision of the caller, not a failure; the watch's `intent` still holds the last read.
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,iBAAiB;IAE5B,uGAAuG;;IAEvG,6EAA6E;;IAE7E,uGAAuG;;IAEvG,6DAA6D;;IAE7D,wFAAwF;;IAMxF,+GAA+G;;IAE/G,wEAAwE;;IAExE,6DAA6D;;IAE7D,0DAA0D;;IAE1D,iEAAiE;;IAEjE,wGAAwG;;IAExG,mEAAmE;;IAEnE,8EAA8E;;IAE9E,uEAAuE;;IAEvE,8DAA8D;;IAE9D,6EAA6E;;IAE7E,uGAAuG;;IAIvG;;;OAGG;;IAEH,yFAAyF;;IAEzF,+EAA+E;;IAE/E,mEAAmE;;IAEnE,qEAAqE;;IAErE,sGAAsG;;IAEtG,sFAAsF;;IAEtF;;;OAGG;;IAEH;;;;OAIG;;IAIH,sGAAsG;;IAEtG,qEAAqE;;IAErE,0EAA0E;;IAE1E,6DAA6D;;IAE7D,gEAAgE;;IAEhE,8EAA8E;;IAE9E,4FAA4F;;IAE5F,4DAA4D;;IAE5D,qGAAqG;;IAErG,wGAAwG;;IAExG,mGAAmG;;IAEnG,sGAAsG;;IAGtG;;;OAGG;;IAEH,2FAA2F;;IAI3F
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,iBAAiB;IAE5B,uGAAuG;;IAEvG,6EAA6E;;IAE7E,uGAAuG;;IAEvG,6DAA6D;;IAE7D,wFAAwF;;IAMxF,+GAA+G;;IAE/G,wEAAwE;;IAExE,6DAA6D;;IAE7D,0DAA0D;;IAE1D,iEAAiE;;IAEjE,wGAAwG;;IAExG,mEAAmE;;IAEnE,8EAA8E;;IAE9E,uEAAuE;;IAEvE,8DAA8D;;IAE9D,6EAA6E;;IAE7E,uGAAuG;;IAIvG;;;OAGG;;IAEH,yFAAyF;;IAEzF,+EAA+E;;IAE/E,mEAAmE;;IAEnE,qEAAqE;;IAErE,sGAAsG;;IAEtG,sFAAsF;;IAEtF;;;OAGG;;IAEH;;;;OAIG;;IAIH,sGAAsG;;IAEtG,qEAAqE;;IAErE,0EAA0E;;IAE1E,6DAA6D;;IAE7D,gEAAgE;;IAEhE,8EAA8E;;IAE9E,4FAA4F;;IAE5F,4DAA4D;;IAE5D,qGAAqG;;IAErG,wGAAwG;;IAExG,mGAAmG;;IAEnG;;;OAGG;;IAEH,sGAAsG;;IAGtG;;;OAGG;;IAEH,2FAA2F;;IAI3F;;;OAGG;;IAEH;;;;OAIG;;IAEH,yDAAyD;;IAIzD,qGAAqG;;CAE7F,CAAC;AAEX,6DAA6D;AAC7D,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAExF;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,2UAgB3B,CAAC;AAEX,gEAAgE;AAChE,qBAAa,eAAgB,SAAQ,KAAK;gBACrB,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;IAM3D,+DAA+D;WACjD,EAAE,CAAC,CAAC,SAAS,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,KAAK,IAAI,CAAC;CAG/G;AAED,oEAAoE;AACpE,qBAAa,aAAc,SAAQ,eAAe;IAChD,SAAgB,IAAI,EAAE,cAAc,CAAC;IACrC,SAAgB,OAAO,EAAE,OAAO,CAAC;gBAEd,IAAI,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,YAAY;CAKnF"}
|
package/dist/errors.js
CHANGED
|
@@ -120,6 +120,11 @@ export const ANDCO_ERROR_CODES = {
|
|
|
120
120
|
INVALID_TOKEN_RESPONSE: "invalid_token_response",
|
|
121
121
|
/** An operation that needs a session ran without one. Actionable: send the person to authorize. */
|
|
122
122
|
SESSION_MISSING: "session_missing",
|
|
123
|
+
/**
|
|
124
|
+
* The session holds no Resource Token for the requested Resource Indicator. Never answered with
|
|
125
|
+
* the Identity Session's token or another audience's: authorize that Resource Server first.
|
|
126
|
+
*/
|
|
127
|
+
NO_TOKEN_FOR_RESOURCE: "no_token_for_resource",
|
|
123
128
|
/** Reading or writing the session store failed -- private browsing, or storage the browser denied. */
|
|
124
129
|
STORAGE_FAILED: "storage_failed",
|
|
125
130
|
/**
|
|
@@ -130,8 +135,6 @@ export const ANDCO_ERROR_CODES = {
|
|
|
130
135
|
/** The pushed authorization request (RFC 9126) answered without a usable `request_uri`. */
|
|
131
136
|
INVALID_PAR_RESPONSE: "invalid_par_response",
|
|
132
137
|
// -- Operations ------------------------------------------------------------------------------
|
|
133
|
-
/** The given Intent identifier is not a well-formed one. */
|
|
134
|
-
INVALID_INTENT_ID: "invalid_intent_id",
|
|
135
138
|
/**
|
|
136
139
|
* An Intent watch was stopped, by `stop()` or its signal, before the Intent reached a terminal
|
|
137
140
|
* status. A decision of the caller, not a failure; the watch's `intent` still holds the last read.
|