@zkproofport-app/sdk 0.2.10 → 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 +131 -31
- package/dist/ProofportSDK.d.ts +22 -8
- 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/deeplink.d.ts +70 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +302 -22
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +309 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +302 -22
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +16 -3
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@zkproofport-app/sdk)
|
|
4
4
|
[](./LICENSE)
|
|
5
5
|
|
|
6
|
-
TypeScript SDK for requesting zero-knowledge proofs from the [ZKProofport](https://zkproofport.com) mobile app and verifying them on-chain.
|
|
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.
|
|
7
7
|
|
|
8
8
|
## How It Works
|
|
9
9
|
|
|
@@ -97,9 +97,73 @@ if (result.status === 'completed') {
|
|
|
97
97
|
}
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
+
## Circuit Identifiers
|
|
101
|
+
|
|
102
|
+
Circuit IDs are canonical, lowercase and case-sensitive: each one is the `name` field of that circuit's `Nargo.toml`, verbatim. Hyphenated spellings such as `coinbase-kyc` or `mdl-kr-age` are route and directory names from elsewhere — they are not circuit IDs, and passing one does not fail with a clear error. It produces a nullifier mismatch or a verifier lookup that finds nothing.
|
|
103
|
+
|
|
104
|
+
This SDK is the single source of truth for that list. Import the constants rather than typing the strings, and a rename becomes a compile error instead of a runtime surprise:
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { CIRCUIT_IDS } from '@zkproofport-app/sdk';
|
|
108
|
+
|
|
109
|
+
const relay = await sdk.createRelayRequest(CIRCUIT_IDS.COINBASE_ATTESTATION, {
|
|
110
|
+
scope: 'myapp.com',
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The same names are also published on their own subpath, which holds nothing but the list — no `ethers`, no `socket.io-client`, no SDK code. A server, a worker or a build script can read it without pulling the SDK in:
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
import { CIRCUIT_IDS, CIRCUIT_SUPPORT_STATUS } from '@zkproofport-app/sdk/circuits';
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Status
|
|
121
|
+
|
|
122
|
+
| Constant | Circuit ID | Status |
|
|
123
|
+
|----------|-----------|--------|
|
|
124
|
+
| `CIRCUIT_IDS.COINBASE_ATTESTATION` | `coinbase_attestation` | **Supported** |
|
|
125
|
+
| `CIRCUIT_IDS.COINBASE_COUNTRY_ATTESTATION` | `coinbase_country_attestation` | **Supported** |
|
|
126
|
+
| `CIRCUIT_IDS.OIDC_DOMAIN_ATTESTATION` | `oidc_domain_attestation` | **Supported** |
|
|
127
|
+
| `CIRCUIT_IDS.GIWA_ATTESTATION` | `giwa_attestation` | Planned |
|
|
128
|
+
| `CIRCUIT_IDS.MDL_KR_OWNERSHIP` | `mdl_kr_ownership` | Planned |
|
|
129
|
+
| `CIRCUIT_IDS.MDL_KR_AGE` | `mdl_kr_age` | Planned |
|
|
130
|
+
| `CIRCUIT_IDS.MDL_KR_REGION` | `mdl_kr_region` | Planned |
|
|
131
|
+
|
|
132
|
+
**Supported** means generally available — build a product on it. **Planned** means the identifier is reserved and the circuit exists, but it is not officially supported yet: availability, inputs and public-input layout can change without a major version bump.
|
|
133
|
+
|
|
134
|
+
Every ID appears in `CircuitType` and in `sdk.getSupportedCircuits()`, planned ones included, so being assignable is not a support guarantee. Gate on the status, not on the type:
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
import { CIRCUIT_SUPPORT_STATUS, isSupportedCircuitId } from '@zkproofport-app/sdk';
|
|
138
|
+
|
|
139
|
+
CIRCUIT_SUPPORT_STATUS.coinbase_attestation; // 'supported'
|
|
140
|
+
CIRCUIT_SUPPORT_STATUS.mdl_kr_age; // 'planned'
|
|
141
|
+
|
|
142
|
+
isSupportedCircuitId('oidc_domain_attestation'); // true
|
|
143
|
+
isSupportedCircuitId('mdl_kr_age'); // false
|
|
144
|
+
isSupportedCircuitId('coinbase-kyc'); // false — not an ID at all
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Exports
|
|
148
|
+
|
|
149
|
+
| Export | Type | What it is |
|
|
150
|
+
|--------|------|------------|
|
|
151
|
+
| `CIRCUIT_IDS` | object | Every canonical ID, keyed by a stable constant name |
|
|
152
|
+
| `ALL_CIRCUIT_IDS` | `readonly CircuitId[]` | Every ID, in the order of the table above |
|
|
153
|
+
| `SUPPORTED_CIRCUIT_IDS` | `readonly CircuitId[]` | Only the officially supported ones |
|
|
154
|
+
| `PLANNED_CIRCUIT_IDS` | `readonly CircuitId[]` | Only the planned ones |
|
|
155
|
+
| `CIRCUIT_SUPPORT_STATUS` | `Readonly<Record<CircuitId, CircuitSupportStatus>>` | The status of each circuit |
|
|
156
|
+
| `isCircuitId(value)` | `value is CircuitId` | Narrows an unknown value; `false` for hyphenated names |
|
|
157
|
+
| `isSupportedCircuitId(value)` | `value is CircuitId` | The same, and additionally requires `supported` |
|
|
158
|
+
| `getCircuitSupportStatus(id)` | `CircuitSupportStatus` | Status of one ID; throws on an unknown one |
|
|
159
|
+
| `CircuitId` | type | Union of the seven IDs. `CircuitType` is an alias of it |
|
|
160
|
+
| `CircuitSupportStatus` | type | `'supported' \| 'planned'` |
|
|
161
|
+
|
|
162
|
+
Both objects and all three arrays are frozen. `ALL_CIRCUIT_IDS`, `SUPPORTED_CIRCUIT_IDS` and `PLANNED_CIRCUIT_IDS` are derived from `CIRCUIT_SUPPORT_STATUS` at load time, so they cannot disagree with it.
|
|
163
|
+
|
|
100
164
|
## Supported Circuits
|
|
101
165
|
|
|
102
|
-
|
|
166
|
+
The circuits below are officially supported. Pass their IDs exactly as written, or use the `CIRCUIT_IDS` constants. `sdk.getSupportedCircuits()` returns every known ID at runtime, planned ones included — see [Circuit Identifiers](#circuit-identifiers).
|
|
103
167
|
|
|
104
168
|
### `coinbase_attestation`
|
|
105
169
|
|
|
@@ -178,6 +242,14 @@ const relay = await sdk.createRelayRequest('oidc_domain_attestation', {
|
|
|
178
242
|
|
|
179
243
|
> When `provider` is set, the mobile app verifies the user's account is managed by the specified workspace provider (e.g., Google Workspace `hd` claim, Microsoft 365 `tid` claim). Without `provider`, only the email domain is verified.
|
|
180
244
|
|
|
245
|
+
## Planned Circuits
|
|
246
|
+
|
|
247
|
+
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`.
|
|
248
|
+
|
|
249
|
+
### `giwa_attestation`
|
|
250
|
+
|
|
251
|
+
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.
|
|
252
|
+
|
|
181
253
|
### `mdl_kr_ownership`
|
|
182
254
|
|
|
183
255
|
Proves the user holds a valid Korean mobile driver's license (모바일 신분증). The license data stays on-device; only the attributes selected by `discloseFlags` are revealed. No wallet signer is required.
|
|
@@ -292,7 +364,7 @@ const relay = await sdk.createRelayRequest('coinbase_attestation', {
|
|
|
292
364
|
dappIcon: 'https://myapp.com/icon.png',
|
|
293
365
|
message: 'Verify your identity to continue',
|
|
294
366
|
nonce: 'unique-nonce-123', // Optional: replay prevention
|
|
295
|
-
returnScheme: 'mydapp://', // Optional:
|
|
367
|
+
returnScheme: 'mydapp://', // Optional: native apps only, see below
|
|
296
368
|
});
|
|
297
369
|
|
|
298
370
|
// relay.requestId — Relay-issued UUID
|
|
@@ -303,48 +375,72 @@ const relay = await sdk.createRelayRequest('coinbase_attestation', {
|
|
|
303
375
|
|
|
304
376
|
Every field of the third argument is optional: `message`, `dappName` and `dappIcon` are shown to the user in the ZKProofport app, `nonce` is a value of your own choosing that the relay refuses to accept twice, and `returnScheme` is described next.
|
|
305
377
|
|
|
306
|
-
#### Switching back
|
|
378
|
+
#### Switching back: `returnScheme`
|
|
379
|
+
|
|
380
|
+
When ZKProofport finishes a proof, the user is sitting in the ZKProofport app. `returnScheme` answers one question: **which app should come back to the foreground?**
|
|
381
|
+
|
|
382
|
+
It names an app. It is not a URL, not a return address, and the proof is never sent to it — the proof still reaches you exactly as before, through `waitForProof()` / `waitForResult()`. This is the same handoff a wallet performs after a signature (`redirect.native`).
|
|
383
|
+
|
|
384
|
+
**One form is accepted:**
|
|
385
|
+
|
|
386
|
+
| Form | Example |
|
|
387
|
+
|------|---------|
|
|
388
|
+
| Bare custom scheme | `'mydapp://'` — an RFC 3986 scheme followed by exactly `://` |
|
|
307
389
|
|
|
308
|
-
|
|
390
|
+
**If you are a native app**, pass the scheme your app registers:
|
|
309
391
|
|
|
310
392
|
```typescript
|
|
311
|
-
// Native app: your own registered scheme
|
|
312
393
|
await sdk.createRelayRequest('coinbase_attestation', { scope: 'myapp.com' }, {
|
|
313
394
|
returnScheme: 'mydapp://',
|
|
314
395
|
});
|
|
315
|
-
|
|
316
|
-
// Web app: your own origin
|
|
317
|
-
await sdk.createRelayRequest('coinbase_attestation', { scope: 'myapp.com' }, {
|
|
318
|
-
returnScheme: 'https://myapp.com',
|
|
319
|
-
});
|
|
320
396
|
```
|
|
321
397
|
|
|
322
|
-
**
|
|
398
|
+
**If you are a web page, pass nothing.** You have no app to come back to, so there is no value you can honestly put here — and the SDK handles the browser case for you:
|
|
323
399
|
|
|
324
400
|
```typescript
|
|
325
|
-
|
|
326
|
-
|
|
401
|
+
// Correct. Do not pass returnScheme from a web page.
|
|
402
|
+
await sdk.createRelayRequest('coinbase_attestation', { scope: 'myapp.com' });
|
|
327
403
|
```
|
|
328
404
|
|
|
329
|
-
|
|
405
|
+
##### What the SDK does automatically
|
|
406
|
+
|
|
407
|
+
With the option omitted, the SDK looks at the page's own user agent and decides:
|
|
408
|
+
|
|
409
|
+
| Where your page is running | What the SDK sends | What the user sees when the proof is done |
|
|
410
|
+
|---|---|---|
|
|
411
|
+
| **Chrome for iOS** (`CriOS`) | `googlechrome://` | Chrome comes forward on **the tab they were already reading** — no new tab, no reload, page state intact |
|
|
412
|
+
| **Firefox for iOS** (`FxiOS`) | `firefox://` | Same: Firefox comes forward on the tab they were already reading |
|
|
413
|
+
| **Android**, any browser | nothing | The ZKProofport app puts itself in the background and the browser resumes exactly as it was |
|
|
414
|
+
| **Safari, Brave, Arc, Edge, Opera on iOS** | nothing | ZKProofport tells them the proof was delivered and to switch back; the system "‹ Back" breadcrumb is still at the top left |
|
|
415
|
+
| **In-app webviews** (KakaoTalk, Naver, Line, Instagram) | nothing | Same notice. Any scheme would destroy the page they are on |
|
|
416
|
+
| **Desktop** | nothing | This is the QR flow: the proof happens on a different device, and your page updates over the relay socket |
|
|
330
417
|
|
|
331
|
-
|
|
418
|
+
Only Chrome and Firefox are auto-detected, each from a positive UA token, because they are the two iOS browsers whose bare scheme is **verified in their own source** to bring the app forward without navigating anywhere. There is no Safari equivalent. Brave and Arc are indistinguishable from Safari on iOS, so guessing would eject those users into a browser they were not using — worse than doing nothing. Edge and Opera are closed source and stay out until someone can show their bare schemes behave the same way.
|
|
332
419
|
|
|
333
|
-
|
|
334
|
-
|------|---------|-------|
|
|
335
|
-
| Bare custom scheme | `'mydapp://'` | An RFC 3986 scheme followed by exactly `://` |
|
|
336
|
-
| https origin | `'https://myapp.com'`, `'https://myapp.com:8443'` | Host (and optional port) only |
|
|
420
|
+
An explicit `returnScheme` always wins; the SDK never overrides a value you set.
|
|
337
421
|
|
|
338
|
-
|
|
422
|
+
##### `https://` origins are not accepted
|
|
339
423
|
|
|
340
|
-
|
|
424
|
+
An https origin such as `'https://myapp.com'` used to be allowed. **It is now rejected** by the SDK, the relay and the ZKProofport app alike.
|
|
425
|
+
|
|
426
|
+
Opening one does not return anybody anywhere. The OS hands the URL to the browser, and the browser opens a **new tab** on a freshly loaded page — the tab your user actually started in is left behind, along with everything in it, including the socket waiting for the proof you just generated. The round trip the field exists to complete was the thing it broke.
|
|
427
|
+
|
|
428
|
+
##### What is rejected
|
|
429
|
+
|
|
430
|
+
These throw before the SDK makes a single network call, so no challenge is consumed and nothing is wasted on a typo:
|
|
431
|
+
|
|
432
|
+
- **https and http origins** — `'https://myapp.com'`, `'https://myapp.com:8443'` (see above)
|
|
433
|
+
- **bare `https://` and `http://`** — a browser with no page to open is not a return target
|
|
434
|
+
- a host, path, query string or fragment — `'mydapp://transfer?to=0x...'` — which is what stops a request driving your app to a specific action rather than just opening it
|
|
341
435
|
- an empty or whitespace-containing value, or one longer than 128 characters
|
|
342
|
-
-
|
|
343
|
-
-
|
|
436
|
+
- non-ASCII schemes (use punycode if you somehow need one)
|
|
437
|
+
- schemes the OS treats specially: `about`, `blob`, `content`, `data`, `facetime`, `facetime-audio`, `file`, `ftp`, `intent`, `javascript`, `jar`, `mailto`, `sms`, `tel`, `vbscript`
|
|
344
438
|
|
|
345
439
|
The value is matched case-insensitively and stored lowercased by the relay.
|
|
346
440
|
|
|
347
|
-
|
|
441
|
+
##### When nothing happens
|
|
442
|
+
|
|
443
|
+
There is no auto-switch when proof generation **fails** — the error has to be read in the ZKProofport app first. And when no target is sent and none can be inferred, ZKProofport shows the user a notice saying the proof was delivered and to switch back themselves. That is the intended outcome on iOS outside Chrome, not a bug.
|
|
348
444
|
|
|
349
445
|
**OIDC Domain Attestation:**
|
|
350
446
|
|
|
@@ -828,6 +924,8 @@ Types you can import:
|
|
|
828
924
|
|
|
829
925
|
```typescript
|
|
830
926
|
import type {
|
|
927
|
+
CircuitId,
|
|
928
|
+
CircuitSupportStatus,
|
|
831
929
|
CircuitType,
|
|
832
930
|
ProofRequestStatus,
|
|
833
931
|
CoinbaseKycInputs,
|
|
@@ -851,7 +949,9 @@ import type {
|
|
|
851
949
|
|
|
852
950
|
| Type | Description |
|
|
853
951
|
|------|-------------|
|
|
854
|
-
| `
|
|
952
|
+
| `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` |
|
|
953
|
+
| `CircuitSupportStatus` | `'supported' \| 'planned'` — see [Circuit Identifiers](#circuit-identifiers) |
|
|
954
|
+
| `CircuitType` | Alias of `CircuitId`. Kept as the name used throughout `ProofRequest`, `ProofResponse` and the SDK methods |
|
|
855
955
|
| `ProofRequestStatus` | `'pending' \| 'completed' \| 'error' \| 'cancelled'` — the status on a `ProofResponse` |
|
|
856
956
|
| `CoinbaseKycInputs` | Inputs for `coinbase_attestation`: `{ scope, userAddress?, rawTransaction? }` |
|
|
857
957
|
| `CoinbaseCountryInputs` | Inputs for `coinbase_country_attestation`: `{ scope, countryList, isIncluded, userAddress?, rawTransaction? }` |
|
|
@@ -860,7 +960,7 @@ import type {
|
|
|
860
960
|
| `MdlKrAgeInputs` | Inputs for `mdl_kr_age`: `{ scope, ageThreshold }` |
|
|
861
961
|
| `MdlKrRegionInputs` | Inputs for `mdl_kr_region`: `{ scope, targetRegion }` |
|
|
862
962
|
| `CircuitInputs` | Union of every input type above (plus an empty-input form for circuits that need nothing from the dApp) |
|
|
863
|
-
| `ProofRequest` | Request object: `requestId`, `circuit`, `inputs`, `createdAt`, plus optional `message`, `dappName`, `dappIcon`, `returnScheme
|
|
963
|
+
| `ProofRequest` | Request object: `requestId`, `circuit`, `inputs`, `createdAt`, plus optional `message`, `dappName`, `dappIcon`, `returnScheme` (a bare scheme such as `mydapp://`), `expiresAt` |
|
|
864
964
|
| `ProofResponse` | What `verifyResponseOnChain()` takes: `requestId`, `circuit`, `status`, and — when completed — `proof`, `publicInputs`, `verifierAddress`, `chainId`; `error` when it failed. `numPublicInputs` and `timestamp` also exist but the relay never fills them, so omit them. Field by field in [Step 6](#step-6-read-the-result) |
|
|
865
965
|
| `QRCodeOptions` | QR customization: `width`, `margin`, `darkColor`, `lightColor`, `errorCorrectionLevel` |
|
|
866
966
|
| `VerifierContract` | Verifier contract info: `{ address, chainId, abi }` |
|
|
@@ -996,12 +1096,12 @@ try {
|
|
|
996
1096
|
|
|
997
1097
|
try {
|
|
998
1098
|
await sdk.createRelayRequest('coinbase_attestation', { scope: 'app.com' }, {
|
|
999
|
-
returnScheme: 'https://myapp.com
|
|
1099
|
+
returnScheme: 'https://myapp.com',
|
|
1000
1100
|
});
|
|
1001
1101
|
} catch (err) {
|
|
1002
|
-
// "returnScheme must be a bare custom scheme such as "mydapp://"
|
|
1003
|
-
//
|
|
1004
|
-
// not
|
|
1102
|
+
// "returnScheme must be a bare custom scheme such as "mydapp://" — hosts,
|
|
1103
|
+
// paths, query strings and fragments are not accepted, and an https URL is
|
|
1104
|
+
// not a return target" (thrown before any network call)
|
|
1005
1105
|
}
|
|
1006
1106
|
|
|
1007
1107
|
try {
|
package/dist/ProofportSDK.d.ts
CHANGED
|
@@ -762,8 +762,10 @@ export declare class ProofportSDK {
|
|
|
762
762
|
* @param options - Request options (message, dappName, dappIcon, nonce, returnScheme)
|
|
763
763
|
* @param options.returnScheme - Which app the ZKProofport app should switch back
|
|
764
764
|
* to once it has finished. Put **your own** deep link scheme here — the bare
|
|
765
|
-
* scheme your app registers, e.g. `'mydapp://'`.
|
|
766
|
-
*
|
|
765
|
+
* scheme your app registers, e.g. `'mydapp://'`. Only a native app has an
|
|
766
|
+
* answer to this question; a web app omits the option entirely, because
|
|
767
|
+
* opening its https origin would launch a new browser tab on a fresh page
|
|
768
|
+
* rather than return the user to the tab they started from.
|
|
767
769
|
*
|
|
768
770
|
* This is intentionally **not** a URL and not a return address: no path, query
|
|
769
771
|
* string or fragment is accepted, and the ZKProofport app never sends the proof
|
|
@@ -772,14 +774,26 @@ export declare class ProofportSDK {
|
|
|
772
774
|
* "which app should come back to the foreground", exactly like the
|
|
773
775
|
* `redirect.native` value a wallet uses to hand control back after signing.
|
|
774
776
|
*
|
|
775
|
-
* **Omit it and
|
|
776
|
-
*
|
|
777
|
-
*
|
|
777
|
+
* **Omit it and the SDK decides for you.** When the request is created from a
|
|
778
|
+
* page running in Chrome for iOS (`CriOS`) or Firefox for iOS (`FxiOS`), the
|
|
779
|
+
* SDK fills in `'googlechrome://'` or `'firefox://'` by itself: opening either
|
|
780
|
+
* scheme bare brings that browser forward without navigating, so the user lands
|
|
781
|
+
* back on the tab they were already reading. Every other browser sends nothing,
|
|
782
|
+
* because nothing safe exists to send — Safari has no such scheme, and Brave
|
|
783
|
+
* and Arc are indistinguishable from Safari on iOS, so guessing would eject the
|
|
784
|
+
* user into the wrong browser.
|
|
785
|
+
* On Android nothing is needed at all: the ZKProofport app brings itself to the
|
|
786
|
+
* back and the browser resumes exactly as it was. When no target is sent and
|
|
787
|
+
* none can be inferred, the ZKProofport app tells the user the proof was
|
|
788
|
+
* delivered and lets them switch back themselves.
|
|
789
|
+
*
|
|
790
|
+
* There is no auto-switch on proof failure; only on success and on the user
|
|
791
|
+
* declining the request.
|
|
778
792
|
*
|
|
779
793
|
* Rejected with an error before the request is sent: empty or whitespace values,
|
|
780
|
-
* anything longer than 128 characters, values
|
|
781
|
-
*
|
|
782
|
-
* `mailto:` families.
|
|
794
|
+
* anything longer than 128 characters, values carrying a host/path/query/fragment
|
|
795
|
+
* (including https origins such as `'https://myapp.com'`), and the `http:`,
|
|
796
|
+
* `file:`, `data:`, `javascript:`, `intent:`, `tel:`, `sms:`, `mailto:` families.
|
|
783
797
|
* @returns Promise resolving to RelayProofRequest with requestId, deepLink, pollUrl
|
|
784
798
|
* @throws Error if signer not set, returnScheme is malformed, or the relay request fails
|
|
785
799
|
*
|
|
@@ -0,0 +1,144 @@
|
|
|
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
|
+
* Whether a circuit is officially supported today or still on the roadmap.
|
|
27
|
+
*
|
|
28
|
+
* - `supported` — generally available. Safe to build a product on.
|
|
29
|
+
* - `planned` — the identifier is reserved and the circuit exists, but it is
|
|
30
|
+
* not officially supported yet. Availability, inputs and public-input layout
|
|
31
|
+
* may change without a major version bump.
|
|
32
|
+
*/
|
|
33
|
+
export type CircuitSupportStatus = 'supported' | 'planned';
|
|
34
|
+
/**
|
|
35
|
+
* Canonical circuit identifiers, keyed by a stable constant name.
|
|
36
|
+
*
|
|
37
|
+
* Prefer these constants over string literals so a rename is a compile error
|
|
38
|
+
* rather than a runtime surprise.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* import { CIRCUIT_IDS } from '@zkproofport-app/sdk/circuits';
|
|
43
|
+
*
|
|
44
|
+
* const relay = await sdk.createRelayRequest(CIRCUIT_IDS.COINBASE_ATTESTATION, {
|
|
45
|
+
* scope: 'myapp.com',
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare const CIRCUIT_IDS: Readonly<{
|
|
50
|
+
/** Coinbase KYC attestation. Officially supported. */
|
|
51
|
+
readonly COINBASE_ATTESTATION: "coinbase_attestation";
|
|
52
|
+
/** Coinbase country attestation (inclusion / exclusion). Officially supported. */
|
|
53
|
+
readonly COINBASE_COUNTRY_ATTESTATION: "coinbase_country_attestation";
|
|
54
|
+
/** OIDC email-domain attestation. Officially supported. */
|
|
55
|
+
readonly OIDC_DOMAIN_ATTESTATION: "oidc_domain_attestation";
|
|
56
|
+
/** GIWA attestation. Planned — not officially supported yet. */
|
|
57
|
+
readonly GIWA_ATTESTATION: "giwa_attestation";
|
|
58
|
+
/** Korea Mobile ID ownership. Planned — not officially supported yet. */
|
|
59
|
+
readonly MDL_KR_OWNERSHIP: "mdl_kr_ownership";
|
|
60
|
+
/** Korea Mobile ID age threshold. Planned — not officially supported yet. */
|
|
61
|
+
readonly MDL_KR_AGE: "mdl_kr_age";
|
|
62
|
+
/** Korea Mobile ID si/do region. Planned — not officially supported yet. */
|
|
63
|
+
readonly MDL_KR_REGION: "mdl_kr_region";
|
|
64
|
+
}>;
|
|
65
|
+
/**
|
|
66
|
+
* Union of every canonical circuit identifier.
|
|
67
|
+
*
|
|
68
|
+
* `CircuitType` (exported from the package root) is an alias of this type — the
|
|
69
|
+
* two names refer to the same union, and this module is where it is defined.
|
|
70
|
+
*/
|
|
71
|
+
export type CircuitId = (typeof CIRCUIT_IDS)[keyof typeof CIRCUIT_IDS];
|
|
72
|
+
/**
|
|
73
|
+
* Support status for every circuit.
|
|
74
|
+
*
|
|
75
|
+
* The record is exhaustive over {@link CircuitId}: adding an identifier without
|
|
76
|
+
* giving it a status is a compile error, so this list cannot drift from
|
|
77
|
+
* {@link CIRCUIT_IDS}.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* import { CIRCUIT_SUPPORT_STATUS } from '@zkproofport-app/sdk/circuits';
|
|
82
|
+
*
|
|
83
|
+
* CIRCUIT_SUPPORT_STATUS.coinbase_attestation; // 'supported'
|
|
84
|
+
* CIRCUIT_SUPPORT_STATUS.mdl_kr_age; // 'planned'
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export declare const CIRCUIT_SUPPORT_STATUS: Readonly<Record<CircuitId, CircuitSupportStatus>>;
|
|
88
|
+
/**
|
|
89
|
+
* Every canonical circuit identifier, in declaration order.
|
|
90
|
+
*
|
|
91
|
+
* Includes circuits that are still `planned`. Use {@link SUPPORTED_CIRCUIT_IDS}
|
|
92
|
+
* when you only want the ones that are officially supported today.
|
|
93
|
+
*/
|
|
94
|
+
export declare const ALL_CIRCUIT_IDS: readonly CircuitId[];
|
|
95
|
+
/**
|
|
96
|
+
* Circuits that are officially supported today: the two Coinbase circuits and
|
|
97
|
+
* OIDC domain attestation.
|
|
98
|
+
*
|
|
99
|
+
* Derived from {@link CIRCUIT_SUPPORT_STATUS}, so it cannot fall out of sync.
|
|
100
|
+
*/
|
|
101
|
+
export declare const SUPPORTED_CIRCUIT_IDS: readonly CircuitId[];
|
|
102
|
+
/**
|
|
103
|
+
* Circuits whose identifiers are reserved but which are not officially
|
|
104
|
+
* supported yet: GIWA attestation and the three Korea Mobile ID circuits.
|
|
105
|
+
*
|
|
106
|
+
* Derived from {@link CIRCUIT_SUPPORT_STATUS}, so it cannot fall out of sync.
|
|
107
|
+
*/
|
|
108
|
+
export declare const PLANNED_CIRCUIT_IDS: readonly CircuitId[];
|
|
109
|
+
/**
|
|
110
|
+
* Narrows an unknown value to a canonical circuit identifier.
|
|
111
|
+
*
|
|
112
|
+
* Returns `false` for hyphenated route names such as `'coinbase-kyc'`, which
|
|
113
|
+
* are not circuit IDs.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* isCircuitId('coinbase_attestation'); // true
|
|
118
|
+
* isCircuitId('coinbase-kyc'); // false
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
export declare function isCircuitId(value: unknown): value is CircuitId;
|
|
122
|
+
/**
|
|
123
|
+
* Narrows an unknown value to a circuit identifier that is officially supported
|
|
124
|
+
* today. Planned circuits return `false`.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* isSupportedCircuitId('oidc_domain_attestation'); // true
|
|
129
|
+
* isSupportedCircuitId('mdl_kr_age'); // false — planned
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
export declare function isSupportedCircuitId(value: unknown): value is CircuitId;
|
|
133
|
+
/**
|
|
134
|
+
* Returns the support status of a circuit.
|
|
135
|
+
*
|
|
136
|
+
* @param circuit - A canonical circuit identifier.
|
|
137
|
+
* @throws Error when the value is not a canonical circuit identifier.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```typescript
|
|
141
|
+
* getCircuitSupportStatus('giwa_attestation'); // 'planned'
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
export declare function getCircuitSupportStatus(circuit: CircuitId): CircuitSupportStatus;
|
|
@@ -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.esm.js.map
|
|
@@ -0,0 +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' | '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;;;;"}
|