@zkproofport-app/sdk 0.2.11 → 0.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -3
- package/dist/circuits.d.ts +144 -0
- package/dist/circuits.esm.js +148 -0
- package/dist/circuits.esm.js.map +1 -0
- package/dist/circuits.js +157 -0
- package/dist/circuits.js.map +1 -0
- package/dist/circuits.mjs +148 -0
- package/dist/circuits.mjs.map +1 -0
- package/dist/constants.d.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +172 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +179 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +172 -6
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +10 -2
- package/package.json +8 -2
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical ZKProofport circuit identifiers.
|
|
3
|
+
*
|
|
4
|
+
* This module is the single source of truth for circuit IDs. Every other layer
|
|
5
|
+
* — the mobile app, the demo, the relay, server-side provers — reads its list
|
|
6
|
+
* from here instead of keeping a private copy that silently drifts.
|
|
7
|
+
*
|
|
8
|
+
* It has **no imports and no dependencies**, so it can be pulled in on its own:
|
|
9
|
+
*
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { CIRCUIT_IDS, isCircuitId } from '@zkproofport-app/sdk/circuits';
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* The same names are also re-exported from the package root
|
|
15
|
+
* (`@zkproofport-app/sdk`) for callers that already import the SDK.
|
|
16
|
+
*
|
|
17
|
+
* ## Identifiers are canonical and case-sensitive
|
|
18
|
+
*
|
|
19
|
+
* Each ID is the circuit's `name` in its `Nargo.toml`, verbatim. The format is
|
|
20
|
+
* lowercase with underscores. Hyphenated spellings (`coinbase-kyc`,
|
|
21
|
+
* `mdl-kr-age`) are directory or UI route names in other repositories — they
|
|
22
|
+
* are **not** circuit IDs, and passing one produces a nullifier mismatch or a
|
|
23
|
+
* failed on-chain lookup rather than a clear error.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Canonical circuit identifiers, keyed by a stable constant name.
|
|
27
|
+
*
|
|
28
|
+
* Prefer these constants over string literals so a rename is a compile error
|
|
29
|
+
* rather than a runtime surprise.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* import { CIRCUIT_IDS } from '@zkproofport-app/sdk/circuits';
|
|
34
|
+
*
|
|
35
|
+
* const relay = await sdk.createRelayRequest(CIRCUIT_IDS.COINBASE_ATTESTATION, {
|
|
36
|
+
* scope: 'myapp.com',
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
const CIRCUIT_IDS = Object.freeze({
|
|
41
|
+
/** Coinbase KYC attestation. Officially supported. */
|
|
42
|
+
COINBASE_ATTESTATION: 'coinbase_attestation',
|
|
43
|
+
/** Coinbase country attestation (inclusion / exclusion). Officially supported. */
|
|
44
|
+
COINBASE_COUNTRY_ATTESTATION: 'coinbase_country_attestation',
|
|
45
|
+
/** OIDC email-domain attestation. Officially supported. */
|
|
46
|
+
OIDC_DOMAIN_ATTESTATION: 'oidc_domain_attestation',
|
|
47
|
+
/** GIWA attestation. Planned — not officially supported yet. */
|
|
48
|
+
GIWA_ATTESTATION: 'giwa_attestation',
|
|
49
|
+
/** Korea Mobile ID ownership. Planned — not officially supported yet. */
|
|
50
|
+
MDL_KR_OWNERSHIP: 'mdl_kr_ownership',
|
|
51
|
+
/** Korea Mobile ID age threshold. Planned — not officially supported yet. */
|
|
52
|
+
MDL_KR_AGE: 'mdl_kr_age',
|
|
53
|
+
/** Korea Mobile ID si/do region. Planned — not officially supported yet. */
|
|
54
|
+
MDL_KR_REGION: 'mdl_kr_region',
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* Support status for every circuit.
|
|
58
|
+
*
|
|
59
|
+
* The record is exhaustive over {@link CircuitId}: adding an identifier without
|
|
60
|
+
* giving it a status is a compile error, so this list cannot drift from
|
|
61
|
+
* {@link CIRCUIT_IDS}.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* import { CIRCUIT_SUPPORT_STATUS } from '@zkproofport-app/sdk/circuits';
|
|
66
|
+
*
|
|
67
|
+
* CIRCUIT_SUPPORT_STATUS.coinbase_attestation; // 'supported'
|
|
68
|
+
* CIRCUIT_SUPPORT_STATUS.mdl_kr_age; // 'planned'
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
const CIRCUIT_SUPPORT_STATUS = Object.freeze({
|
|
72
|
+
coinbase_attestation: 'supported',
|
|
73
|
+
coinbase_country_attestation: 'supported',
|
|
74
|
+
oidc_domain_attestation: 'supported',
|
|
75
|
+
giwa_attestation: 'planned',
|
|
76
|
+
mdl_kr_ownership: 'planned',
|
|
77
|
+
mdl_kr_age: 'planned',
|
|
78
|
+
mdl_kr_region: 'planned',
|
|
79
|
+
});
|
|
80
|
+
/**
|
|
81
|
+
* Every canonical circuit identifier, in declaration order.
|
|
82
|
+
*
|
|
83
|
+
* Includes circuits that are still `planned`. Use {@link SUPPORTED_CIRCUIT_IDS}
|
|
84
|
+
* when you only want the ones that are officially supported today.
|
|
85
|
+
*/
|
|
86
|
+
const ALL_CIRCUIT_IDS = Object.freeze(Object.values(CIRCUIT_IDS));
|
|
87
|
+
/**
|
|
88
|
+
* Circuits that are officially supported today: the two Coinbase circuits and
|
|
89
|
+
* OIDC domain attestation.
|
|
90
|
+
*
|
|
91
|
+
* Derived from {@link CIRCUIT_SUPPORT_STATUS}, so it cannot fall out of sync.
|
|
92
|
+
*/
|
|
93
|
+
const SUPPORTED_CIRCUIT_IDS = Object.freeze(ALL_CIRCUIT_IDS.filter((id) => CIRCUIT_SUPPORT_STATUS[id] === 'supported'));
|
|
94
|
+
/**
|
|
95
|
+
* Circuits whose identifiers are reserved but which are not officially
|
|
96
|
+
* supported yet: GIWA attestation and the three Korea Mobile ID circuits.
|
|
97
|
+
*
|
|
98
|
+
* Derived from {@link CIRCUIT_SUPPORT_STATUS}, so it cannot fall out of sync.
|
|
99
|
+
*/
|
|
100
|
+
const PLANNED_CIRCUIT_IDS = Object.freeze(ALL_CIRCUIT_IDS.filter((id) => CIRCUIT_SUPPORT_STATUS[id] === 'planned'));
|
|
101
|
+
/**
|
|
102
|
+
* Narrows an unknown value to a canonical circuit identifier.
|
|
103
|
+
*
|
|
104
|
+
* Returns `false` for hyphenated route names such as `'coinbase-kyc'`, which
|
|
105
|
+
* are not circuit IDs.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* isCircuitId('coinbase_attestation'); // true
|
|
110
|
+
* isCircuitId('coinbase-kyc'); // false
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
function isCircuitId(value) {
|
|
114
|
+
return typeof value === 'string' && ALL_CIRCUIT_IDS.includes(value);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Narrows an unknown value to a circuit identifier that is officially supported
|
|
118
|
+
* today. Planned circuits return `false`.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
122
|
+
* isSupportedCircuitId('oidc_domain_attestation'); // true
|
|
123
|
+
* isSupportedCircuitId('mdl_kr_age'); // false — planned
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
function isSupportedCircuitId(value) {
|
|
127
|
+
return isCircuitId(value) && CIRCUIT_SUPPORT_STATUS[value] === 'supported';
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Returns the support status of a circuit.
|
|
131
|
+
*
|
|
132
|
+
* @param circuit - A canonical circuit identifier.
|
|
133
|
+
* @throws Error when the value is not a canonical circuit identifier.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```typescript
|
|
137
|
+
* getCircuitSupportStatus('giwa_attestation'); // 'planned'
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
function getCircuitSupportStatus(circuit) {
|
|
141
|
+
if (!isCircuitId(circuit)) {
|
|
142
|
+
throw new Error(`Unknown circuit '${String(circuit)}'. Expected one of: ${ALL_CIRCUIT_IDS.join(', ')}`);
|
|
143
|
+
}
|
|
144
|
+
return CIRCUIT_SUPPORT_STATUS[circuit];
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export { ALL_CIRCUIT_IDS, CIRCUIT_IDS, CIRCUIT_SUPPORT_STATUS, PLANNED_CIRCUIT_IDS, SUPPORTED_CIRCUIT_IDS, getCircuitSupportStatus, isCircuitId, isSupportedCircuitId };
|
|
148
|
+
//# sourceMappingURL=circuits.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circuits.mjs","sources":["../src/circuits.ts"],"sourcesContent":["/**\n * Canonical ZKProofport circuit identifiers.\n *\n * This module is the single source of truth for circuit IDs. Every other layer\n * — the mobile app, the demo, the relay, server-side provers — reads its list\n * from here instead of keeping a private copy that silently drifts.\n *\n * It has **no imports and no dependencies**, so it can be pulled in on its own:\n *\n * ```typescript\n * import { CIRCUIT_IDS, isCircuitId } from '@zkproofport-app/sdk/circuits';\n * ```\n *\n * The same names are also re-exported from the package root\n * (`@zkproofport-app/sdk`) for callers that already import the SDK.\n *\n * ## Identifiers are canonical and case-sensitive\n *\n * Each ID is the circuit's `name` in its `Nargo.toml`, verbatim. The format is\n * lowercase with underscores. Hyphenated spellings (`coinbase-kyc`,\n * `mdl-kr-age`) are directory or UI route names in other repositories — they\n * are **not** circuit IDs, and passing one produces a nullifier mismatch or a\n * failed on-chain lookup rather than a clear error.\n */\n\n/**\n * Whether a circuit is officially supported today or still on the roadmap.\n *\n * - `supported` — generally available. Safe to build a product on.\n * - `planned` — the identifier is reserved and the circuit exists, but it is\n * not officially supported yet. Availability, inputs and public-input layout\n * may change without a major version bump.\n */\nexport type CircuitSupportStatus = 'supported' | 'planned';\n\n/**\n * Canonical circuit identifiers, keyed by a stable constant name.\n *\n * Prefer these constants over string literals so a rename is a compile error\n * rather than a runtime surprise.\n *\n * @example\n * ```typescript\n * import { CIRCUIT_IDS } from '@zkproofport-app/sdk/circuits';\n *\n * const relay = await sdk.createRelayRequest(CIRCUIT_IDS.COINBASE_ATTESTATION, {\n * scope: 'myapp.com',\n * });\n * ```\n */\nexport const CIRCUIT_IDS = Object.freeze({\n /** Coinbase KYC attestation. Officially supported. */\n COINBASE_ATTESTATION: 'coinbase_attestation',\n /** Coinbase country attestation (inclusion / exclusion). Officially supported. */\n COINBASE_COUNTRY_ATTESTATION: 'coinbase_country_attestation',\n /** OIDC email-domain attestation. Officially supported. */\n OIDC_DOMAIN_ATTESTATION: 'oidc_domain_attestation',\n /** GIWA attestation. Planned — not officially supported yet. */\n GIWA_ATTESTATION: 'giwa_attestation',\n /** Korea Mobile ID ownership. Planned — not officially supported yet. */\n MDL_KR_OWNERSHIP: 'mdl_kr_ownership',\n /** Korea Mobile ID age threshold. Planned — not officially supported yet. */\n MDL_KR_AGE: 'mdl_kr_age',\n /** Korea Mobile ID si/do region. Planned — not officially supported yet. */\n MDL_KR_REGION: 'mdl_kr_region',\n} as const);\n\n/**\n * Union of every canonical circuit identifier.\n *\n * `CircuitType` (exported from the package root) is an alias of this type — the\n * two names refer to the same union, and this module is where it is defined.\n */\nexport type CircuitId = (typeof CIRCUIT_IDS)[keyof typeof CIRCUIT_IDS];\n\n/**\n * Support status for every circuit.\n *\n * The record is exhaustive over {@link CircuitId}: adding an identifier without\n * giving it a status is a compile error, so this list cannot drift from\n * {@link CIRCUIT_IDS}.\n *\n * @example\n * ```typescript\n * import { CIRCUIT_SUPPORT_STATUS } from '@zkproofport-app/sdk/circuits';\n *\n * CIRCUIT_SUPPORT_STATUS.coinbase_attestation; // 'supported'\n * CIRCUIT_SUPPORT_STATUS.mdl_kr_age; // 'planned'\n * ```\n */\nexport const CIRCUIT_SUPPORT_STATUS: Readonly<Record<CircuitId, CircuitSupportStatus>> =\n Object.freeze({\n coinbase_attestation: 'supported',\n coinbase_country_attestation: 'supported',\n oidc_domain_attestation: 'supported',\n giwa_attestation: 'planned',\n mdl_kr_ownership: 'planned',\n mdl_kr_age: 'planned',\n mdl_kr_region: 'planned',\n } as const);\n\n/**\n * Every canonical circuit identifier, in declaration order.\n *\n * Includes circuits that are still `planned`. Use {@link SUPPORTED_CIRCUIT_IDS}\n * when you only want the ones that are officially supported today.\n */\nexport const ALL_CIRCUIT_IDS: readonly CircuitId[] = Object.freeze(\n Object.values(CIRCUIT_IDS) as CircuitId[]\n);\n\n/**\n * Circuits that are officially supported today: the two Coinbase circuits and\n * OIDC domain attestation.\n *\n * Derived from {@link CIRCUIT_SUPPORT_STATUS}, so it cannot fall out of sync.\n */\nexport const SUPPORTED_CIRCUIT_IDS: readonly CircuitId[] = Object.freeze(\n ALL_CIRCUIT_IDS.filter((id) => CIRCUIT_SUPPORT_STATUS[id] === 'supported')\n);\n\n/**\n * Circuits whose identifiers are reserved but which are not officially\n * supported yet: GIWA attestation and the three Korea Mobile ID circuits.\n *\n * Derived from {@link CIRCUIT_SUPPORT_STATUS}, so it cannot fall out of sync.\n */\nexport const PLANNED_CIRCUIT_IDS: readonly CircuitId[] = Object.freeze(\n ALL_CIRCUIT_IDS.filter((id) => CIRCUIT_SUPPORT_STATUS[id] === 'planned')\n);\n\n/**\n * Narrows an unknown value to a canonical circuit identifier.\n *\n * Returns `false` for hyphenated route names such as `'coinbase-kyc'`, which\n * are not circuit IDs.\n *\n * @example\n * ```typescript\n * isCircuitId('coinbase_attestation'); // true\n * isCircuitId('coinbase-kyc'); // false\n * ```\n */\nexport function isCircuitId(value: unknown): value is CircuitId {\n return typeof value === 'string' && (ALL_CIRCUIT_IDS as readonly string[]).includes(value);\n}\n\n/**\n * Narrows an unknown value to a circuit identifier that is officially supported\n * today. Planned circuits return `false`.\n *\n * @example\n * ```typescript\n * isSupportedCircuitId('oidc_domain_attestation'); // true\n * isSupportedCircuitId('mdl_kr_age'); // false — planned\n * ```\n */\nexport function isSupportedCircuitId(value: unknown): value is CircuitId {\n return isCircuitId(value) && CIRCUIT_SUPPORT_STATUS[value] === 'supported';\n}\n\n/**\n * Returns the support status of a circuit.\n *\n * @param circuit - A canonical circuit identifier.\n * @throws Error when the value is not a canonical circuit identifier.\n *\n * @example\n * ```typescript\n * getCircuitSupportStatus('giwa_attestation'); // 'planned'\n * ```\n */\nexport function getCircuitSupportStatus(circuit: CircuitId): CircuitSupportStatus {\n if (!isCircuitId(circuit)) {\n throw new Error(\n `Unknown circuit '${String(circuit)}'. Expected one of: ${ALL_CIRCUIT_IDS.join(', ')}`\n );\n }\n return CIRCUIT_SUPPORT_STATUS[circuit];\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;AAuBG;AAYH;;;;;;;;;;;;;;AAcG;AACI,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC;;AAEvC,IAAA,oBAAoB,EAAE,sBAAsB;;AAE5C,IAAA,4BAA4B,EAAE,8BAA8B;;AAE5D,IAAA,uBAAuB,EAAE,yBAAyB;;AAElD,IAAA,gBAAgB,EAAE,kBAAkB;;AAEpC,IAAA,gBAAgB,EAAE,kBAAkB;;AAEpC,IAAA,UAAU,EAAE,YAAY;;AAExB,IAAA,aAAa,EAAE,eAAe;AACtB,CAAA;AAUV;;;;;;;;;;;;;;AAcG;AACI,MAAM,sBAAsB,GACjC,MAAM,CAAC,MAAM,CAAC;AACZ,IAAA,oBAAoB,EAAE,WAAW;AACjC,IAAA,4BAA4B,EAAE,WAAW;AACzC,IAAA,uBAAuB,EAAE,WAAW;AACpC,IAAA,gBAAgB,EAAE,SAAS;AAC3B,IAAA,gBAAgB,EAAE,SAAS;AAC3B,IAAA,UAAU,EAAE,SAAS;AACrB,IAAA,aAAa,EAAE,SAAS;AAChB,CAAA;AAEZ;;;;;AAKG;AACI,MAAM,eAAe,GAAyB,MAAM,CAAC,MAAM,CAChE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAgB;AAG3C;;;;;AAKG;AACI,MAAM,qBAAqB,GAAyB,MAAM,CAAC,MAAM,CACtE,eAAe,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,sBAAsB,CAAC,EAAE,CAAC,KAAK,WAAW,CAAC;AAG5E;;;;;AAKG;AACI,MAAM,mBAAmB,GAAyB,MAAM,CAAC,MAAM,CACpE,eAAe,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,sBAAsB,CAAC,EAAE,CAAC,KAAK,SAAS,CAAC;AAG1E;;;;;;;;;;;AAWG;AACG,SAAU,WAAW,CAAC,KAAc,EAAA;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,eAAqC,CAAC,QAAQ,CAAC,KAAK,CAAC;AAC5F;AAEA;;;;;;;;;AASG;AACG,SAAU,oBAAoB,CAAC,KAAc,EAAA;IACjD,OAAO,WAAW,CAAC,KAAK,CAAC,IAAI,sBAAsB,CAAC,KAAK,CAAC,KAAK,WAAW;AAC5E;AAEA;;;;;;;;;;AAUG;AACG,SAAU,uBAAuB,CAAC,OAAkB,EAAA;AACxD,IAAA,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;AACzB,QAAA,MAAM,IAAI,KAAK,CACb,CAAA,iBAAA,EAAoB,MAAM,CAAC,OAAO,CAAC,CAAA,oBAAA,EAAuB,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE,CACvF;IACH;AACA,IAAA,OAAO,sBAAsB,CAAC,OAAO,CAAC;AACxC;;;;"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export declare const DEEP_LINK_HOSTS: {
|
|
|
49
49
|
* ```typescript
|
|
50
50
|
* const metadata = CIRCUIT_METADATA['coinbase_attestation'];
|
|
51
51
|
* console.log(metadata.name); // "Coinbase KYC"
|
|
52
|
-
* console.log(metadata.publicInputsCount); //
|
|
52
|
+
* console.log(metadata.publicInputsCount); // 128
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
55
|
export declare const CIRCUIT_METADATA: Record<CircuitType, {
|
package/dist/index.d.ts
CHANGED
|
@@ -27,5 +27,7 @@
|
|
|
27
27
|
*/
|
|
28
28
|
export { ProofportSDK, default } from './ProofportSDK';
|
|
29
29
|
export { extractScopeFromPublicInputs, extractNullifierFromPublicInputs, extractDomainFromPublicInputs, } from './verifier';
|
|
30
|
+
export { CIRCUIT_IDS, CIRCUIT_SUPPORT_STATUS, ALL_CIRCUIT_IDS, SUPPORTED_CIRCUIT_IDS, PLANNED_CIRCUIT_IDS, isCircuitId, isSupportedCircuitId, getCircuitSupportStatus, } from './circuits';
|
|
30
31
|
export { COINBASE_ATTESTATION_PUBLIC_INPUT_LAYOUT, COINBASE_COUNTRY_PUBLIC_INPUT_LAYOUT, OIDC_DOMAIN_ATTESTATION_PUBLIC_INPUT_LAYOUT, MDL_KR_PUBLIC_INPUT_LAYOUT, } from './constants';
|
|
32
|
+
export type { CircuitId, CircuitSupportStatus } from './circuits';
|
|
31
33
|
export type { CircuitType, ProofRequestStatus, CoinbaseKycInputs, CoinbaseCountryInputs, OidcDomainInputs, MdlKrOwnershipInputs, MdlKrAgeInputs, MdlKrRegionInputs, CircuitInputs, ProofRequest, ProofResponse, QRCodeOptions, VerifierContract, ProofportConfig, ChallengeResponse, WalletSigner, RelayProofRequest, RelayProofResult, SDKEnvironment, } from './types';
|
package/dist/index.esm.js
CHANGED
|
@@ -51,20 +51,26 @@ const DEEP_LINK_HOSTS = {
|
|
|
51
51
|
* ```typescript
|
|
52
52
|
* const metadata = CIRCUIT_METADATA['coinbase_attestation'];
|
|
53
53
|
* console.log(metadata.name); // "Coinbase KYC"
|
|
54
|
-
* console.log(metadata.publicInputsCount); //
|
|
54
|
+
* console.log(metadata.publicInputsCount); // 128
|
|
55
55
|
* ```
|
|
56
56
|
*/
|
|
57
57
|
const CIRCUIT_METADATA = {
|
|
58
58
|
coinbase_attestation: {
|
|
59
59
|
name: 'Coinbase KYC',
|
|
60
60
|
description: 'Prove Coinbase identity verification',
|
|
61
|
-
|
|
61
|
+
// 4 x `pub [u8; 32]` in coinbase-attestation/src/main.nr, flattened to
|
|
62
|
+
// bytes: signal_hash, signer_list_merkle_root, scope, nullifier.
|
|
63
|
+
// Read 2 here until 2026-09-04, which was wrong under any reading —
|
|
64
|
+
// the circuit has never had two public inputs, logical or flattened.
|
|
65
|
+
publicInputsCount: 128,
|
|
62
66
|
publicInputNames: ['signal_hash', 'signer_list_merkle_root'],
|
|
63
67
|
},
|
|
64
68
|
coinbase_country_attestation: {
|
|
65
69
|
name: 'Coinbase Country',
|
|
66
70
|
description: 'Prove Coinbase country verification',
|
|
67
|
-
|
|
71
|
+
// 32 + 32 + (10 x 2) + 1 + 1 + 32 + 32 = 150, counted off
|
|
72
|
+
// coinbase-country-attestation/src/main.nr. Read 14 until 2026-09-04.
|
|
73
|
+
publicInputsCount: 150,
|
|
68
74
|
publicInputNames: ['signal_hash', 'signer_list_merkle_root', 'country_list', 'country_list_length', 'is_included'],
|
|
69
75
|
},
|
|
70
76
|
oidc_domain_attestation: {
|
|
@@ -73,8 +79,22 @@ const CIRCUIT_METADATA = {
|
|
|
73
79
|
publicInputsCount: 148,
|
|
74
80
|
publicInputNames: ['pubkey_modulus_limbs', 'domain', 'scope', 'nullifier', 'provider'],
|
|
75
81
|
},
|
|
76
|
-
//
|
|
77
|
-
//
|
|
82
|
+
// Planned circuit — the identifier is reserved and the circuit exists, but it
|
|
83
|
+
// is not officially supported yet. See CIRCUIT_SUPPORT_STATUS in ./circuits.
|
|
84
|
+
// Forked from coinbase_attestation and shares its four public inputs, so the
|
|
85
|
+
// count is the byte-flattened total (4 x [u8; 32] = 128), matching the
|
|
86
|
+
// COINBASE_ATTESTATION_PUBLIC_INPUT_LAYOUT indices below. The
|
|
87
|
+
// coinbase_attestation entry above reports a legacy logical count of 2 and is
|
|
88
|
+
// left as-is for backwards compatibility.
|
|
89
|
+
giwa_attestation: {
|
|
90
|
+
name: 'GIWA Attestation',
|
|
91
|
+
description: 'Prove GIWA identity verification (planned — not officially supported yet)',
|
|
92
|
+
publicInputsCount: 128,
|
|
93
|
+
publicInputNames: ['signal_hash', 'signer_list_merkle_root', 'scope', 'nullifier'],
|
|
94
|
+
},
|
|
95
|
+
// Korea Mobile ID (mDL) circuits. Planned — not officially supported yet.
|
|
96
|
+
// Counts are byte-flattened field totals from the compiled circuit ABIs:
|
|
97
|
+
// [u8; 32] arrays contribute 32 inputs each.
|
|
78
98
|
mdl_kr_ownership: {
|
|
79
99
|
name: 'Korea Mobile ID — Ownership',
|
|
80
100
|
description: "Prove valid Korean mobile driver's license ownership with selective disclosure",
|
|
@@ -5553,5 +5573,151 @@ ProofportSDK.WALLET_SIGNATURE_CIRCUITS = [
|
|
|
5553
5573
|
'coinbase_country_attestation',
|
|
5554
5574
|
];
|
|
5555
5575
|
|
|
5556
|
-
|
|
5576
|
+
/**
|
|
5577
|
+
* Canonical ZKProofport circuit identifiers.
|
|
5578
|
+
*
|
|
5579
|
+
* This module is the single source of truth for circuit IDs. Every other layer
|
|
5580
|
+
* — the mobile app, the demo, the relay, server-side provers — reads its list
|
|
5581
|
+
* from here instead of keeping a private copy that silently drifts.
|
|
5582
|
+
*
|
|
5583
|
+
* It has **no imports and no dependencies**, so it can be pulled in on its own:
|
|
5584
|
+
*
|
|
5585
|
+
* ```typescript
|
|
5586
|
+
* import { CIRCUIT_IDS, isCircuitId } from '@zkproofport-app/sdk/circuits';
|
|
5587
|
+
* ```
|
|
5588
|
+
*
|
|
5589
|
+
* The same names are also re-exported from the package root
|
|
5590
|
+
* (`@zkproofport-app/sdk`) for callers that already import the SDK.
|
|
5591
|
+
*
|
|
5592
|
+
* ## Identifiers are canonical and case-sensitive
|
|
5593
|
+
*
|
|
5594
|
+
* Each ID is the circuit's `name` in its `Nargo.toml`, verbatim. The format is
|
|
5595
|
+
* lowercase with underscores. Hyphenated spellings (`coinbase-kyc`,
|
|
5596
|
+
* `mdl-kr-age`) are directory or UI route names in other repositories — they
|
|
5597
|
+
* are **not** circuit IDs, and passing one produces a nullifier mismatch or a
|
|
5598
|
+
* failed on-chain lookup rather than a clear error.
|
|
5599
|
+
*/
|
|
5600
|
+
/**
|
|
5601
|
+
* Canonical circuit identifiers, keyed by a stable constant name.
|
|
5602
|
+
*
|
|
5603
|
+
* Prefer these constants over string literals so a rename is a compile error
|
|
5604
|
+
* rather than a runtime surprise.
|
|
5605
|
+
*
|
|
5606
|
+
* @example
|
|
5607
|
+
* ```typescript
|
|
5608
|
+
* import { CIRCUIT_IDS } from '@zkproofport-app/sdk/circuits';
|
|
5609
|
+
*
|
|
5610
|
+
* const relay = await sdk.createRelayRequest(CIRCUIT_IDS.COINBASE_ATTESTATION, {
|
|
5611
|
+
* scope: 'myapp.com',
|
|
5612
|
+
* });
|
|
5613
|
+
* ```
|
|
5614
|
+
*/
|
|
5615
|
+
const CIRCUIT_IDS = Object.freeze({
|
|
5616
|
+
/** Coinbase KYC attestation. Officially supported. */
|
|
5617
|
+
COINBASE_ATTESTATION: 'coinbase_attestation',
|
|
5618
|
+
/** Coinbase country attestation (inclusion / exclusion). Officially supported. */
|
|
5619
|
+
COINBASE_COUNTRY_ATTESTATION: 'coinbase_country_attestation',
|
|
5620
|
+
/** OIDC email-domain attestation. Officially supported. */
|
|
5621
|
+
OIDC_DOMAIN_ATTESTATION: 'oidc_domain_attestation',
|
|
5622
|
+
/** GIWA attestation. Planned — not officially supported yet. */
|
|
5623
|
+
GIWA_ATTESTATION: 'giwa_attestation',
|
|
5624
|
+
/** Korea Mobile ID ownership. Planned — not officially supported yet. */
|
|
5625
|
+
MDL_KR_OWNERSHIP: 'mdl_kr_ownership',
|
|
5626
|
+
/** Korea Mobile ID age threshold. Planned — not officially supported yet. */
|
|
5627
|
+
MDL_KR_AGE: 'mdl_kr_age',
|
|
5628
|
+
/** Korea Mobile ID si/do region. Planned — not officially supported yet. */
|
|
5629
|
+
MDL_KR_REGION: 'mdl_kr_region',
|
|
5630
|
+
});
|
|
5631
|
+
/**
|
|
5632
|
+
* Support status for every circuit.
|
|
5633
|
+
*
|
|
5634
|
+
* The record is exhaustive over {@link CircuitId}: adding an identifier without
|
|
5635
|
+
* giving it a status is a compile error, so this list cannot drift from
|
|
5636
|
+
* {@link CIRCUIT_IDS}.
|
|
5637
|
+
*
|
|
5638
|
+
* @example
|
|
5639
|
+
* ```typescript
|
|
5640
|
+
* import { CIRCUIT_SUPPORT_STATUS } from '@zkproofport-app/sdk/circuits';
|
|
5641
|
+
*
|
|
5642
|
+
* CIRCUIT_SUPPORT_STATUS.coinbase_attestation; // 'supported'
|
|
5643
|
+
* CIRCUIT_SUPPORT_STATUS.mdl_kr_age; // 'planned'
|
|
5644
|
+
* ```
|
|
5645
|
+
*/
|
|
5646
|
+
const CIRCUIT_SUPPORT_STATUS = Object.freeze({
|
|
5647
|
+
coinbase_attestation: 'supported',
|
|
5648
|
+
coinbase_country_attestation: 'supported',
|
|
5649
|
+
oidc_domain_attestation: 'supported',
|
|
5650
|
+
giwa_attestation: 'planned',
|
|
5651
|
+
mdl_kr_ownership: 'planned',
|
|
5652
|
+
mdl_kr_age: 'planned',
|
|
5653
|
+
mdl_kr_region: 'planned',
|
|
5654
|
+
});
|
|
5655
|
+
/**
|
|
5656
|
+
* Every canonical circuit identifier, in declaration order.
|
|
5657
|
+
*
|
|
5658
|
+
* Includes circuits that are still `planned`. Use {@link SUPPORTED_CIRCUIT_IDS}
|
|
5659
|
+
* when you only want the ones that are officially supported today.
|
|
5660
|
+
*/
|
|
5661
|
+
const ALL_CIRCUIT_IDS = Object.freeze(Object.values(CIRCUIT_IDS));
|
|
5662
|
+
/**
|
|
5663
|
+
* Circuits that are officially supported today: the two Coinbase circuits and
|
|
5664
|
+
* OIDC domain attestation.
|
|
5665
|
+
*
|
|
5666
|
+
* Derived from {@link CIRCUIT_SUPPORT_STATUS}, so it cannot fall out of sync.
|
|
5667
|
+
*/
|
|
5668
|
+
const SUPPORTED_CIRCUIT_IDS = Object.freeze(ALL_CIRCUIT_IDS.filter((id) => CIRCUIT_SUPPORT_STATUS[id] === 'supported'));
|
|
5669
|
+
/**
|
|
5670
|
+
* Circuits whose identifiers are reserved but which are not officially
|
|
5671
|
+
* supported yet: GIWA attestation and the three Korea Mobile ID circuits.
|
|
5672
|
+
*
|
|
5673
|
+
* Derived from {@link CIRCUIT_SUPPORT_STATUS}, so it cannot fall out of sync.
|
|
5674
|
+
*/
|
|
5675
|
+
const PLANNED_CIRCUIT_IDS = Object.freeze(ALL_CIRCUIT_IDS.filter((id) => CIRCUIT_SUPPORT_STATUS[id] === 'planned'));
|
|
5676
|
+
/**
|
|
5677
|
+
* Narrows an unknown value to a canonical circuit identifier.
|
|
5678
|
+
*
|
|
5679
|
+
* Returns `false` for hyphenated route names such as `'coinbase-kyc'`, which
|
|
5680
|
+
* are not circuit IDs.
|
|
5681
|
+
*
|
|
5682
|
+
* @example
|
|
5683
|
+
* ```typescript
|
|
5684
|
+
* isCircuitId('coinbase_attestation'); // true
|
|
5685
|
+
* isCircuitId('coinbase-kyc'); // false
|
|
5686
|
+
* ```
|
|
5687
|
+
*/
|
|
5688
|
+
function isCircuitId(value) {
|
|
5689
|
+
return typeof value === 'string' && ALL_CIRCUIT_IDS.includes(value);
|
|
5690
|
+
}
|
|
5691
|
+
/**
|
|
5692
|
+
* Narrows an unknown value to a circuit identifier that is officially supported
|
|
5693
|
+
* today. Planned circuits return `false`.
|
|
5694
|
+
*
|
|
5695
|
+
* @example
|
|
5696
|
+
* ```typescript
|
|
5697
|
+
* isSupportedCircuitId('oidc_domain_attestation'); // true
|
|
5698
|
+
* isSupportedCircuitId('mdl_kr_age'); // false — planned
|
|
5699
|
+
* ```
|
|
5700
|
+
*/
|
|
5701
|
+
function isSupportedCircuitId(value) {
|
|
5702
|
+
return isCircuitId(value) && CIRCUIT_SUPPORT_STATUS[value] === 'supported';
|
|
5703
|
+
}
|
|
5704
|
+
/**
|
|
5705
|
+
* Returns the support status of a circuit.
|
|
5706
|
+
*
|
|
5707
|
+
* @param circuit - A canonical circuit identifier.
|
|
5708
|
+
* @throws Error when the value is not a canonical circuit identifier.
|
|
5709
|
+
*
|
|
5710
|
+
* @example
|
|
5711
|
+
* ```typescript
|
|
5712
|
+
* getCircuitSupportStatus('giwa_attestation'); // 'planned'
|
|
5713
|
+
* ```
|
|
5714
|
+
*/
|
|
5715
|
+
function getCircuitSupportStatus(circuit) {
|
|
5716
|
+
if (!isCircuitId(circuit)) {
|
|
5717
|
+
throw new Error(`Unknown circuit '${String(circuit)}'. Expected one of: ${ALL_CIRCUIT_IDS.join(', ')}`);
|
|
5718
|
+
}
|
|
5719
|
+
return CIRCUIT_SUPPORT_STATUS[circuit];
|
|
5720
|
+
}
|
|
5721
|
+
|
|
5722
|
+
export { ALL_CIRCUIT_IDS, CIRCUIT_IDS, CIRCUIT_SUPPORT_STATUS, COINBASE_ATTESTATION_PUBLIC_INPUT_LAYOUT, COINBASE_COUNTRY_PUBLIC_INPUT_LAYOUT, MDL_KR_PUBLIC_INPUT_LAYOUT, OIDC_DOMAIN_ATTESTATION_PUBLIC_INPUT_LAYOUT, PLANNED_CIRCUIT_IDS, ProofportSDK, SUPPORTED_CIRCUIT_IDS, ProofportSDK as default, extractDomainFromPublicInputs, extractNullifierFromPublicInputs, extractScopeFromPublicInputs, getCircuitSupportStatus, isCircuitId, isSupportedCircuitId };
|
|
5557
5723
|
//# sourceMappingURL=index.esm.js.map
|