@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/dist/index.mjs 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); // 2
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
- publicInputsCount: 2,
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
- publicInputsCount: 14,
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
- // Korea Mobile ID (mDL) circuits. Counts are byte-flattened field totals
77
- // from the compiled circuit ABIs: [u8; 32] arrays contribute 32 inputs each.
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
- export { COINBASE_ATTESTATION_PUBLIC_INPUT_LAYOUT, COINBASE_COUNTRY_PUBLIC_INPUT_LAYOUT, MDL_KR_PUBLIC_INPUT_LAYOUT, OIDC_DOMAIN_ATTESTATION_PUBLIC_INPUT_LAYOUT, ProofportSDK, ProofportSDK as default, extractDomainFromPublicInputs, extractNullifierFromPublicInputs, extractScopeFromPublicInputs };
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.mjs.map