@e-sig/uaid-exch 0.1.0-preview.0 → 0.1.0-preview.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +74 -0
- package/dist/index.d.ts +54 -24
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -1
- package/dist/revocation.d.ts +103 -0
- package/dist/revocation.d.ts.map +1 -0
- package/dist/revocation.js +213 -0
- package/dist/revocation.js.map +1 -0
- package/dist/verify.d.ts +115 -0
- package/dist/verify.d.ts.map +1 -0
- package/dist/verify.js +358 -0
- package/dist/verify.js.map +1 -0
- package/package.json +7 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 VMVTech, Ltd.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -82,6 +82,80 @@ Per [UAP-EXCH-1 § 4](https://github.com/uuaid/spec/blob/main/docs/profiles/UAP-
|
|
|
82
82
|
|
|
83
83
|
Counterparties enforce a minimum level; this SDK renders it into the Signing Credential and Exchange so verification is one JSON check.
|
|
84
84
|
|
|
85
|
+
## Revocation
|
|
86
|
+
|
|
87
|
+
Status-list style revocation for Signing Credentials (UAP-EXCH-1 § 9, draft). An issuer publishes an append-only `RevocationList` — `{ id, issuer, issued, revoked: [{ credentialId, revokedAt, reason? }], digest }` — whose `digest` is `sha256:<hex>` over the JCS (RFC 8785) canonicalization of the list body. Any mutation (removing an entry, backdating, issuer swap) fails integrity verification, and verifiers **fail closed**: a list that doesn't verify blocks the credential rather than silently allowing it.
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
import {
|
|
91
|
+
createRevocationList,
|
|
92
|
+
revokeCredential,
|
|
93
|
+
isRevoked,
|
|
94
|
+
verifyRevocationListIntegrity,
|
|
95
|
+
assertCredentialUsable,
|
|
96
|
+
CredentialRevokedError,
|
|
97
|
+
CredentialExpiredError,
|
|
98
|
+
} from "@e-sig/uaid-exch";
|
|
99
|
+
|
|
100
|
+
// Issuer side: cut a list, revoke a credential. Every call returns a NEW,
|
|
101
|
+
// re-digested list — the input is never mutated, and double-revoking the
|
|
102
|
+
// same id is idempotent.
|
|
103
|
+
let list = await createRevocationList({ issuer: certifierUuaid });
|
|
104
|
+
list = await revokeCredential(list, signingCredentialId, "key compromise");
|
|
105
|
+
|
|
106
|
+
// Verifier side: gate every use of a Signing Credential.
|
|
107
|
+
await isRevoked(list, signingCredentialId); // → true; THROWS
|
|
108
|
+
// RevocationListIntegrityError on a tampered list (fail-closed — a lookup
|
|
109
|
+
// against an unverified list could be silently un-revoked by an attacker)
|
|
110
|
+
await verifyRevocationListIntegrity(list); // → true (false on ANY tamper)
|
|
111
|
+
|
|
112
|
+
try {
|
|
113
|
+
await assertCredentialUsable(signingCredential, list); // checks validFrom,
|
|
114
|
+
// validUntil (malformed dates fail closed), AND the revocation list —
|
|
115
|
+
// throws typed errors: CredentialExpiredError | CredentialNotYetValidError |
|
|
116
|
+
// CredentialMalformedValidityError | CredentialRevokedError |
|
|
117
|
+
// RevocationListIntegrityError
|
|
118
|
+
} catch (e) {
|
|
119
|
+
if (e instanceof CredentialRevokedError) console.error(e.entry.reason);
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Note:** this module has no revocation-check path to hook into (revocation is network-side per § 8), so `assertCredentialUsable()` is exported standalone — call it before acting on a credential, i.e. before `createExchange()` / `UaidNetworkClient.submit()`. Verifying the proofs *themselves* — no revocation check involved — is covered below.
|
|
124
|
+
|
|
125
|
+
## Verifying proofs locally
|
|
126
|
+
|
|
127
|
+
Every `DataIntegrityProof` this package produces (both proofs on a `UaidExchange`, or a standalone challenge proof per § 12 of the [MCP signer-identity design](../../docs/architecture/esig-mcp.md)) can be verified **offline, with no network call**, against a `did:key` or JWK public key.
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
import { createExchange, verifyExchange, verifyDataIntegrityProof } from "@e-sig/uaid-exch";
|
|
131
|
+
|
|
132
|
+
const exchange = await createExchange(input, agentSigner, issuerSigner);
|
|
133
|
+
|
|
134
|
+
// Verifies both proofs — proof[0] (agent, "authentication") and proof[1]
|
|
135
|
+
// (issuer, "assertionMethod") — resolving each key from its own
|
|
136
|
+
// verificationMethod (a did:key URI) unless you pass one explicitly.
|
|
137
|
+
const result = verifyExchange(exchange);
|
|
138
|
+
// { ok: true, agent: { ok: true, keyFingerprint, verificationMethod },
|
|
139
|
+
// issuer: { ok: true, keyFingerprint, verificationMethod }, failures: [] }
|
|
140
|
+
|
|
141
|
+
if (!result.ok) console.error(result.failures); // e.g. ["agent: signature verification failed"]
|
|
142
|
+
|
|
143
|
+
// Or verify a single arbitrary DataIntegrityProof over any JCS-canonicalizable
|
|
144
|
+
// document (the primitive verifyExchange is built on):
|
|
145
|
+
verifyDataIntegrityProof(documentWithoutProofField, someProof, {
|
|
146
|
+
expectedProofPurpose: "authentication", // optional
|
|
147
|
+
publicKey: rawEd25519PublicKeyBytes, // optional — skips verificationMethod resolution
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Key resolution (`publicKeyFromVerificationMethod`) accepts a `did:key:z...` URI (multibase `z` = base58btc, multicodec `0xed 0x01` + 32 raw Ed25519 bytes) or a raw JWK (`{kty:"OKP", crv:"Ed25519", x}` — **exactly** those three fields; any other field, notably a private-key `d`, is rejected outright) — anything else throws `UnsupportedVerificationMethodError`. `decodeMultibase`/`encodeMultibase` (`z` = base58btc, `u` = base64url) are exported standalone too.
|
|
152
|
+
|
|
153
|
+
**R6 — `uuaid:...#sk-...` verification methods are NOT independently verifiable.** `AgentSigner.verificationMethod` is documented (and used throughout this package's own tests) as a `uuaid:foundation:agent:<uuid>#sk-<label>` fragment identifier, e.g. `uuaid:foundation:agent:018f7abc#sk-2026-07-04` — this is an IDENTIFIER, not a key-encoding scheme `publicKeyFromVerificationMethod` can decode (it only understands `did:key:` URIs and raw JWKs). `verifyExchange(exchange)` called with **no options** will therefore report `agent.ok: false` (a `reason` string sourced from the internal `UnsupportedVerificationMethodError` — `verifyDataIntegrityProof`/`verifyExchange` never throw, per their own doc comments; they catch it and return `{ok:false, reason}`) for any exchange whose agent proof uses this form — that is not a bug, it is this package correctly refusing to invent a resolution for an identifier scheme it cannot cryptographically dereference. To verify such an exchange you MUST already know the agent's public key out-of-band (e.g. from a prior UUAID registry resolution) and pass it explicitly: `verifyExchange(exchange, { agentPublicKey: rawEd25519Bytes })` (same for `issuerPublicKey`). Do not treat a bare `verifyExchange(exchange)` call as sufficient proof when either `verificationMethod` uses the `uuaid:...#sk-...` form.
|
|
154
|
+
|
|
155
|
+
**Signed-bytes note:** verification mirrors `createExchange()`'s actual construction — Ed25519 over `jcsBytes(document-with-proof-omitted)` directly — not the W3C `eddsa-jcs-2022` cryptosuite's `sha256(JCS(proofConfig)) || sha256(JCS(document))` double-hash. See the `src/verify.ts` module doc comment for the full divergence note.
|
|
156
|
+
|
|
157
|
+
**R5 — what a proof's digest does and does not cover.** A `DataIntegrityProof`'s `created`, `verificationMethod`, and `proofPurpose` fields sit OUTSIDE the signed bytes by construction (the divergence note above: `createExchange()` signs only the document, with the whole `proof` object — including these fields — omitted). Consequently, anywhere a consumer (e.g. `@e-sig/mcp`'s signer-identity feature) computes a digest over the *entire presented proof object* (`sha256(jcs(proof))`) as an integrity/audit reference, that digest covers those mutable-by-construction fields too, not just the cryptographically-bound core — two proofs with the identical `proofValue`/signed content but a different `created` timestamp produce two different digests. Treat such a digest as "the digest of the artifact as presented," not as "the digest of what was cryptographically signed."
|
|
158
|
+
|
|
85
159
|
## Strictly opt-in
|
|
86
160
|
|
|
87
161
|
Absent `UUAID_API_KEY`, the package is a pure library — no network calls. `UaidNetworkClient.submit()` throws early rather than dropping data into a silent no-op. Reads (`get`, `getReceipt`) are unauthenticated per the spec.
|
package/dist/index.d.ts
CHANGED
|
@@ -7,44 +7,74 @@
|
|
|
7
7
|
*
|
|
8
8
|
* See docs/profiles/UAP-EXCH-1/v0.1.md in the uuaid repo for the normative
|
|
9
9
|
* profile. This module implements the § 5 (Signing Credential), § 6 (Exchange),
|
|
10
|
-
* and § 7 (Receipt) shapes plus the § 8 submission API.
|
|
10
|
+
* and § 7 (Receipt) shapes plus the § 8 submission API. § 9 (Revocation,
|
|
11
|
+
* draft) lives in ./revocation.ts and is re-exported below.
|
|
11
12
|
*/
|
|
13
|
+
export * from "./revocation.js";
|
|
14
|
+
export * from "./verify.js";
|
|
12
15
|
export type AssuranceLevel = "L0" | "L1" | "L2" | "L3" | "L4" | "L5";
|
|
16
|
+
/**
|
|
17
|
+
* IAASO tae/v1 Signing Credential (ADR-006). Reconciled field-for-field
|
|
18
|
+
* against the authoritative schema —
|
|
19
|
+
* `/Volumes/X/VMV/iaaso/artifacts/schemas/tae/v1/signing-credential/schema.json`
|
|
20
|
+
* — under RedTeam rt-verdict-ESIGMCP-V02-IDENTITY-20260827 (G1a). The prior
|
|
21
|
+
* shape here (`type: ["VerifiableCredential","UaidSigningCredential"]`, a
|
|
22
|
+
* root `@context`, and a `credentialSubject` carrying `id`/`principal`/ a
|
|
23
|
+
* nested authenticator key field (not `credentialSubject.key.publicKey`)/
|
|
24
|
+
* `assurance_evidence`/`kya_hash`) was never
|
|
25
|
+
* checked against the real schema and does not match it — see CHANGELOG for
|
|
26
|
+
* the full before/after diff. Both the schema root and its
|
|
27
|
+
* `credentialSubject`/`scope`/`key` objects are `additionalProperties:
|
|
28
|
+
* false`, so this type carries EXACTLY the fields the schema allows, no
|
|
29
|
+
* more:
|
|
30
|
+
* - root: dropped `@context` (not a schema property at all); added the
|
|
31
|
+
* required `schemaVersion`, `issuedAt`, `subjectRef`; `type` narrowed
|
|
32
|
+
* from a two-element VC tuple to the schema's `const
|
|
33
|
+
* "IAASOSigningCredential"`.
|
|
34
|
+
* - `credentialSubject`: dropped `id`, `principal`, the nested
|
|
35
|
+
* authenticator key field, `assurance_evidence`, `kya_hash` (none
|
|
36
|
+
* exist in the schema); kept `assurance_level`; `scope` renamed/aligned
|
|
37
|
+
* to the schema's own field names (`counterparties` not
|
|
38
|
+
* `counterparty_allowlist`, `geography` not `geographies`, no
|
|
39
|
+
* `resource_pattern`/`assurance_min`); added the schema's real key
|
|
40
|
+
* object, `key: {keyId, publicKey}` (schema.json:80-89) — THIS is the
|
|
41
|
+
* field RedTeam G1 is about: the drifted authenticator key field
|
|
42
|
+
* named a field that does not exist in the schema at all, and the
|
|
43
|
+
* correct field is `credentialSubject.key.publicKey`.
|
|
44
|
+
*
|
|
45
|
+
* `proof` and `signatureSuite` reference the schema's own EXTERNAL
|
|
46
|
+
* `common/base-object/v1.1` `$defs` (`signatureEnvelope` /
|
|
47
|
+
* `signatureSuite`), which this package has not fetched — typed
|
|
48
|
+
* structurally-unknown rather than guessed at.
|
|
49
|
+
*/
|
|
13
50
|
export interface UaidSigningCredential {
|
|
14
|
-
"@context": string[];
|
|
15
|
-
type: ["VerifiableCredential", "UaidSigningCredential"];
|
|
16
51
|
id: string;
|
|
52
|
+
type: "IAASOSigningCredential";
|
|
53
|
+
schemaVersion: string;
|
|
54
|
+
issuedAt: string;
|
|
17
55
|
issuer: string;
|
|
18
|
-
|
|
19
|
-
validUntil: string;
|
|
56
|
+
subjectRef: string;
|
|
20
57
|
credentialSubject: {
|
|
21
|
-
|
|
22
|
-
principal: string;
|
|
58
|
+
assurance_level: AssuranceLevel;
|
|
23
59
|
scope: {
|
|
24
60
|
actions: string[];
|
|
25
|
-
|
|
26
|
-
counterparty_allowlist?: string[];
|
|
61
|
+
counterparties: string[];
|
|
27
62
|
value_ceiling?: {
|
|
28
|
-
currency: string;
|
|
29
63
|
amount: number;
|
|
64
|
+
currency: string;
|
|
30
65
|
};
|
|
31
|
-
|
|
32
|
-
assurance_min?: AssuranceLevel;
|
|
66
|
+
geography?: string[];
|
|
33
67
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
public_key_jwk: JsonWebKey;
|
|
68
|
+
key: {
|
|
69
|
+
keyId: string;
|
|
70
|
+
publicKey: string;
|
|
38
71
|
};
|
|
39
|
-
assurance_level: AssuranceLevel;
|
|
40
|
-
assurance_evidence?: Array<{
|
|
41
|
-
provider: string;
|
|
42
|
-
evidence_uri: string;
|
|
43
|
-
hash: string;
|
|
44
|
-
}>;
|
|
45
|
-
kya_hash: string;
|
|
46
72
|
};
|
|
47
|
-
|
|
73
|
+
validFrom: string;
|
|
74
|
+
validUntil: string;
|
|
75
|
+
status?: "active" | "suspended" | "revoked" | "expired";
|
|
76
|
+
proof: unknown[];
|
|
77
|
+
signatureSuite?: unknown;
|
|
48
78
|
}
|
|
49
79
|
export interface UaidExchange {
|
|
50
80
|
"@context": string[];
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAWH,cAAc,iBAAiB,CAAC;AAUhC,cAAc,aAAa,CAAC;AAE5B,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,wBAAwB,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE;QACjB,eAAe,EAAE,cAAc,CAAC;QAChC,KAAK,EAAE;YACL,OAAO,EAAE,MAAM,EAAE,CAAC;YAClB,cAAc,EAAE,MAAM,EAAE,CAAC;YACzB,aAAa,CAAC,EAAE;gBAAE,MAAM,EAAE,MAAM,CAAC;gBAAC,QAAQ,EAAE,MAAM,CAAA;aAAE,CAAC;YACrD,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;SACtB,CAAC;QACF,GAAG,EAAE;YACH,KAAK,EAAE,MAAM,CAAC;YACd,SAAS,EAAE,MAAM,CAAC;SACnB,CAAC;KACH,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;IACxD,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,cAA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AAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CAEnD;AA+DD;;;GAGG;AACH,wBAAgB,MAAM,IAAI,MAAM,CAsB/B"}
|
package/dist/index.js
CHANGED
|
@@ -7,9 +7,27 @@
|
|
|
7
7
|
*
|
|
8
8
|
* See docs/profiles/UAP-EXCH-1/v0.1.md in the uuaid repo for the normative
|
|
9
9
|
* profile. This module implements the § 5 (Signing Credential), § 6 (Exchange),
|
|
10
|
-
* and § 7 (Receipt) shapes plus the § 8 submission API.
|
|
10
|
+
* and § 7 (Receipt) shapes plus the § 8 submission API. § 9 (Revocation,
|
|
11
|
+
* draft) lives in ./revocation.ts and is re-exported below.
|
|
11
12
|
*/
|
|
12
13
|
// ============================================================================
|
|
14
|
+
// Revocation (§ 9, draft) — status-list style credential revocation
|
|
15
|
+
// ============================================================================
|
|
16
|
+
//
|
|
17
|
+
// There is no verify entry point in this module to wire into, so the
|
|
18
|
+
// usability gate is exported standalone: call assertCredentialUsable()
|
|
19
|
+
// before acting on a Signing Credential (e.g. before createExchange /
|
|
20
|
+
// UaidNetworkClient.submit).
|
|
21
|
+
export * from "./revocation.js";
|
|
22
|
+
// ============================================================================
|
|
23
|
+
// Local proof verification — did:key/JWK key resolution + eddsa-jcs-2022
|
|
24
|
+
// DataIntegrityProof verification for createExchange()'s output and for
|
|
25
|
+
// arbitrary JCS documents (e.g. the MCP sole-control challenge). See
|
|
26
|
+
// ./verify.ts for the signed-bytes construction and its documented
|
|
27
|
+
// divergence from the W3C eddsa-jcs-2022 cryptosuite.
|
|
28
|
+
// ============================================================================
|
|
29
|
+
export * from "./verify.js";
|
|
30
|
+
// ============================================================================
|
|
13
31
|
// Exchange creation
|
|
14
32
|
// ============================================================================
|
|
15
33
|
const CONTEXT = [
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":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|
+
/**
|
|
2
|
+
* @e-sig/uaid-exch — UAP-EXCH-1 § 9 (Revocation, draft) — status-list style
|
|
3
|
+
* credential revocation.
|
|
4
|
+
*
|
|
5
|
+
* A RevocationList is an append-only, issuer-published list of revoked
|
|
6
|
+
* Signing Credential ids. Integrity is a sha256 digest over the JCS
|
|
7
|
+
* (RFC 8785) canonicalization of the list body (everything except the
|
|
8
|
+
* `digest` field itself), so any mutation — reordering, backdating, entry
|
|
9
|
+
* removal — is detectable offline. Verifiers MUST fail closed: a list whose
|
|
10
|
+
* digest does not verify is treated as unusable, not as "nothing revoked".
|
|
11
|
+
*
|
|
12
|
+
* Like § 5–§ 8 in ./index.ts this is a preview shape; it will be re-cut to
|
|
13
|
+
* the accepted IAASO ADR-006 schemas when the doctrine lands.
|
|
14
|
+
*/
|
|
15
|
+
import { type UaidSigningCredential } from "./index.js";
|
|
16
|
+
export interface RevocationEntry {
|
|
17
|
+
credentialId: string;
|
|
18
|
+
revokedAt: string;
|
|
19
|
+
reason?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface RevocationList {
|
|
22
|
+
id: string;
|
|
23
|
+
issuer: string;
|
|
24
|
+
issued: string;
|
|
25
|
+
revoked: RevocationEntry[];
|
|
26
|
+
digest: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The minimal credential surface needed for a usability check. Structural
|
|
30
|
+
* (Pick-style) so any § 5 UaidSigningCredential — or anything with the same
|
|
31
|
+
* id + validity window — is accepted without a hard dependency.
|
|
32
|
+
*/
|
|
33
|
+
export type RevocableCredential = Pick<UaidSigningCredential, "id" | "validFrom" | "validUntil">;
|
|
34
|
+
export interface CreateRevocationListInput {
|
|
35
|
+
issuer: string;
|
|
36
|
+
now?: () => Date;
|
|
37
|
+
idFactory?: () => string;
|
|
38
|
+
}
|
|
39
|
+
export type CredentialUsabilityErrorCode = "CREDENTIAL_EXPIRED" | "CREDENTIAL_NOT_YET_VALID" | "CREDENTIAL_REVOKED" | "CREDENTIAL_MALFORMED_VALIDITY" | "REVOCATION_LIST_INTEGRITY";
|
|
40
|
+
export declare class CredentialUsabilityError extends Error {
|
|
41
|
+
readonly code: CredentialUsabilityErrorCode;
|
|
42
|
+
constructor(code: CredentialUsabilityErrorCode, message: string);
|
|
43
|
+
}
|
|
44
|
+
export declare class CredentialExpiredError extends CredentialUsabilityError {
|
|
45
|
+
constructor(credentialId: string, validUntil: string, now: Date);
|
|
46
|
+
}
|
|
47
|
+
export declare class CredentialNotYetValidError extends CredentialUsabilityError {
|
|
48
|
+
constructor(credentialId: string, validFrom: string, now: Date);
|
|
49
|
+
}
|
|
50
|
+
export declare class CredentialRevokedError extends CredentialUsabilityError {
|
|
51
|
+
readonly entry: RevocationEntry;
|
|
52
|
+
constructor(entry: RevocationEntry);
|
|
53
|
+
}
|
|
54
|
+
export declare class CredentialMalformedValidityError extends CredentialUsabilityError {
|
|
55
|
+
constructor(credentialId: string, field: "validFrom" | "validUntil", value: string);
|
|
56
|
+
}
|
|
57
|
+
export declare class RevocationListIntegrityError extends CredentialUsabilityError {
|
|
58
|
+
constructor(listId: string);
|
|
59
|
+
}
|
|
60
|
+
/** Create an empty, digested revocation list for an issuer. */
|
|
61
|
+
export declare function createRevocationList(input: CreateRevocationListInput): Promise<RevocationList>;
|
|
62
|
+
/**
|
|
63
|
+
* Revoke a credential id. Returns a NEW list — the input is never mutated —
|
|
64
|
+
* with the entry appended and the digest recomputed. Revoking an id that is
|
|
65
|
+
* already revoked is idempotent: the input list is returned unchanged (the
|
|
66
|
+
* original entry, including its `revokedAt` and `reason`, is authoritative).
|
|
67
|
+
*
|
|
68
|
+
* Fails closed: refuses to append to a list that does not verify.
|
|
69
|
+
*/
|
|
70
|
+
export declare function revokeCredential(list: RevocationList, credentialId: string, reason?: string, opts?: {
|
|
71
|
+
now?: () => Date;
|
|
72
|
+
}): Promise<RevocationList>;
|
|
73
|
+
/**
|
|
74
|
+
* True if `credentialId` appears in the list's revoked entries.
|
|
75
|
+
*
|
|
76
|
+
* Verifies list integrity first and throws {@link RevocationListIntegrityError}
|
|
77
|
+
* on any tampered/malformed list — a lookup against an unverified list would
|
|
78
|
+
* fail open (an attacker who can strip an entry could un-revoke a credential).
|
|
79
|
+
*/
|
|
80
|
+
export declare function isRevoked(list: RevocationList, credentialId: string): Promise<boolean>;
|
|
81
|
+
/**
|
|
82
|
+
* Look up the revocation entry for a credential id, if any. Same fail-closed
|
|
83
|
+
* integrity gate as {@link isRevoked}.
|
|
84
|
+
*/
|
|
85
|
+
export declare function getRevocationEntry(list: RevocationList, credentialId: string): Promise<RevocationEntry | undefined>;
|
|
86
|
+
/**
|
|
87
|
+
* Recompute the JCS + sha256 digest over the list body and compare against
|
|
88
|
+
* `list.digest`. Fail-closed: any structural anomaly, canonicalization error,
|
|
89
|
+
* or digest mismatch returns false — it never throws.
|
|
90
|
+
*/
|
|
91
|
+
export declare function verifyRevocationListIntegrity(list: RevocationList): Promise<boolean>;
|
|
92
|
+
/**
|
|
93
|
+
* Assert a Signing Credential is currently usable: the revocation list
|
|
94
|
+
* verifies, the credential's § 5 validity window (validFrom/validUntil)
|
|
95
|
+
* covers `now`, and the credential id is not revoked.
|
|
96
|
+
*
|
|
97
|
+
* Throws a typed CredentialUsabilityError subclass on the first failure;
|
|
98
|
+
* resolves (void) on the happy path. Standalone by design — ./index.ts has
|
|
99
|
+
* no verify entry point to wire into, so call this before acting on a
|
|
100
|
+
* credential (e.g. before createExchange / UaidNetworkClient.submit).
|
|
101
|
+
*/
|
|
102
|
+
export declare function assertCredentialUsable(credential: RevocableCredential, list: RevocationList, now?: Date): Promise<void>;
|
|
103
|
+
//# sourceMappingURL=revocation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revocation.d.ts","sourceRoot":"","sources":["../src/revocation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAoB,KAAK,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAM1E,MAAM,WAA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WAAW,GAAG,YAAY,EAAE,KAAK,EAAE,MAAM;CAOnF;AAED,qBAAa,4BAA6B,SAAQ,wBAAwB;gBAC5D,MAAM,EAAE,MAAM;CAO3B;AAMD,+DAA+D;AAC/D,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,yBAAyB,GAC/B,OAAO,CAAC,cAAc,CAAC,CASzB;AAED;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,cAAc,EACpB,YAAY,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,MAAM,EACf,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,GAC1B,OAAO,CAAC,cAAc,CAAC,CAqBzB;AAWD;;;;;;GAMG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,cAAc,EACpB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,OAAO,CAAC,CAKlB;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,cAAc,EACpB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAKtC;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,OAAO,CAAC,CAuBlB;AAMD;;;;;;;;;GASG;AACH,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,mBAAmB,EAC/B,IAAI,EAAE,cAAc,EACpB,GAAG,CAAC,EAAE,IAAI,GACT,OAAO,CAAC,IAAI,CAAC,CAwBf"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @e-sig/uaid-exch — UAP-EXCH-1 § 9 (Revocation, draft) — status-list style
|
|
3
|
+
* credential revocation.
|
|
4
|
+
*
|
|
5
|
+
* A RevocationList is an append-only, issuer-published list of revoked
|
|
6
|
+
* Signing Credential ids. Integrity is a sha256 digest over the JCS
|
|
7
|
+
* (RFC 8785) canonicalization of the list body (everything except the
|
|
8
|
+
* `digest` field itself), so any mutation — reordering, backdating, entry
|
|
9
|
+
* removal — is detectable offline. Verifiers MUST fail closed: a list whose
|
|
10
|
+
* digest does not verify is treated as unusable, not as "nothing revoked".
|
|
11
|
+
*
|
|
12
|
+
* Like § 5–§ 8 in ./index.ts this is a preview shape; it will be re-cut to
|
|
13
|
+
* the accepted IAASO ADR-006 schemas when the doctrine lands.
|
|
14
|
+
*/
|
|
15
|
+
import { jcsBytes, uuidv7 } from "./index.js";
|
|
16
|
+
export class CredentialUsabilityError extends Error {
|
|
17
|
+
code;
|
|
18
|
+
constructor(code, message) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.name = "CredentialUsabilityError";
|
|
21
|
+
this.code = code;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export class CredentialExpiredError extends CredentialUsabilityError {
|
|
25
|
+
constructor(credentialId, validUntil, now) {
|
|
26
|
+
super("CREDENTIAL_EXPIRED", `credential ${credentialId} expired at ${validUntil} (now ${now.toISOString()})`);
|
|
27
|
+
this.name = "CredentialExpiredError";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export class CredentialNotYetValidError extends CredentialUsabilityError {
|
|
31
|
+
constructor(credentialId, validFrom, now) {
|
|
32
|
+
super("CREDENTIAL_NOT_YET_VALID", `credential ${credentialId} is not valid until ${validFrom} (now ${now.toISOString()})`);
|
|
33
|
+
this.name = "CredentialNotYetValidError";
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export class CredentialRevokedError extends CredentialUsabilityError {
|
|
37
|
+
entry;
|
|
38
|
+
constructor(entry) {
|
|
39
|
+
super("CREDENTIAL_REVOKED", `credential ${entry.credentialId} was revoked at ${entry.revokedAt}` +
|
|
40
|
+
(entry.reason ? ` (${entry.reason})` : ""));
|
|
41
|
+
this.name = "CredentialRevokedError";
|
|
42
|
+
this.entry = entry;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export class CredentialMalformedValidityError extends CredentialUsabilityError {
|
|
46
|
+
constructor(credentialId, field, value) {
|
|
47
|
+
super("CREDENTIAL_MALFORMED_VALIDITY", `credential ${credentialId} has unparseable ${field} ${JSON.stringify(value)}; failing closed`);
|
|
48
|
+
this.name = "CredentialMalformedValidityError";
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export class RevocationListIntegrityError extends CredentialUsabilityError {
|
|
52
|
+
constructor(listId) {
|
|
53
|
+
super("REVOCATION_LIST_INTEGRITY", `revocation list ${listId} failed integrity verification; failing closed`);
|
|
54
|
+
this.name = "RevocationListIntegrityError";
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// ============================================================================
|
|
58
|
+
// List construction + mutation (append-only, always re-digested)
|
|
59
|
+
// ============================================================================
|
|
60
|
+
/** Create an empty, digested revocation list for an issuer. */
|
|
61
|
+
export async function createRevocationList(input) {
|
|
62
|
+
const now = (input.now ?? (() => new Date()))();
|
|
63
|
+
const body = {
|
|
64
|
+
id: `uuaid:foundation:revocation-list:${(input.idFactory ?? uuidv7)()}`,
|
|
65
|
+
issuer: input.issuer,
|
|
66
|
+
issued: now.toISOString(),
|
|
67
|
+
revoked: [],
|
|
68
|
+
};
|
|
69
|
+
return { ...body, digest: await computeListDigest(body) };
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Revoke a credential id. Returns a NEW list — the input is never mutated —
|
|
73
|
+
* with the entry appended and the digest recomputed. Revoking an id that is
|
|
74
|
+
* already revoked is idempotent: the input list is returned unchanged (the
|
|
75
|
+
* original entry, including its `revokedAt` and `reason`, is authoritative).
|
|
76
|
+
*
|
|
77
|
+
* Fails closed: refuses to append to a list that does not verify.
|
|
78
|
+
*/
|
|
79
|
+
export async function revokeCredential(list, credentialId, reason, opts) {
|
|
80
|
+
if (!(await verifyRevocationListIntegrity(list))) {
|
|
81
|
+
throw new RevocationListIntegrityError(list.id);
|
|
82
|
+
}
|
|
83
|
+
// Integrity verified above — the unverified lookup is safe here.
|
|
84
|
+
if (findRevocationEntry(list, credentialId)) {
|
|
85
|
+
return list;
|
|
86
|
+
}
|
|
87
|
+
const now = (opts?.now ?? (() => new Date()))();
|
|
88
|
+
const entry = {
|
|
89
|
+
credentialId,
|
|
90
|
+
revokedAt: now.toISOString(),
|
|
91
|
+
...(reason !== undefined ? { reason } : {}),
|
|
92
|
+
};
|
|
93
|
+
const body = {
|
|
94
|
+
id: list.id,
|
|
95
|
+
issuer: list.issuer,
|
|
96
|
+
issued: now.toISOString(),
|
|
97
|
+
revoked: [...list.revoked, entry],
|
|
98
|
+
};
|
|
99
|
+
return { ...body, digest: await computeListDigest(body) };
|
|
100
|
+
}
|
|
101
|
+
/** Entry lookup WITHOUT integrity verification — internal use only, after
|
|
102
|
+
* the caller has already verified the list digest. */
|
|
103
|
+
function findRevocationEntry(list, credentialId) {
|
|
104
|
+
return list.revoked.find((e) => e.credentialId === credentialId);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* True if `credentialId` appears in the list's revoked entries.
|
|
108
|
+
*
|
|
109
|
+
* Verifies list integrity first and throws {@link RevocationListIntegrityError}
|
|
110
|
+
* on any tampered/malformed list — a lookup against an unverified list would
|
|
111
|
+
* fail open (an attacker who can strip an entry could un-revoke a credential).
|
|
112
|
+
*/
|
|
113
|
+
export async function isRevoked(list, credentialId) {
|
|
114
|
+
if (!(await verifyRevocationListIntegrity(list))) {
|
|
115
|
+
throw new RevocationListIntegrityError(list.id);
|
|
116
|
+
}
|
|
117
|
+
return findRevocationEntry(list, credentialId) !== undefined;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Look up the revocation entry for a credential id, if any. Same fail-closed
|
|
121
|
+
* integrity gate as {@link isRevoked}.
|
|
122
|
+
*/
|
|
123
|
+
export async function getRevocationEntry(list, credentialId) {
|
|
124
|
+
if (!(await verifyRevocationListIntegrity(list))) {
|
|
125
|
+
throw new RevocationListIntegrityError(list.id);
|
|
126
|
+
}
|
|
127
|
+
return findRevocationEntry(list, credentialId);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Recompute the JCS + sha256 digest over the list body and compare against
|
|
131
|
+
* `list.digest`. Fail-closed: any structural anomaly, canonicalization error,
|
|
132
|
+
* or digest mismatch returns false — it never throws.
|
|
133
|
+
*/
|
|
134
|
+
export async function verifyRevocationListIntegrity(list) {
|
|
135
|
+
try {
|
|
136
|
+
if (typeof list !== "object" ||
|
|
137
|
+
list === null ||
|
|
138
|
+
typeof list.id !== "string" ||
|
|
139
|
+
typeof list.issuer !== "string" ||
|
|
140
|
+
typeof list.issued !== "string" ||
|
|
141
|
+
typeof list.digest !== "string" ||
|
|
142
|
+
!Array.isArray(list.revoked)) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
const body = {
|
|
146
|
+
id: list.id,
|
|
147
|
+
issuer: list.issuer,
|
|
148
|
+
issued: list.issued,
|
|
149
|
+
revoked: list.revoked,
|
|
150
|
+
};
|
|
151
|
+
return (await computeListDigest(body)) === list.digest;
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// ============================================================================
|
|
158
|
+
// Usability gate
|
|
159
|
+
// ============================================================================
|
|
160
|
+
/**
|
|
161
|
+
* Assert a Signing Credential is currently usable: the revocation list
|
|
162
|
+
* verifies, the credential's § 5 validity window (validFrom/validUntil)
|
|
163
|
+
* covers `now`, and the credential id is not revoked.
|
|
164
|
+
*
|
|
165
|
+
* Throws a typed CredentialUsabilityError subclass on the first failure;
|
|
166
|
+
* resolves (void) on the happy path. Standalone by design — ./index.ts has
|
|
167
|
+
* no verify entry point to wire into, so call this before acting on a
|
|
168
|
+
* credential (e.g. before createExchange / UaidNetworkClient.submit).
|
|
169
|
+
*/
|
|
170
|
+
export async function assertCredentialUsable(credential, list, now) {
|
|
171
|
+
if (!(await verifyRevocationListIntegrity(list))) {
|
|
172
|
+
throw new RevocationListIntegrityError(list.id);
|
|
173
|
+
}
|
|
174
|
+
const at = now ?? new Date();
|
|
175
|
+
const from = Date.parse(credential.validFrom);
|
|
176
|
+
const until = Date.parse(credential.validUntil);
|
|
177
|
+
if (!Number.isFinite(from)) {
|
|
178
|
+
throw new CredentialMalformedValidityError(credential.id, "validFrom", credential.validFrom);
|
|
179
|
+
}
|
|
180
|
+
if (!Number.isFinite(until)) {
|
|
181
|
+
throw new CredentialMalformedValidityError(credential.id, "validUntil", credential.validUntil);
|
|
182
|
+
}
|
|
183
|
+
if (at.getTime() < from) {
|
|
184
|
+
throw new CredentialNotYetValidError(credential.id, credential.validFrom, at);
|
|
185
|
+
}
|
|
186
|
+
if (at.getTime() > until) {
|
|
187
|
+
throw new CredentialExpiredError(credential.id, credential.validUntil, at);
|
|
188
|
+
}
|
|
189
|
+
// List integrity was verified above — the unverified lookup is safe here.
|
|
190
|
+
const entry = findRevocationEntry(list, credential.id);
|
|
191
|
+
if (entry) {
|
|
192
|
+
throw new CredentialRevokedError(entry);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// ============================================================================
|
|
196
|
+
// Digest — JCS (RFC 8785) canonical body → sha256:<hex>
|
|
197
|
+
// ============================================================================
|
|
198
|
+
async function computeListDigest(body) {
|
|
199
|
+
return `sha256:${await sha256Hex(jcsBytes(body))}`;
|
|
200
|
+
}
|
|
201
|
+
async function sha256Hex(bytes) {
|
|
202
|
+
const subtle = globalThis.crypto?.subtle;
|
|
203
|
+
if (!subtle) {
|
|
204
|
+
// Node >= 20 and all modern browsers expose WebCrypto; integrity cannot
|
|
205
|
+
// be computed without it, so refuse rather than degrade.
|
|
206
|
+
throw new Error("WebCrypto subtle digest unavailable (requires Node >= 20)");
|
|
207
|
+
}
|
|
208
|
+
const digest = await subtle.digest("SHA-256", bytes);
|
|
209
|
+
return Array.from(new Uint8Array(digest))
|
|
210
|
+
.map((b) => b.toString(16).padStart(2, "0"))
|
|
211
|
+
.join("");
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=revoc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G,mBAAmB,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;IACvD,IAAI,KAAK,EAAE,CAAC;QACV,MAAM,IAAI,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAED,+EAA+E;AAC/E,wDAAwD;AACxD,+EAA+E;AAE/E,KAAK,UAAU,iBAAiB,CAC9B,IAAoC;IAEpC,OAAO,UAAU,MAAM,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;AACrD,CAAC;AAED,KAAK,UAAU,SAAS,CAAC,KAAiB;IACxC,MAAM,MAAM,GAAI,UAA6C,CAAC,MAAM,EAAE,MAAM,CAAC;IAC7E,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,wEAAwE;QACxE,yDAAyD;QACzD,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;IAC/E,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,KAAqB,CAAC,CAAC;IACrE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;SACtC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;SAC3C,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC"}
|
package/dist/verify.d.ts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @e-sig/uaid-exch — local proof verification.
|
|
3
|
+
*
|
|
4
|
+
* Verifies the two `DataIntegrityProof` entries `createExchange()` produces
|
|
5
|
+
* (./index.ts:197-254) without any network round-trip, plus a generic
|
|
6
|
+
* `verifyDataIntegrityProof`/`verifyChallengeProof` pair usable for any
|
|
7
|
+
* JCS-canonicalizable document carrying an `eddsa-jcs-2022` proof — this is
|
|
8
|
+
* the local (L1) leg of the UUAID/IAASO signer-identity ladder described in
|
|
9
|
+
* docs/architecture/esig-mcp.md § 12 ("L1 proven"): a sole-control challenge
|
|
10
|
+
* signed by the presenter, verified here with no registry call.
|
|
11
|
+
*
|
|
12
|
+
* SIGNED-BYTES CONSTRUCTION — divergence from W3C eddsa-jcs-2022 (documented,
|
|
13
|
+
* intentional; ADR note per docs/architecture/esig-mcp.md § 12 "Bindings"):
|
|
14
|
+
* the W3C Data Integrity `eddsa-jcs-2022` cryptosuite signs
|
|
15
|
+
* `sha256(JCS(proofConfig)) || sha256(JCS(document))` — a hash of the proof
|
|
16
|
+
* options (everything in the proof object except `proofValue`) concatenated
|
|
17
|
+
* with a hash of the document. `createExchange()` (./index.ts:229-234) does
|
|
18
|
+
* NOT do this: it JCS-canonicalizes ONLY the exchange body with the `proof`
|
|
19
|
+
* property omitted (`const canonicalBytes = jcsBytes(body)`, ./index.ts:229)
|
|
20
|
+
* and signs those bytes directly — the proof's own `created`,
|
|
21
|
+
* `verificationMethod`, and `proofPurpose` fields are never part of the
|
|
22
|
+
* signed input, and there is no proof-config hash at all. Every function
|
|
23
|
+
* below mirrors `createExchange` exactly (interop with our own artifacts
|
|
24
|
+
* wins per the build ticket), NOT the W3C double-hash construction. See the
|
|
25
|
+
* "signs jcsBytes(document) directly (createExchange's construction), not
|
|
26
|
+
* the W3C eddsa-jcs-2022 proofConfig-hash construction" test in
|
|
27
|
+
* tests/verify.test.ts for a pinned, human-checkable example of the
|
|
28
|
+
* divergence.
|
|
29
|
+
*
|
|
30
|
+
* Key resolution supports two `verificationMethod` shapes (docs/architecture
|
|
31
|
+
* /esig-mcp.md § 12 T10): a `did:key:z...` URI (multibase + multicodec
|
|
32
|
+
* Ed25519) and a raw JWK (`{kty:"OKP", crv:"Ed25519", x}` — EXACTLY those
|
|
33
|
+
* three fields, no more; RedTeam G6, rt-verdict-ESIGMCP-V02-IDENTITY-20260827:
|
|
34
|
+
* a JWK carrying any other property, notably `d` (the RFC 8037 §2 PRIVATE
|
|
35
|
+
* half of an OKP/Ed25519 keypair), is rejected outright rather than having
|
|
36
|
+
* its extra fields silently ignored). This is also the encoding
|
|
37
|
+
* `UaidSigningCredential.credentialSubject.key.publicKey` uses when it
|
|
38
|
+
* carries a JWK rather than a `did:key:` string (./index.ts, schema.json:
|
|
39
|
+
* 80-89 — the real tae/v1 field, `credentialSubject.key.publicKey`; a
|
|
40
|
+
* previous doc reference here named a field that does not exist in the
|
|
41
|
+
* schema and has been corrected). A bare `"ed25519:<hex64>"` form was considered per the
|
|
42
|
+
* build ticket and rejected: neither `createExchange` (./index.ts:141-151,
|
|
43
|
+
* `AgentSigner.verificationMethod` is documented as
|
|
44
|
+
* `uuaid:foundation:agent:<uuid>#sk-...`) nor any test in tests/ uses that
|
|
45
|
+
* shape, so it is not implemented — inventing an unused key format would be
|
|
46
|
+
* unverifiable surface area.
|
|
47
|
+
*/
|
|
48
|
+
import { type DataIntegrityProof, type UaidExchange } from "./index.js";
|
|
49
|
+
/** The multibase prefixes this module understands: `z` = base58btc, `u` = base64url (unpadded). */
|
|
50
|
+
export type MultibasePrefix = "z" | "u";
|
|
51
|
+
/**
|
|
52
|
+
* Decode a multibase string: `z` prefix → base58btc, `u` prefix →
|
|
53
|
+
* base64url (unpadded, per the multibase spec). Any other (or missing)
|
|
54
|
+
* prefix throws.
|
|
55
|
+
*/
|
|
56
|
+
export declare function decodeMultibase(value: string): Uint8Array;
|
|
57
|
+
/** Encode bytes as multibase under the given prefix. Counterpart to {@link decodeMultibase}, used by tests and by callers building their own did:key values. */
|
|
58
|
+
export declare function encodeMultibase(bytes: Uint8Array, prefix: MultibasePrefix): string;
|
|
59
|
+
export declare class UnsupportedVerificationMethodError extends Error {
|
|
60
|
+
constructor(message: string);
|
|
61
|
+
}
|
|
62
|
+
export declare function publicKeyFromVerificationMethod(vm: string | JsonWebKey): Uint8Array;
|
|
63
|
+
export interface DataIntegrityProofOpts {
|
|
64
|
+
/** Override key resolution — skip deriving from `proof.verificationMethod`. */
|
|
65
|
+
publicKey?: Uint8Array;
|
|
66
|
+
/** Reject the proof unless `proof.proofPurpose` equals this. */
|
|
67
|
+
expectedProofPurpose?: "authentication" | "assertionMethod";
|
|
68
|
+
}
|
|
69
|
+
export interface DataIntegrityVerifyResult {
|
|
70
|
+
ok: boolean;
|
|
71
|
+
reason?: string;
|
|
72
|
+
/** sha256 hex digest of the 32 raw Ed25519 public key bytes, when a key was resolved. */
|
|
73
|
+
keyFingerprint?: string;
|
|
74
|
+
verificationMethod: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Verify an `eddsa-jcs-2022` `DataIntegrityProof` over `document`. `document`
|
|
78
|
+
* must NOT include the `proof` property — pass the same shape
|
|
79
|
+
* `createExchange` signed (everything except `proof`; see the module doc
|
|
80
|
+
* comment on the signed-bytes construction). Never throws: any failure
|
|
81
|
+
* (unknown type/cryptosuite, purpose mismatch, unresolvable or wrong-length
|
|
82
|
+
* key, bad multibase `proofValue`, bad signature) comes back as `ok: false`
|
|
83
|
+
* with a `reason`, fail-closed like the rest of this package
|
|
84
|
+
* (revocation.ts's `verifyRevocationListIntegrity`).
|
|
85
|
+
*/
|
|
86
|
+
export declare function verifyDataIntegrityProof(document: unknown, proof: DataIntegrityProof, opts?: DataIntegrityProofOpts): DataIntegrityVerifyResult;
|
|
87
|
+
/**
|
|
88
|
+
* Thin alias of {@link verifyDataIntegrityProof} for an arbitrary
|
|
89
|
+
* JCS-canonicalizable document that carries no embedded `proof` field of its
|
|
90
|
+
* own — e.g. the MCP sole-control challenge
|
|
91
|
+
* (docs/architecture/esig-mcp.md § 12: `{type, envelopeId, signerId,
|
|
92
|
+
* htmlSha256, nonce, issuedAt, expiresAt}`, proof presented alongside it,
|
|
93
|
+
* never inside it).
|
|
94
|
+
*/
|
|
95
|
+
export declare function verifyChallengeProof(challenge: object, proof: DataIntegrityProof, opts?: DataIntegrityProofOpts): DataIntegrityVerifyResult;
|
|
96
|
+
export interface VerifyExchangeOpts {
|
|
97
|
+
agentPublicKey?: Uint8Array;
|
|
98
|
+
issuerPublicKey?: Uint8Array;
|
|
99
|
+
}
|
|
100
|
+
export interface VerifyExchangeResult {
|
|
101
|
+
ok: boolean;
|
|
102
|
+
agent: DataIntegrityVerifyResult;
|
|
103
|
+
issuer: DataIntegrityVerifyResult;
|
|
104
|
+
failures: string[];
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Verify both proofs on a `UaidExchange` produced by `createExchange`
|
|
108
|
+
* (./index.ts:197-254): `proof[0]` is always the agent's (`authentication`),
|
|
109
|
+
* `proof[1]` is always the issuer's (`assertionMethod`) — createExchange
|
|
110
|
+
* constructs the array in exactly that fixed order (./index.ts:253). Both
|
|
111
|
+
* proofs sign the same canonical bytes: the exchange with its `proof` array
|
|
112
|
+
* removed. Never throws.
|
|
113
|
+
*/
|
|
114
|
+
export declare function verifyExchange(exchange: UaidExchange, opts?: VerifyExchangeOpts): VerifyExchangeResult;
|
|
115
|
+
//# sourceMappingURL=verify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../src/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAGH,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,YAAY,EAClB,MAAM,YAAY,CAAC;AAMpB,mGAAmG;AACnG,MAAM,MAAM,eAAe,GAAG,GAAG,GAAG,GAAG,CAAC;AAQxC;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAWzD;AAED,gKAAgK;AAChK,wBAAgB,eAAe,CAC7B,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,eAAe,GACtB,MAAM,CAMR;AA6DD,qBAAa,kCAAmC,SAAQ,KAAK;gBAC/C,OAAO,EAAE,MAAM;CAI5B;AA0BD,wBAAgB,+BAA+B,CAC7C,EAAE,EAAE,MAAM,GAAG,UAAU,GACtB,UAAU,CAoCZ;AA+CD,MAAM,WAAW,sBAAsB;IACrC,+EAA+E;IAC/E,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,gEAAgE;IAChE,oBAAoB,CAAC,EAAE,gBAAgB,GAAG,iBAAiB,CAAC;CAC7D;AAED,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yFAAyF;IACzF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,OAAO,EACjB,KAAK,EAAE,kBAAkB,EACzB,IAAI,GAAE,sBAA2B,GAChC,yBAAyB,CA+E3B;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,kBAAkB,EACzB,IAAI,GAAE,sBAA2B,GAChC,yBAAyB,CAE3B;AAMD,MAAM,WAAW,kBAAkB;IACjC,cAAc,CAAC,EAAE,UAAU,CAAC;IAC5B,eAAe,CAAC,EAAE,UAAU,CAAC;CAC9B;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,yBAAyB,CAAC;IACjC,MAAM,EAAE,yBAAyB,CAAC;IAClC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,YAAY,EACtB,IAAI,GAAE,kBAAuB,GAC5B,oBAAoB,CAyBtB"}
|
package/dist/verify.js
ADDED
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @e-sig/uaid-exch — local proof verification.
|
|
3
|
+
*
|
|
4
|
+
* Verifies the two `DataIntegrityProof` entries `createExchange()` produces
|
|
5
|
+
* (./index.ts:197-254) without any network round-trip, plus a generic
|
|
6
|
+
* `verifyDataIntegrityProof`/`verifyChallengeProof` pair usable for any
|
|
7
|
+
* JCS-canonicalizable document carrying an `eddsa-jcs-2022` proof — this is
|
|
8
|
+
* the local (L1) leg of the UUAID/IAASO signer-identity ladder described in
|
|
9
|
+
* docs/architecture/esig-mcp.md § 12 ("L1 proven"): a sole-control challenge
|
|
10
|
+
* signed by the presenter, verified here with no registry call.
|
|
11
|
+
*
|
|
12
|
+
* SIGNED-BYTES CONSTRUCTION — divergence from W3C eddsa-jcs-2022 (documented,
|
|
13
|
+
* intentional; ADR note per docs/architecture/esig-mcp.md § 12 "Bindings"):
|
|
14
|
+
* the W3C Data Integrity `eddsa-jcs-2022` cryptosuite signs
|
|
15
|
+
* `sha256(JCS(proofConfig)) || sha256(JCS(document))` — a hash of the proof
|
|
16
|
+
* options (everything in the proof object except `proofValue`) concatenated
|
|
17
|
+
* with a hash of the document. `createExchange()` (./index.ts:229-234) does
|
|
18
|
+
* NOT do this: it JCS-canonicalizes ONLY the exchange body with the `proof`
|
|
19
|
+
* property omitted (`const canonicalBytes = jcsBytes(body)`, ./index.ts:229)
|
|
20
|
+
* and signs those bytes directly — the proof's own `created`,
|
|
21
|
+
* `verificationMethod`, and `proofPurpose` fields are never part of the
|
|
22
|
+
* signed input, and there is no proof-config hash at all. Every function
|
|
23
|
+
* below mirrors `createExchange` exactly (interop with our own artifacts
|
|
24
|
+
* wins per the build ticket), NOT the W3C double-hash construction. See the
|
|
25
|
+
* "signs jcsBytes(document) directly (createExchange's construction), not
|
|
26
|
+
* the W3C eddsa-jcs-2022 proofConfig-hash construction" test in
|
|
27
|
+
* tests/verify.test.ts for a pinned, human-checkable example of the
|
|
28
|
+
* divergence.
|
|
29
|
+
*
|
|
30
|
+
* Key resolution supports two `verificationMethod` shapes (docs/architecture
|
|
31
|
+
* /esig-mcp.md § 12 T10): a `did:key:z...` URI (multibase + multicodec
|
|
32
|
+
* Ed25519) and a raw JWK (`{kty:"OKP", crv:"Ed25519", x}` — EXACTLY those
|
|
33
|
+
* three fields, no more; RedTeam G6, rt-verdict-ESIGMCP-V02-IDENTITY-20260827:
|
|
34
|
+
* a JWK carrying any other property, notably `d` (the RFC 8037 §2 PRIVATE
|
|
35
|
+
* half of an OKP/Ed25519 keypair), is rejected outright rather than having
|
|
36
|
+
* its extra fields silently ignored). This is also the encoding
|
|
37
|
+
* `UaidSigningCredential.credentialSubject.key.publicKey` uses when it
|
|
38
|
+
* carries a JWK rather than a `did:key:` string (./index.ts, schema.json:
|
|
39
|
+
* 80-89 — the real tae/v1 field, `credentialSubject.key.publicKey`; a
|
|
40
|
+
* previous doc reference here named a field that does not exist in the
|
|
41
|
+
* schema and has been corrected). A bare `"ed25519:<hex64>"` form was considered per the
|
|
42
|
+
* build ticket and rejected: neither `createExchange` (./index.ts:141-151,
|
|
43
|
+
* `AgentSigner.verificationMethod` is documented as
|
|
44
|
+
* `uuaid:foundation:agent:<uuid>#sk-...`) nor any test in tests/ uses that
|
|
45
|
+
* shape, so it is not implemented — inventing an unused key format would be
|
|
46
|
+
* unverifiable surface area.
|
|
47
|
+
*/
|
|
48
|
+
import { createHash, createPublicKey, verify as ed25519Verify } from "node:crypto";
|
|
49
|
+
import { jcsBytes, } from "./index.js";
|
|
50
|
+
const BASE58BTC_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
51
|
+
const BASE58BTC_INDEX = new Map(Array.from(BASE58BTC_ALPHABET).map((c, i) => [c, i]));
|
|
52
|
+
/**
|
|
53
|
+
* Decode a multibase string: `z` prefix → base58btc, `u` prefix →
|
|
54
|
+
* base64url (unpadded, per the multibase spec). Any other (or missing)
|
|
55
|
+
* prefix throws.
|
|
56
|
+
*/
|
|
57
|
+
export function decodeMultibase(value) {
|
|
58
|
+
if (typeof value !== "string" || value.length < 1) {
|
|
59
|
+
throw new Error("decodeMultibase: expected a non-empty multibase string");
|
|
60
|
+
}
|
|
61
|
+
const prefix = value[0];
|
|
62
|
+
const rest = value.slice(1);
|
|
63
|
+
if (prefix === "z")
|
|
64
|
+
return base58btcDecode(rest);
|
|
65
|
+
if (prefix === "u")
|
|
66
|
+
return base64UrlDecode(rest);
|
|
67
|
+
throw new Error(`decodeMultibase: unsupported multibase prefix ${JSON.stringify(prefix)}`);
|
|
68
|
+
}
|
|
69
|
+
/** Encode bytes as multibase under the given prefix. Counterpart to {@link decodeMultibase}, used by tests and by callers building their own did:key values. */
|
|
70
|
+
export function encodeMultibase(bytes, prefix) {
|
|
71
|
+
if (prefix === "z")
|
|
72
|
+
return "z" + base58btcEncode(bytes);
|
|
73
|
+
if (prefix === "u")
|
|
74
|
+
return "u" + base64UrlEncode(bytes);
|
|
75
|
+
throw new Error(`encodeMultibase: unsupported multibase prefix ${JSON.stringify(prefix)}`);
|
|
76
|
+
}
|
|
77
|
+
/** Inline base58btc decoder (Bitcoin alphabet) — no dependency. */
|
|
78
|
+
function base58btcDecode(s) {
|
|
79
|
+
let num = 0n;
|
|
80
|
+
for (const ch of s) {
|
|
81
|
+
const digit = BASE58BTC_INDEX.get(ch);
|
|
82
|
+
if (digit === undefined) {
|
|
83
|
+
throw new Error(`decodeMultibase: invalid base58btc character ${JSON.stringify(ch)}`);
|
|
84
|
+
}
|
|
85
|
+
num = num * 58n + BigInt(digit);
|
|
86
|
+
}
|
|
87
|
+
let hex = num.toString(16);
|
|
88
|
+
if (hex.length % 2 === 1)
|
|
89
|
+
hex = "0" + hex;
|
|
90
|
+
const body = hex.length === 0
|
|
91
|
+
? new Uint8Array(0)
|
|
92
|
+
: new Uint8Array(hex.match(/.{2}/g).map((byte) => parseInt(byte, 16)));
|
|
93
|
+
let leadingZeros = 0;
|
|
94
|
+
for (const ch of s) {
|
|
95
|
+
if (ch === "1")
|
|
96
|
+
leadingZeros++;
|
|
97
|
+
else
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
const out = new Uint8Array(leadingZeros + body.length);
|
|
101
|
+
out.set(body, leadingZeros);
|
|
102
|
+
return out;
|
|
103
|
+
}
|
|
104
|
+
/** Inline base58btc encoder — no dependency. */
|
|
105
|
+
function base58btcEncode(bytes) {
|
|
106
|
+
let num = 0n;
|
|
107
|
+
for (const b of bytes)
|
|
108
|
+
num = (num << 8n) | BigInt(b);
|
|
109
|
+
let out = "";
|
|
110
|
+
while (num > 0n) {
|
|
111
|
+
const rem = Number(num % 58n);
|
|
112
|
+
out = BASE58BTC_ALPHABET[rem] + out;
|
|
113
|
+
num /= 58n;
|
|
114
|
+
}
|
|
115
|
+
let leadingZeros = 0;
|
|
116
|
+
for (const b of bytes) {
|
|
117
|
+
if (b === 0)
|
|
118
|
+
leadingZeros++;
|
|
119
|
+
else
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
return BASE58BTC_ALPHABET[0].repeat(leadingZeros) + out;
|
|
123
|
+
}
|
|
124
|
+
function base64UrlDecode(s) {
|
|
125
|
+
if (!/^[A-Za-z0-9_-]*$/.test(s)) {
|
|
126
|
+
throw new Error("decodeMultibase: invalid base64url characters");
|
|
127
|
+
}
|
|
128
|
+
return new Uint8Array(Buffer.from(s, "base64url"));
|
|
129
|
+
}
|
|
130
|
+
function base64UrlEncode(bytes) {
|
|
131
|
+
return Buffer.from(bytes).toString("base64url");
|
|
132
|
+
}
|
|
133
|
+
// ============================================================================
|
|
134
|
+
// Key resolution — did:key (Ed25519 multicodec) or raw Ed25519 JWK
|
|
135
|
+
// ============================================================================
|
|
136
|
+
export class UnsupportedVerificationMethodError extends Error {
|
|
137
|
+
constructor(message) {
|
|
138
|
+
super(message);
|
|
139
|
+
this.name = "UnsupportedVerificationMethodError";
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// multicodec varint for "ed25519-pub" (table code 0xed) is the two bytes
|
|
143
|
+
// [0xed, 0x01] — 0xed >= 0x80 so the varint continues: byte0 = (0xed & 0x7f)
|
|
144
|
+
// | 0x80 = 0xed, byte1 = 0xed >> 7 = 0x01. Verified against did:key spec
|
|
145
|
+
// examples (all begin `z6Mk`, decoding to this exact 2-byte prefix).
|
|
146
|
+
const ED25519_MULTICODEC_PREFIX = [0xed, 0x01];
|
|
147
|
+
/**
|
|
148
|
+
* Resolve the raw 32-byte Ed25519 public key from a `verificationMethod`.
|
|
149
|
+
* Accepts a `did:key:z...` URI (optionally with a `#fragment`, which is
|
|
150
|
+
* ignored — did:key's method-specific-id already IS the key) or a raw
|
|
151
|
+
* `{kty:"OKP", crv:"Ed25519", x}` JWK — EXACTLY those three fields.
|
|
152
|
+
* Anything else throws {@link UnsupportedVerificationMethodError}.
|
|
153
|
+
*
|
|
154
|
+
* G6 (RedTeam rt-verdict-ESIGMCP-V02-IDENTITY-20260827, LOW): a JWK carrying
|
|
155
|
+
* ANY property beyond `{kty, crv, x}` is rejected outright, before the
|
|
156
|
+
* shape check below even runs — most notably `d` (RFC 8037 §2's PRIVATE
|
|
157
|
+
* half of an OKP/Ed25519 keypair). A counterparty handing over `d`
|
|
158
|
+
* alongside `x` is either malformed or testing whether this verifier
|
|
159
|
+
* silently drops unrecognized fields on a key it is about to trust for
|
|
160
|
+
* authentication; either way, "pass the public half, ignore the rest" is
|
|
161
|
+
* the wrong response — reject the whole JWK instead.
|
|
162
|
+
*/
|
|
163
|
+
const ALLOWED_JWK_FIELDS = new Set(["kty", "crv", "x"]);
|
|
164
|
+
export function publicKeyFromVerificationMethod(vm) {
|
|
165
|
+
if (typeof vm === "string")
|
|
166
|
+
return publicKeyFromDidKey(vm);
|
|
167
|
+
if (vm && typeof vm === "object") {
|
|
168
|
+
const extra = Object.keys(vm).filter((k) => !ALLOWED_JWK_FIELDS.has(k));
|
|
169
|
+
if (extra.length > 0) {
|
|
170
|
+
throw new UnsupportedVerificationMethodError(`unsupported Ed25519 JWK: unexpected extra field(s) ${JSON.stringify(extra)} — only ` +
|
|
171
|
+
`{kty, crv, x} is accepted (G6: no extra key material, e.g. a private "d")`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (vm &&
|
|
175
|
+
typeof vm === "object" &&
|
|
176
|
+
vm.kty === "OKP" &&
|
|
177
|
+
vm.crv === "Ed25519" &&
|
|
178
|
+
typeof vm.x === "string") {
|
|
179
|
+
let raw;
|
|
180
|
+
try {
|
|
181
|
+
raw = base64UrlDecode(vm.x);
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
throw new UnsupportedVerificationMethodError(`unsupported Ed25519 JWK: invalid base64url "x" (${err instanceof Error ? err.message : String(err)})`);
|
|
185
|
+
}
|
|
186
|
+
if (raw.length !== 32) {
|
|
187
|
+
throw new UnsupportedVerificationMethodError(`unsupported Ed25519 JWK: expected 32-byte "x", got ${raw.length}`);
|
|
188
|
+
}
|
|
189
|
+
return raw;
|
|
190
|
+
}
|
|
191
|
+
throw new UnsupportedVerificationMethodError(`unsupported verificationMethod: ${JSON.stringify(vm)}`);
|
|
192
|
+
}
|
|
193
|
+
function publicKeyFromDidKey(vm) {
|
|
194
|
+
const match = /^did:key:([^#]+)(?:#.*)?$/.exec(vm);
|
|
195
|
+
if (!match) {
|
|
196
|
+
throw new UnsupportedVerificationMethodError(`unsupported verificationMethod: ${JSON.stringify(vm)}`);
|
|
197
|
+
}
|
|
198
|
+
let decoded;
|
|
199
|
+
try {
|
|
200
|
+
decoded = decodeMultibase(match[1]);
|
|
201
|
+
}
|
|
202
|
+
catch (err) {
|
|
203
|
+
throw new UnsupportedVerificationMethodError(`unsupported did:key verificationMethod ${JSON.stringify(vm)}: ${err instanceof Error ? err.message : String(err)}`);
|
|
204
|
+
}
|
|
205
|
+
if (decoded.length !== 34 ||
|
|
206
|
+
decoded[0] !== ED25519_MULTICODEC_PREFIX[0] ||
|
|
207
|
+
decoded[1] !== ED25519_MULTICODEC_PREFIX[1]) {
|
|
208
|
+
throw new UnsupportedVerificationMethodError(`unsupported did:key verificationMethod ${JSON.stringify(vm)}: expected Ed25519 multicodec prefix ` +
|
|
209
|
+
`0xed 0x01 + 32 key bytes (34 bytes total), got ${decoded.length} bytes with prefix ` +
|
|
210
|
+
`0x${(decoded[0] ?? 0).toString(16).padStart(2, "0")} 0x${(decoded[1] ?? 0).toString(16).padStart(2, "0")}`);
|
|
211
|
+
}
|
|
212
|
+
return decoded.slice(2);
|
|
213
|
+
}
|
|
214
|
+
// ============================================================================
|
|
215
|
+
// DataIntegrityProof verification
|
|
216
|
+
// ============================================================================
|
|
217
|
+
// DER SubjectPublicKeyInfo prefix for a raw Ed25519 public key (RFC 8410):
|
|
218
|
+
// SEQUENCE { SEQUENCE { OID 1.3.101.112 (Ed25519) } BIT STRING (32 bytes) }.
|
|
219
|
+
// Verified live against node:crypto's own SPKI export for a generated
|
|
220
|
+
// Ed25519 key (identical 12-byte prefix) before use here.
|
|
221
|
+
const ED25519_SPKI_PREFIX = Uint8Array.from([
|
|
222
|
+
0x30, 0x2a, 0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, 0x70, 0x03, 0x21, 0x00,
|
|
223
|
+
]);
|
|
224
|
+
function sha256Hex(bytes) {
|
|
225
|
+
return createHash("sha256").update(bytes).digest("hex");
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Verify an `eddsa-jcs-2022` `DataIntegrityProof` over `document`. `document`
|
|
229
|
+
* must NOT include the `proof` property — pass the same shape
|
|
230
|
+
* `createExchange` signed (everything except `proof`; see the module doc
|
|
231
|
+
* comment on the signed-bytes construction). Never throws: any failure
|
|
232
|
+
* (unknown type/cryptosuite, purpose mismatch, unresolvable or wrong-length
|
|
233
|
+
* key, bad multibase `proofValue`, bad signature) comes back as `ok: false`
|
|
234
|
+
* with a `reason`, fail-closed like the rest of this package
|
|
235
|
+
* (revocation.ts's `verifyRevocationListIntegrity`).
|
|
236
|
+
*/
|
|
237
|
+
export function verifyDataIntegrityProof(document, proof, opts = {}) {
|
|
238
|
+
const verificationMethod = proof?.verificationMethod ?? "";
|
|
239
|
+
try {
|
|
240
|
+
if (proof?.type !== "DataIntegrityProof") {
|
|
241
|
+
return {
|
|
242
|
+
ok: false,
|
|
243
|
+
reason: `unsupported proof type: ${JSON.stringify(proof?.type)}`,
|
|
244
|
+
verificationMethod,
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
if (proof.cryptosuite !== "eddsa-jcs-2022") {
|
|
248
|
+
return {
|
|
249
|
+
ok: false,
|
|
250
|
+
reason: `unsupported cryptosuite: ${JSON.stringify(proof.cryptosuite)}`,
|
|
251
|
+
verificationMethod,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
if (opts.expectedProofPurpose !== undefined &&
|
|
255
|
+
proof.proofPurpose !== opts.expectedProofPurpose) {
|
|
256
|
+
return {
|
|
257
|
+
ok: false,
|
|
258
|
+
reason: `proofPurpose mismatch: expected "${opts.expectedProofPurpose}", got "${proof.proofPurpose}"`,
|
|
259
|
+
verificationMethod,
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
let publicKey;
|
|
263
|
+
try {
|
|
264
|
+
publicKey = opts.publicKey ?? publicKeyFromVerificationMethod(proof.verificationMethod);
|
|
265
|
+
}
|
|
266
|
+
catch (err) {
|
|
267
|
+
return {
|
|
268
|
+
ok: false,
|
|
269
|
+
reason: err instanceof Error ? err.message : String(err),
|
|
270
|
+
verificationMethod,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
if (publicKey.length !== 32) {
|
|
274
|
+
return {
|
|
275
|
+
ok: false,
|
|
276
|
+
reason: `invalid public key length: expected 32 bytes, got ${publicKey.length}`,
|
|
277
|
+
verificationMethod,
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
const keyFingerprint = sha256Hex(publicKey);
|
|
281
|
+
let signature;
|
|
282
|
+
try {
|
|
283
|
+
signature = decodeMultibase(proof.proofValue);
|
|
284
|
+
}
|
|
285
|
+
catch (err) {
|
|
286
|
+
return {
|
|
287
|
+
ok: false,
|
|
288
|
+
reason: `bad multibase proofValue: ${err instanceof Error ? err.message : String(err)}`,
|
|
289
|
+
keyFingerprint,
|
|
290
|
+
verificationMethod,
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
const keyObject = createPublicKey({
|
|
294
|
+
key: Buffer.concat([Buffer.from(ED25519_SPKI_PREFIX), Buffer.from(publicKey)]),
|
|
295
|
+
format: "der",
|
|
296
|
+
type: "spki",
|
|
297
|
+
});
|
|
298
|
+
// The exact bytes createExchange signed: jcsBytes(body-without-proof),
|
|
299
|
+
// NOT a W3C proofConfig-hash construction — see module doc comment.
|
|
300
|
+
const signedBytes = jcsBytes(document);
|
|
301
|
+
const sigOk = ed25519Verify(null, signedBytes, keyObject, signature);
|
|
302
|
+
if (!sigOk) {
|
|
303
|
+
return { ok: false, reason: "signature verification failed", keyFingerprint, verificationMethod };
|
|
304
|
+
}
|
|
305
|
+
return { ok: true, keyFingerprint, verificationMethod };
|
|
306
|
+
}
|
|
307
|
+
catch (err) {
|
|
308
|
+
return {
|
|
309
|
+
ok: false,
|
|
310
|
+
reason: `verification error: ${err instanceof Error ? err.message : String(err)}`,
|
|
311
|
+
verificationMethod,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Thin alias of {@link verifyDataIntegrityProof} for an arbitrary
|
|
317
|
+
* JCS-canonicalizable document that carries no embedded `proof` field of its
|
|
318
|
+
* own — e.g. the MCP sole-control challenge
|
|
319
|
+
* (docs/architecture/esig-mcp.md § 12: `{type, envelopeId, signerId,
|
|
320
|
+
* htmlSha256, nonce, issuedAt, expiresAt}`, proof presented alongside it,
|
|
321
|
+
* never inside it).
|
|
322
|
+
*/
|
|
323
|
+
export function verifyChallengeProof(challenge, proof, opts = {}) {
|
|
324
|
+
return verifyDataIntegrityProof(challenge, proof, opts);
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Verify both proofs on a `UaidExchange` produced by `createExchange`
|
|
328
|
+
* (./index.ts:197-254): `proof[0]` is always the agent's (`authentication`),
|
|
329
|
+
* `proof[1]` is always the issuer's (`assertionMethod`) — createExchange
|
|
330
|
+
* constructs the array in exactly that fixed order (./index.ts:253). Both
|
|
331
|
+
* proofs sign the same canonical bytes: the exchange with its `proof` array
|
|
332
|
+
* removed. Never throws.
|
|
333
|
+
*/
|
|
334
|
+
export function verifyExchange(exchange, opts = {}) {
|
|
335
|
+
const proofCount = Array.isArray(exchange?.proof) ? exchange.proof.length : -1;
|
|
336
|
+
if (proofCount !== 2) {
|
|
337
|
+
const reason = `expected exactly 2 proofs (agent, issuer), got ${proofCount < 0 ? "none" : proofCount}`;
|
|
338
|
+
const unresolved = { ok: false, reason, verificationMethod: "" };
|
|
339
|
+
return { ok: false, agent: unresolved, issuer: unresolved, failures: [reason] };
|
|
340
|
+
}
|
|
341
|
+
const { proof, ...documentBody } = exchange;
|
|
342
|
+
const [agentProof, issuerProof] = proof;
|
|
343
|
+
const agent = verifyDataIntegrityProof(documentBody, agentProof, {
|
|
344
|
+
publicKey: opts.agentPublicKey,
|
|
345
|
+
expectedProofPurpose: "authentication",
|
|
346
|
+
});
|
|
347
|
+
const issuer = verifyDataIntegrityProof(documentBody, issuerProof, {
|
|
348
|
+
publicKey: opts.issuerPublicKey,
|
|
349
|
+
expectedProofPurpose: "assertionMethod",
|
|
350
|
+
});
|
|
351
|
+
const failures = [];
|
|
352
|
+
if (!agent.ok)
|
|
353
|
+
failures.push(`agent: ${agent.reason}`);
|
|
354
|
+
if (!issuer.ok)
|
|
355
|
+
failures.push(`issuer: ${issuer.reason}`);
|
|
356
|
+
return { ok: agent.ok && issuer.ok, agent, issuer, failures };
|
|
357
|
+
}
|
|
358
|
+
//# sourceMappingURL=verify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../src/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MA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MAAM,EAAE,CAAC,CAAC;IACvD,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,CAAC,WAAW,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAE1D,OAAO,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,IAAI,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAChE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-sig/uaid-exch",
|
|
3
|
-
"version": "0.1.0-preview.
|
|
3
|
+
"version": "0.1.0-preview.2",
|
|
4
4
|
"description": "Preview implementation of the IAASO Exchange Profile (ADR-006, under review). Wraps @e-sig/core envelopes as per-transaction signed authorizations on the UUAID Network with subject + issuer proofs and Polygon-anchored batch receipts. Wire format will be finalized when ADR-006 is Accepted.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
],
|
|
46
46
|
"repository": {
|
|
47
47
|
"type": "git",
|
|
48
|
-
"url": "https://github.com/vmvtech/esig-suite.git",
|
|
48
|
+
"url": "git+https://github.com/vmvtech/esig-suite.git",
|
|
49
49
|
"directory": "packages/esig-uaid-exch"
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://github.com/vmvtech/esig-suite/tree/main/packages/esig-uaid-exch#readme",
|
|
@@ -53,16 +53,17 @@
|
|
|
53
53
|
"@uuaid/sdk": "^0.1.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@e-sig/core": "^0.5.0"
|
|
56
|
+
"@e-sig/core": "^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@e-sig/core": "^0.
|
|
59
|
+
"@e-sig/core": "^0.8.0",
|
|
60
60
|
"@types/node": "^22.0.0",
|
|
61
61
|
"typescript": "^5.4.0",
|
|
62
|
-
"vitest": "^
|
|
62
|
+
"vitest": "^4.1.10"
|
|
63
63
|
},
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"registry": "https://registry.npmjs.org",
|
|
66
|
-
"access": "public"
|
|
66
|
+
"access": "public",
|
|
67
|
+
"tag": "preview"
|
|
67
68
|
}
|
|
68
69
|
}
|