@terminal3/t3n-sdk 1.2.1 → 1.3.2
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 +122 -0
- package/dist/index.d.ts +223 -2
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/src/client/t3n-client.d.ts +86 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/types/kyc.d.ts +135 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -560,6 +560,128 @@ When upserting a profile with an email address (either for a new profile or when
|
|
|
560
560
|
3. Guide you through the Google OAuth flow
|
|
561
561
|
4. Allow you to paste the ID token back into the terminal
|
|
562
562
|
|
|
563
|
+
#### KYC Walkthrough (MAT-1371)
|
|
564
|
+
|
|
565
|
+
The `--kyc-walkthrough` mode drives the full MetaMask KYC L1 + L2 flow against a running Trinity node, end-to-end, without needing the actual MetaMask front-end. It is useful for:
|
|
566
|
+
|
|
567
|
+
- Smoke-testing a freshly-built node (`node/bin/start-local`) before pointing the real FE at it.
|
|
568
|
+
- Reproducing edge cases (rejected KYC, OTP expiry, merge suggestions) deterministically.
|
|
569
|
+
- Showing internal stakeholders what the L1 + L2 flow looks like without spinning up MetaMask Snap + Veriff sandbox.
|
|
570
|
+
|
|
571
|
+
**Quick start (interactive):**
|
|
572
|
+
|
|
573
|
+
```bash
|
|
574
|
+
pnpm demo:real-wasm --kyc-walkthrough
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
The walkthrough then prompts at each step in the order Trinity expects:
|
|
578
|
+
|
|
579
|
+
1. **Handshake** + **authenticate** (existing prompts — wallet / OIDC).
|
|
580
|
+
2. **Email OTP** — request + verify on `tee:user/contracts::user-upsert` (email channel).
|
|
581
|
+
3. **Phone OTP** — request + verify on the same function (SMS channel via `keys.generic_api.otp_channel: "sms"` shadow). Gated by the contract on a verified email.
|
|
582
|
+
4. **Level 1 user-input** — single `user-upsert` call carrying `first_name`, `last_name`, `country_of_residence`, `document_issuance_country`, `ssn`, `address`.
|
|
583
|
+
5. **`create-kyc-provider-session`** ([MAT-1284](https://linear.app/terminal3/issue/MAT-1284)) — prints the Veriff `session_url`. The CLI does **not** auto-open the URL.
|
|
584
|
+
6. **`kyc-status` poll** — until terminal status (`verified`, `rejected`, or `orphan`) or the timeout fires. Each snapshot is logged.
|
|
585
|
+
|
|
586
|
+
**Veriff is driven manually.** The CLI prints the `session_url` and waits — open it in your browser, drive the Veriff flow to the desired terminal state (approve / reject / abandon), then come back to the terminal. The poll loop will see the contract update and surface the terminal status.
|
|
587
|
+
|
|
588
|
+
##### KYC walkthrough flags
|
|
589
|
+
|
|
590
|
+
| Flag | Default | Meaning |
|
|
591
|
+
|---|---|---|
|
|
592
|
+
| `--kyc-walkthrough` | off | Enable the walkthrough mode. Implicitly enabled by `--scenario`. |
|
|
593
|
+
| `--scenario <name>` | none | One of `happy-path-l1`, `happy-path-l2`, `rejected`. See *Scenarios* below. |
|
|
594
|
+
| `--auth-method <eth\|metamask\|oidc>` | interactive prompt | Skip the auth-method prompt. |
|
|
595
|
+
| `--email <addr>` | interactive prompt (or `demo+kyc@example.com` in scenario mode) | Email to verify in the L1 OTP step. |
|
|
596
|
+
| `--phone <e164>` | interactive prompt (or `+14155552671` in scenario mode) | Phone in E.164 format for the SMS OTP step. |
|
|
597
|
+
| `--first-name <name>` | interactive prompt (or `Ada` in scenario mode) | L1 first name. |
|
|
598
|
+
| `--last-name <name>` | interactive prompt (or `Lovelace` in scenario mode) | L1 last name. |
|
|
599
|
+
| `--country <ISO-2>` | `US` | Convenience: applies to both `country_of_residence` and `document_issuance_country` unless overridden individually. |
|
|
600
|
+
| `--country-of-residence <ISO-2>` | `--country` value | L1 residence country. |
|
|
601
|
+
| `--document-issuance-country <ISO-2>` | `--country` value | L1 document issuance country. |
|
|
602
|
+
| `--ssn <value>` | interactive prompt (or `123-45-6789` in scenario mode) | L1 SSN (9 digits or `XXX-XX-XXXX`). |
|
|
603
|
+
| `--address <text>` | interactive prompt (or default address in scenario mode) | L1 residential address. |
|
|
604
|
+
| `--kyc-provider-id <id>` | `veriff` | Provider id passed to `create-kyc-provider-session` and `kyc-status`. |
|
|
605
|
+
| `--kyc-poll-fast-ms <ms>` | `2000` | Fast-cadence poll interval (T3-TS-026 §8.4). |
|
|
606
|
+
| `--kyc-poll-slow-ms <ms>` | `5000` | Slow-cadence poll interval. |
|
|
607
|
+
| `--kyc-poll-switch-at-ms <ms>` | `30000` | Elapsed threshold to switch from fast to slow. |
|
|
608
|
+
| `--kyc-poll-timeout-ms <ms>` | `300000` | Total cap before `KycStatusTimeoutError` is raised. |
|
|
609
|
+
| `--skip-create-kyc-session` | off | Stop after L1 — useful when no Veriff sandbox is configured. |
|
|
610
|
+
|
|
611
|
+
##### Scenarios
|
|
612
|
+
|
|
613
|
+
Pre-baked shortcuts that auto-feed answers (mock-mode OTP codes, default L1 fields) so the walkthrough runs without operator input. All scenarios still require a running Trinity node configured with the **mock OTP provider** (otherwise the deterministic OTP code algorithm doesn't match what the node actually generated).
|
|
614
|
+
|
|
615
|
+
| Scenario | What it does | Veriff |
|
|
616
|
+
|---|---|---|
|
|
617
|
+
| `happy-path-l1` | Email OTP → phone OTP → L1 upsert. Stops before `create-kyc-provider-session`. | Not exercised. |
|
|
618
|
+
| `happy-path-l2` | Full L1 + L2 flow. Asserts `kyc-status` terminates with `verified`. | **Manual**: open the printed `session_url` and drive Veriff to approval. |
|
|
619
|
+
| `rejected` | Full L1 + L2 flow. Asserts `kyc-status` terminates with `rejected`. | **Manual**: open the printed `session_url` and drive Veriff to a rejection. |
|
|
620
|
+
|
|
621
|
+
Examples:
|
|
622
|
+
|
|
623
|
+
```bash
|
|
624
|
+
# L1-only happy path — no Veriff sandbox needed
|
|
625
|
+
pnpm demo:real-wasm --scenario happy-path-l1
|
|
626
|
+
|
|
627
|
+
# Full L1 + L2 happy path — drive Veriff to approved manually
|
|
628
|
+
pnpm demo:real-wasm --scenario happy-path-l2
|
|
629
|
+
|
|
630
|
+
# Rejection scenario — drive Veriff to a rejection manually
|
|
631
|
+
pnpm demo:real-wasm --scenario rejected
|
|
632
|
+
|
|
633
|
+
# Custom inputs without a scenario
|
|
634
|
+
pnpm demo:real-wasm --kyc-walkthrough \
|
|
635
|
+
--auth-method eth \
|
|
636
|
+
--email me@example.com \
|
|
637
|
+
--phone +14155551234 \
|
|
638
|
+
--country US \
|
|
639
|
+
--first-name Ada --last-name Lovelace
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
##### Mock-mode OTP code
|
|
643
|
+
|
|
644
|
+
When the Trinity node runs against the mock OTP provider (the default for `node/bin/start-local`), the OTP code is a **deterministic** 6-digit hash of the contact value. The walkthrough always prints the calculated mock code in the OTP-pending log line, so even without a scenario you can simply enter that code at the prompt to advance.
|
|
645
|
+
|
|
646
|
+
The algorithm matches `node/wasm/src/otp.rs` byte-for-byte: `String((hash * 31 + byte_i) % 1_000_000).padStart(6, "0")` over the UTF-8 bytes of the contact (email address or E.164 phone).
|
|
647
|
+
|
|
648
|
+
##### Sample output (excerpt)
|
|
649
|
+
|
|
650
|
+
```text
|
|
651
|
+
🚦 KYC walkthrough mode enabled (MAT-1371)
|
|
652
|
+
Scenario: happy-path-l1
|
|
653
|
+
|
|
654
|
+
📧 Step 5/8 — Email OTP: demo+kyc@example.com
|
|
655
|
+
5️⃣ Executing action: user-upsert...
|
|
656
|
+
✅ Action executed successfully
|
|
657
|
+
📨 Email verification required
|
|
658
|
+
📬 OTP code sent to: demo+kyc@example.com
|
|
659
|
+
📡 Channel: email
|
|
660
|
+
💡 Mock mode OTP code (deterministic): 482913
|
|
661
|
+
🤖 Scenario auto-feeding OTP code: 482913
|
|
662
|
+
🔄 Verifying Email OTP code...
|
|
663
|
+
5️⃣ Executing action: user-upsert...
|
|
664
|
+
✅ OTP verified successfully
|
|
665
|
+
📝 Transaction hash: tx:1:42
|
|
666
|
+
|
|
667
|
+
📱 Step 6/8 — Phone OTP: +14155552671
|
|
668
|
+
6️⃣ Executing action: user-upsert...
|
|
669
|
+
...
|
|
670
|
+
|
|
671
|
+
📋 KYC walkthrough summary
|
|
672
|
+
✅ email-otp demo+kyc@example.com
|
|
673
|
+
✅ phone-otp +14155552671
|
|
674
|
+
✅ l1-upsert tx:1:44
|
|
675
|
+
⏭️ create-kyc-session (scenario)
|
|
676
|
+
⏭️ kyc-status-poll (scenario)
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
##### Caveats
|
|
680
|
+
|
|
681
|
+
- **No version bump.** The walkthrough is dev tooling — it does not introduce new `@terminal3/t3n-sdk` public-API surface, so `package.json` is not bumped.
|
|
682
|
+
- **Spec alignment.** The walkthrough follows the as-built code, which differs from earlier T3-TS-026 versions on two points: `user-upsert` has no `op:` discriminator (dispatch is implicit on input shape), and the function for L2 session creation is `tee:user/contracts::create-kyc-provider-session` rather than `tee:kyc/contracts::create-session`. See [T3-TS-026 v0.6.0 changelog](../../docs/specs/T3-TS-026-kyc-frontend-integration.md) and [MAT-1374](https://linear.app/terminal3/issue/MAT-1374) for the deferred discriminator-vs-split decision.
|
|
683
|
+
- **`STRICT_SCENARIO=true`** in the environment turns scenario assertion failures into a non-zero exit code (otherwise they're logged but the demo exits zero). `--scenario` always exits non-zero on a terminal-status mismatch.
|
|
684
|
+
|
|
563
685
|
## WASM Integration
|
|
564
686
|
|
|
565
687
|
The SDK can work with both real T3n WASM components and mock components for testing.
|
package/dist/index.d.ts
CHANGED
|
@@ -655,6 +655,142 @@ declare class ContractResponseError extends T3nError {
|
|
|
655
655
|
*/
|
|
656
656
|
declare function parseContractResponse<T = unknown>(raw: string, schema?: ContractResponseSchema<T>): T;
|
|
657
657
|
|
|
658
|
+
/**
|
|
659
|
+
* KYC types for the `tee:user/contracts::kyc-status` short-poll
|
|
660
|
+
* function added in MAT-1202.
|
|
661
|
+
*
|
|
662
|
+
* The shape mirrors `tee_contracts/user/src/kyc_status.rs::KycStatusResponse`.
|
|
663
|
+
* Keep the two in sync — the bytes go straight from the contract
|
|
664
|
+
* through the JSON-RPC envelope into [[T3nClient.kycStatus]].
|
|
665
|
+
*/
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* Terminal status for a Level 2 KYC verification, plus `pending`.
|
|
669
|
+
*
|
|
670
|
+
* - `pending` — provider has not delivered a verdict yet, or the
|
|
671
|
+
* webhook arrived but the post-action VC issuance hasn't completed.
|
|
672
|
+
* - `verified` — provider approved AND a VC has been issued. `vcIds`
|
|
673
|
+
* carries the issued credential ids.
|
|
674
|
+
* - `rejected` — provider declined / required resubmission /
|
|
675
|
+
* expired / the user abandoned the flow. `error` may carry a
|
|
676
|
+
* provider-supplied reason.
|
|
677
|
+
* - `orphan` — a Veriff webhook arrived with a `vendorData` that
|
|
678
|
+
* couldn't be matched to any user (T3-TS-024 §3.4). Should not
|
|
679
|
+
* happen in the MetaMask flow but the contract surfaces it for
|
|
680
|
+
* completeness.
|
|
681
|
+
*/
|
|
682
|
+
type KycStatusKind = "pending" | "verified" | "rejected" | "orphan";
|
|
683
|
+
/**
|
|
684
|
+
* Snapshot returned by `tee:user/contracts::kyc-status`.
|
|
685
|
+
*
|
|
686
|
+
* Field names use camelCase on the SDK boundary even though the
|
|
687
|
+
* wire is snake_case — the wrapper rewrites keys at the client edge
|
|
688
|
+
* so callers don't see the JSON shape leaking through.
|
|
689
|
+
*/
|
|
690
|
+
interface KycStatus {
|
|
691
|
+
/** Terminal status if reached, otherwise `pending`. */
|
|
692
|
+
status: KycStatusKind;
|
|
693
|
+
/**
|
|
694
|
+
* Provider being polled. Echoed back so callers that didn't
|
|
695
|
+
* supply one see the contract's default (`"veriff"` in phase one).
|
|
696
|
+
*/
|
|
697
|
+
provider: string;
|
|
698
|
+
/**
|
|
699
|
+
* Unix-millis of the latest contract-visible event:
|
|
700
|
+
* VC issuance time, attestation arrival time, session-row
|
|
701
|
+
* `started_at_ms`, or orphan-record arrival time. Best-effort —
|
|
702
|
+
* `undefined` when no source carries a usable timestamp.
|
|
703
|
+
*/
|
|
704
|
+
updatedAt?: number;
|
|
705
|
+
/**
|
|
706
|
+
* VC ids appended for this provider, in append order. Empty for
|
|
707
|
+
* `pending` / `rejected` / `orphan`.
|
|
708
|
+
*/
|
|
709
|
+
vcIds: string[];
|
|
710
|
+
/**
|
|
711
|
+
* Provider-supplied reason for `rejected`, when available.
|
|
712
|
+
*/
|
|
713
|
+
error?: string;
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Polling cadence for [[T3nClient.kycStatusPoll]]. Defaults match
|
|
717
|
+
* T3-TS-026 §8.4: poll fast for the first 30 seconds, then back
|
|
718
|
+
* off, and bail after 5 minutes.
|
|
719
|
+
*/
|
|
720
|
+
interface KycPollCadence {
|
|
721
|
+
/** Poll interval in ms while `elapsed < switchAtMs`. Default: 2000. */
|
|
722
|
+
fastMs: number;
|
|
723
|
+
/** Poll interval in ms once `elapsed >= switchAtMs`. Default: 5000. */
|
|
724
|
+
slowMs: number;
|
|
725
|
+
/** Elapsed-ms threshold to switch from fast to slow cadence. Default: 30_000. */
|
|
726
|
+
switchAtMs: number;
|
|
727
|
+
/**
|
|
728
|
+
* Maximum total time to spend polling before rejecting with
|
|
729
|
+
* [[KycStatusTimeoutError]]. Default: 300_000 (5 minutes).
|
|
730
|
+
*/
|
|
731
|
+
timeoutMs: number;
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* Optional knobs for [[T3nClient.kycStatusPoll]]. Most callers won't
|
|
735
|
+
* touch any of these — the §8.4 defaults are baked in.
|
|
736
|
+
*/
|
|
737
|
+
interface KycPollOptions {
|
|
738
|
+
/**
|
|
739
|
+
* Cancellation signal. When aborted, the helper rejects with
|
|
740
|
+
* `signal.reason` (or a generic `AbortError` if the consumer
|
|
741
|
+
* didn't supply a reason). The currently-in-flight `kycStatus()`
|
|
742
|
+
* call also receives the signal so it can short-circuit.
|
|
743
|
+
*/
|
|
744
|
+
signal?: AbortSignal;
|
|
745
|
+
/**
|
|
746
|
+
* Called with every snapshot the helper receives, including
|
|
747
|
+
* non-terminal `pending` ones. Useful for surfacing intermediate
|
|
748
|
+
* UI states (e.g. "still waiting on provider…"). Errors thrown
|
|
749
|
+
* from this callback are caught and ignored — they must not
|
|
750
|
+
* sink the poll loop.
|
|
751
|
+
*/
|
|
752
|
+
onUpdate?: (status: KycStatus) => void;
|
|
753
|
+
/**
|
|
754
|
+
* Override one or more cadence fields. Anything not specified
|
|
755
|
+
* uses the §8.4 defaults from [[DEFAULT_KYC_POLL_CADENCE]].
|
|
756
|
+
*/
|
|
757
|
+
cadence?: Partial<KycPollCadence>;
|
|
758
|
+
/**
|
|
759
|
+
* Provider id to poll. Defaults to the contract default
|
|
760
|
+
* (`"veriff"` in phase one). Mirrored on the wire as
|
|
761
|
+
* `input.provider_id`.
|
|
762
|
+
*/
|
|
763
|
+
providerId?: string;
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* Default cadence used by [[T3nClient.kycStatusPoll]] when the caller
|
|
767
|
+
* doesn't override `cadence.*`. Matches T3-TS-026 §8.4 verbatim.
|
|
768
|
+
*/
|
|
769
|
+
declare const DEFAULT_KYC_POLL_CADENCE: KycPollCadence;
|
|
770
|
+
/**
|
|
771
|
+
* Subset of [[KycStatusKind]] that ends a poll. `pending` is the
|
|
772
|
+
* only non-terminal value.
|
|
773
|
+
*/
|
|
774
|
+
declare const TERMINAL_KYC_STATUSES: ReadonlySet<KycStatusKind>;
|
|
775
|
+
/**
|
|
776
|
+
* Thrown by [[T3nClient.kycStatusPoll]] when the cadence's
|
|
777
|
+
* `timeoutMs` elapses without a terminal status arriving. The
|
|
778
|
+
* `lastStatus` field is the most recent (necessarily `pending`)
|
|
779
|
+
* snapshot the helper saw, useful for surfacing "we tried for N
|
|
780
|
+
* minutes but Veriff is still working" UX.
|
|
781
|
+
*/
|
|
782
|
+
declare class KycStatusTimeoutError extends T3nError {
|
|
783
|
+
/** The §8.4 timeout the helper exhausted. */
|
|
784
|
+
readonly timeoutMs: number;
|
|
785
|
+
/** The last `pending` snapshot before timeout, if any. */
|
|
786
|
+
readonly lastStatus?: KycStatus | undefined;
|
|
787
|
+
constructor(
|
|
788
|
+
/** The §8.4 timeout the helper exhausted. */
|
|
789
|
+
timeoutMs: number,
|
|
790
|
+
/** The last `pending` snapshot before timeout, if any. */
|
|
791
|
+
lastStatus?: KycStatus | undefined);
|
|
792
|
+
}
|
|
793
|
+
|
|
658
794
|
/**
|
|
659
795
|
* T3n Client - Main SDK class
|
|
660
796
|
*
|
|
@@ -668,6 +804,14 @@ declare function parseContractResponse<T = unknown>(raw: string, schema?: Contra
|
|
|
668
804
|
declare class T3nClient {
|
|
669
805
|
private readonly config;
|
|
670
806
|
private readonly transport;
|
|
807
|
+
/**
|
|
808
|
+
* Resolved node base URL. Snapshotted in the constructor so the
|
|
809
|
+
* typed contract wrappers (`kycStatus`, `getSelfEthAddress`, …)
|
|
810
|
+
* can call `getScriptVersion()` against the same host the
|
|
811
|
+
* transport talks to. Used only by the `script_version: "latest"`
|
|
812
|
+
* resolution path in {@link executeUserContract}.
|
|
813
|
+
*/
|
|
814
|
+
private readonly effectiveBaseUrl;
|
|
671
815
|
/**
|
|
672
816
|
* Server-minted session ID, set by {@link handshake} from the
|
|
673
817
|
* `Session-Id` response header (pentest M-1 / MAT-983). `null`
|
|
@@ -763,6 +907,32 @@ declare class T3nClient {
|
|
|
763
907
|
* @throws {ContractResponseError} when the response is not valid JSON
|
|
764
908
|
*/
|
|
765
909
|
executeAndDecode<T = unknown>(payload: unknown, schema?: ContractResponseSchema<T>): Promise<T>;
|
|
910
|
+
/**
|
|
911
|
+
* Build the canonical `ExecuteActionRequest` shape the server
|
|
912
|
+
* expects in `node/primitives/src/action.rs::ExecuteActionRequest`
|
|
913
|
+
* (`script_name`, `script_version`, `function_name`, `input`,
|
|
914
|
+
* optional `pii_did`) and dispatch it through {@link execute}.
|
|
915
|
+
*
|
|
916
|
+
* Two pieces of glue live here that every typed user-contract
|
|
917
|
+
* wrapper would otherwise duplicate:
|
|
918
|
+
*
|
|
919
|
+
* 1. **Field naming.** The server deserialises strictly into
|
|
920
|
+
* `script_name` / `script_version` / `function_name` —
|
|
921
|
+
* sending `contract` / `version` / `function` produces
|
|
922
|
+
* `Invalid action request: missing field …` 400s. Centralising
|
|
923
|
+
* the names here means every wrapper agrees with the server.
|
|
924
|
+
* 2. **`"latest"` resolution.** `script_version` is `SemVer` on
|
|
925
|
+
* the server, so a literal `"latest"` cannot be parsed. We
|
|
926
|
+
* fetch the registered current version via
|
|
927
|
+
* `GET /api/contracts/current?name=…` (cached per script name
|
|
928
|
+
* in `getScriptVersion`) and forward the resolved
|
|
929
|
+
* `MAJOR.MINOR.PATCH` string.
|
|
930
|
+
*
|
|
931
|
+
* Wrappers that need PII delegation can extend this helper
|
|
932
|
+
* later — current call sites are all SelfOnly so `pii_did` stays
|
|
933
|
+
* implicit.
|
|
934
|
+
*/
|
|
935
|
+
private executeUserContract;
|
|
766
936
|
/**
|
|
767
937
|
* Return the authenticated user's Ethereum address from their
|
|
768
938
|
* T3N-hosted per-user wallet, as a 0x-prefixed lowercase hex string.
|
|
@@ -837,6 +1007,57 @@ declare class T3nClient {
|
|
|
837
1007
|
* the response cannot be decoded.
|
|
838
1008
|
*/
|
|
839
1009
|
removeUserWithWalletAbandonment(): Promise<unknown>;
|
|
1010
|
+
/**
|
|
1011
|
+
* One-shot poll of `tee:user/contracts::kyc-status`.
|
|
1012
|
+
*
|
|
1013
|
+
* Returns the current snapshot of the authenticated user's Level 2
|
|
1014
|
+
* KYC state — see [[KycStatus]] for the four possible terminal /
|
|
1015
|
+
* non-terminal values. The caller usually wants
|
|
1016
|
+
* [[kycStatusPoll]] (which loops with §8.4 cadence until a
|
|
1017
|
+
* terminal status arrives), but the bare snapshot is useful for
|
|
1018
|
+
* pages that need to render the user's standing without waiting
|
|
1019
|
+
* (e.g. account-status views, "did the user finish KYC last time
|
|
1020
|
+
* they were here?" gates).
|
|
1021
|
+
*
|
|
1022
|
+
* Phase one default — `providerId` defaults to `"veriff"` (the
|
|
1023
|
+
* contract applies the same default when the field is absent),
|
|
1024
|
+
* so the most common call site is `await t3n.kycStatus()`.
|
|
1025
|
+
*
|
|
1026
|
+
* @param providerId optional provider id, mirrored on the wire as
|
|
1027
|
+
* `input.provider_id`. Omit for phase-one MetaMask flows.
|
|
1028
|
+
* @throws if unauthenticated, if the node rejects the action
|
|
1029
|
+
* (e.g. `precondition_failed:` when no `create-kyc-provider-session`
|
|
1030
|
+
* row exists yet), or if the response shape is unexpected.
|
|
1031
|
+
*/
|
|
1032
|
+
kycStatus(providerId?: string): Promise<KycStatus>;
|
|
1033
|
+
/**
|
|
1034
|
+
* Poll `kyc-status` until a terminal status arrives or the
|
|
1035
|
+
* configured timeout elapses.
|
|
1036
|
+
*
|
|
1037
|
+
* Cadence defaults to T3-TS-026 §8.4: 2-second interval for the
|
|
1038
|
+
* first 30 seconds, then 5 seconds, with a 5-minute hard cap.
|
|
1039
|
+
* Override via `opts.cadence` if you need different numbers
|
|
1040
|
+
* (e.g. tests that don't want to wait the full 30 seconds before
|
|
1041
|
+
* the slow window kicks in). [[KycStatusTimeoutError]] is thrown
|
|
1042
|
+
* if the timeout elapses without reaching a terminal state.
|
|
1043
|
+
*
|
|
1044
|
+
* `opts.signal` cancels the loop synchronously — the helper
|
|
1045
|
+
* stops sleeping and rejects with the abort reason; an
|
|
1046
|
+
* already-in-flight `kycStatus()` request is allowed to settle
|
|
1047
|
+
* but its result is discarded.
|
|
1048
|
+
*
|
|
1049
|
+
* `opts.onUpdate` fires once per snapshot, including
|
|
1050
|
+
* intermediate `pending` ones. Errors thrown from the callback
|
|
1051
|
+
* are swallowed so a misbehaving UI handler can't strand the
|
|
1052
|
+
* poll loop.
|
|
1053
|
+
*
|
|
1054
|
+
* @throws [[KycStatusTimeoutError]] when the cadence's
|
|
1055
|
+
* `timeoutMs` elapses without a terminal status.
|
|
1056
|
+
* @throws the abort reason when `opts.signal` is aborted.
|
|
1057
|
+
* @throws the underlying RPC error when the contract or
|
|
1058
|
+
* transport raises (e.g. session expiry mid-poll).
|
|
1059
|
+
*/
|
|
1060
|
+
kycStatusPoll(opts?: KycPollOptions): Promise<KycStatus>;
|
|
840
1061
|
/**
|
|
841
1062
|
* The server-minted session ID once handshake has completed, or
|
|
842
1063
|
* `null` beforehand (pentest M-1 / MAT-983).
|
|
@@ -1202,5 +1423,5 @@ declare function clearKeyCache(): void;
|
|
|
1202
1423
|
*/
|
|
1203
1424
|
declare function loadConfig(baseUrl?: string): SdkConfig;
|
|
1204
1425
|
|
|
1205
|
-
export { AuthMethod, AuthenticationError, ContractResponseError, HandshakeError, HttpTransport, LogLevel, MockTransport, NODE_URLS, RpcError, SessionStateError, SessionStatus, T3nClient, T3nError, WasmError, bytesToString, clearKeyCache, createDefaultHandlers, createEthAuthInput, createLogger, createMlKemPublicKeyHandler, createOidcAuthInput, createRandomHandler, decodeWasmErrorMessage, eth_get_address, extractWasmError, fetchDkgAttestation, fetchMlKemPublicKey, generateRandomString, generateUUID, getEnvironment, getEnvironmentName, getGlobalLogLevel, getLogger, getNodeUrl, getScriptVersion, loadConfig, loadWasmComponent, metamask_get_address, metamask_sign, parseContractResponse, redactSecrets, redactSecretsFromJson, setEnvironment, setGlobalLogLevel, setNodeUrl, stringToBytes, validateConfig, verifyDkgAttestation, verifyTdxQuote };
|
|
1206
|
-
export type { AuthInput, ClientAuth, ClientHandshake, ConfigValidationResult, ContractResponseSchema, Did, DkgAttestation, DkgVerifyResult, Environment, EthAuthInput, GuestToHostHandler, GuestToHostHandlers, HandshakeResult, JsonRpcRequest, JsonRpcResponse, Logger, OidcAuthInput, OidcCredentials, PeerQuoteResult, QuoteVerifyResult, SdkConfig, SessionCrypto, SessionId, T3nClientConfig, Transport, WasmComponent, WasmNextResult };
|
|
1426
|
+
export { AuthMethod, AuthenticationError, ContractResponseError, DEFAULT_KYC_POLL_CADENCE, HandshakeError, HttpTransport, KycStatusTimeoutError, LogLevel, MockTransport, NODE_URLS, RpcError, SessionStateError, SessionStatus, T3nClient, T3nError, TERMINAL_KYC_STATUSES, WasmError, bytesToString, clearKeyCache, createDefaultHandlers, createEthAuthInput, createLogger, createMlKemPublicKeyHandler, createOidcAuthInput, createRandomHandler, decodeWasmErrorMessage, eth_get_address, extractWasmError, fetchDkgAttestation, fetchMlKemPublicKey, generateRandomString, generateUUID, getEnvironment, getEnvironmentName, getGlobalLogLevel, getLogger, getNodeUrl, getScriptVersion, loadConfig, loadWasmComponent, metamask_get_address, metamask_sign, parseContractResponse, redactSecrets, redactSecretsFromJson, setEnvironment, setGlobalLogLevel, setNodeUrl, stringToBytes, validateConfig, verifyDkgAttestation, verifyTdxQuote };
|
|
1427
|
+
export type { AuthInput, ClientAuth, ClientHandshake, ConfigValidationResult, ContractResponseSchema, Did, DkgAttestation, DkgVerifyResult, Environment, EthAuthInput, GuestToHostHandler, GuestToHostHandlers, HandshakeResult, JsonRpcRequest, JsonRpcResponse, KycPollCadence, KycPollOptions, KycStatus, KycStatusKind, Logger, OidcAuthInput, OidcCredentials, PeerQuoteResult, QuoteVerifyResult, SdkConfig, SessionCrypto, SessionId, T3nClientConfig, Transport, WasmComponent, WasmNextResult };
|