@zkproofport-app/sdk 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![npm version](https://img.shields.io/npm/v/@zkproofport-app/sdk)](https://www.npmjs.com/package/@zkproofport-app/sdk)
4
4
  [![license](https://img.shields.io/npm/l/@zkproofport-app/sdk)](./LICENSE)
5
5
 
6
- TypeScript SDK for requesting zero-knowledge proofs from the [ZKProofport](https://zkproofport.com) mobile app and verifying them on-chain. Three circuits are officially supported today — Coinbase KYC, Coinbase country attestation, and OIDC email-domain attestation (Google, Microsoft 365). Four more identifiers are reserved and planned: GIWA attestation and the three Korean mobile ID (mDL) circuits. [Circuit Identifiers](#circuit-identifiers) has the full list and what each status means.
6
+ TypeScript SDK for requesting zero-knowledge proofs from the [ZKProofport](https://zkproofport.com) mobile app and verifying them on-chain. Three circuits are officially supported today — Coinbase KYC, Coinbase country attestation, and OIDC email-domain attestation (Google, Microsoft 365). One more proves today against a testnet deployment and is marked experimental: GIWA attestation. The three Korean mobile ID (mDL) identifiers are reserved and planned. [Circuit Identifiers](#circuit-identifiers) has the full list and what each status means.
7
7
 
8
8
  ## How It Works
9
9
 
@@ -124,8 +124,7 @@ import { CIRCUIT_IDS, CIRCUIT_SUPPORT_STATUS } from '@zkproofport-app/sdk/circui
124
124
  | `CIRCUIT_IDS.COINBASE_ATTESTATION` | `coinbase_attestation` | **Supported** |
125
125
  | `CIRCUIT_IDS.COINBASE_COUNTRY_ATTESTATION` | `coinbase_country_attestation` | **Supported** |
126
126
  | `CIRCUIT_IDS.OIDC_DOMAIN_ATTESTATION` | `oidc_domain_attestation` | **Supported** |
127
- | `CIRCUIT_IDS.ARC_ELIGIBILITY` | `arc_eligibility` | _Experimental_ |
128
- | `CIRCUIT_IDS.GIWA_ATTESTATION` | `giwa_attestation` | Planned |
127
+ | `CIRCUIT_IDS.GIWA_ATTESTATION` | `giwa_attestation` | _Experimental_ |
129
128
  | `CIRCUIT_IDS.MDL_KR_OWNERSHIP` | `mdl_kr_ownership` | Planned |
130
129
  | `CIRCUIT_IDS.MDL_KR_AGE` | `mdl_kr_age` | Planned |
131
130
  | `CIRCUIT_IDS.MDL_KR_REGION` | `mdl_kr_region` | Planned |
@@ -142,11 +141,11 @@ Every ID appears in `CircuitType` and in `sdk.getSupportedCircuits()`, planned o
142
141
  import { CIRCUIT_SUPPORT_STATUS, isSupportedCircuitId } from '@zkproofport-app/sdk';
143
142
 
144
143
  CIRCUIT_SUPPORT_STATUS.coinbase_attestation; // 'supported'
145
- CIRCUIT_SUPPORT_STATUS.arc_eligibility; // 'experimental'
144
+ CIRCUIT_SUPPORT_STATUS.giwa_attestation; // 'experimental'
146
145
  CIRCUIT_SUPPORT_STATUS.mdl_kr_age; // 'planned'
147
146
 
148
147
  isSupportedCircuitId('oidc_domain_attestation'); // true
149
- isSupportedCircuitId('arc_eligibility'); // false — experimental is not supported
148
+ isSupportedCircuitId('giwa_attestation'); // false — experimental is not supported
150
149
  isSupportedCircuitId('mdl_kr_age'); // false
151
150
  isSupportedCircuitId('coinbase-kyc'); // false — not an ID at all
152
151
  ```
@@ -251,70 +250,79 @@ const relay = await sdk.createRelayRequest('oidc_domain_attestation', {
251
250
 
252
251
  ## Experimental Circuits
253
252
 
254
- ### `arc_eligibility`
253
+ ### `giwa_attestation`
255
254
 
256
- Proves the same Coinbase attestation as `coinbase_attestation`, with one thing
257
- changed: the wallet signs a named EIP-712 action instead of an opaque signal
258
- hash. The proof's public inputs then carry the action's domain separator and
259
- struct hash, so a verifier checks **which** action was authorised — not merely
260
- that somebody eligible signed something.
255
+ The same attestation shape as Coinbase KYC, against GIWA's attester on GIWA
256
+ Sepolia. A request needs a scope and nothing else; the app connects the wallet.
261
257
 
262
- That matters once an agent moves money. `personal_sign` over 32 opaque bytes
263
- shows a person a hex string, so they approve without seeing what they approve;
264
- a typed action is rendered field by field in the wallet.
258
+ ```typescript
259
+ const { deepLink } = await sdk.createRelayRequest(
260
+ CIRCUIT_IDS.GIWA_ATTESTATION,
261
+ { scope: 'myapp.com' },
262
+ { dappName: 'My App' },
263
+ );
264
+ ```
265
+
266
+ **An action is optional here.** Send one
267
+ and the wallet signs EIP-712 typed data, so the person reads named fields and
268
+ the proof carries what they approved. Send none and the wallet signs the
269
+ request's signal hash, exactly as Coinbase KYC does. The circuit itself
270
+ branches, and it refuses a request that tries to be both: with an action the
271
+ signal hash must be empty, without one the EIP-712 pair must be.
265
272
 
266
273
  ```typescript
267
- import { CIRCUIT_IDS, validateTypedAction } from '@zkproofport-app/sdk';
268
-
269
- const action = {
270
- domain: {
271
- name: 'MyVault',
272
- version: '1',
273
- chainId: 5042002, // Arc Testnet
274
- verifyingContract: '0xYourContract',
275
- },
276
- types: {
277
- Deposit: [
278
- { name: 'amount', type: 'uint256' },
279
- { name: 'nonce', type: 'uint256' },
280
- ],
274
+ await sdk.createRelayRequest(
275
+ CIRCUIT_IDS.GIWA_ATTESTATION,
276
+ {
277
+ scope: 'myapp.com',
278
+ action: {
279
+ domain: { name: 'My Vault', version: '1', chainId: 91342, verifyingContract: '0x…' },
280
+ types: { Deposit: [{ name: 'amount', type: 'uint256' }] },
281
+ primaryType: 'Deposit',
282
+ message: { amount: '1000000' },
283
+ },
281
284
  },
282
- primaryType: 'Deposit',
283
- message: { amount: '1000000', nonce: '1' },
284
- };
285
+ { dappName: 'My App' },
286
+ );
287
+ ```
285
288
 
286
- // Optional: catch a malformed action before sending it. The circuit hashes the
287
- // action without reading it, so a broken one produces a valid proof of the
288
- // wrong thing rather than failing.
289
- const problem = validateTypedAction(action);
290
- if (problem) throw new Error(problem);
289
+ Its public inputs are `signal_hash`, `domain_separator`, `action_hash`,
290
+ `signer_list_merkle_root`, `scope`, `nullifier` — 64 bytes longer than the Coinbase layout it used to share. Anything holding the
291
+ old offsets reads the Merkle root where the nullifier is.
291
292
 
292
- const relay = await sdk.createRelayRequest(CIRCUIT_IDS.ARC_ELIGIBILITY, {
293
- scope: 'myapp.com',
294
- action,
295
- });
296
- ```
293
+ One more difference worth knowing if you count people: its nullifier is
294
+ `keccak(keccak(wallet ++ keccak("giwa_attestation")) ++ scope)`. The wallet and
295
+ a constant compiled into the circuit, so one wallet in one scope has exactly
296
+ one nullifier and there is no input a prover can vary.
297
297
 
298
- `action` is required. A request without one is refused rather than proved
299
- against some default, because the signature is the whole point.
298
+ **Testnet only.** The verifier lives on GIWA Sepolia (chain `91342`) and
299
+ nowhere else, so the mobile app keeps it behind Developer Mode. A mainnet
300
+ deployment is planned; until it exists, do not ship on this.
300
301
 
301
- **Testnet only.** The verifier is deployed on Arc Testnet (chain `5042002`) and
302
- nowhere else. Circle has not published a mainnet chain id, so there is nothing
303
- to point a production build at. The mobile app keeps the whole Arc network
304
- behind Developer Mode for the same reason.
302
+ ### Which circuits take an action
305
303
 
306
- The public inputs are `signal_hash`, `domain_separator`, `action_hash`,
307
- `signer_list_merkle_root`, `scope`, `nullifier` — a different order from every
308
- other circuit, which is why `extractScopeFromPublicInputs` and
309
- `extractNullifierFromPublicInputs` require the circuit id and refuse to guess.
304
+ `CIRCUIT_ACTION_BINDING` is the one table, so you do not have to learn which
305
+ circuit names are special:
310
306
 
311
- ## Planned Circuits
307
+ | What the circuit does with an action | Circuits |
308
+ |---|---|
309
+ | Signs it when present, signs the signal hash when not | `giwa_attestation` |
310
+ | Has no action inputs — sending one is refused, not ignored | Coinbase KYC, Coinbase country, OIDC domain, the three mDL circuits |
312
311
 
313
- The identifiers below are reserved and exported, and the circuits exist — but they are **not officially supported yet**. Availability, input shape and public-input layout can change without a major version bump, so treat anything here as provisional. `CIRCUIT_SUPPORT_STATUS` reports each of them as `planned`.
312
+ ```typescript
313
+ import { circuitActionBinding } from '@zkproofport-app/sdk';
314
314
 
315
- ### `giwa_attestation`
315
+ circuitActionBinding('giwa_attestation'); // 'optional'
316
+ circuitActionBinding('coinbase_attestation'); // 'none'
317
+ ```
318
+
319
+ Sending an action to a circuit that cannot prove one is an error rather than a
320
+ silent drop: a dropped action would leave you believing a proof authorized
321
+ something the circuit never saw.
316
322
 
317
- Reserved identifier for GIWA attestation. It is a fork of `coinbase_attestation` and carries the same four public inputs, but there is no dedicated input type for it and no supported request flow. The ID is exported so that every layer spells it the same way; do not build on it yet.
323
+ ## Planned Circuits
324
+
325
+ The identifiers below are reserved and exported, and the circuits exist — but they are **not officially supported yet**. Availability, input shape and public-input layout can change without a major version bump, so treat anything here as provisional. `CIRCUIT_SUPPORT_STATUS` reports each of them as `planned`.
318
326
 
319
327
  ### `mdl_kr_ownership`
320
328
 
@@ -997,6 +1005,8 @@ import type {
997
1005
  CoinbaseKycInputs,
998
1006
  CoinbaseCountryInputs,
999
1007
  OidcDomainInputs,
1008
+ ActionBoundInputs,
1009
+ TypedAction,
1000
1010
  MdlKrOwnershipInputs,
1001
1011
  MdlKrAgeInputs,
1002
1012
  MdlKrRegionInputs,
@@ -1015,8 +1025,8 @@ import type {
1015
1025
 
1016
1026
  | Type | Description |
1017
1027
  |------|-------------|
1018
- | `CircuitId` | Union of the eight canonical circuit IDs — `'coinbase_attestation' \| 'coinbase_country_attestation' \| 'oidc_domain_attestation' \| 'arc_eligibility' \| 'giwa_attestation' \| 'mdl_kr_ownership' \| 'mdl_kr_age' \| 'mdl_kr_region'`. Also exported from `@zkproofport-app/sdk/circuits` |
1019
- | `TypedAction` | The EIP-712 action an `arc_eligibility` proof binds to: `{ domain, types, primaryType, message }` — the same object `eth_signTypedData_v4` takes |
1028
+ | `CircuitId` | Union of the seven canonical circuit IDs — `'coinbase_attestation' \| 'coinbase_country_attestation' \| 'oidc_domain_attestation' \| 'giwa_attestation' \| 'mdl_kr_ownership' \| 'mdl_kr_age' \| 'mdl_kr_region'`. Also exported from `@zkproofport-app/sdk/circuits` |
1029
+ | `TypedAction` | The EIP-712 action a `giwa_attestation` proof binds to: `{ domain, types, primaryType, message }` — the same object `eth_signTypedData_v4` takes |
1020
1030
  | `CircuitSupportStatus` | `'supported' \| 'planned'` — see [Circuit Identifiers](#circuit-identifiers) |
1021
1031
  | `CircuitType` | Alias of `CircuitId`. Kept as the name used throughout `ProofRequest`, `ProofResponse` and the SDK methods |
1022
1032
  | `ProofRequestStatus` | `'pending' \| 'completed' \| 'error' \| 'cancelled'` — the status on a `ProofResponse` |
@@ -1024,7 +1034,8 @@ import type {
1024
1034
  | `CoinbaseCountryInputs` | Inputs for `coinbase_country_attestation`: `{ scope, countryList, isIncluded, userAddress?, rawTransaction? }` |
1025
1035
  | `OidcDomainInputs` | Inputs for `oidc_domain_attestation`: `{ domain, scope, provider? }` |
1026
1036
  | `MdlKrOwnershipInputs` | Inputs for `mdl_kr_ownership`: `{ scope, discloseFlags? }` |
1027
- | `ArcEligibilityInputs` | Inputs for `arc_eligibility`: `{ scope, action, userAddress?, rawTransaction? }` — `action` is required |
1037
+ | `ActionBoundInputs` | Inputs for the circuits that can bind an EIP-712 action: `{ scope, action?, userAddress?, rawTransaction? }`. Whether the action is required is the circuit's property, in `CIRCUIT_ACTION_BINDING` — optional for `giwa_attestation` |
1038
+ | `GiwaAttestationInputs` | Alias of `ActionBoundInputs`, for `giwa_attestation` |
1028
1039
  | `MdlKrAgeInputs` | Inputs for `mdl_kr_age`: `{ scope, ageThreshold }` |
1029
1040
  | `MdlKrRegionInputs` | Inputs for `mdl_kr_region`: `{ scope, targetRegion }` |
1030
1041
  | `CircuitInputs` | Union of every input type above (plus an empty-input form for circuits that need nothing from the dApp) |
@@ -53,8 +53,6 @@ export declare const CIRCUIT_IDS: Readonly<{
53
53
  readonly COINBASE_COUNTRY_ATTESTATION: "coinbase_country_attestation";
54
54
  /** OIDC email-domain attestation. Officially supported. */
55
55
  readonly OIDC_DOMAIN_ATTESTATION: "oidc_domain_attestation";
56
- /** Arc eligibility: one EIP-712 action, authorized. Officially supported. */
57
- readonly ARC_ELIGIBILITY: "arc_eligibility";
58
56
  /** GIWA attestation. Planned — not officially supported yet. */
59
57
  readonly GIWA_ATTESTATION: "giwa_attestation";
60
58
  /** Korea Mobile ID ownership. Planned — not officially supported yet. */
@@ -131,12 +129,11 @@ export declare const SUPPORTED_CIRCUIT_IDS: readonly CircuitId[];
131
129
  /**
132
130
  * Circuits you can prove today, on a testnet, with everything subject to change.
133
131
  *
134
- * `arc_eligibility` is the reason this status exists. Calling it `planned`
135
- * would be wrong — the circuit compiles, the verifier is deployed and a proof
136
- * verifies against it — and calling it `supported` would be worse, because the
137
- * only deployment is Arc Testnet, Circle has not published a mainnet chain id,
138
- * and the public-input layout is still open. Neither existing word was true, so
139
- * the honest move was a third word rather than picking the closer lie.
132
+ * `giwa_attestation` is in this state. Calling it `planned` would be wrong —
133
+ * the circuit compiles, the verifier is deployed and a proof verifies against
134
+ * it — and calling it `supported` would be worse, because the only deployment
135
+ * is a testnet (GIWA Sepolia). Neither existing word was true, so the honest
136
+ * move was a third word rather than picking the closer lie.
140
137
  */
141
138
  export declare const EXPERIMENTAL_CIRCUIT_IDS: readonly CircuitId[];
142
139
  export declare const PLANNED_CIRCUIT_IDS: readonly CircuitId[];
@@ -188,13 +185,48 @@ export declare function getCircuitSupportStatus(circuit: CircuitId): CircuitSupp
188
185
  * `satisfies` and not an annotation, so a circuit added above is a compile
189
186
  * error here until somebody decides which it is.
190
187
  */
188
+ /**
189
+ * Whether a circuit's proof can bind an EIP-712 action, and whether it must.
190
+ *
191
+ * ONE TABLE, because the answer was becoming a chain of `circuit === '...'`
192
+ * tests. It was asked in the deep-link validator and again in
193
+ * `createRelayRequest`, both spelling out one circuit id, and a second
194
+ * action-capable circuit would have made each of them a two-branch chain that
195
+ * ends on whatever the last test happens to be.
196
+ *
197
+ * 'required' the circuit proves nothing without an action -- the wallet
198
+ * signs the typed data and there is no other message.
199
+ * 'optional' the circuit signs the action when one is supplied and
200
+ * personal_signs its signal hash when one is not. The circuit
201
+ * itself branches; see giwa-attestation/src/main.nr.
202
+ * 'none' the circuit has no action inputs. An action sent anyway is a
203
+ * caller misunderstanding, and is refused rather than dropped:
204
+ * silently ignoring it would let a dapp believe a proof
205
+ * authorized something it never mentioned.
206
+ */
207
+ export type CircuitActionBinding = 'none' | 'required' | 'optional';
208
+ export declare const CIRCUIT_ACTION_BINDING: {
209
+ coinbase_attestation: "none";
210
+ coinbase_country_attestation: "none";
211
+ oidc_domain_attestation: "none";
212
+ giwa_attestation: "optional";
213
+ mdl_kr_ownership: "none";
214
+ mdl_kr_age: "none";
215
+ mdl_kr_region: "none";
216
+ };
217
+ /**
218
+ * How this circuit treats an action, or an error naming the id that is not one.
219
+ *
220
+ * No default: a circuit nobody has classified must not inherit 'none', which
221
+ * would silently drop an action a dapp meant to bind.
222
+ */
223
+ export declare function circuitActionBinding(circuit: string): CircuitActionBinding;
191
224
  export declare const CIRCUIT_NEEDS_WALLET_SIGNATURE: {
192
225
  coinbase_attestation: true;
193
226
  coinbase_country_attestation: true;
194
- arc_eligibility: true;
195
227
  oidc_domain_attestation: false;
196
228
  mdl_kr_ownership: false;
197
229
  mdl_kr_age: false;
198
230
  mdl_kr_region: false;
199
- giwa_attestation: false;
231
+ giwa_attestation: true;
200
232
  };
@@ -44,8 +44,6 @@ const CIRCUIT_IDS = Object.freeze({
44
44
  COINBASE_COUNTRY_ATTESTATION: 'coinbase_country_attestation',
45
45
  /** OIDC email-domain attestation. Officially supported. */
46
46
  OIDC_DOMAIN_ATTESTATION: 'oidc_domain_attestation',
47
- /** Arc eligibility: one EIP-712 action, authorized. Officially supported. */
48
- ARC_ELIGIBILITY: 'arc_eligibility',
49
47
  /** GIWA attestation. Planned — not officially supported yet. */
50
48
  GIWA_ATTESTATION: 'giwa_attestation',
51
49
  /** Korea Mobile ID ownership. Planned — not officially supported yet. */
@@ -74,8 +72,11 @@ const CIRCUIT_SUPPORT_STATUS = Object.freeze({
74
72
  coinbase_attestation: 'supported',
75
73
  coinbase_country_attestation: 'supported',
76
74
  oidc_domain_attestation: 'supported',
77
- arc_eligibility: 'experimental',
78
- giwa_attestation: 'planned',
75
+ // Experimental, not planned: the circuit is built, its verifier is
76
+ // deployed on GIWA Sepolia and the demo requests it. What keeps it out of
77
+ // 'supported' is that it is testnet-only, so the app offers it behind
78
+ // Developer Mode and reads its files from main rather than a release tag.
79
+ giwa_attestation: 'experimental',
79
80
  mdl_kr_ownership: 'planned',
80
81
  mdl_kr_age: 'planned',
81
82
  mdl_kr_region: 'planned',
@@ -104,7 +105,6 @@ const CIRCUIT_VK_PATHS = Object.freeze({
104
105
  coinbase_attestation: 'coinbase-attestation/target/vk/vk',
105
106
  coinbase_country_attestation: 'coinbase-country-attestation/target/vk/vk',
106
107
  oidc_domain_attestation: 'oidc-domain-attestation/target/vk/vk',
107
- arc_eligibility: 'arc-eligibility/target/vk/vk',
108
108
  giwa_attestation: 'giwa-attestation/target/vk/vk',
109
109
  mdl_kr_ownership: 'mdl/kr-ownership/target/vk/vk',
110
110
  mdl_kr_age: 'mdl/kr-age/target/vk/vk',
@@ -133,12 +133,11 @@ const SUPPORTED_CIRCUIT_IDS = Object.freeze(ALL_CIRCUIT_IDS.filter((id) => CIRCU
133
133
  /**
134
134
  * Circuits you can prove today, on a testnet, with everything subject to change.
135
135
  *
136
- * `arc_eligibility` is the reason this status exists. Calling it `planned`
137
- * would be wrong — the circuit compiles, the verifier is deployed and a proof
138
- * verifies against it — and calling it `supported` would be worse, because the
139
- * only deployment is Arc Testnet, Circle has not published a mainnet chain id,
140
- * and the public-input layout is still open. Neither existing word was true, so
141
- * the honest move was a third word rather than picking the closer lie.
136
+ * `giwa_attestation` is in this state. Calling it `planned` would be wrong —
137
+ * the circuit compiles, the verifier is deployed and a proof verifies against
138
+ * it — and calling it `supported` would be worse, because the only deployment
139
+ * is a testnet (GIWA Sepolia). Neither existing word was true, so the honest
140
+ * move was a third word rather than picking the closer lie.
142
141
  */
143
142
  const EXPERIMENTAL_CIRCUIT_IDS = Object.freeze(ALL_CIRCUIT_IDS.filter(id => CIRCUIT_SUPPORT_STATUS[id] === 'experimental'));
144
143
  const PLANNED_CIRCUIT_IDS = Object.freeze(ALL_CIRCUIT_IDS.filter((id) => CIRCUIT_SUPPORT_STATUS[id] === 'planned'));
@@ -187,32 +186,55 @@ function getCircuitSupportStatus(circuit) {
187
186
  }
188
187
  return CIRCUIT_SUPPORT_STATUS[circuit];
189
188
  }
189
+ const CIRCUIT_ACTION_BINDING = {
190
+ coinbase_attestation: 'none',
191
+ coinbase_country_attestation: 'none',
192
+ // The signature lives inside the identity token; no wallet, no action.
193
+ oidc_domain_attestation: 'none',
194
+ // Branches in-circuit: with an action the wallet signs the typed data,
195
+ // without one it personal_signs the request's signal hash.
196
+ giwa_attestation: 'optional',
197
+ mdl_kr_ownership: 'none',
198
+ mdl_kr_age: 'none',
199
+ mdl_kr_region: 'none',
200
+ };
201
+ /*
202
+ * The union is declared above rather than derived from the table's values.
203
+ *
204
+ * Deriving it narrowed the type to whatever the table happens to hold today --
205
+ * 'none' | 'optional' -- and TypeScript then called every `=== 'required'`
206
+ * check impossible. The publish typecheck caught it; `rollup` and `vitest` did
207
+ * not. 'required' is a state a circuit can legitimately be in (an EIP-712 path
208
+ * and nothing else), so the union says so and the table is checked against it.
209
+ */
190
210
  /**
191
- * Whether a circuit's relay request must carry a wallet signature.
192
- *
193
- * The SDK checks this to fail fast — "Signer not set" locally beats a 401 from
194
- * the relay two round trips later, with nothing saying which circuit needed
195
- * what. The relay declares its OWN copy on purpose and does not import this
196
- * one: it is a security boundary, and an auth policy that a published package
197
- * can change is not a policy. A test in the relay asserts the two agree.
211
+ * How this circuit treats an action, or an error naming the id that is not one.
198
212
  *
199
- * `satisfies` and not an annotation, so a circuit added above is a compile
200
- * error here until somebody decides which it is.
213
+ * No default: a circuit nobody has classified must not inherit 'none', which
214
+ * would silently drop an action a dapp meant to bind.
201
215
  */
216
+ function circuitActionBinding(circuit) {
217
+ const binding = CIRCUIT_ACTION_BINDING[circuit];
218
+ if (!binding) {
219
+ throw new Error(`Unknown circuit '${circuit}'. Expected: ${ALL_CIRCUIT_IDS.join(', ')}`);
220
+ }
221
+ return binding;
222
+ }
202
223
  const CIRCUIT_NEEDS_WALLET_SIGNATURE = {
203
224
  coinbase_attestation: true,
204
225
  coinbase_country_attestation: true,
205
- // Same Coinbase-attested wallet as above; what changes is that it signs an
206
- // EIP-712 action rather than signal_hash.
207
- arc_eligibility: true,
208
226
  // The signature is inside the OIDC identity token, checked by the prover.
209
227
  oidc_domain_attestation: false,
210
228
  // Web2 (OmniOne CX) flows with no wallet binding at all.
211
229
  mdl_kr_ownership: false,
212
230
  mdl_kr_age: false,
213
231
  mdl_kr_region: false,
214
- giwa_attestation: false,
232
+ // A GIWA-attested wallet signing an EIP-712 action (or its signal hash).
233
+ // This read `false` while the circuit had always verified a wallet signature
234
+ // -- it sat under the Web2 comment above and was never revisited. A request
235
+ // for it would have reached the relay with no signer.
236
+ giwa_attestation: true,
215
237
  };
216
238
 
217
- export { ALL_CIRCUIT_IDS, CIRCUIT_IDS, CIRCUIT_NEEDS_WALLET_SIGNATURE, CIRCUIT_SUPPORT_STATUS, CIRCUIT_VK_PATHS, EXPERIMENTAL_CIRCUIT_IDS, PLANNED_CIRCUIT_IDS, SUPPORTED_CIRCUIT_IDS, getCircuitSupportStatus, isCircuitId, isSupportedCircuitId };
239
+ export { ALL_CIRCUIT_IDS, CIRCUIT_ACTION_BINDING, CIRCUIT_IDS, CIRCUIT_NEEDS_WALLET_SIGNATURE, CIRCUIT_SUPPORT_STATUS, CIRCUIT_VK_PATHS, EXPERIMENTAL_CIRCUIT_IDS, PLANNED_CIRCUIT_IDS, SUPPORTED_CIRCUIT_IDS, circuitActionBinding, getCircuitSupportStatus, isCircuitId, isSupportedCircuitId };
218
240
  //# sourceMappingURL=circuits.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"circuits.esm.js","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' | 'experimental' | '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 /** Arc eligibility: one EIP-712 action, authorized. Officially supported. */\n ARC_ELIGIBILITY: 'arc_eligibility',\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 arc_eligibility: 'experimental',\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 * Where each circuit's verification key FILE lives inside the\n * `zkproofport/circuits` repository, relative to its root.\n *\n * Off-chain verification needs the verification key and nothing else — no\n * circuit bytecode, no witness. The key is public by nature: it is what anyone\n * checking a proof must already have, and the Solidity verifiers deployed\n * on-chain embed the same key.\n *\n * NOTE THE TRAILING `/vk` TWICE. In that repository `target/vk` is a DIRECTORY\n * holding `vk`, `vk_hash` and `SHA256SUMS`; the key itself is `target/vk/vk`.\n * These paths were first copied here from the mobile app, which keeps the\n * directory and the filename as two fields and joins them — so taking only the\n * directory produced a URL that answers 404, and the first browser to try\n * off-chain verification said \"Could not fetch the verification key (HTTP 404)\".\n *\n * Exhaustive over {@link CircuitId} on purpose. A new circuit whose key path is\n * not listed here fails to compile rather than failing at verification time,\n * where the only symptom would be a proof that cannot be checked.\n */\nexport const CIRCUIT_VK_PATHS: Readonly<Record<CircuitId, string>> = Object.freeze({\n coinbase_attestation: 'coinbase-attestation/target/vk/vk',\n coinbase_country_attestation: 'coinbase-country-attestation/target/vk/vk',\n oidc_domain_attestation: 'oidc-domain-attestation/target/vk/vk',\n arc_eligibility: 'arc-eligibility/target/vk/vk',\n giwa_attestation: 'giwa-attestation/target/vk/vk',\n mdl_kr_ownership: 'mdl/kr-ownership/target/vk/vk',\n mdl_kr_age: 'mdl/kr-age/target/vk/vk',\n mdl_kr_region: 'mdl/kr-region/target/vk/vk',\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 */\n/**\n * Circuits you can prove today, on a testnet, with everything subject to change.\n *\n * `arc_eligibility` is the reason this status exists. Calling it `planned`\n * would be wrong — the circuit compiles, the verifier is deployed and a proof\n * verifies against it — and calling it `supported` would be worse, because the\n * only deployment is Arc Testnet, Circle has not published a mainnet chain id,\n * and the public-input layout is still open. Neither existing word was true, so\n * the honest move was a third word rather than picking the closer lie.\n */\nexport const EXPERIMENTAL_CIRCUIT_IDS: readonly CircuitId[] = Object.freeze(\n ALL_CIRCUIT_IDS.filter(id => CIRCUIT_SUPPORT_STATUS[id] === 'experimental'),\n);\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\n/**\n * Whether a circuit's relay request must carry a wallet signature.\n *\n * The SDK checks this to fail fast — \"Signer not set\" locally beats a 401 from\n * the relay two round trips later, with nothing saying which circuit needed\n * what. The relay declares its OWN copy on purpose and does not import this\n * one: it is a security boundary, and an auth policy that a published package\n * can change is not a policy. A test in the relay asserts the two agree.\n *\n * `satisfies` and not an annotation, so a circuit added above is a compile\n * error here until somebody decides which it is.\n */\nexport const CIRCUIT_NEEDS_WALLET_SIGNATURE = {\n coinbase_attestation: true,\n coinbase_country_attestation: true,\n // Same Coinbase-attested wallet as above; what changes is that it signs an\n // EIP-712 action rather than signal_hash.\n arc_eligibility: true,\n // The signature is inside the OIDC identity token, checked by the prover.\n oidc_domain_attestation: false,\n // Web2 (OmniOne CX) flows with no wallet binding at all.\n mdl_kr_ownership: false,\n mdl_kr_age: false,\n mdl_kr_region: false,\n giwa_attestation: false,\n} satisfies Record<CircuitId, boolean>;\n"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"circuits.esm.js","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' | 'experimental' | '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 // Experimental, not planned: the circuit is built, its verifier is\n // deployed on GIWA Sepolia and the demo requests it. What keeps it out of\n // 'supported' is that it is testnet-only, so the app offers it behind\n // Developer Mode and reads its files from main rather than a release tag.\n giwa_attestation: 'experimental',\n mdl_kr_ownership: 'planned',\n mdl_kr_age: 'planned',\n mdl_kr_region: 'planned',\n } as const);\n\n/**\n * Where each circuit's verification key FILE lives inside the\n * `zkproofport/circuits` repository, relative to its root.\n *\n * Off-chain verification needs the verification key and nothing else — no\n * circuit bytecode, no witness. The key is public by nature: it is what anyone\n * checking a proof must already have, and the Solidity verifiers deployed\n * on-chain embed the same key.\n *\n * NOTE THE TRAILING `/vk` TWICE. In that repository `target/vk` is a DIRECTORY\n * holding `vk`, `vk_hash` and `SHA256SUMS`; the key itself is `target/vk/vk`.\n * These paths were first copied here from the mobile app, which keeps the\n * directory and the filename as two fields and joins them — so taking only the\n * directory produced a URL that answers 404, and the first browser to try\n * off-chain verification said \"Could not fetch the verification key (HTTP 404)\".\n *\n * Exhaustive over {@link CircuitId} on purpose. A new circuit whose key path is\n * not listed here fails to compile rather than failing at verification time,\n * where the only symptom would be a proof that cannot be checked.\n */\nexport const CIRCUIT_VK_PATHS: Readonly<Record<CircuitId, string>> = Object.freeze({\n coinbase_attestation: 'coinbase-attestation/target/vk/vk',\n coinbase_country_attestation: 'coinbase-country-attestation/target/vk/vk',\n oidc_domain_attestation: 'oidc-domain-attestation/target/vk/vk',\n giwa_attestation: 'giwa-attestation/target/vk/vk',\n mdl_kr_ownership: 'mdl/kr-ownership/target/vk/vk',\n mdl_kr_age: 'mdl/kr-age/target/vk/vk',\n mdl_kr_region: 'mdl/kr-region/target/vk/vk',\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 */\n/**\n * Circuits you can prove today, on a testnet, with everything subject to change.\n *\n * `giwa_attestation` is in this state. Calling it `planned` would be wrong —\n * the circuit compiles, the verifier is deployed and a proof verifies against\n * it — and calling it `supported` would be worse, because the only deployment\n * is a testnet (GIWA Sepolia). Neither existing word was true, so the honest\n * move was a third word rather than picking the closer lie.\n */\nexport const EXPERIMENTAL_CIRCUIT_IDS: readonly CircuitId[] = Object.freeze(\n ALL_CIRCUIT_IDS.filter(id => CIRCUIT_SUPPORT_STATUS[id] === 'experimental'),\n);\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\n/**\n * Whether a circuit's relay request must carry a wallet signature.\n *\n * The SDK checks this to fail fast — \"Signer not set\" locally beats a 401 from\n * the relay two round trips later, with nothing saying which circuit needed\n * what. The relay declares its OWN copy on purpose and does not import this\n * one: it is a security boundary, and an auth policy that a published package\n * can change is not a policy. A test in the relay asserts the two agree.\n *\n * `satisfies` and not an annotation, so a circuit added above is a compile\n * error here until somebody decides which it is.\n */\n/**\n * Whether a circuit's proof can bind an EIP-712 action, and whether it must.\n *\n * ONE TABLE, because the answer was becoming a chain of `circuit === '...'`\n * tests. It was asked in the deep-link validator and again in\n * `createRelayRequest`, both spelling out one circuit id, and a second\n * action-capable circuit would have made each of them a two-branch chain that\n * ends on whatever the last test happens to be.\n *\n * 'required' the circuit proves nothing without an action -- the wallet\n * signs the typed data and there is no other message.\n * 'optional' the circuit signs the action when one is supplied and\n * personal_signs its signal hash when one is not. The circuit\n * itself branches; see giwa-attestation/src/main.nr.\n * 'none' the circuit has no action inputs. An action sent anyway is a\n * caller misunderstanding, and is refused rather than dropped:\n * silently ignoring it would let a dapp believe a proof\n * authorized something it never mentioned.\n */\nexport type CircuitActionBinding = 'none' | 'required' | 'optional';\n\nexport const CIRCUIT_ACTION_BINDING = {\n coinbase_attestation: 'none',\n coinbase_country_attestation: 'none',\n // The signature lives inside the identity token; no wallet, no action.\n oidc_domain_attestation: 'none',\n // Branches in-circuit: with an action the wallet signs the typed data,\n // without one it personal_signs the request's signal hash.\n giwa_attestation: 'optional',\n mdl_kr_ownership: 'none',\n mdl_kr_age: 'none',\n mdl_kr_region: 'none',\n} satisfies Record<CircuitId, CircuitActionBinding>;\n\n/*\n * The union is declared above rather than derived from the table's values.\n *\n * Deriving it narrowed the type to whatever the table happens to hold today --\n * 'none' | 'optional' -- and TypeScript then called every `=== 'required'`\n * check impossible. The publish typecheck caught it; `rollup` and `vitest` did\n * not. 'required' is a state a circuit can legitimately be in (an EIP-712 path\n * and nothing else), so the union says so and the table is checked against it.\n */\n\n/**\n * How this circuit treats an action, or an error naming the id that is not one.\n *\n * No default: a circuit nobody has classified must not inherit 'none', which\n * would silently drop an action a dapp meant to bind.\n */\nexport function circuitActionBinding(circuit: string): CircuitActionBinding {\n const binding = (CIRCUIT_ACTION_BINDING as Record<string, CircuitActionBinding | undefined>)[circuit];\n if (!binding) {\n throw new Error(\n `Unknown circuit '${circuit}'. Expected: ${ALL_CIRCUIT_IDS.join(', ')}`,\n );\n }\n return binding;\n}\n\nexport const CIRCUIT_NEEDS_WALLET_SIGNATURE = {\n coinbase_attestation: true,\n coinbase_country_attestation: true,\n // The signature is inside the OIDC identity token, checked by the prover.\n oidc_domain_attestation: false,\n // Web2 (OmniOne CX) flows with no wallet binding at all.\n mdl_kr_ownership: false,\n mdl_kr_age: false,\n mdl_kr_region: false,\n // A GIWA-attested wallet signing an EIP-712 action (or its signal hash).\n // This read `false` while the circuit had always verified a wallet signature\n // -- it sat under the Web2 comment above and was never revisited. A request\n // for it would have reached the relay with no signer.\n giwa_attestation: true,\n} satisfies Record<CircuitId, boolean>;\n"],"names":[],"mappings":"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"}
package/dist/circuits.js CHANGED
@@ -46,8 +46,6 @@ const CIRCUIT_IDS = Object.freeze({
46
46
  COINBASE_COUNTRY_ATTESTATION: 'coinbase_country_attestation',
47
47
  /** OIDC email-domain attestation. Officially supported. */
48
48
  OIDC_DOMAIN_ATTESTATION: 'oidc_domain_attestation',
49
- /** Arc eligibility: one EIP-712 action, authorized. Officially supported. */
50
- ARC_ELIGIBILITY: 'arc_eligibility',
51
49
  /** GIWA attestation. Planned — not officially supported yet. */
52
50
  GIWA_ATTESTATION: 'giwa_attestation',
53
51
  /** Korea Mobile ID ownership. Planned — not officially supported yet. */
@@ -76,8 +74,11 @@ const CIRCUIT_SUPPORT_STATUS = Object.freeze({
76
74
  coinbase_attestation: 'supported',
77
75
  coinbase_country_attestation: 'supported',
78
76
  oidc_domain_attestation: 'supported',
79
- arc_eligibility: 'experimental',
80
- giwa_attestation: 'planned',
77
+ // Experimental, not planned: the circuit is built, its verifier is
78
+ // deployed on GIWA Sepolia and the demo requests it. What keeps it out of
79
+ // 'supported' is that it is testnet-only, so the app offers it behind
80
+ // Developer Mode and reads its files from main rather than a release tag.
81
+ giwa_attestation: 'experimental',
81
82
  mdl_kr_ownership: 'planned',
82
83
  mdl_kr_age: 'planned',
83
84
  mdl_kr_region: 'planned',
@@ -106,7 +107,6 @@ const CIRCUIT_VK_PATHS = Object.freeze({
106
107
  coinbase_attestation: 'coinbase-attestation/target/vk/vk',
107
108
  coinbase_country_attestation: 'coinbase-country-attestation/target/vk/vk',
108
109
  oidc_domain_attestation: 'oidc-domain-attestation/target/vk/vk',
109
- arc_eligibility: 'arc-eligibility/target/vk/vk',
110
110
  giwa_attestation: 'giwa-attestation/target/vk/vk',
111
111
  mdl_kr_ownership: 'mdl/kr-ownership/target/vk/vk',
112
112
  mdl_kr_age: 'mdl/kr-age/target/vk/vk',
@@ -135,12 +135,11 @@ const SUPPORTED_CIRCUIT_IDS = Object.freeze(ALL_CIRCUIT_IDS.filter((id) => CIRCU
135
135
  /**
136
136
  * Circuits you can prove today, on a testnet, with everything subject to change.
137
137
  *
138
- * `arc_eligibility` is the reason this status exists. Calling it `planned`
139
- * would be wrong — the circuit compiles, the verifier is deployed and a proof
140
- * verifies against it — and calling it `supported` would be worse, because the
141
- * only deployment is Arc Testnet, Circle has not published a mainnet chain id,
142
- * and the public-input layout is still open. Neither existing word was true, so
143
- * the honest move was a third word rather than picking the closer lie.
138
+ * `giwa_attestation` is in this state. Calling it `planned` would be wrong —
139
+ * the circuit compiles, the verifier is deployed and a proof verifies against
140
+ * it — and calling it `supported` would be worse, because the only deployment
141
+ * is a testnet (GIWA Sepolia). Neither existing word was true, so the honest
142
+ * move was a third word rather than picking the closer lie.
144
143
  */
145
144
  const EXPERIMENTAL_CIRCUIT_IDS = Object.freeze(ALL_CIRCUIT_IDS.filter(id => CIRCUIT_SUPPORT_STATUS[id] === 'experimental'));
146
145
  const PLANNED_CIRCUIT_IDS = Object.freeze(ALL_CIRCUIT_IDS.filter((id) => CIRCUIT_SUPPORT_STATUS[id] === 'planned'));
@@ -189,34 +188,58 @@ function getCircuitSupportStatus(circuit) {
189
188
  }
190
189
  return CIRCUIT_SUPPORT_STATUS[circuit];
191
190
  }
191
+ const CIRCUIT_ACTION_BINDING = {
192
+ coinbase_attestation: 'none',
193
+ coinbase_country_attestation: 'none',
194
+ // The signature lives inside the identity token; no wallet, no action.
195
+ oidc_domain_attestation: 'none',
196
+ // Branches in-circuit: with an action the wallet signs the typed data,
197
+ // without one it personal_signs the request's signal hash.
198
+ giwa_attestation: 'optional',
199
+ mdl_kr_ownership: 'none',
200
+ mdl_kr_age: 'none',
201
+ mdl_kr_region: 'none',
202
+ };
203
+ /*
204
+ * The union is declared above rather than derived from the table's values.
205
+ *
206
+ * Deriving it narrowed the type to whatever the table happens to hold today --
207
+ * 'none' | 'optional' -- and TypeScript then called every `=== 'required'`
208
+ * check impossible. The publish typecheck caught it; `rollup` and `vitest` did
209
+ * not. 'required' is a state a circuit can legitimately be in (an EIP-712 path
210
+ * and nothing else), so the union says so and the table is checked against it.
211
+ */
192
212
  /**
193
- * Whether a circuit's relay request must carry a wallet signature.
194
- *
195
- * The SDK checks this to fail fast — "Signer not set" locally beats a 401 from
196
- * the relay two round trips later, with nothing saying which circuit needed
197
- * what. The relay declares its OWN copy on purpose and does not import this
198
- * one: it is a security boundary, and an auth policy that a published package
199
- * can change is not a policy. A test in the relay asserts the two agree.
213
+ * How this circuit treats an action, or an error naming the id that is not one.
200
214
  *
201
- * `satisfies` and not an annotation, so a circuit added above is a compile
202
- * error here until somebody decides which it is.
215
+ * No default: a circuit nobody has classified must not inherit 'none', which
216
+ * would silently drop an action a dapp meant to bind.
203
217
  */
218
+ function circuitActionBinding(circuit) {
219
+ const binding = CIRCUIT_ACTION_BINDING[circuit];
220
+ if (!binding) {
221
+ throw new Error(`Unknown circuit '${circuit}'. Expected: ${ALL_CIRCUIT_IDS.join(', ')}`);
222
+ }
223
+ return binding;
224
+ }
204
225
  const CIRCUIT_NEEDS_WALLET_SIGNATURE = {
205
226
  coinbase_attestation: true,
206
227
  coinbase_country_attestation: true,
207
- // Same Coinbase-attested wallet as above; what changes is that it signs an
208
- // EIP-712 action rather than signal_hash.
209
- arc_eligibility: true,
210
228
  // The signature is inside the OIDC identity token, checked by the prover.
211
229
  oidc_domain_attestation: false,
212
230
  // Web2 (OmniOne CX) flows with no wallet binding at all.
213
231
  mdl_kr_ownership: false,
214
232
  mdl_kr_age: false,
215
233
  mdl_kr_region: false,
216
- giwa_attestation: false,
234
+ // A GIWA-attested wallet signing an EIP-712 action (or its signal hash).
235
+ // This read `false` while the circuit had always verified a wallet signature
236
+ // -- it sat under the Web2 comment above and was never revisited. A request
237
+ // for it would have reached the relay with no signer.
238
+ giwa_attestation: true,
217
239
  };
218
240
 
219
241
  exports.ALL_CIRCUIT_IDS = ALL_CIRCUIT_IDS;
242
+ exports.CIRCUIT_ACTION_BINDING = CIRCUIT_ACTION_BINDING;
220
243
  exports.CIRCUIT_IDS = CIRCUIT_IDS;
221
244
  exports.CIRCUIT_NEEDS_WALLET_SIGNATURE = CIRCUIT_NEEDS_WALLET_SIGNATURE;
222
245
  exports.CIRCUIT_SUPPORT_STATUS = CIRCUIT_SUPPORT_STATUS;
@@ -224,6 +247,7 @@ exports.CIRCUIT_VK_PATHS = CIRCUIT_VK_PATHS;
224
247
  exports.EXPERIMENTAL_CIRCUIT_IDS = EXPERIMENTAL_CIRCUIT_IDS;
225
248
  exports.PLANNED_CIRCUIT_IDS = PLANNED_CIRCUIT_IDS;
226
249
  exports.SUPPORTED_CIRCUIT_IDS = SUPPORTED_CIRCUIT_IDS;
250
+ exports.circuitActionBinding = circuitActionBinding;
227
251
  exports.getCircuitSupportStatus = getCircuitSupportStatus;
228
252
  exports.isCircuitId = isCircuitId;
229
253
  exports.isSupportedCircuitId = isSupportedCircuitId;