@midnight-ntwrk/credential-compact 0.2.0 → 0.3.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/CHANGELOG.md +19 -2
- package/README.md +65 -1
- package/dist/compact-build.json +2 -2
- package/dist/compact-value-codec.d.ts.map +1 -1
- package/dist/compact-value-codec.js +3 -0
- package/dist/compact-value-codec.js.map +1 -1
- package/dist/credentials/signer-authorization.compact +5 -0
- package/dist/credentials/vc.compact +6 -0
- package/dist/credentials/vp.compact +46 -0
- package/dist/managed/credentials/contract/index.js +14 -14
- package/dist/managed/credentials/contract/index.js.map +1 -1
- package/package.json +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 0.3.0 - 2026-10-01
|
|
6
|
+
|
|
7
|
+
- Keep the repository's pnpm requirement development-only so published Compact
|
|
8
|
+
consumers are not coupled to this monorepo's package manager.
|
|
9
|
+
- BREAKING: Make typed Compact payload decoding fail closed unless descriptor
|
|
10
|
+
re-encoding reproduces the exact payload, rejecting alternate zero-padded
|
|
11
|
+
chunk widths and lossy descriptor round trips while preserving untyped chunk
|
|
12
|
+
framing.
|
|
13
|
+
- Add the supported explicit-holder presentation-proof composition, including
|
|
14
|
+
credential-to-presentation holder equality, signer-reference and accepted-key
|
|
15
|
+
binding, internally derived body-root verification, and substitution-negative
|
|
16
|
+
conformance.
|
|
17
|
+
- Require every normative non-codec operation to map back to a supported core
|
|
18
|
+
or extension Compact circuit.
|
|
19
|
+
|
|
20
|
+
## 0.2.0 - 2026-09-25
|
|
4
21
|
|
|
5
22
|
- Classified every exported Compact circuit and added fail-closed coverage for
|
|
6
23
|
envelope invariants, verification-method references, proof contexts, and
|
|
@@ -14,7 +31,7 @@
|
|
|
14
31
|
exact method/key/scope binding circuits, monotonic lifecycle validation, and
|
|
15
32
|
domain-separated Jubjub authority and verifier-request proof contexts without
|
|
16
33
|
introducing Trust Registry or datetime dependencies.
|
|
17
|
-
- Documented `midnight-did` `0.
|
|
34
|
+
- Documented `midnight-did` `0.7.0` as the current downstream adapter
|
|
18
35
|
compatibility baseline while keeping the Compact package DID-independent.
|
|
19
36
|
- Bound authority decisions to an explicit consumer/network domain, made
|
|
20
37
|
revocation terminal per authorization ID, validated Jubjub subgroup
|
package/README.md
CHANGED
|
@@ -4,10 +4,25 @@
|
|
|
4
4
|
> Maturity: `core`
|
|
5
5
|
> Package class: `dist`
|
|
6
6
|
|
|
7
|
-
Supported
|
|
7
|
+
Supported pre-1.0 package for reusable, family-neutral Compact VC/VP
|
|
8
8
|
semantics. This is a library include surface, not a deployable contract,
|
|
9
9
|
credential family, proof artifact, or registry authority.
|
|
10
10
|
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add -E @midnight-ntwrk/credential-compact@0.2.0
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`0.2.0` is the current stable release. To evaluate the current 0.3 release
|
|
18
|
+
candidate explicitly, install
|
|
19
|
+
`@midnight-ntwrk/credential-compact@0.3.0-rc1` and keep every package in the
|
|
20
|
+
VC graph on that same version. Confirm the moving `rc` tag before adopting it:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm view @midnight-ntwrk/credential-compact dist-tags --json
|
|
24
|
+
```
|
|
25
|
+
|
|
11
26
|
## Scope
|
|
12
27
|
|
|
13
28
|
The package contains generic VC/VP envelopes, schema references, issuer and
|
|
@@ -25,12 +40,30 @@ domain-separated challenges, and verify Schnorr signatures. Signed timestamps
|
|
|
25
40
|
and challenge hashes still require application-defined time, freshness,
|
|
26
41
|
audience, and replay policy.
|
|
27
42
|
|
|
43
|
+
`ExplicitHolderPresentationProof<TPublicClaims, TClaimCommitments,
|
|
44
|
+
TDisclosures, TStatusBinding>::assertValidPresentationProof` is the supported
|
|
45
|
+
presentation-proof entrypoint. It accepts the credential, an independently
|
|
46
|
+
accepted holder public key, the complete presentation, and its proof; derives
|
|
47
|
+
the presentation root internally; validates generic VC-to-VP relations; rejects
|
|
48
|
+
holder or proof-key mismatch; binds the proof signer reference and key; and
|
|
49
|
+
verifies the presentation-context signature. The accepted key is a trust input:
|
|
50
|
+
the circuit cannot distinguish a pinned or authorized method snapshot from an
|
|
51
|
+
internally consistent attacker-supplied snapshot. Consumers still apply
|
|
52
|
+
credential-proof verification, DID resolution or snapshot authentication,
|
|
53
|
+
family-specific disclosure relations, status, freshness, and application policy
|
|
54
|
+
separately.
|
|
55
|
+
|
|
28
56
|
Signer authorization supports two composition modes. Applications may install
|
|
29
57
|
an accepted descriptor through local governance, or verify a domain-separated
|
|
30
58
|
authority proof before materializing the same descriptor. The authorization
|
|
31
59
|
proof is bound to a caller-configured network/consumer domain. The composed
|
|
32
60
|
`VC<>::assertAuthorizedIssuerProof` and verifier-request helper verify the
|
|
33
61
|
signature as well as the exact role, method, key, and scope binding. This
|
|
62
|
+
composed issuer helper is the supported authorization-aware issuance path.
|
|
63
|
+
`assertAuthorizedIssuerDescriptor` and
|
|
64
|
+
`assertProofSignerMatchesAuthorization` are low-level metadata comparisons and
|
|
65
|
+
do not verify a signature. `VC<>::assertValidCredentialProof` verifies a
|
|
66
|
+
credential's self-declared issuer proof but does not authorize that issuer. This
|
|
34
67
|
package does not resolve
|
|
35
68
|
`midnight-did`, evaluate Trust Registry policy, synchronize registry state, or
|
|
36
69
|
provide trusted wall-clock time.
|
|
@@ -77,3 +110,34 @@ the repository's npm publication runbook.
|
|
|
77
110
|
Consumers must use the package name and explicit exports, never repository
|
|
78
111
|
relative includes or `src`/`managed` paths. Candidate tarball and clean-consumer
|
|
79
112
|
checks compile every advertised Compact entrypoint outside this repository.
|
|
113
|
+
|
|
114
|
+
## TypeScript value framing
|
|
115
|
+
|
|
116
|
+
The TypeScript export encodes and decodes canonical Compact runtime values for
|
|
117
|
+
transport or storage. Typed application payloads should use
|
|
118
|
+
`encodeCompactPayload` and `decodeCompactPayload` with the generated descriptor
|
|
119
|
+
for that type.
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
import {
|
|
123
|
+
decodeCompactValue,
|
|
124
|
+
encodeCompactValue,
|
|
125
|
+
} from "@midnight-ntwrk/credential-compact";
|
|
126
|
+
|
|
127
|
+
const encoded = encodeCompactValue([Uint8Array.of(1, 2, 3)]);
|
|
128
|
+
const decoded = decodeCompactValue(encoded);
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Compatibility and support
|
|
132
|
+
|
|
133
|
+
- The TypeScript surface is ESM-only and supports Node.js 24 or newer.
|
|
134
|
+
- Compact consumers use compiler `0.31.1`, runtime `0.16.0`, and Ledger
|
|
135
|
+
`8.0.2`.
|
|
136
|
+
- During `0.x`, breaking API changes may ship in a minor release. Keep exact
|
|
137
|
+
versions pinned and read [`CHANGELOG.md`](./CHANGELOG.md) before upgrading.
|
|
138
|
+
- Release candidates are supported only until a newer candidate or stable
|
|
139
|
+
release in the same minor line is published.
|
|
140
|
+
|
|
141
|
+
Technical ownership belongs to `@midnightntwrk/ex-identus`. Release operations
|
|
142
|
+
belong to `@midnightntwrk/mn-sre`. Security reports follow the repository
|
|
143
|
+
[`SECURITY.md`](../../../SECURITY.md) process.
|
package/dist/compact-build.json
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
"name": "@midnight-ntwrk/compact-runtime",
|
|
6
6
|
"version": "0.16.0"
|
|
7
7
|
},
|
|
8
|
-
"sourceDigest": "
|
|
9
|
-
"artifactDigest": "
|
|
8
|
+
"sourceDigest": "3a2e6360bfce9c9d182bee43b852347ae5ec3395c5e2ec0726a39b3c137d03dd",
|
|
9
|
+
"artifactDigest": "ea1cda2a6f0c0c7b113d8f6caf72da6dd06611b6cfca8dbf934b501a69fbff0d",
|
|
10
10
|
"sourceFiles": [
|
|
11
11
|
"src/credentials/composable.compact",
|
|
12
12
|
"src/credentials/holder-bindings.compact",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compact-value-codec.d.ts","sourceRoot":"","sources":["../src/compact-value-codec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAE1E,eAAO,MAAM,sBAAsB,EAAG,4BAAqC,CAAC;AAS5E,MAAM,MAAM,oBAAoB,GAAG,OAAO,sBAAsB,CAAC;AAEjE,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAgFF,eAAO,MAAM,mBAAmB,GAC9B,OAAO,SAAS,UAAU,EAAE,KAC3B,UAiBF,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,OAAO,UAAU,KAAG,KAyBzD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,OAAO,SAAS,UAAU,EAAE,KAC3B,mBAGD,CAAC;AAEH,eAAO,MAAM,kBAAkB,GAAI,SAAS,mBAAmB,KAAG,KAKjE,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,CAAC,EACpC,YAAY,WAAW,CAAC,CAAC,CAAC,EAC1B,OAAO,CAAC,KACP,mBAAoE,CAAC;AAExE,eAAO,MAAM,oBAAoB,GAAI,CAAC,EACpC,YAAY,WAAW,CAAC,CAAC,CAAC,EAC1B,SAAS,mBAAmB,KAC3B,
|
|
1
|
+
{"version":3,"file":"compact-value-codec.d.ts","sourceRoot":"","sources":["../src/compact-value-codec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAE1E,eAAO,MAAM,sBAAsB,EAAG,4BAAqC,CAAC;AAS5E,MAAM,MAAM,oBAAoB,GAAG,OAAO,sBAAsB,CAAC;AAEjE,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAgFF,eAAO,MAAM,mBAAmB,GAC9B,OAAO,SAAS,UAAU,EAAE,KAC3B,UAiBF,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,OAAO,UAAU,KAAG,KAyBzD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,OAAO,SAAS,UAAU,EAAE,KAC3B,mBAGD,CAAC;AAEH,eAAO,MAAM,kBAAkB,GAAI,SAAS,mBAAmB,KAAG,KAKjE,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,CAAC,EACpC,YAAY,WAAW,CAAC,CAAC,CAAC,EAC1B,OAAO,CAAC,KACP,mBAAoE,CAAC;AAExE,eAAO,MAAM,oBAAoB,GAAI,CAAC,EACpC,YAAY,WAAW,CAAC,CAAC,CAAC,EAC1B,SAAS,mBAAmB,KAC3B,CAYF,CAAC"}
|
|
@@ -130,6 +130,9 @@ export const decodeCompactPayload = (descriptor, encoded) => {
|
|
|
130
130
|
if (runtimeValue.length !== 0) {
|
|
131
131
|
throw new Error("Compact value payload contains trailing chunks for descriptor");
|
|
132
132
|
}
|
|
133
|
+
if (encodeCompactPayload(descriptor, decoded).payload !== encoded.payload) {
|
|
134
|
+
throw new Error("Compact value payload is not canonical for descriptor");
|
|
135
|
+
}
|
|
133
136
|
return decoded;
|
|
134
137
|
};
|
|
135
138
|
//# sourceMappingURL=compact-value-codec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compact-value-codec.js","sourceRoot":"","sources":["../src/compact-value-codec.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,sBAAsB,GAAG,4BAAqC,CAAC;AAE5E,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO;AAC/D,MAAM,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AAI,KAAK,CAAC,uCAAuC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IAC9E,CAAC;IACD,OAAO,qBAAqB,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;AAC/D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,UAA0B,EAC1B,KAAQ,EACa,EAAE,CAAC,kBAAkB,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AAExE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,UAA0B,EAC1B,OAA4B,EACzB,EAAE;IACL,MAAM,YAAY,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACjD,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACnD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CACb,+DAA+D,CAChE,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import type { CompactType, Value } from \"@midnight-ntwrk/compact-runtime\";\n\nexport const COMPACT_VALUE_ENCODING = \"compact-value-v1.base64url\" as const;\n\nconst MAGIC = new Uint8Array([0x4d, 0x43, 0x56, 0x31]); // MCV1\nconst HEADER_LENGTH = MAGIC.length + 4;\nconst CHUNK_LENGTH_BYTES = 4;\nconst BASE64URL_ALPHABET =\n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_\";\nconst BASE64URL_TEXT = /^[A-Za-z0-9_-]+$/u;\n\nexport type CompactValueEncoding = typeof COMPACT_VALUE_ENCODING;\n\nexport type EncodedCompactValue = {\n readonly encoding: CompactValueEncoding;\n readonly payload: string;\n};\n\nconst assertUint32 = (value: number, label: string): void => {\n if (!Number.isInteger(value) || value < 0 || value > 0xffffffff) {\n throw new Error(`${label} must fit into uint32`);\n }\n};\n\nconst writeUint32 = (\n target: Uint8Array,\n offset: number,\n value: number,\n): void => {\n assertUint32(value, \"uint32 value\");\n target[offset] = (value >>> 24) & 0xff;\n target[offset + 1] = (value >>> 16) & 0xff;\n target[offset + 2] = (value >>> 8) & 0xff;\n target[offset + 3] = value & 0xff;\n};\n\nconst readUint32 = (source: Uint8Array, offset: number): number => {\n if (offset + CHUNK_LENGTH_BYTES > source.length) {\n throw new Error(\"Compact value payload ended before uint32 field\");\n }\n return (\n source[offset] * 0x1000000 +\n ((source[offset + 1] ?? 0) << 16) +\n ((source[offset + 2] ?? 0) << 8) +\n (source[offset + 3] ?? 0)\n );\n};\n\nconst toBase64Url = (bytes: Uint8Array): string => {\n let encoded = \"\";\n for (let offset = 0; offset < bytes.length; offset += 3) {\n const first = bytes[offset] ?? 0;\n const second = bytes[offset + 1] ?? 0;\n const third = bytes[offset + 2] ?? 0;\n const packed = (first << 16) | (second << 8) | third;\n encoded += BASE64URL_ALPHABET[(packed >>> 18) & 0x3f];\n encoded += BASE64URL_ALPHABET[(packed >>> 12) & 0x3f];\n if (offset + 1 < bytes.length) {\n encoded += BASE64URL_ALPHABET[(packed >>> 6) & 0x3f];\n }\n if (offset + 2 < bytes.length) {\n encoded += BASE64URL_ALPHABET[packed & 0x3f];\n }\n }\n return encoded;\n};\n\nconst fromBase64Url = (value: string): Uint8Array => {\n if (value.length === 0) {\n throw new Error(\"Compact value payload must not be empty\");\n }\n if (!BASE64URL_TEXT.test(value) || value.length % 4 === 1) {\n throw new Error(\"Compact value payload is not valid unpadded base64url\");\n }\n const decoded = new Uint8Array(Math.floor((value.length * 6) / 8));\n let accumulator = 0;\n let bitCount = 0;\n let outputOffset = 0;\n for (const character of value) {\n const index = BASE64URL_ALPHABET.indexOf(character);\n accumulator = (accumulator << 6) | index;\n bitCount += 6;\n if (bitCount >= 8) {\n bitCount -= 8;\n decoded[outputOffset] = (accumulator >>> bitCount) & 0xff;\n outputOffset += 1;\n }\n }\n if (toBase64Url(decoded) !== value) {\n throw new Error(\n \"Compact value payload is not canonical unpadded base64url\",\n );\n }\n return decoded;\n};\n\nexport const compactValueToBytes = (\n value: readonly Uint8Array[],\n): Uint8Array => {\n assertUint32(value.length, \"Compact value chunk count\");\n const bodyLength = value.reduce((total, chunk) => {\n assertUint32(chunk.length, \"Compact value chunk length\");\n return total + CHUNK_LENGTH_BYTES + chunk.length;\n }, 0);\n const result = new Uint8Array(HEADER_LENGTH + bodyLength);\n result.set(MAGIC, 0);\n writeUint32(result, MAGIC.length, value.length);\n let offset = HEADER_LENGTH;\n for (const chunk of value) {\n writeUint32(result, offset, chunk.length);\n offset += CHUNK_LENGTH_BYTES;\n result.set(chunk, offset);\n offset += chunk.length;\n }\n return result;\n};\n\nexport const compactValueFromBytes = (bytes: Uint8Array): Value => {\n if (bytes.length < HEADER_LENGTH) {\n throw new Error(\"Compact value payload is shorter than the header\");\n }\n for (let i = 0; i < MAGIC.length; i += 1) {\n if (bytes[i] !== MAGIC[i]) {\n throw new Error(\"Compact value payload has an unexpected magic header\");\n }\n }\n const chunkCount = readUint32(bytes, MAGIC.length);\n const chunks: Uint8Array[] = [];\n let offset = HEADER_LENGTH;\n for (let i = 0; i < chunkCount; i += 1) {\n const length = readUint32(bytes, offset);\n offset += CHUNK_LENGTH_BYTES;\n if (offset + length > bytes.length) {\n throw new Error(\"Compact value chunk exceeds payload length\");\n }\n chunks.push(bytes.slice(offset, offset + length));\n offset += length;\n }\n if (offset !== bytes.length) {\n throw new Error(\"Compact value payload contains trailing bytes\");\n }\n return chunks;\n};\n\nexport const encodeCompactValue = (\n value: readonly Uint8Array[],\n): EncodedCompactValue => ({\n encoding: COMPACT_VALUE_ENCODING,\n payload: toBase64Url(compactValueToBytes(value)),\n});\n\nexport const decodeCompactValue = (encoded: EncodedCompactValue): Value => {\n if (encoded.encoding !== COMPACT_VALUE_ENCODING) {\n throw new Error(`Unsupported Compact value encoding \"${encoded.encoding}\"`);\n }\n return compactValueFromBytes(fromBase64Url(encoded.payload));\n};\n\nexport const encodeCompactPayload = <T>(\n descriptor: CompactType<T>,\n value: T,\n): EncodedCompactValue => encodeCompactValue(descriptor.toValue(value));\n\nexport const decodeCompactPayload = <T>(\n descriptor: CompactType<T>,\n encoded: EncodedCompactValue,\n): T => {\n const runtimeValue = decodeCompactValue(encoded);\n const decoded = descriptor.fromValue(runtimeValue);\n if (runtimeValue.length !== 0) {\n throw new Error(\n \"Compact value payload contains trailing chunks for descriptor\",\n );\n }\n return decoded;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"compact-value-codec.js","sourceRoot":"","sources":["../src/compact-value-codec.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,sBAAsB,GAAG,4BAAqC,CAAC;AAE5E,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO;AAC/D,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AACvC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,kBAAkB,GACtB,kEAAkE,CAAC;AACrE,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAS3C,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,KAAa,EAAQ,EAAE;IAC1D,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,UAAU,EAAE,CAAC;QAChE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,uBAAuB,CAAC,CAAC;IACnD,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAClB,MAAkB,EAClB,MAAc,EACd,KAAa,EACP,EAAE;IACR,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IACpC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACvC,MAAM,CAAC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UAAU,EAAE,OAAO,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC;QAC1E,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import type { CompactType, Value } from \"@midnight-ntwrk/compact-runtime\";\n\nexport const COMPACT_VALUE_ENCODING = \"compact-value-v1.base64url\" as const;\n\nconst MAGIC = new Uint8Array([0x4d, 0x43, 0x56, 0x31]); // MCV1\nconst HEADER_LENGTH = MAGIC.length + 4;\nconst CHUNK_LENGTH_BYTES = 4;\nconst BASE64URL_ALPHABET =\n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_\";\nconst BASE64URL_TEXT = /^[A-Za-z0-9_-]+$/u;\n\nexport type CompactValueEncoding = typeof COMPACT_VALUE_ENCODING;\n\nexport type EncodedCompactValue = {\n readonly encoding: CompactValueEncoding;\n readonly payload: string;\n};\n\nconst assertUint32 = (value: number, label: string): void => {\n if (!Number.isInteger(value) || value < 0 || value > 0xffffffff) {\n throw new Error(`${label} must fit into uint32`);\n }\n};\n\nconst writeUint32 = (\n target: Uint8Array,\n offset: number,\n value: number,\n): void => {\n assertUint32(value, \"uint32 value\");\n target[offset] = (value >>> 24) & 0xff;\n target[offset + 1] = (value >>> 16) & 0xff;\n target[offset + 2] = (value >>> 8) & 0xff;\n target[offset + 3] = value & 0xff;\n};\n\nconst readUint32 = (source: Uint8Array, offset: number): number => {\n if (offset + CHUNK_LENGTH_BYTES > source.length) {\n throw new Error(\"Compact value payload ended before uint32 field\");\n }\n return (\n source[offset] * 0x1000000 +\n ((source[offset + 1] ?? 0) << 16) +\n ((source[offset + 2] ?? 0) << 8) +\n (source[offset + 3] ?? 0)\n );\n};\n\nconst toBase64Url = (bytes: Uint8Array): string => {\n let encoded = \"\";\n for (let offset = 0; offset < bytes.length; offset += 3) {\n const first = bytes[offset] ?? 0;\n const second = bytes[offset + 1] ?? 0;\n const third = bytes[offset + 2] ?? 0;\n const packed = (first << 16) | (second << 8) | third;\n encoded += BASE64URL_ALPHABET[(packed >>> 18) & 0x3f];\n encoded += BASE64URL_ALPHABET[(packed >>> 12) & 0x3f];\n if (offset + 1 < bytes.length) {\n encoded += BASE64URL_ALPHABET[(packed >>> 6) & 0x3f];\n }\n if (offset + 2 < bytes.length) {\n encoded += BASE64URL_ALPHABET[packed & 0x3f];\n }\n }\n return encoded;\n};\n\nconst fromBase64Url = (value: string): Uint8Array => {\n if (value.length === 0) {\n throw new Error(\"Compact value payload must not be empty\");\n }\n if (!BASE64URL_TEXT.test(value) || value.length % 4 === 1) {\n throw new Error(\"Compact value payload is not valid unpadded base64url\");\n }\n const decoded = new Uint8Array(Math.floor((value.length * 6) / 8));\n let accumulator = 0;\n let bitCount = 0;\n let outputOffset = 0;\n for (const character of value) {\n const index = BASE64URL_ALPHABET.indexOf(character);\n accumulator = (accumulator << 6) | index;\n bitCount += 6;\n if (bitCount >= 8) {\n bitCount -= 8;\n decoded[outputOffset] = (accumulator >>> bitCount) & 0xff;\n outputOffset += 1;\n }\n }\n if (toBase64Url(decoded) !== value) {\n throw new Error(\n \"Compact value payload is not canonical unpadded base64url\",\n );\n }\n return decoded;\n};\n\nexport const compactValueToBytes = (\n value: readonly Uint8Array[],\n): Uint8Array => {\n assertUint32(value.length, \"Compact value chunk count\");\n const bodyLength = value.reduce((total, chunk) => {\n assertUint32(chunk.length, \"Compact value chunk length\");\n return total + CHUNK_LENGTH_BYTES + chunk.length;\n }, 0);\n const result = new Uint8Array(HEADER_LENGTH + bodyLength);\n result.set(MAGIC, 0);\n writeUint32(result, MAGIC.length, value.length);\n let offset = HEADER_LENGTH;\n for (const chunk of value) {\n writeUint32(result, offset, chunk.length);\n offset += CHUNK_LENGTH_BYTES;\n result.set(chunk, offset);\n offset += chunk.length;\n }\n return result;\n};\n\nexport const compactValueFromBytes = (bytes: Uint8Array): Value => {\n if (bytes.length < HEADER_LENGTH) {\n throw new Error(\"Compact value payload is shorter than the header\");\n }\n for (let i = 0; i < MAGIC.length; i += 1) {\n if (bytes[i] !== MAGIC[i]) {\n throw new Error(\"Compact value payload has an unexpected magic header\");\n }\n }\n const chunkCount = readUint32(bytes, MAGIC.length);\n const chunks: Uint8Array[] = [];\n let offset = HEADER_LENGTH;\n for (let i = 0; i < chunkCount; i += 1) {\n const length = readUint32(bytes, offset);\n offset += CHUNK_LENGTH_BYTES;\n if (offset + length > bytes.length) {\n throw new Error(\"Compact value chunk exceeds payload length\");\n }\n chunks.push(bytes.slice(offset, offset + length));\n offset += length;\n }\n if (offset !== bytes.length) {\n throw new Error(\"Compact value payload contains trailing bytes\");\n }\n return chunks;\n};\n\nexport const encodeCompactValue = (\n value: readonly Uint8Array[],\n): EncodedCompactValue => ({\n encoding: COMPACT_VALUE_ENCODING,\n payload: toBase64Url(compactValueToBytes(value)),\n});\n\nexport const decodeCompactValue = (encoded: EncodedCompactValue): Value => {\n if (encoded.encoding !== COMPACT_VALUE_ENCODING) {\n throw new Error(`Unsupported Compact value encoding \"${encoded.encoding}\"`);\n }\n return compactValueFromBytes(fromBase64Url(encoded.payload));\n};\n\nexport const encodeCompactPayload = <T>(\n descriptor: CompactType<T>,\n value: T,\n): EncodedCompactValue => encodeCompactValue(descriptor.toValue(value));\n\nexport const decodeCompactPayload = <T>(\n descriptor: CompactType<T>,\n encoded: EncodedCompactValue,\n): T => {\n const runtimeValue = decodeCompactValue(encoded);\n const decoded = descriptor.fromValue(runtimeValue);\n if (runtimeValue.length !== 0) {\n throw new Error(\n \"Compact value payload contains trailing chunks for descriptor\",\n );\n }\n if (encodeCompactPayload(descriptor, decoded).payload !== encoded.payload) {\n throw new Error(\"Compact value payload is not canonical for descriptor\");\n }\n return decoded;\n};\n"]}
|
|
@@ -105,6 +105,8 @@ export pure circuit assertProofSignerMatchesAuthorization(
|
|
|
105
105
|
proof: Proof,
|
|
106
106
|
descriptor: AuthorizedSignerDescriptor
|
|
107
107
|
): [] {
|
|
108
|
+
// Low-level metadata binding only. This circuit does not verify proof.signature.
|
|
109
|
+
// Authorization-aware consumers must use a context-specific composed helper.
|
|
108
110
|
assertValidAuthorizedSignerDescriptor(descriptor);
|
|
109
111
|
assert(
|
|
110
112
|
descriptor.state == AuthorizationState.active,
|
|
@@ -131,6 +133,9 @@ export pure circuit assertAuthorizedIssuerDescriptor(
|
|
|
131
133
|
proof: Proof,
|
|
132
134
|
descriptor: AuthorizedSignerDescriptor
|
|
133
135
|
): [] {
|
|
136
|
+
// Low-level descriptor/scope binding only. A forged signature can satisfy
|
|
137
|
+
// these comparisons; VC<>::assertAuthorizedIssuerProof is the supported
|
|
138
|
+
// issuer-authorization decision circuit.
|
|
134
139
|
assertProofSignerMatchesAuthorization(proof, descriptor);
|
|
135
140
|
assert(
|
|
136
141
|
descriptor.role == SignerRole.issuer,
|
|
@@ -37,6 +37,8 @@ module VC<TPublicClaims, TClaimCommitments, THolderBinding, TStatusBinding> {
|
|
|
37
37
|
credential: Credential,
|
|
38
38
|
proof: Proof
|
|
39
39
|
): [] {
|
|
40
|
+
// Cryptographic validity only: the credential names its own issuer method.
|
|
41
|
+
// Use assertAuthorizedIssuerProof for an issuer-authorization decision.
|
|
40
42
|
const bodyRoot: Bytes<32> = credentialBodyRoot(credential);
|
|
41
43
|
assertValidCredentialProofForCanonicalBodyRoot(credential, proof, bodyRoot);
|
|
42
44
|
}
|
|
@@ -46,6 +48,8 @@ module VC<TPublicClaims, TClaimCommitments, THolderBinding, TStatusBinding> {
|
|
|
46
48
|
proof: Proof,
|
|
47
49
|
bodyRoot: Bytes<32>
|
|
48
50
|
): [] {
|
|
51
|
+
// Cryptographic validity only. The caller-supplied root is checked against
|
|
52
|
+
// the credential, but no signer authorization is applied here.
|
|
49
53
|
assert(
|
|
50
54
|
bodyRoot == credentialBodyRoot(credential),
|
|
51
55
|
"Credential body root does not match credential"
|
|
@@ -74,6 +78,8 @@ module VC<TPublicClaims, TClaimCommitments, THolderBinding, TStatusBinding> {
|
|
|
74
78
|
proof: Proof,
|
|
75
79
|
descriptor: AuthorizedSignerDescriptor
|
|
76
80
|
): [] {
|
|
81
|
+
// Canonical authorization-aware issuance path: descriptor binding and the
|
|
82
|
+
// credential-derived issuance-context signature are both mandatory.
|
|
77
83
|
assertAuthorizedIssuerDescriptor(credential.schema, proof, descriptor);
|
|
78
84
|
assertValidCredentialProof(credential, proof);
|
|
79
85
|
}
|
|
@@ -23,3 +23,49 @@ module VP<TDisclosures, THolderBinding> {
|
|
|
23
23
|
assert(presentation.version == 1, "Presentation version mismatch");
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
// Canonical presentation-proof composition for the core's supported explicit
|
|
28
|
+
// holder profile. The credential is supplied directly so a caller cannot
|
|
29
|
+
// accidentally validate against the presentation's self-selected binding.
|
|
30
|
+
module ExplicitHolderPresentationProof<
|
|
31
|
+
TPublicClaims,
|
|
32
|
+
TClaimCommitments,
|
|
33
|
+
TDisclosures,
|
|
34
|
+
TStatusBinding
|
|
35
|
+
> {
|
|
36
|
+
import VC<
|
|
37
|
+
TPublicClaims,
|
|
38
|
+
TClaimCommitments,
|
|
39
|
+
ExplicitHolderBinding,
|
|
40
|
+
TStatusBinding
|
|
41
|
+
> prefix ExplicitHolderVC_;
|
|
42
|
+
import VP<TDisclosures, ExplicitHolderBinding> prefix ExplicitHolderVP_;
|
|
43
|
+
import CredentialPresentationRelations<
|
|
44
|
+
TPublicClaims,
|
|
45
|
+
TClaimCommitments,
|
|
46
|
+
TDisclosures,
|
|
47
|
+
ExplicitHolderBinding,
|
|
48
|
+
TStatusBinding
|
|
49
|
+
> prefix ExplicitHolderRelations_;
|
|
50
|
+
|
|
51
|
+
export pure circuit assertValidPresentationProof(
|
|
52
|
+
credential: ExplicitHolderVC_Credential,
|
|
53
|
+
acceptedHolderPublicKey: JubjubPoint,
|
|
54
|
+
presentation: ExplicitHolderVP_Presentation,
|
|
55
|
+
proof: Proof
|
|
56
|
+
): [] {
|
|
57
|
+
const bodyRoot: Bytes<32> = ExplicitHolderVP_presentationBodyRoot(presentation);
|
|
58
|
+
ExplicitHolderVP_assertValidPresentationEnvelope(presentation);
|
|
59
|
+
ExplicitHolderRelations_assertMatchingCredentialPresentation(
|
|
60
|
+
credential,
|
|
61
|
+
presentation
|
|
62
|
+
);
|
|
63
|
+
assertMatchingExplicitHolderBindings(
|
|
64
|
+
credential.holderBinding,
|
|
65
|
+
presentation.holderBinding
|
|
66
|
+
);
|
|
67
|
+
assertProofMatchesExplicitHolderBinding(presentation.holderBinding, proof);
|
|
68
|
+
assertMatchingJubjubPoints(acceptedHolderPublicKey, proof.publicKey);
|
|
69
|
+
assertValidPresentationContextProof(bodyRoot, proof);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -1363,21 +1363,21 @@ export const pureCircuits = {
|
|
|
1363
1363
|
if (!(typeof(schema_0) === 'object' && schema_0.packageId.buffer instanceof ArrayBuffer && schema_0.packageId.BYTES_PER_ELEMENT === 1 && schema_0.packageId.length === 32 && schema_0.schemaId.buffer instanceof ArrayBuffer && schema_0.schemaId.BYTES_PER_ELEMENT === 1 && schema_0.schemaId.length === 32 && typeof(schema_0.majorVersion) === 'bigint' && schema_0.majorVersion >= 0n && schema_0.majorVersion <= 65535n && typeof(schema_0.minorVersion) === 'bigint' && schema_0.minorVersion >= 0n && schema_0.minorVersion <= 65535n)) {
|
|
1364
1364
|
__compactRuntime.typeError('assertAuthorizedIssuerDescriptor',
|
|
1365
1365
|
'argument 1',
|
|
1366
|
-
'signer-authorization.compact line
|
|
1366
|
+
'signer-authorization.compact line 131 char 1',
|
|
1367
1367
|
'struct SchemaRef<packageId: Bytes<32>, schemaId: Bytes<32>, majorVersion: Uint<0..65536>, minorVersion: Uint<0..65536>>',
|
|
1368
1368
|
schema_0)
|
|
1369
1369
|
}
|
|
1370
1370
|
if (!(typeof(proof_0) === 'object' && typeof(proof_0.signerVerificationMethodRef) === 'object' && typeof(proof_0.signerVerificationMethodRef.controllerAddress) === 'object' && proof_0.signerVerificationMethodRef.controllerAddress.bytes.buffer instanceof ArrayBuffer && proof_0.signerVerificationMethodRef.controllerAddress.bytes.BYTES_PER_ELEMENT === 1 && proof_0.signerVerificationMethodRef.controllerAddress.bytes.length === 32 && proof_0.signerVerificationMethodRef.methodId.buffer instanceof ArrayBuffer && proof_0.signerVerificationMethodRef.methodId.BYTES_PER_ELEMENT === 1 && proof_0.signerVerificationMethodRef.methodId.length === 32 && typeof(proof_0.createdAt) === 'bigint' && proof_0.createdAt >= 0n && proof_0.createdAt <= 18446744073709551615n && proof_0.challengeHash.buffer instanceof ArrayBuffer && proof_0.challengeHash.BYTES_PER_ELEMENT === 1 && proof_0.challengeHash.length === 32 && true && typeof(proof_0.signature) === 'object' && true && typeof(proof_0.signature.s) === 'bigint' && proof_0.signature.s >= 0 && proof_0.signature.s <= __compactRuntime.MAX_FIELD)) {
|
|
1371
1371
|
__compactRuntime.typeError('assertAuthorizedIssuerDescriptor',
|
|
1372
1372
|
'argument 2',
|
|
1373
|
-
'signer-authorization.compact line
|
|
1373
|
+
'signer-authorization.compact line 131 char 1',
|
|
1374
1374
|
'struct Proof<signerVerificationMethodRef: struct VerificationMethodRef<controllerAddress: struct ContractAddress<bytes: Bytes<32>>, methodId: Bytes<32>>, createdAt: Uint<0..18446744073709551616>, challengeHash: Bytes<32>, publicKey: Opaque<"JubjubPoint">, signature: struct Signature<r: Opaque<"JubjubPoint">, s: Field>>',
|
|
1375
1375
|
proof_0)
|
|
1376
1376
|
}
|
|
1377
1377
|
if (!(typeof(descriptor_0) === 'object' && typeof(descriptor_0.version) === 'bigint' && descriptor_0.version >= 0n && descriptor_0.version <= 65535n && descriptor_0.authorizationId.buffer instanceof ArrayBuffer && descriptor_0.authorizationId.BYTES_PER_ELEMENT === 1 && descriptor_0.authorizationId.length === 32 && typeof(descriptor_0.decisionSequence) === 'bigint' && descriptor_0.decisionSequence >= 0n && descriptor_0.decisionSequence <= 18446744073709551615n && typeof(descriptor_0.state) === 'number' && descriptor_0.state >= 0 && descriptor_0.state <= 2 && typeof(descriptor_0.role) === 'number' && descriptor_0.role >= 0 && descriptor_0.role <= 1 && typeof(descriptor_0.signerVerificationMethodRef) === 'object' && typeof(descriptor_0.signerVerificationMethodRef.controllerAddress) === 'object' && descriptor_0.signerVerificationMethodRef.controllerAddress.bytes.buffer instanceof ArrayBuffer && descriptor_0.signerVerificationMethodRef.controllerAddress.bytes.BYTES_PER_ELEMENT === 1 && descriptor_0.signerVerificationMethodRef.controllerAddress.bytes.length === 32 && descriptor_0.signerVerificationMethodRef.methodId.buffer instanceof ArrayBuffer && descriptor_0.signerVerificationMethodRef.methodId.BYTES_PER_ELEMENT === 1 && descriptor_0.signerVerificationMethodRef.methodId.length === 32 && true && typeof(descriptor_0.didStateVersion) === 'bigint' && descriptor_0.didStateVersion >= 0n && descriptor_0.didStateVersion <= 18446744073709551615n && typeof(descriptor_0.verificationRelationship) === 'number' && descriptor_0.verificationRelationship >= 0 && descriptor_0.verificationRelationship <= 2 && descriptor_0.scopeCommitment.buffer instanceof ArrayBuffer && descriptor_0.scopeCommitment.BYTES_PER_ELEMENT === 1 && descriptor_0.scopeCommitment.length === 32 && descriptor_0.policyCommitment.buffer instanceof ArrayBuffer && descriptor_0.policyCommitment.BYTES_PER_ELEMENT === 1 && descriptor_0.policyCommitment.length === 32)) {
|
|
1378
1378
|
__compactRuntime.typeError('assertAuthorizedIssuerDescriptor',
|
|
1379
1379
|
'argument 3',
|
|
1380
|
-
'signer-authorization.compact line
|
|
1380
|
+
'signer-authorization.compact line 131 char 1',
|
|
1381
1381
|
'struct AuthorizedSignerDescriptor<version: Uint<0..65536>, authorizationId: Bytes<32>, decisionSequence: Uint<0..18446744073709551616>, state: Enum<AuthorizationState, active, suspended, revoked>, role: Enum<SignerRole, issuer, verifier>, signerVerificationMethodRef: struct VerificationMethodRef<controllerAddress: struct ContractAddress<bytes: Bytes<32>>, methodId: Bytes<32>>, signerPublicKey: Opaque<"JubjubPoint">, didStateVersion: Uint<0..18446744073709551616>, verificationRelationship: Enum<VerificationRelationship, assertionMethod, authentication, capabilityInvocation>, scopeCommitment: Bytes<32>, policyCommitment: Bytes<32>>',
|
|
1382
1382
|
descriptor_0)
|
|
1383
1383
|
}
|
|
@@ -1395,21 +1395,21 @@ export const pureCircuits = {
|
|
|
1395
1395
|
if (!(requestScopeCommitment_0.buffer instanceof ArrayBuffer && requestScopeCommitment_0.BYTES_PER_ELEMENT === 1 && requestScopeCommitment_0.length === 32)) {
|
|
1396
1396
|
__compactRuntime.typeError('assertAuthorizedVerifierProof',
|
|
1397
1397
|
'argument 1',
|
|
1398
|
-
'signer-authorization.compact line
|
|
1398
|
+
'signer-authorization.compact line 150 char 1',
|
|
1399
1399
|
'Bytes<32>',
|
|
1400
1400
|
requestScopeCommitment_0)
|
|
1401
1401
|
}
|
|
1402
1402
|
if (!(typeof(proof_0) === 'object' && typeof(proof_0.signerVerificationMethodRef) === 'object' && typeof(proof_0.signerVerificationMethodRef.controllerAddress) === 'object' && proof_0.signerVerificationMethodRef.controllerAddress.bytes.buffer instanceof ArrayBuffer && proof_0.signerVerificationMethodRef.controllerAddress.bytes.BYTES_PER_ELEMENT === 1 && proof_0.signerVerificationMethodRef.controllerAddress.bytes.length === 32 && proof_0.signerVerificationMethodRef.methodId.buffer instanceof ArrayBuffer && proof_0.signerVerificationMethodRef.methodId.BYTES_PER_ELEMENT === 1 && proof_0.signerVerificationMethodRef.methodId.length === 32 && typeof(proof_0.createdAt) === 'bigint' && proof_0.createdAt >= 0n && proof_0.createdAt <= 18446744073709551615n && proof_0.challengeHash.buffer instanceof ArrayBuffer && proof_0.challengeHash.BYTES_PER_ELEMENT === 1 && proof_0.challengeHash.length === 32 && true && typeof(proof_0.signature) === 'object' && true && typeof(proof_0.signature.s) === 'bigint' && proof_0.signature.s >= 0 && proof_0.signature.s <= __compactRuntime.MAX_FIELD)) {
|
|
1403
1403
|
__compactRuntime.typeError('assertAuthorizedVerifierProof',
|
|
1404
1404
|
'argument 2',
|
|
1405
|
-
'signer-authorization.compact line
|
|
1405
|
+
'signer-authorization.compact line 150 char 1',
|
|
1406
1406
|
'struct Proof<signerVerificationMethodRef: struct VerificationMethodRef<controllerAddress: struct ContractAddress<bytes: Bytes<32>>, methodId: Bytes<32>>, createdAt: Uint<0..18446744073709551616>, challengeHash: Bytes<32>, publicKey: Opaque<"JubjubPoint">, signature: struct Signature<r: Opaque<"JubjubPoint">, s: Field>>',
|
|
1407
1407
|
proof_0)
|
|
1408
1408
|
}
|
|
1409
1409
|
if (!(typeof(descriptor_0) === 'object' && typeof(descriptor_0.version) === 'bigint' && descriptor_0.version >= 0n && descriptor_0.version <= 65535n && descriptor_0.authorizationId.buffer instanceof ArrayBuffer && descriptor_0.authorizationId.BYTES_PER_ELEMENT === 1 && descriptor_0.authorizationId.length === 32 && typeof(descriptor_0.decisionSequence) === 'bigint' && descriptor_0.decisionSequence >= 0n && descriptor_0.decisionSequence <= 18446744073709551615n && typeof(descriptor_0.state) === 'number' && descriptor_0.state >= 0 && descriptor_0.state <= 2 && typeof(descriptor_0.role) === 'number' && descriptor_0.role >= 0 && descriptor_0.role <= 1 && typeof(descriptor_0.signerVerificationMethodRef) === 'object' && typeof(descriptor_0.signerVerificationMethodRef.controllerAddress) === 'object' && descriptor_0.signerVerificationMethodRef.controllerAddress.bytes.buffer instanceof ArrayBuffer && descriptor_0.signerVerificationMethodRef.controllerAddress.bytes.BYTES_PER_ELEMENT === 1 && descriptor_0.signerVerificationMethodRef.controllerAddress.bytes.length === 32 && descriptor_0.signerVerificationMethodRef.methodId.buffer instanceof ArrayBuffer && descriptor_0.signerVerificationMethodRef.methodId.BYTES_PER_ELEMENT === 1 && descriptor_0.signerVerificationMethodRef.methodId.length === 32 && true && typeof(descriptor_0.didStateVersion) === 'bigint' && descriptor_0.didStateVersion >= 0n && descriptor_0.didStateVersion <= 18446744073709551615n && typeof(descriptor_0.verificationRelationship) === 'number' && descriptor_0.verificationRelationship >= 0 && descriptor_0.verificationRelationship <= 2 && descriptor_0.scopeCommitment.buffer instanceof ArrayBuffer && descriptor_0.scopeCommitment.BYTES_PER_ELEMENT === 1 && descriptor_0.scopeCommitment.length === 32 && descriptor_0.policyCommitment.buffer instanceof ArrayBuffer && descriptor_0.policyCommitment.BYTES_PER_ELEMENT === 1 && descriptor_0.policyCommitment.length === 32)) {
|
|
1410
1410
|
__compactRuntime.typeError('assertAuthorizedVerifierProof',
|
|
1411
1411
|
'argument 3',
|
|
1412
|
-
'signer-authorization.compact line
|
|
1412
|
+
'signer-authorization.compact line 150 char 1',
|
|
1413
1413
|
'struct AuthorizedSignerDescriptor<version: Uint<0..65536>, authorizationId: Bytes<32>, decisionSequence: Uint<0..18446744073709551616>, state: Enum<AuthorizationState, active, suspended, revoked>, role: Enum<SignerRole, issuer, verifier>, signerVerificationMethodRef: struct VerificationMethodRef<controllerAddress: struct ContractAddress<bytes: Bytes<32>>, methodId: Bytes<32>>, signerPublicKey: Opaque<"JubjubPoint">, didStateVersion: Uint<0..18446744073709551616>, verificationRelationship: Enum<VerificationRelationship, assertionMethod, authentication, capabilityInvocation>, scopeCommitment: Bytes<32>, policyCommitment: Bytes<32>>',
|
|
1414
1414
|
descriptor_0)
|
|
1415
1415
|
}
|
|
@@ -1425,7 +1425,7 @@ export const pureCircuits = {
|
|
|
1425
1425
|
if (!(typeof(authority_0) === 'object' && authority_0.domainCommitment.buffer instanceof ArrayBuffer && authority_0.domainCommitment.BYTES_PER_ELEMENT === 1 && authority_0.domainCommitment.length === 32 && typeof(authority_0.verificationMethodRef) === 'object' && typeof(authority_0.verificationMethodRef.controllerAddress) === 'object' && authority_0.verificationMethodRef.controllerAddress.bytes.buffer instanceof ArrayBuffer && authority_0.verificationMethodRef.controllerAddress.bytes.BYTES_PER_ELEMENT === 1 && authority_0.verificationMethodRef.controllerAddress.bytes.length === 32 && authority_0.verificationMethodRef.methodId.buffer instanceof ArrayBuffer && authority_0.verificationMethodRef.methodId.BYTES_PER_ELEMENT === 1 && authority_0.verificationMethodRef.methodId.length === 32 && true)) {
|
|
1426
1426
|
__compactRuntime.typeError('assertValidSignerAuthorizationAuthority',
|
|
1427
1427
|
'argument 1',
|
|
1428
|
-
'signer-authorization.compact line
|
|
1428
|
+
'signer-authorization.compact line 171 char 1',
|
|
1429
1429
|
'struct SignerAuthorizationAuthority<domainCommitment: Bytes<32>, verificationMethodRef: struct VerificationMethodRef<controllerAddress: struct ContractAddress<bytes: Bytes<32>>, methodId: Bytes<32>>, publicKey: Opaque<"JubjubPoint">>',
|
|
1430
1430
|
authority_0)
|
|
1431
1431
|
}
|
|
@@ -1440,14 +1440,14 @@ export const pureCircuits = {
|
|
|
1440
1440
|
if (!(typeof(descriptor_0) === 'object' && typeof(descriptor_0.version) === 'bigint' && descriptor_0.version >= 0n && descriptor_0.version <= 65535n && descriptor_0.authorizationId.buffer instanceof ArrayBuffer && descriptor_0.authorizationId.BYTES_PER_ELEMENT === 1 && descriptor_0.authorizationId.length === 32 && typeof(descriptor_0.decisionSequence) === 'bigint' && descriptor_0.decisionSequence >= 0n && descriptor_0.decisionSequence <= 18446744073709551615n && typeof(descriptor_0.state) === 'number' && descriptor_0.state >= 0 && descriptor_0.state <= 2 && typeof(descriptor_0.role) === 'number' && descriptor_0.role >= 0 && descriptor_0.role <= 1 && typeof(descriptor_0.signerVerificationMethodRef) === 'object' && typeof(descriptor_0.signerVerificationMethodRef.controllerAddress) === 'object' && descriptor_0.signerVerificationMethodRef.controllerAddress.bytes.buffer instanceof ArrayBuffer && descriptor_0.signerVerificationMethodRef.controllerAddress.bytes.BYTES_PER_ELEMENT === 1 && descriptor_0.signerVerificationMethodRef.controllerAddress.bytes.length === 32 && descriptor_0.signerVerificationMethodRef.methodId.buffer instanceof ArrayBuffer && descriptor_0.signerVerificationMethodRef.methodId.BYTES_PER_ELEMENT === 1 && descriptor_0.signerVerificationMethodRef.methodId.length === 32 && true && typeof(descriptor_0.didStateVersion) === 'bigint' && descriptor_0.didStateVersion >= 0n && descriptor_0.didStateVersion <= 18446744073709551615n && typeof(descriptor_0.verificationRelationship) === 'number' && descriptor_0.verificationRelationship >= 0 && descriptor_0.verificationRelationship <= 2 && descriptor_0.scopeCommitment.buffer instanceof ArrayBuffer && descriptor_0.scopeCommitment.BYTES_PER_ELEMENT === 1 && descriptor_0.scopeCommitment.length === 32 && descriptor_0.policyCommitment.buffer instanceof ArrayBuffer && descriptor_0.policyCommitment.BYTES_PER_ELEMENT === 1 && descriptor_0.policyCommitment.length === 32)) {
|
|
1441
1441
|
__compactRuntime.typeError('signerAuthorizationDecisionRoot',
|
|
1442
1442
|
'argument 1',
|
|
1443
|
-
'signer-authorization.compact line
|
|
1443
|
+
'signer-authorization.compact line 182 char 1',
|
|
1444
1444
|
'struct AuthorizedSignerDescriptor<version: Uint<0..65536>, authorizationId: Bytes<32>, decisionSequence: Uint<0..18446744073709551616>, state: Enum<AuthorizationState, active, suspended, revoked>, role: Enum<SignerRole, issuer, verifier>, signerVerificationMethodRef: struct VerificationMethodRef<controllerAddress: struct ContractAddress<bytes: Bytes<32>>, methodId: Bytes<32>>, signerPublicKey: Opaque<"JubjubPoint">, didStateVersion: Uint<0..18446744073709551616>, verificationRelationship: Enum<VerificationRelationship, assertionMethod, authentication, capabilityInvocation>, scopeCommitment: Bytes<32>, policyCommitment: Bytes<32>>',
|
|
1445
1445
|
descriptor_0)
|
|
1446
1446
|
}
|
|
1447
1447
|
if (!(domainCommitment_0.buffer instanceof ArrayBuffer && domainCommitment_0.BYTES_PER_ELEMENT === 1 && domainCommitment_0.length === 32)) {
|
|
1448
1448
|
__compactRuntime.typeError('signerAuthorizationDecisionRoot',
|
|
1449
1449
|
'argument 2',
|
|
1450
|
-
'signer-authorization.compact line
|
|
1450
|
+
'signer-authorization.compact line 182 char 1',
|
|
1451
1451
|
'Bytes<32>',
|
|
1452
1452
|
domainCommitment_0)
|
|
1453
1453
|
}
|
|
@@ -1464,21 +1464,21 @@ export const pureCircuits = {
|
|
|
1464
1464
|
if (!(typeof(descriptor_0) === 'object' && typeof(descriptor_0.version) === 'bigint' && descriptor_0.version >= 0n && descriptor_0.version <= 65535n && descriptor_0.authorizationId.buffer instanceof ArrayBuffer && descriptor_0.authorizationId.BYTES_PER_ELEMENT === 1 && descriptor_0.authorizationId.length === 32 && typeof(descriptor_0.decisionSequence) === 'bigint' && descriptor_0.decisionSequence >= 0n && descriptor_0.decisionSequence <= 18446744073709551615n && typeof(descriptor_0.state) === 'number' && descriptor_0.state >= 0 && descriptor_0.state <= 2 && typeof(descriptor_0.role) === 'number' && descriptor_0.role >= 0 && descriptor_0.role <= 1 && typeof(descriptor_0.signerVerificationMethodRef) === 'object' && typeof(descriptor_0.signerVerificationMethodRef.controllerAddress) === 'object' && descriptor_0.signerVerificationMethodRef.controllerAddress.bytes.buffer instanceof ArrayBuffer && descriptor_0.signerVerificationMethodRef.controllerAddress.bytes.BYTES_PER_ELEMENT === 1 && descriptor_0.signerVerificationMethodRef.controllerAddress.bytes.length === 32 && descriptor_0.signerVerificationMethodRef.methodId.buffer instanceof ArrayBuffer && descriptor_0.signerVerificationMethodRef.methodId.BYTES_PER_ELEMENT === 1 && descriptor_0.signerVerificationMethodRef.methodId.length === 32 && true && typeof(descriptor_0.didStateVersion) === 'bigint' && descriptor_0.didStateVersion >= 0n && descriptor_0.didStateVersion <= 18446744073709551615n && typeof(descriptor_0.verificationRelationship) === 'number' && descriptor_0.verificationRelationship >= 0 && descriptor_0.verificationRelationship <= 2 && descriptor_0.scopeCommitment.buffer instanceof ArrayBuffer && descriptor_0.scopeCommitment.BYTES_PER_ELEMENT === 1 && descriptor_0.scopeCommitment.length === 32 && descriptor_0.policyCommitment.buffer instanceof ArrayBuffer && descriptor_0.policyCommitment.BYTES_PER_ELEMENT === 1 && descriptor_0.policyCommitment.length === 32)) {
|
|
1465
1465
|
__compactRuntime.typeError('assertValidSignerAuthorizationProof',
|
|
1466
1466
|
'argument 1',
|
|
1467
|
-
'signer-authorization.compact line
|
|
1467
|
+
'signer-authorization.compact line 197 char 1',
|
|
1468
1468
|
'struct AuthorizedSignerDescriptor<version: Uint<0..65536>, authorizationId: Bytes<32>, decisionSequence: Uint<0..18446744073709551616>, state: Enum<AuthorizationState, active, suspended, revoked>, role: Enum<SignerRole, issuer, verifier>, signerVerificationMethodRef: struct VerificationMethodRef<controllerAddress: struct ContractAddress<bytes: Bytes<32>>, methodId: Bytes<32>>, signerPublicKey: Opaque<"JubjubPoint">, didStateVersion: Uint<0..18446744073709551616>, verificationRelationship: Enum<VerificationRelationship, assertionMethod, authentication, capabilityInvocation>, scopeCommitment: Bytes<32>, policyCommitment: Bytes<32>>',
|
|
1469
1469
|
descriptor_0)
|
|
1470
1470
|
}
|
|
1471
1471
|
if (!(typeof(authorizationProof_0) === 'object' && typeof(authorizationProof_0.signerVerificationMethodRef) === 'object' && typeof(authorizationProof_0.signerVerificationMethodRef.controllerAddress) === 'object' && authorizationProof_0.signerVerificationMethodRef.controllerAddress.bytes.buffer instanceof ArrayBuffer && authorizationProof_0.signerVerificationMethodRef.controllerAddress.bytes.BYTES_PER_ELEMENT === 1 && authorizationProof_0.signerVerificationMethodRef.controllerAddress.bytes.length === 32 && authorizationProof_0.signerVerificationMethodRef.methodId.buffer instanceof ArrayBuffer && authorizationProof_0.signerVerificationMethodRef.methodId.BYTES_PER_ELEMENT === 1 && authorizationProof_0.signerVerificationMethodRef.methodId.length === 32 && typeof(authorizationProof_0.createdAt) === 'bigint' && authorizationProof_0.createdAt >= 0n && authorizationProof_0.createdAt <= 18446744073709551615n && authorizationProof_0.challengeHash.buffer instanceof ArrayBuffer && authorizationProof_0.challengeHash.BYTES_PER_ELEMENT === 1 && authorizationProof_0.challengeHash.length === 32 && true && typeof(authorizationProof_0.signature) === 'object' && true && typeof(authorizationProof_0.signature.s) === 'bigint' && authorizationProof_0.signature.s >= 0 && authorizationProof_0.signature.s <= __compactRuntime.MAX_FIELD)) {
|
|
1472
1472
|
__compactRuntime.typeError('assertValidSignerAuthorizationProof',
|
|
1473
1473
|
'argument 2',
|
|
1474
|
-
'signer-authorization.compact line
|
|
1474
|
+
'signer-authorization.compact line 197 char 1',
|
|
1475
1475
|
'struct Proof<signerVerificationMethodRef: struct VerificationMethodRef<controllerAddress: struct ContractAddress<bytes: Bytes<32>>, methodId: Bytes<32>>, createdAt: Uint<0..18446744073709551616>, challengeHash: Bytes<32>, publicKey: Opaque<"JubjubPoint">, signature: struct Signature<r: Opaque<"JubjubPoint">, s: Field>>',
|
|
1476
1476
|
authorizationProof_0)
|
|
1477
1477
|
}
|
|
1478
1478
|
if (!(typeof(authority_0) === 'object' && authority_0.domainCommitment.buffer instanceof ArrayBuffer && authority_0.domainCommitment.BYTES_PER_ELEMENT === 1 && authority_0.domainCommitment.length === 32 && typeof(authority_0.verificationMethodRef) === 'object' && typeof(authority_0.verificationMethodRef.controllerAddress) === 'object' && authority_0.verificationMethodRef.controllerAddress.bytes.buffer instanceof ArrayBuffer && authority_0.verificationMethodRef.controllerAddress.bytes.BYTES_PER_ELEMENT === 1 && authority_0.verificationMethodRef.controllerAddress.bytes.length === 32 && authority_0.verificationMethodRef.methodId.buffer instanceof ArrayBuffer && authority_0.verificationMethodRef.methodId.BYTES_PER_ELEMENT === 1 && authority_0.verificationMethodRef.methodId.length === 32 && true)) {
|
|
1479
1479
|
__compactRuntime.typeError('assertValidSignerAuthorizationProof',
|
|
1480
1480
|
'argument 3',
|
|
1481
|
-
'signer-authorization.compact line
|
|
1481
|
+
'signer-authorization.compact line 197 char 1',
|
|
1482
1482
|
'struct SignerAuthorizationAuthority<domainCommitment: Bytes<32>, verificationMethodRef: struct VerificationMethodRef<controllerAddress: struct ContractAddress<bytes: Bytes<32>>, methodId: Bytes<32>>, publicKey: Opaque<"JubjubPoint">>',
|
|
1483
1483
|
authority_0)
|
|
1484
1484
|
}
|
|
@@ -1495,14 +1495,14 @@ export const pureCircuits = {
|
|
|
1495
1495
|
if (!(typeof(previous_0) === 'object' && typeof(previous_0.version) === 'bigint' && previous_0.version >= 0n && previous_0.version <= 65535n && previous_0.authorizationId.buffer instanceof ArrayBuffer && previous_0.authorizationId.BYTES_PER_ELEMENT === 1 && previous_0.authorizationId.length === 32 && typeof(previous_0.decisionSequence) === 'bigint' && previous_0.decisionSequence >= 0n && previous_0.decisionSequence <= 18446744073709551615n && typeof(previous_0.state) === 'number' && previous_0.state >= 0 && previous_0.state <= 2 && typeof(previous_0.role) === 'number' && previous_0.role >= 0 && previous_0.role <= 1 && typeof(previous_0.signerVerificationMethodRef) === 'object' && typeof(previous_0.signerVerificationMethodRef.controllerAddress) === 'object' && previous_0.signerVerificationMethodRef.controllerAddress.bytes.buffer instanceof ArrayBuffer && previous_0.signerVerificationMethodRef.controllerAddress.bytes.BYTES_PER_ELEMENT === 1 && previous_0.signerVerificationMethodRef.controllerAddress.bytes.length === 32 && previous_0.signerVerificationMethodRef.methodId.buffer instanceof ArrayBuffer && previous_0.signerVerificationMethodRef.methodId.BYTES_PER_ELEMENT === 1 && previous_0.signerVerificationMethodRef.methodId.length === 32 && true && typeof(previous_0.didStateVersion) === 'bigint' && previous_0.didStateVersion >= 0n && previous_0.didStateVersion <= 18446744073709551615n && typeof(previous_0.verificationRelationship) === 'number' && previous_0.verificationRelationship >= 0 && previous_0.verificationRelationship <= 2 && previous_0.scopeCommitment.buffer instanceof ArrayBuffer && previous_0.scopeCommitment.BYTES_PER_ELEMENT === 1 && previous_0.scopeCommitment.length === 32 && previous_0.policyCommitment.buffer instanceof ArrayBuffer && previous_0.policyCommitment.BYTES_PER_ELEMENT === 1 && previous_0.policyCommitment.length === 32)) {
|
|
1496
1496
|
__compactRuntime.typeError('assertValidSignerAuthorizationUpdate',
|
|
1497
1497
|
'argument 1',
|
|
1498
|
-
'signer-authorization.compact line
|
|
1498
|
+
'signer-authorization.compact line 228 char 1',
|
|
1499
1499
|
'struct AuthorizedSignerDescriptor<version: Uint<0..65536>, authorizationId: Bytes<32>, decisionSequence: Uint<0..18446744073709551616>, state: Enum<AuthorizationState, active, suspended, revoked>, role: Enum<SignerRole, issuer, verifier>, signerVerificationMethodRef: struct VerificationMethodRef<controllerAddress: struct ContractAddress<bytes: Bytes<32>>, methodId: Bytes<32>>, signerPublicKey: Opaque<"JubjubPoint">, didStateVersion: Uint<0..18446744073709551616>, verificationRelationship: Enum<VerificationRelationship, assertionMethod, authentication, capabilityInvocation>, scopeCommitment: Bytes<32>, policyCommitment: Bytes<32>>',
|
|
1500
1500
|
previous_0)
|
|
1501
1501
|
}
|
|
1502
1502
|
if (!(typeof(next_0) === 'object' && typeof(next_0.version) === 'bigint' && next_0.version >= 0n && next_0.version <= 65535n && next_0.authorizationId.buffer instanceof ArrayBuffer && next_0.authorizationId.BYTES_PER_ELEMENT === 1 && next_0.authorizationId.length === 32 && typeof(next_0.decisionSequence) === 'bigint' && next_0.decisionSequence >= 0n && next_0.decisionSequence <= 18446744073709551615n && typeof(next_0.state) === 'number' && next_0.state >= 0 && next_0.state <= 2 && typeof(next_0.role) === 'number' && next_0.role >= 0 && next_0.role <= 1 && typeof(next_0.signerVerificationMethodRef) === 'object' && typeof(next_0.signerVerificationMethodRef.controllerAddress) === 'object' && next_0.signerVerificationMethodRef.controllerAddress.bytes.buffer instanceof ArrayBuffer && next_0.signerVerificationMethodRef.controllerAddress.bytes.BYTES_PER_ELEMENT === 1 && next_0.signerVerificationMethodRef.controllerAddress.bytes.length === 32 && next_0.signerVerificationMethodRef.methodId.buffer instanceof ArrayBuffer && next_0.signerVerificationMethodRef.methodId.BYTES_PER_ELEMENT === 1 && next_0.signerVerificationMethodRef.methodId.length === 32 && true && typeof(next_0.didStateVersion) === 'bigint' && next_0.didStateVersion >= 0n && next_0.didStateVersion <= 18446744073709551615n && typeof(next_0.verificationRelationship) === 'number' && next_0.verificationRelationship >= 0 && next_0.verificationRelationship <= 2 && next_0.scopeCommitment.buffer instanceof ArrayBuffer && next_0.scopeCommitment.BYTES_PER_ELEMENT === 1 && next_0.scopeCommitment.length === 32 && next_0.policyCommitment.buffer instanceof ArrayBuffer && next_0.policyCommitment.BYTES_PER_ELEMENT === 1 && next_0.policyCommitment.length === 32)) {
|
|
1503
1503
|
__compactRuntime.typeError('assertValidSignerAuthorizationUpdate',
|
|
1504
1504
|
'argument 2',
|
|
1505
|
-
'signer-authorization.compact line
|
|
1505
|
+
'signer-authorization.compact line 228 char 1',
|
|
1506
1506
|
'struct AuthorizedSignerDescriptor<version: Uint<0..65536>, authorizationId: Bytes<32>, decisionSequence: Uint<0..18446744073709551616>, state: Enum<AuthorizationState, active, suspended, revoked>, role: Enum<SignerRole, issuer, verifier>, signerVerificationMethodRef: struct VerificationMethodRef<controllerAddress: struct ContractAddress<bytes: Bytes<32>>, methodId: Bytes<32>>, signerPublicKey: Opaque<"JubjubPoint">, didStateVersion: Uint<0..18446744073709551616>, verificationRelationship: Enum<VerificationRelationship, assertionMethod, authentication, capabilityInvocation>, scopeCommitment: Bytes<32>, policyCommitment: Bytes<32>>',
|
|
1507
1507
|
next_0)
|
|
1508
1508
|
}
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
"sourceRoot": "../../../../",
|
|
5
5
|
"sources": ["src/credentials.compact", "src/./credentials/./types.compact", "src/./credentials/./proofs.compact", "src/./credentials/./signer-authorization.compact", "src/./credentials/./holder-bindings.compact", "src/./credentials/./status-bindings.compact", "compiler/standard-library.compact"],
|
|
6
6
|
"names": [],
|
|
7
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcA;;;;;;;;;;MCPA,AAAA,oBAIC;;OAAA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SAAmC;;;;;;;;4DAAnC,SAAmC;GAIpC;;;;"
|
|
8
8
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midnight-ntwrk/credential-compact",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Family-neutral Compact VC and VP semantics",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"private": false,
|
|
@@ -24,8 +24,7 @@
|
|
|
24
24
|
],
|
|
25
25
|
"sideEffects": [],
|
|
26
26
|
"engines": {
|
|
27
|
-
"node": ">=24"
|
|
28
|
-
"pnpm": ">=10.34.5"
|
|
27
|
+
"node": ">=24"
|
|
29
28
|
},
|
|
30
29
|
"main": "dist/index.js",
|
|
31
30
|
"module": "dist/index.js",
|
|
@@ -42,6 +41,9 @@
|
|
|
42
41
|
"dependencies": {
|
|
43
42
|
"@midnight-ntwrk/compact-runtime": "0.16.0"
|
|
44
43
|
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"fast-check": "^4.10.2"
|
|
46
|
+
},
|
|
45
47
|
"files": [
|
|
46
48
|
"dist/**",
|
|
47
49
|
"README.md",
|