@andco/protocol 0.0.14 → 0.1.0-ti.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/README.md +2 -2
- package/dist/api-errors.d.ts +9 -9
- package/dist/api-errors.js +9 -9
- package/dist/authorization-preparation.d.ts +1 -1
- package/dist/authorization-preparation.js +2 -2
- package/dist/authorization.d.ts +1 -1
- package/dist/authorization.js +1 -1
- package/dist/consent.d.ts +2 -2
- package/dist/consent.js +2 -2
- package/dist/errors.d.ts +10 -10
- package/dist/errors.js +10 -10
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/intent-input.d.ts +452 -880
- package/dist/intent-input.d.ts.map +1 -1
- package/dist/intent-input.js +164 -127
- package/dist/intent-status.d.ts +5 -6
- package/dist/intent-status.d.ts.map +1 -1
- package/dist/intent-status.js +12 -7
- package/dist/miniapp-manifest.d.ts +3 -3
- package/dist/miniapp-manifest.js +1 -1
- package/dist/native-intent.d.ts +82 -68
- package/dist/native-intent.d.ts.map +1 -1
- package/dist/native-intent.js +137 -84
- package/dist/native.d.ts +1 -1
- package/dist/rar/account-matchers.d.ts +35 -30
- package/dist/rar/account-matchers.d.ts.map +1 -1
- package/dist/rar/account-matchers.js +27 -21
- package/dist/rar/bank.d.ts +357 -85
- package/dist/rar/bank.d.ts.map +1 -1
- package/dist/rar/bank.js +43 -5
- package/dist/rar/catalog.d.ts +174 -49
- package/dist/rar/catalog.d.ts.map +1 -1
- package/dist/rar/catalog.js +6 -6
- package/dist/rar/detail.d.ts +1 -1
- package/dist/rar/detail.js +1 -1
- package/dist/rar/json-schemas.generated.d.ts +1 -1
- package/dist/rar/json-schemas.generated.d.ts.map +1 -1
- package/dist/rar/json-schemas.generated.js +393 -21
- package/dist/rar/money.d.ts +1 -1
- package/dist/rar/money.js +1 -1
- package/dist/rar/subject-data.d.ts +1 -1
- package/dist/rar/subject-data.js +1 -1
- package/dist/rar/subject.d.ts +1 -1
- package/dist/rar/subject.js +1 -1
- package/dist/rest/accounts.d.ts +28 -28
- package/dist/rest/accounts.d.ts.map +1 -1
- package/dist/rest/accounts.js +22 -22
- package/dist/rest/api-error.d.ts +1 -1
- package/dist/rest/api-error.js +1 -1
- package/dist/rest/catalog.d.ts +3 -3
- package/dist/rest/catalog.js +2 -2
- package/dist/rest/common.d.ts +3 -3
- package/dist/rest/common.js +3 -3
- package/dist/rest/contract.d.ts +1183 -547
- package/dist/rest/contract.d.ts.map +1 -1
- package/dist/rest/contract.js +21 -5
- package/dist/rest/events.d.ts +1 -1
- package/dist/rest/events.d.ts.map +1 -1
- package/dist/rest/events.js +2 -2
- package/dist/rest/identity.d.ts +22 -22
- package/dist/rest/identity.d.ts.map +1 -1
- package/dist/rest/identity.js +5 -5
- package/dist/rest/index.d.ts +1 -0
- package/dist/rest/index.d.ts.map +1 -1
- package/dist/rest/index.js +1 -0
- package/dist/rest/intents.d.ts +973 -743
- package/dist/rest/intents.d.ts.map +1 -1
- package/dist/rest/intents.js +112 -89
- package/dist/rest/signatures.d.ts +25 -5
- package/dist/rest/signatures.d.ts.map +1 -1
- package/dist/rest/signatures.js +52 -0
- package/dist/rest/transfers.d.ts +988 -0
- package/dist/rest/transfers.d.ts.map +1 -0
- package/dist/rest/transfers.js +142 -0
- package/dist/scopes.d.ts +1 -1
- package/dist/signing.d.ts +17 -3
- package/dist/signing.d.ts.map +1 -1
- package/dist/signing.js +8 -1
- package/dist/transfer.d.ts +399 -0
- package/dist/transfer.d.ts.map +1 -0
- package/dist/transfer.js +313 -0
- package/dist/transport/financial-events.d.ts +82 -27
- package/dist/transport/financial-events.d.ts.map +1 -1
- package/dist/transport/financial-events.js +34 -0
- package/dist/transport/generated/oauth-api.d.ts +1420 -333
- package/dist/transport/generated/oauth-api.d.ts.map +1 -1
- package/dist/transport/intents.d.ts +29 -13
- package/dist/transport/intents.d.ts.map +1 -1
- package/dist/transport/intents.js +1 -1
- package/dist/transport/rest.d.ts +5 -5
- package/dist/urls.d.ts +2 -2
- package/dist/urls.js +3 -3
- package/dist/userinfo.d.ts +2 -2
- package/dist/userinfo.js +2 -2
- package/dist/webhooks.d.ts +16 -16
- package/dist/webhooks.js +14 -14
- package/dist/window-features.d.ts +2 -2
- package/dist/window-features.js +2 -2
- package/package.json +2 -2
|
@@ -2,6 +2,12 @@ import * as v from "valibot";
|
|
|
2
2
|
import { InvalidOrigin, InvalidToken, PayloadTooLarge, ServerError, TemporarilyUnavailable, UnsupportedMediaType, UnsupportedVersion } from "./common.js";
|
|
3
3
|
/** The media type a Signed Instruction travels as: one compact JWS, as text. */
|
|
4
4
|
export declare const SIGNED_INSTRUCTION_MEDIA_TYPE = "application/jwt";
|
|
5
|
+
/**
|
|
6
|
+
* The media type a signed transfer travels as: a JWS in the General JSON Serialization (RFC 7515
|
|
7
|
+
* §7.2.1), the `SignedTransferEnvelope` itself. `POST /transfers` takes it, and so does `POST /intents`
|
|
8
|
+
* for a signed transfer with `approved: false`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const SIGNED_TRANSFER_MEDIA_TYPE = "application/jose+json";
|
|
5
11
|
/**
|
|
6
12
|
* A Signed Instruction as the body of a request: the compact JWS, as text. The schema reads any
|
|
7
13
|
* string, and the pattern is only documented, because an assertion that is not a compact JWS is
|
|
@@ -22,22 +28,36 @@ export declare function signedInstructionBody(description: string, claims?: Reco
|
|
|
22
28
|
* `contentMediaType` as a file, and then writes the JSON branches inline instead of by reference.
|
|
23
29
|
*/
|
|
24
30
|
export declare function servedAsSignedInstruction(operation: Record<string, unknown>): Record<string, unknown>;
|
|
31
|
+
/**
|
|
32
|
+
* Like {@link servedAsSignedInstruction}, for an operation whose body also takes a signed transfer:
|
|
33
|
+
* the branch that is the `SignedTransferEnvelope` moves to `application/jose+json`, the compact JWS
|
|
34
|
+
* string moves to `application/jwt`, and the JSON proposals stay in `application/json`. It is the
|
|
35
|
+
* `spec` of `POST /intents`.
|
|
36
|
+
*/
|
|
37
|
+
export declare function servedAsSignedInstructionOrTransfer(operation: Record<string, unknown>): Record<string, unknown>;
|
|
25
38
|
/**
|
|
26
39
|
* Why a Signed Instruction did not verify. Every refusal names one cause, so an integrator can tell a
|
|
27
40
|
* `kid` that was never registered from one that was revoked, a clock that ran out from an audience
|
|
28
41
|
* that was wrong, and any of those from a payload altered in flight.
|
|
42
|
+
*
|
|
43
|
+
* Four causes belong to a signed transfer (`POST /transfers`, and `POST /intents` with `approved: false`):
|
|
44
|
+
* `missing_signature`, an envelope whose `signatures` is empty; `unsynced_key`, a key AndCo does not
|
|
45
|
+
* accept yet for a signed transfer; `unusable_key`, a key that is registered but that AndCo could not
|
|
46
|
+
* load to check this signature (its person registers a new key and revokes this one, then you sign
|
|
47
|
+
* again); and `expiration_too_soon`, the `exp` of a new `jti` less than 15 minutes after the submission
|
|
48
|
+
* (a repeat of a stored transfer is never refused for it).
|
|
29
49
|
*/
|
|
30
|
-
export declare const SignedInstructionRejectionReason: v.PicklistSchema<["malformed_assertion", "missing_key_id", "disallowed_algorithm", "unknown_key", "revoked_key", "unusable_key", "invalid_signature", "expired_assertion", "premature_assertion", "missing_expiration", "missing_instruction_id", "missing_claim", "wrong_audience", "wrong_issuer", "verification_failed"], undefined>;
|
|
50
|
+
export declare const SignedInstructionRejectionReason: v.PicklistSchema<["malformed_assertion", "missing_signature", "missing_key_id", "disallowed_algorithm", "unknown_key", "revoked_key", "expired_key", "unusable_key", "unsynced_key", "invalid_signature", "expired_assertion", "premature_assertion", "missing_expiration", "expiration_too_soon", "missing_instruction_id", "missing_claim", "wrong_audience", "wrong_issuer", "verification_failed"], undefined>;
|
|
31
51
|
/** Why a Signed Instruction did not verify. */
|
|
32
52
|
export type SignedInstructionRejectionReason = v.InferOutput<typeof SignedInstructionRejectionReason>;
|
|
33
53
|
declare const UnverifiedSignedInstruction_base: (abstract new (data: {
|
|
34
|
-
reason: "malformed_assertion" | "missing_key_id" | "disallowed_algorithm" | "unknown_key" | "revoked_key" | "unusable_key" | "invalid_signature" | "expired_assertion" | "premature_assertion" | "missing_expiration" | "missing_instruction_id" | "missing_claim" | "wrong_audience" | "wrong_issuer" | "verification_failed";
|
|
54
|
+
reason: "malformed_assertion" | "missing_signature" | "missing_key_id" | "disallowed_algorithm" | "unknown_key" | "revoked_key" | "expired_key" | "unusable_key" | "unsynced_key" | "invalid_signature" | "expired_assertion" | "premature_assertion" | "missing_expiration" | "expiration_too_soon" | "missing_instruction_id" | "missing_claim" | "wrong_audience" | "wrong_issuer" | "verification_failed";
|
|
35
55
|
key_id: string | null;
|
|
36
56
|
}, message?: string, hint?: string) => {
|
|
37
57
|
readonly error: "unverified_signed_instruction";
|
|
38
58
|
readonly hint?: string;
|
|
39
59
|
readonly data: {
|
|
40
|
-
reason: "malformed_assertion" | "missing_key_id" | "disallowed_algorithm" | "unknown_key" | "revoked_key" | "unusable_key" | "invalid_signature" | "expired_assertion" | "premature_assertion" | "missing_expiration" | "missing_instruction_id" | "missing_claim" | "wrong_audience" | "wrong_issuer" | "verification_failed";
|
|
60
|
+
reason: "malformed_assertion" | "missing_signature" | "missing_key_id" | "disallowed_algorithm" | "unknown_key" | "revoked_key" | "expired_key" | "unusable_key" | "unsynced_key" | "invalid_signature" | "expired_assertion" | "premature_assertion" | "missing_expiration" | "expiration_too_soon" | "missing_instruction_id" | "missing_claim" | "wrong_audience" | "wrong_issuer" | "verification_failed";
|
|
41
61
|
key_id: string | null;
|
|
42
62
|
};
|
|
43
63
|
name: string;
|
|
@@ -48,10 +68,10 @@ declare const UnverifiedSignedInstruction_base: (abstract new (data: {
|
|
|
48
68
|
readonly error: "unverified_signed_instruction";
|
|
49
69
|
readonly status: 422;
|
|
50
70
|
readonly data: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
51
|
-
readonly reason: v.SchemaWithPipe<readonly [v.PicklistSchema<["malformed_assertion", "missing_key_id", "disallowed_algorithm", "unknown_key", "revoked_key", "unusable_key", "invalid_signature", "expired_assertion", "premature_assertion", "missing_expiration", "missing_instruction_id", "missing_claim", "wrong_audience", "wrong_issuer", "verification_failed"], undefined>, v.DescriptionAction<"malformed_assertion" | "missing_key_id" | "disallowed_algorithm" | "unknown_key" | "revoked_key" | "unusable_key" | "invalid_signature" | "expired_assertion" | "premature_assertion" | "missing_expiration" | "missing_instruction_id" | "missing_claim" | "wrong_audience" | "wrong_issuer" | "verification_failed", "The one cause, never a generic failure.">]>;
|
|
71
|
+
readonly reason: v.SchemaWithPipe<readonly [v.PicklistSchema<["malformed_assertion", "missing_signature", "missing_key_id", "disallowed_algorithm", "unknown_key", "revoked_key", "expired_key", "unusable_key", "unsynced_key", "invalid_signature", "expired_assertion", "premature_assertion", "missing_expiration", "expiration_too_soon", "missing_instruction_id", "missing_claim", "wrong_audience", "wrong_issuer", "verification_failed"], undefined>, v.DescriptionAction<"malformed_assertion" | "missing_signature" | "missing_key_id" | "disallowed_algorithm" | "unknown_key" | "revoked_key" | "expired_key" | "unusable_key" | "unsynced_key" | "invalid_signature" | "expired_assertion" | "premature_assertion" | "missing_expiration" | "expiration_too_soon" | "missing_instruction_id" | "missing_claim" | "wrong_audience" | "wrong_issuer" | "verification_failed", "The one cause, never a generic failure.">]>;
|
|
52
72
|
readonly key_id: v.SchemaWithPipe<readonly [v.NullableSchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string | null, "The `kid` the assertion declared, when one could be read from it.">]>;
|
|
53
73
|
}, undefined>, v.DescriptionAction<{
|
|
54
|
-
reason: "malformed_assertion" | "missing_key_id" | "disallowed_algorithm" | "unknown_key" | "revoked_key" | "unusable_key" | "invalid_signature" | "expired_assertion" | "premature_assertion" | "missing_expiration" | "missing_instruction_id" | "missing_claim" | "wrong_audience" | "wrong_issuer" | "verification_failed";
|
|
74
|
+
reason: "malformed_assertion" | "missing_signature" | "missing_key_id" | "disallowed_algorithm" | "unknown_key" | "revoked_key" | "expired_key" | "unusable_key" | "unsynced_key" | "invalid_signature" | "expired_assertion" | "premature_assertion" | "missing_expiration" | "expiration_too_soon" | "missing_instruction_id" | "missing_claim" | "wrong_audience" | "wrong_issuer" | "verification_failed";
|
|
55
75
|
key_id: string | null;
|
|
56
76
|
}, "The assertion did not verify against the OAuth Client's registered Signing Keys.">]>;
|
|
57
77
|
define<const Code extends string, const Status extends number, Data extends import("./api-error.js").AndcoAPIErrorDataSchema>(error: Code, status: Status, data: Data): (abstract new (data: v.InferOutput<Data>, message?: string, hint?: string) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signatures.d.ts","sourceRoot":"","sources":["../../src/rest/signatures.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EACL,aAAa,EACb,YAAY,EACZ,eAAe,EACf,WAAW,EACX,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAGrB,gFAAgF;AAChF,eAAO,MAAM,6BAA6B,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"signatures.d.ts","sourceRoot":"","sources":["../../src/rest/signatures.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EACL,aAAa,EACb,YAAY,EACZ,eAAe,EACf,WAAW,EACX,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAGrB,gFAAgF;AAChF,eAAO,MAAM,6BAA6B,oBAAoB,CAAC;AAE/D;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,0BAA0B,CAAC;AAKlE;;;;;;;;GAQG;AAEH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,kJAM1F;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsBrG;AAKD;;;;;GAKG;AACH,wBAAgB,mCAAmC,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA0B/G;AAQD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gCAAgC,oZAoB3C,CAAC;AAEH,+CAA+C;AAC/C,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,gCAAgC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtG;;;;GAIG;AACH,qBAAa,2BAA4B,SAAQ,eAAe,CAAC,gCAahE;gBACa,IAAI,EAAE;QAAE,MAAM,EAAE,gCAAgC,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,EAAE,OAAO,CAAC,EAAE,MAAM;CAGxG;AAED,wEAAwE;AACxE,eAAO,MAAM,6BAA6B;;;;;;;;;;mWAYzC,CAAC;AAEF,wEAAwE;AACxE,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEhG,sGAAsG;AACtG,eAAO,MAAM,eAAe;;;;;;;;;;4mBAyBY,CAAC"}
|
package/dist/rest/signatures.js
CHANGED
|
@@ -5,6 +5,12 @@ import { InvalidOrigin, InvalidToken, PayloadTooLarge, ServerError, TemporarilyU
|
|
|
5
5
|
import { http } from "./http.js";
|
|
6
6
|
/** The media type a Signed Instruction travels as: one compact JWS, as text. */
|
|
7
7
|
export const SIGNED_INSTRUCTION_MEDIA_TYPE = "application/jwt";
|
|
8
|
+
/**
|
|
9
|
+
* The media type a signed transfer travels as: a JWS in the General JSON Serialization (RFC 7515
|
|
10
|
+
* §7.2.1), the `SignedTransferEnvelope` itself. `POST /transfers` takes it, and so does `POST /intents`
|
|
11
|
+
* for a signed transfer with `approved: false`.
|
|
12
|
+
*/
|
|
13
|
+
export const SIGNED_TRANSFER_MEDIA_TYPE = "application/jose+json";
|
|
8
14
|
/** What a compact JWS looks like: three base64url segments separated by dots. */
|
|
9
15
|
const COMPACT_JWS_PATTERN = "^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$";
|
|
10
16
|
/**
|
|
@@ -57,22 +63,68 @@ export function servedAsSignedInstruction(operation) {
|
|
|
57
63
|
};
|
|
58
64
|
return { ...operation, requestBody: { ...requestBody, content } };
|
|
59
65
|
}
|
|
66
|
+
/** The reference that the OpenAPI document gives the signed transfer envelope. */
|
|
67
|
+
const SIGNED_TRANSFER_ENVELOPE_REF = "#/components/schemas/SignedTransferEnvelope";
|
|
68
|
+
/**
|
|
69
|
+
* Like {@link servedAsSignedInstruction}, for an operation whose body also takes a signed transfer:
|
|
70
|
+
* the branch that is the `SignedTransferEnvelope` moves to `application/jose+json`, the compact JWS
|
|
71
|
+
* string moves to `application/jwt`, and the JSON proposals stay in `application/json`. It is the
|
|
72
|
+
* `spec` of `POST /intents`.
|
|
73
|
+
*/
|
|
74
|
+
export function servedAsSignedInstructionOrTransfer(operation) {
|
|
75
|
+
const requestBody = operation["requestBody"];
|
|
76
|
+
const schema = requestBody?.content?.["application/json"]?.schema;
|
|
77
|
+
if (requestBody?.content === undefined || schema === undefined) {
|
|
78
|
+
throw new Error("The operation has no body to serve as a Signed Instruction.");
|
|
79
|
+
}
|
|
80
|
+
const branches = schema.anyOf ?? [schema];
|
|
81
|
+
const envelopes = branches.filter((branch) => branch["$ref"] === SIGNED_TRANSFER_ENVELOPE_REF);
|
|
82
|
+
if (envelopes.length !== 1) {
|
|
83
|
+
throw new Error("The body of the operation declares no signed transfer.");
|
|
84
|
+
}
|
|
85
|
+
const rest = branches.filter((branch) => branch["$ref"] !== SIGNED_TRANSFER_ENVELOPE_REF);
|
|
86
|
+
const served = servedAsSignedInstruction({
|
|
87
|
+
...operation,
|
|
88
|
+
requestBody: {
|
|
89
|
+
...requestBody,
|
|
90
|
+
content: { "application/json": { schema: rest.length === 1 ? rest[0] : { anyOf: rest } } },
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
return {
|
|
94
|
+
...served,
|
|
95
|
+
requestBody: {
|
|
96
|
+
...served.requestBody,
|
|
97
|
+
content: { ...served.requestBody.content, [SIGNED_TRANSFER_MEDIA_TYPE]: { schema: envelopes[0] } },
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
60
101
|
/**
|
|
61
102
|
* Why a Signed Instruction did not verify. Every refusal names one cause, so an integrator can tell a
|
|
62
103
|
* `kid` that was never registered from one that was revoked, a clock that ran out from an audience
|
|
63
104
|
* that was wrong, and any of those from a payload altered in flight.
|
|
105
|
+
*
|
|
106
|
+
* Four causes belong to a signed transfer (`POST /transfers`, and `POST /intents` with `approved: false`):
|
|
107
|
+
* `missing_signature`, an envelope whose `signatures` is empty; `unsynced_key`, a key AndCo does not
|
|
108
|
+
* accept yet for a signed transfer; `unusable_key`, a key that is registered but that AndCo could not
|
|
109
|
+
* load to check this signature (its person registers a new key and revokes this one, then you sign
|
|
110
|
+
* again); and `expiration_too_soon`, the `exp` of a new `jti` less than 15 minutes after the submission
|
|
111
|
+
* (a repeat of a stored transfer is never refused for it).
|
|
64
112
|
*/
|
|
65
113
|
export const SignedInstructionRejectionReason = /* @__PURE__ */ v.picklist([
|
|
66
114
|
"malformed_assertion",
|
|
115
|
+
"missing_signature",
|
|
67
116
|
"missing_key_id",
|
|
68
117
|
"disallowed_algorithm",
|
|
69
118
|
"unknown_key",
|
|
70
119
|
"revoked_key",
|
|
120
|
+
"expired_key",
|
|
71
121
|
"unusable_key",
|
|
122
|
+
"unsynced_key",
|
|
72
123
|
"invalid_signature",
|
|
73
124
|
"expired_assertion",
|
|
74
125
|
"premature_assertion",
|
|
75
126
|
"missing_expiration",
|
|
127
|
+
"expiration_too_soon",
|
|
76
128
|
"missing_instruction_id",
|
|
77
129
|
"missing_claim",
|
|
78
130
|
"wrong_audience",
|