@metamask-previews/kyc-controller 0.0.0-preview-4f4c98e → 0.0.0-preview-eb263b0ee
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/KycController-method-action-types.cjs +7 -0
- package/dist/KycController-method-action-types.cjs.map +1 -0
- package/dist/{KycController-method-action-types.d.ts → KycController-method-action-types.d.cts} +2 -2
- package/dist/KycController-method-action-types.d.cts.map +1 -0
- package/dist/KycController-method-action-types.d.mts +237 -0
- package/dist/KycController-method-action-types.d.mts.map +1 -0
- package/dist/{KycController-method-action-types.js → KycController-method-action-types.mjs} +1 -1
- package/dist/KycController-method-action-types.mjs.map +1 -0
- package/dist/KycController.cjs +1843 -0
- package/dist/KycController.cjs.map +1 -0
- package/dist/{KycController.d.ts → KycController.d.cts} +9 -9
- package/dist/KycController.d.cts.map +1 -0
- package/dist/KycController.d.mts +393 -0
- package/dist/KycController.d.mts.map +1 -0
- package/dist/{KycController.js → KycController.mjs} +10 -10
- package/dist/KycController.mjs.map +1 -0
- package/dist/KycService-method-action-types.cjs +7 -0
- package/dist/KycService-method-action-types.cjs.map +1 -0
- package/dist/{KycService-method-action-types.d.ts → KycService-method-action-types.d.cts} +2 -2
- package/dist/KycService-method-action-types.d.cts.map +1 -0
- package/dist/KycService-method-action-types.d.mts +186 -0
- package/dist/KycService-method-action-types.d.mts.map +1 -0
- package/dist/{KycService-method-action-types.js → KycService-method-action-types.mjs} +1 -1
- package/dist/KycService-method-action-types.mjs.map +1 -0
- package/dist/KycService.cjs +628 -0
- package/dist/KycService.cjs.map +1 -0
- package/dist/{KycService.d.ts → KycService.d.cts} +12 -12
- package/dist/KycService.d.cts.map +1 -0
- package/dist/KycService.d.mts +494 -0
- package/dist/KycService.d.mts.map +1 -0
- package/dist/{KycService.js → KycService.mjs} +7 -7
- package/dist/{KycService.js.map → KycService.mjs.map} +1 -1
- package/dist/countryCodes.cjs +274 -0
- package/dist/countryCodes.cjs.map +1 -0
- package/dist/{countryCodes.d.ts → countryCodes.d.cts} +1 -1
- package/dist/countryCodes.d.cts.map +1 -0
- package/dist/countryCodes.d.mts +18 -0
- package/dist/countryCodes.d.mts.map +1 -0
- package/dist/{countryCodes.js → countryCodes.mjs} +1 -1
- package/dist/countryCodes.mjs.map +1 -0
- package/dist/crypto.cjs +154 -0
- package/dist/crypto.cjs.map +1 -0
- package/dist/{crypto.d.ts → crypto.d.cts} +1 -1
- package/dist/crypto.d.cts.map +1 -0
- package/dist/crypto.d.mts +84 -0
- package/dist/crypto.d.mts.map +1 -0
- package/dist/{crypto.js → crypto.mjs} +7 -7
- package/dist/crypto.mjs.map +1 -0
- package/dist/encoding.cjs +40 -0
- package/dist/encoding.cjs.map +1 -0
- package/dist/{encoding.d.ts → encoding.d.cts} +1 -1
- package/dist/encoding.d.cts.map +1 -0
- package/dist/encoding.d.mts +24 -0
- package/dist/encoding.d.mts.map +1 -0
- package/dist/{encoding.js → encoding.mjs} +2 -2
- package/dist/encoding.mjs.map +1 -0
- package/dist/index.cjs +37 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{index.d.ts → index.d.cts} +19 -19
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +19 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +12 -0
- package/dist/index.mjs.map +1 -0
- package/dist/selectors.cjs +30 -0
- package/dist/selectors.cjs.map +1 -0
- package/dist/{selectors.d.ts → selectors.d.cts} +4 -4
- package/dist/selectors.d.cts.map +1 -0
- package/dist/selectors.d.mts +24 -0
- package/dist/selectors.d.mts.map +1 -0
- package/dist/{selectors.js → selectors.mjs} +2 -2
- package/dist/selectors.mjs.map +1 -0
- package/dist/types.cjs +10 -0
- package/dist/types.cjs.map +1 -0
- package/dist/{types.d.ts → types.d.cts} +1 -1
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +208 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/{types.js → types.mjs} +1 -1
- package/dist/types.mjs.map +1 -0
- package/dist/ukyc/constants.cjs +75 -0
- package/dist/ukyc/constants.cjs.map +1 -0
- package/dist/ukyc/{constants.d.ts → constants.d.cts} +9 -9
- package/dist/ukyc/constants.d.cts.map +1 -0
- package/dist/ukyc/constants.d.mts +69 -0
- package/dist/ukyc/constants.d.mts.map +1 -0
- package/dist/ukyc/{constants.js → constants.mjs} +1 -1
- package/dist/ukyc/constants.mjs.map +1 -0
- package/dist/ukyc/deriveClientMaterial.cjs +65 -0
- package/dist/ukyc/deriveClientMaterial.cjs.map +1 -0
- package/dist/ukyc/{deriveClientMaterial.d.ts → deriveClientMaterial.d.cts} +1 -1
- package/dist/ukyc/deriveClientMaterial.d.cts.map +1 -0
- package/dist/ukyc/deriveClientMaterial.d.mts +54 -0
- package/dist/ukyc/deriveClientMaterial.d.mts.map +1 -0
- package/dist/ukyc/{deriveClientMaterial.js → deriveClientMaterial.mjs} +7 -7
- package/dist/ukyc/deriveClientMaterial.mjs.map +1 -0
- package/dist/ukyc/jwtChain.cjs +54 -0
- package/dist/ukyc/jwtChain.cjs.map +1 -0
- package/dist/ukyc/{jwtChain.d.ts → jwtChain.d.cts} +1 -1
- package/dist/ukyc/jwtChain.d.cts.map +1 -0
- package/dist/ukyc/jwtChain.d.mts +40 -0
- package/dist/ukyc/jwtChain.d.mts.map +1 -0
- package/dist/ukyc/{jwtChain.js → jwtChain.mjs} +4 -4
- package/dist/ukyc/jwtChain.mjs.map +1 -0
- package/dist/ukyc/localUserSecret.cjs +98 -0
- package/dist/ukyc/localUserSecret.cjs.map +1 -0
- package/dist/ukyc/{localUserSecret.d.ts → localUserSecret.d.cts} +1 -1
- package/dist/ukyc/localUserSecret.d.cts.map +1 -0
- package/dist/ukyc/localUserSecret.d.mts +65 -0
- package/dist/ukyc/localUserSecret.d.mts.map +1 -0
- package/dist/ukyc/{localUserSecret.js → localUserSecret.mjs} +4 -4
- package/dist/ukyc/localUserSecret.mjs.map +1 -0
- package/dist/ukyc/storageAccessToken.cjs +139 -0
- package/dist/ukyc/storageAccessToken.cjs.map +1 -0
- package/dist/ukyc/{storageAccessToken.d.ts → storageAccessToken.d.cts} +2 -2
- package/dist/ukyc/storageAccessToken.d.cts.map +1 -0
- package/dist/ukyc/storageAccessToken.d.mts +99 -0
- package/dist/ukyc/storageAccessToken.d.mts.map +1 -0
- package/dist/ukyc/{storageAccessToken.js → storageAccessToken.mjs} +5 -5
- package/dist/ukyc/storageAccessToken.mjs.map +1 -0
- package/dist/ukyc/testToken.cjs +61 -0
- package/dist/ukyc/testToken.cjs.map +1 -0
- package/dist/ukyc/{testToken.d.ts → testToken.d.cts} +2 -2
- package/dist/ukyc/testToken.d.cts.map +1 -0
- package/dist/ukyc/testToken.d.mts +50 -0
- package/dist/ukyc/testToken.d.mts.map +1 -0
- package/dist/ukyc/{testToken.js → testToken.mjs} +5 -5
- package/dist/ukyc/testToken.mjs.map +1 -0
- package/dist/ukyc/wrapEncryptionKey.cjs +37 -0
- package/dist/ukyc/wrapEncryptionKey.cjs.map +1 -0
- package/dist/ukyc/{wrapEncryptionKey.d.ts → wrapEncryptionKey.d.cts} +1 -1
- package/dist/ukyc/wrapEncryptionKey.d.cts.map +1 -0
- package/dist/ukyc/wrapEncryptionKey.d.mts +41 -0
- package/dist/ukyc/wrapEncryptionKey.d.mts.map +1 -0
- package/dist/ukyc/{wrapEncryptionKey.js → wrapEncryptionKey.mjs} +4 -3
- package/dist/ukyc/wrapEncryptionKey.mjs.map +1 -0
- package/dist/ukyc/wrapUserKey.cjs +80 -0
- package/dist/ukyc/wrapUserKey.cjs.map +1 -0
- package/dist/ukyc/{wrapUserKey.d.ts → wrapUserKey.d.cts} +1 -1
- package/dist/ukyc/wrapUserKey.d.cts.map +1 -0
- package/dist/ukyc/wrapUserKey.d.mts +26 -0
- package/dist/ukyc/wrapUserKey.d.mts.map +1 -0
- package/dist/ukyc/{wrapUserKey.js → wrapUserKey.mjs} +8 -8
- package/dist/ukyc/wrapUserKey.mjs.map +1 -0
- package/dist/ukyc/wrappedRelayPayload.cjs +32 -0
- package/dist/ukyc/wrappedRelayPayload.cjs.map +1 -0
- package/dist/ukyc/{wrappedRelayPayload.d.ts → wrappedRelayPayload.d.cts} +3 -3
- package/dist/ukyc/wrappedRelayPayload.d.cts.map +1 -0
- package/dist/ukyc/wrappedRelayPayload.d.mts +35 -0
- package/dist/ukyc/wrappedRelayPayload.d.mts.map +1 -0
- package/dist/ukyc/{wrappedRelayPayload.js → wrappedRelayPayload.mjs} +2 -2
- package/dist/ukyc/wrappedRelayPayload.mjs.map +1 -0
- package/package.json +17 -13
- package/dist/KycController-method-action-types.d.ts.map +0 -1
- package/dist/KycController-method-action-types.js.map +0 -1
- package/dist/KycController.d.ts.map +0 -1
- package/dist/KycController.js.map +0 -1
- package/dist/KycService-method-action-types.d.ts.map +0 -1
- package/dist/KycService-method-action-types.js.map +0 -1
- package/dist/KycService.d.ts.map +0 -1
- package/dist/countryCodes.d.ts.map +0 -1
- package/dist/countryCodes.js.map +0 -1
- package/dist/crypto.d.ts.map +0 -1
- package/dist/crypto.js.map +0 -1
- package/dist/encoding.d.ts.map +0 -1
- package/dist/encoding.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -12
- package/dist/index.js.map +0 -1
- package/dist/selectors.d.ts.map +0 -1
- package/dist/selectors.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/ukyc/constants.d.ts.map +0 -1
- package/dist/ukyc/constants.js.map +0 -1
- package/dist/ukyc/deriveClientMaterial.d.ts.map +0 -1
- package/dist/ukyc/deriveClientMaterial.js.map +0 -1
- package/dist/ukyc/jwtChain.d.ts.map +0 -1
- package/dist/ukyc/jwtChain.js.map +0 -1
- package/dist/ukyc/localUserSecret.d.ts.map +0 -1
- package/dist/ukyc/localUserSecret.js.map +0 -1
- package/dist/ukyc/storageAccessToken.d.ts.map +0 -1
- package/dist/ukyc/storageAccessToken.js.map +0 -1
- package/dist/ukyc/testToken.d.ts.map +0 -1
- package/dist/ukyc/testToken.js.map +0 -1
- package/dist/ukyc/wrapEncryptionKey.d.ts.map +0 -1
- package/dist/ukyc/wrapEncryptionKey.js.map +0 -1
- package/dist/ukyc/wrapUserKey.d.ts.map +0 -1
- package/dist/ukyc/wrapUserKey.js.map +0 -1
- package/dist/ukyc/wrappedRelayPayload.d.ts.map +0 -1
- package/dist/ukyc/wrappedRelayPayload.js.map +0 -1
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import type { ControllerGetStateAction, ControllerStateChangeEvent } from "@metamask/base-controller";
|
|
2
|
+
import { BaseController } from "@metamask/base-controller";
|
|
3
|
+
import type { Messenger } from "@metamask/messenger";
|
|
4
|
+
import type { UserStorageControllerPerformGetStorageAction, UserStorageControllerPerformSetStorageAction } from "@metamask/profile-sync-controller/user-storage";
|
|
5
|
+
import type { Json } from "@metamask/utils";
|
|
6
|
+
import type { KycControllerMethodActions } from "./KycController-method-action-types.mjs";
|
|
7
|
+
import type { KycServiceMethodActions } from "./KycService-method-action-types.mjs";
|
|
8
|
+
import type { KycCustomerIdentity, KycDisclaimer, KycPhase, KycProduct, KycSessionDisclaimers, KycSessionStatus, KycSumSubLauncher, KycSumSubStatus, KycUserStatus, KycVendor } from "./types.mjs";
|
|
9
|
+
export declare const controllerName = "KycController";
|
|
10
|
+
/**
|
|
11
|
+
* Describes the shape of the state object for {@link KycController}.
|
|
12
|
+
*/
|
|
13
|
+
export type KycControllerState = {
|
|
14
|
+
/** Current phase of the identity flow. */
|
|
15
|
+
phase: KycPhase;
|
|
16
|
+
/** Human-readable status message for the current phase. */
|
|
17
|
+
statusMessage: string;
|
|
18
|
+
/** The current error message, or `null`. */
|
|
19
|
+
error: string | null;
|
|
20
|
+
/** Email associated with the session (sourced from the account). */
|
|
21
|
+
email: string | null;
|
|
22
|
+
/** ISO-8601 timestamp of the customer's terms acceptance (persisted). */
|
|
23
|
+
termsAcceptedAt: string | null;
|
|
24
|
+
/** IDs of the disclaimers the customer accepted (persisted). */
|
|
25
|
+
acceptedDisclaimerIds: string[];
|
|
26
|
+
/**
|
|
27
|
+
* The vendor whose disclaimers `acceptedDisclaimerIds` belong to (persisted).
|
|
28
|
+
* Each vendor serves its own disclaimer set, so acceptance recorded for one
|
|
29
|
+
* vendor must not be reused for another. `null` when nothing is accepted.
|
|
30
|
+
*/
|
|
31
|
+
termsAcceptedVendor: KycVendor | null;
|
|
32
|
+
/**
|
|
33
|
+
* Whether the customer accepted the SumSub T&C (T&C2) during the last
|
|
34
|
+
* terms acceptance (persisted). Consents-path vendors require this flag
|
|
35
|
+
* when resuming a session. `null` for acceptance recorded before this
|
|
36
|
+
* field existed (treated as requiring reacceptance).
|
|
37
|
+
*/
|
|
38
|
+
sumsubTncAccepted: boolean | null;
|
|
39
|
+
/**
|
|
40
|
+
* Whether the customer accepted the idOS T&C (T&C2) during the last
|
|
41
|
+
* terms acceptance (persisted). Consents-path vendors require this flag
|
|
42
|
+
* when resuming a session. `null` for acceptance recorded before this
|
|
43
|
+
* field existed (treated as requiring reacceptance).
|
|
44
|
+
*/
|
|
45
|
+
idosTncAccepted: boolean | null;
|
|
46
|
+
/**
|
|
47
|
+
* Whether the customer consented to reuse existing idOS credentials
|
|
48
|
+
* during this session. Applied when recording session-scoped disclaimers.
|
|
49
|
+
* Not persisted: a new UKYC session must collect reuse consent again.
|
|
50
|
+
* `null` when never set (treated as `false`).
|
|
51
|
+
*/
|
|
52
|
+
credentialReusabilityConsentGiven: boolean | null;
|
|
53
|
+
/** Disclaimers fetched for the current country. */
|
|
54
|
+
disclaimers: KycDisclaimer[];
|
|
55
|
+
/** Error encountered while loading disclaimers, or `null`. */
|
|
56
|
+
disclaimersError: string | null;
|
|
57
|
+
/**
|
|
58
|
+
* Session-scoped idOS / KYC-provider disclaimer catalog from
|
|
59
|
+
* `GET /sessions/{sessionId}/disclaimers`. `null` until a UKYC session
|
|
60
|
+
* exists and the catalog has been fetched.
|
|
61
|
+
*/
|
|
62
|
+
sessionDisclaimers: KycSessionDisclaimers | null;
|
|
63
|
+
/** Resolved ISO 3166-1 alpha-3 country code. */
|
|
64
|
+
geoCountry: string | null;
|
|
65
|
+
/** Vendor session token (not persisted, not logged). */
|
|
66
|
+
sessionToken: string | null;
|
|
67
|
+
/** Vendor access token (not persisted, not logged). */
|
|
68
|
+
accessToken: string | null;
|
|
69
|
+
/** Vendor customer id, used for the SumSub hand-off. */
|
|
70
|
+
moonpayCustomerId: string | null;
|
|
71
|
+
/**
|
|
72
|
+
* The identity vendor driving the current flow. Captured at `initialize`.
|
|
73
|
+
* Defaults to `moonpay` when omitted so existing ramps/card callers keep
|
|
74
|
+
* the Check/Auth frame path. Non-MoonPay vendors skip those frames.
|
|
75
|
+
*/
|
|
76
|
+
activeVendor: KycVendor;
|
|
77
|
+
/**
|
|
78
|
+
* The product the current flow is running for. Captured at `initialize`
|
|
79
|
+
* (or `acceptTermsAndStartSession`) and used to automatically run the
|
|
80
|
+
* KYC-required check once authentication completes. `null` outside a
|
|
81
|
+
* product-scoped flow (in which case the flow stops at `form` and the
|
|
82
|
+
* consumer drives the check manually).
|
|
83
|
+
*/
|
|
84
|
+
activeProduct: KycProduct | null;
|
|
85
|
+
/** Cached "is KYC required" result per product (persisted). */
|
|
86
|
+
kycRequiredByProduct: Partial<Record<KycProduct, boolean>>;
|
|
87
|
+
/** ISO-8601 timestamp of the last KYC-required check (persisted). */
|
|
88
|
+
lastCheckedAt: string | null;
|
|
89
|
+
/**
|
|
90
|
+
* User-keyed simplified KYC status from `GET /kyc/status` (persisted so the
|
|
91
|
+
* Money toast can render across cold starts). `null` until the first
|
|
92
|
+
* successful `refreshKycStatus`.
|
|
93
|
+
*/
|
|
94
|
+
userStatus: KycUserStatus | null;
|
|
95
|
+
/** Optional SumSub session id for the retryable error path. */
|
|
96
|
+
userStatusSumsubSessionId: string | null;
|
|
97
|
+
/** Optional machine-readable error code for terminal / EDD UX. */
|
|
98
|
+
userStatusErrorCode: string | null;
|
|
99
|
+
/** SumSub document-verification sub-flow state. */
|
|
100
|
+
sumsub: {
|
|
101
|
+
status: KycSumSubStatus;
|
|
102
|
+
result: Json | null;
|
|
103
|
+
sessionId: string | null;
|
|
104
|
+
applicantAccessToken: string | null;
|
|
105
|
+
/**
|
|
106
|
+
* The latest UKYC session status, populated while polling after the SDK
|
|
107
|
+
* completes. `null` until the first successful poll.
|
|
108
|
+
*/
|
|
109
|
+
sessionStatus: KycSessionStatus | null;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Constructs the default {@link KycController} state.
|
|
114
|
+
*
|
|
115
|
+
* @returns The default state.
|
|
116
|
+
*/
|
|
117
|
+
export declare function getDefaultKycControllerState(): KycControllerState;
|
|
118
|
+
export type KycControllerGetStateAction = ControllerGetStateAction<typeof controllerName, KycControllerState>;
|
|
119
|
+
export type KycControllerActions = KycControllerGetStateAction | KycControllerMethodActions;
|
|
120
|
+
type AllowedActions = KycServiceMethodActions | UserStorageControllerPerformGetStorageAction | UserStorageControllerPerformSetStorageAction;
|
|
121
|
+
export type KycControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, KycControllerState>;
|
|
122
|
+
/**
|
|
123
|
+
* Published when the user-keyed simplified KYC status changes (Money toast).
|
|
124
|
+
*/
|
|
125
|
+
export type KycControllerStatusChangedEvent = {
|
|
126
|
+
type: `${typeof controllerName}:statusChanged`;
|
|
127
|
+
payload: [
|
|
128
|
+
{
|
|
129
|
+
status: KycUserStatus;
|
|
130
|
+
sumsubSessionId: string | null;
|
|
131
|
+
errorCode: string | null;
|
|
132
|
+
}
|
|
133
|
+
];
|
|
134
|
+
};
|
|
135
|
+
export type KycControllerEvents = KycControllerStateChangeEvent | KycControllerStatusChangedEvent;
|
|
136
|
+
type AllowedEvents = never;
|
|
137
|
+
export type KycControllerMessenger = Messenger<typeof controllerName, KycControllerActions | AllowedActions, KycControllerEvents | AllowedEvents>;
|
|
138
|
+
/**
|
|
139
|
+
* Options for constructing a {@link KycController}.
|
|
140
|
+
*/
|
|
141
|
+
export type KycControllerOptions = {
|
|
142
|
+
messenger: KycControllerMessenger;
|
|
143
|
+
state?: Partial<KycControllerState>;
|
|
144
|
+
/**
|
|
145
|
+
* Platform adapter that presents the SumSub SDK. Injected by each client so
|
|
146
|
+
* the controller stays platform-agnostic.
|
|
147
|
+
*/
|
|
148
|
+
sumsubLauncher: KycSumSubLauncher;
|
|
149
|
+
/**
|
|
150
|
+
* How often, in milliseconds, to poll the UKYC session status after the
|
|
151
|
+
* SumSub SDK completes. Defaults to
|
|
152
|
+
* {@link DEFAULT_SESSION_STATUS_POLL_INTERVAL_MS}.
|
|
153
|
+
*/
|
|
154
|
+
sessionStatusPollIntervalMs?: number;
|
|
155
|
+
/**
|
|
156
|
+
* How often, in milliseconds, to refresh `GET /kyc/status` while the
|
|
157
|
+
* simplified user status is `pending`. Defaults to
|
|
158
|
+
* {@link DEFAULT_USER_STATUS_POLL_INTERVAL_MS}.
|
|
159
|
+
*/
|
|
160
|
+
userStatusPollIntervalMs?: number;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* `KycController` orchestrates the vendor-backed KYC / identity-verification
|
|
164
|
+
* flow (MoonPay identity + SumSub documents) behind a vendor-neutral, per
|
|
165
|
+
* product surface used by ramps and card. It owns all state, HTTP
|
|
166
|
+
* orchestration (via `KycService`), crypto, and the frame message protocol;
|
|
167
|
+
* platform-specific presentation (WebView/iframe, SumSub SDK) is injected.
|
|
168
|
+
*/
|
|
169
|
+
export declare class KycController extends BaseController<typeof controllerName, KycControllerState, KycControllerMessenger> {
|
|
170
|
+
#private;
|
|
171
|
+
/**
|
|
172
|
+
* Constructs a new {@link KycController}.
|
|
173
|
+
*
|
|
174
|
+
* @param options - The constructor options.
|
|
175
|
+
* @param options.messenger - The messenger suited for this controller.
|
|
176
|
+
* @param options.state - Partial initial state; merged over defaults.
|
|
177
|
+
* @param options.sumsubLauncher - The platform SumSub launcher adapter.
|
|
178
|
+
* @param options.sessionStatusPollIntervalMs - How often to poll the UKYC
|
|
179
|
+
* session status after the SumSub SDK completes.
|
|
180
|
+
* @param options.userStatusPollIntervalMs - How often to refresh the
|
|
181
|
+
* user-keyed KYC status while it is still `pending`.
|
|
182
|
+
*/
|
|
183
|
+
constructor({ messenger, state, sumsubLauncher, sessionStatusPollIntervalMs, userStatusPollIntervalMs, }: KycControllerOptions);
|
|
184
|
+
/**
|
|
185
|
+
* Resolves persisted terms + geolocation, and auto-creates a session when
|
|
186
|
+
* terms are already accepted and an email is available.
|
|
187
|
+
*
|
|
188
|
+
* @param params - Optional parameters.
|
|
189
|
+
* @param params.email - The account email to associate with the session.
|
|
190
|
+
* @param params.product - The consuming feature the flow runs for. When
|
|
191
|
+
* provided, the controller automatically runs the KYC-required check once
|
|
192
|
+
* authentication completes (and chains into document verification when KYC
|
|
193
|
+
* is required). When omitted, the flow stops at `form` and the consumer must
|
|
194
|
+
* call `checkKycRequired` manually.
|
|
195
|
+
* @param params.vendor - Identity vendor for this flow. Non-MoonPay vendors
|
|
196
|
+
* skip Check/Auth frames and use the consents path. Defaults to `moonpay`.
|
|
197
|
+
*/
|
|
198
|
+
initialize(params?: {
|
|
199
|
+
email?: string;
|
|
200
|
+
product?: KycProduct;
|
|
201
|
+
vendor?: KycVendor;
|
|
202
|
+
}): Promise<void>;
|
|
203
|
+
/**
|
|
204
|
+
* Creates (or resumes) an empty-shell customer for the given identity
|
|
205
|
+
* vendor. Exposed so a consumer can ensure the customer exists before
|
|
206
|
+
* showing T&C screens independently of {@link initialize}.
|
|
207
|
+
*
|
|
208
|
+
* A call while a session flow is already in progress is a no-op — matching
|
|
209
|
+
* {@link initialize} — so a vendor switch cannot leave Check/Auth frames
|
|
210
|
+
* attached to the wrong vendor. Call {@link reset} first to start over.
|
|
211
|
+
*
|
|
212
|
+
* @param params - The parameters.
|
|
213
|
+
* @param params.vendor - Identity vendor for the customer.
|
|
214
|
+
* @param params.email - Email for the vendor customer.
|
|
215
|
+
*/
|
|
216
|
+
createVendorCustomer(params: {
|
|
217
|
+
vendor: KycVendor;
|
|
218
|
+
email: string;
|
|
219
|
+
}): Promise<void>;
|
|
220
|
+
/**
|
|
221
|
+
* Loads the disclaimers for the resolved (or provided) country.
|
|
222
|
+
*
|
|
223
|
+
* @param params - Optional parameters.
|
|
224
|
+
* @param params.country - ISO 3166-1 alpha-3 country code override.
|
|
225
|
+
*/
|
|
226
|
+
loadDisclaimers(params?: {
|
|
227
|
+
country?: string;
|
|
228
|
+
}): Promise<void>;
|
|
229
|
+
/**
|
|
230
|
+
* Captures terms acceptance for the currently loaded disclaimers and creates
|
|
231
|
+
* a session.
|
|
232
|
+
*
|
|
233
|
+
* @param params - The parameters.
|
|
234
|
+
* @param params.email - The account email to associate with the session.
|
|
235
|
+
* @param params.product - The consuming feature the flow runs for. See
|
|
236
|
+
* {@link initialize} for how the product drives the automatic post
|
|
237
|
+
* authentication continuation.
|
|
238
|
+
* @param params.sumsubTncSigned - Whether Sumsub T&C were accepted (T&C2).
|
|
239
|
+
* Required for every vendor so callers explicitly declare acceptance.
|
|
240
|
+
* @param params.idosTncSigned - Whether idOS T&C were accepted (T&C2).
|
|
241
|
+
* Required for every vendor so callers explicitly declare acceptance.
|
|
242
|
+
* @param params.credentialReusabilityConsentGiven - Whether the customer
|
|
243
|
+
* consented to reuse existing idOS credentials. Used when recording
|
|
244
|
+
* session-scoped disclaimers on the consents path. Defaults to `false`.
|
|
245
|
+
*/
|
|
246
|
+
acceptTermsAndStartSession(params: {
|
|
247
|
+
email?: string;
|
|
248
|
+
product?: KycProduct;
|
|
249
|
+
sumsubTncSigned: boolean;
|
|
250
|
+
idosTncSigned: boolean;
|
|
251
|
+
credentialReusabilityConsentGiven?: boolean;
|
|
252
|
+
}): Promise<void>;
|
|
253
|
+
/**
|
|
254
|
+
* Clears the persisted terms acceptance.
|
|
255
|
+
*/
|
|
256
|
+
clearSavedTerms(): void;
|
|
257
|
+
/**
|
|
258
|
+
* Handles a message posted by a Check/Auth frame and advances the flow.
|
|
259
|
+
*
|
|
260
|
+
* The transport-agnostic caller (WebView on mobile, iframe on web) forwards
|
|
261
|
+
* the raw message and injects the returned `reply` back into the frame.
|
|
262
|
+
*
|
|
263
|
+
* @param params - The parameters.
|
|
264
|
+
* @param params.message - The raw message posted by the frame.
|
|
265
|
+
* @returns An object whose optional `reply` should be posted back.
|
|
266
|
+
*/
|
|
267
|
+
handleFrameMessage(params: {
|
|
268
|
+
message: unknown;
|
|
269
|
+
}): Promise<{
|
|
270
|
+
reply?: unknown;
|
|
271
|
+
}>;
|
|
272
|
+
/**
|
|
273
|
+
* Builds the Check-frame URL, or `null` when no session exists yet.
|
|
274
|
+
*
|
|
275
|
+
* @returns The Check-frame URL or `null`.
|
|
276
|
+
*/
|
|
277
|
+
buildCheckFrameUrl(): string | null;
|
|
278
|
+
/**
|
|
279
|
+
* Builds the Auth-frame URL, or `null` when no client token is available.
|
|
280
|
+
*
|
|
281
|
+
* @returns The Auth-frame URL or `null`.
|
|
282
|
+
*/
|
|
283
|
+
buildAuthFrameUrl(): string | null;
|
|
284
|
+
/**
|
|
285
|
+
* Builds the Reset-frame URL.
|
|
286
|
+
*
|
|
287
|
+
* @returns The Reset-frame URL.
|
|
288
|
+
*/
|
|
289
|
+
buildResetFrameUrl(): string;
|
|
290
|
+
/**
|
|
291
|
+
* Checks whether KYC is required for a product and caches the result.
|
|
292
|
+
*
|
|
293
|
+
* @param params - The parameters.
|
|
294
|
+
* @param params.product - The consuming feature.
|
|
295
|
+
* @param params.country - Optional alpha-3 country override.
|
|
296
|
+
* @returns Whether KYC is required.
|
|
297
|
+
*/
|
|
298
|
+
checkKycRequired(params: {
|
|
299
|
+
product: KycProduct;
|
|
300
|
+
country?: string;
|
|
301
|
+
}): Promise<boolean>;
|
|
302
|
+
/**
|
|
303
|
+
* Reads the cached "is KYC required" result for a product.
|
|
304
|
+
*
|
|
305
|
+
* @param params - The parameters.
|
|
306
|
+
* @param params.product - The consuming feature.
|
|
307
|
+
* @returns The cached value, or `undefined` if not yet checked.
|
|
308
|
+
*/
|
|
309
|
+
getKycStatus(params: {
|
|
310
|
+
product: KycProduct;
|
|
311
|
+
}): boolean | undefined;
|
|
312
|
+
/**
|
|
313
|
+
* Returns the vendor-scoped identity for the currently authenticated
|
|
314
|
+
* customer, or `null` when the flow has not yet captured a vendor customer
|
|
315
|
+
* id (before authentication or after {@link reset}), or when a MoonPay id
|
|
316
|
+
* is present under a different `activeVendor`.
|
|
317
|
+
*
|
|
318
|
+
* Exposed so consumers (e.g. ramps autoramp creation) can attach the vendor
|
|
319
|
+
* customer id to downstream calls without reading the full KYC state, which
|
|
320
|
+
* also holds session/access tokens. The id is session-scoped and never
|
|
321
|
+
* persisted.
|
|
322
|
+
*
|
|
323
|
+
* @returns The current {@link KycCustomerIdentity}, or `null`.
|
|
324
|
+
*/
|
|
325
|
+
getCustomerIdentity(): KycCustomerIdentity | null;
|
|
326
|
+
/**
|
|
327
|
+
* Runs the SumSub document-verification sub-flow end to end:
|
|
328
|
+
*
|
|
329
|
+
* 1. creates a UKYC session, receiving per-secret encryption schemas;
|
|
330
|
+
* 2. verifies each schema's `jwtChain` against the Fractal JWKS and confirms
|
|
331
|
+
* the attested session server public key;
|
|
332
|
+
* 3. derives the `data_encryption_key` from the wallet's UKYC
|
|
333
|
+
* `local_user_secret` and wraps it for the session server;
|
|
334
|
+
* 4. mints a client-signed, read-only `ukyc_capability_token`, wraps it the
|
|
335
|
+
* same way as the encryption key, and submits both via authorizations;
|
|
336
|
+
* 5. fetches the SumSub applicant access token; and
|
|
337
|
+
* 6. presents the SDK via the injected launcher.
|
|
338
|
+
*
|
|
339
|
+
* If a UKYC session already exists (the consents path creates it before
|
|
340
|
+
* recording session disclaimers), steps 1–4 are skipped.
|
|
341
|
+
*
|
|
342
|
+
* If authorizations report the applicant is already approved on the relay
|
|
343
|
+
* while the vendor is still finalizing (`kycStatus: approved`,
|
|
344
|
+
* `finalStatus: pending`), the sub-flow stops at step 4 with a
|
|
345
|
+
* `vendorProcessing` status and a message rather than launching the SDK.
|
|
346
|
+
*
|
|
347
|
+
* @param params - Optional parameters.
|
|
348
|
+
* @param params.locale - BCP-47 locale for the SDK UI.
|
|
349
|
+
* @param params.debug - Enables SDK debug logging.
|
|
350
|
+
* @returns The SDK result.
|
|
351
|
+
*/
|
|
352
|
+
startSumSub(params?: {
|
|
353
|
+
locale?: string;
|
|
354
|
+
debug?: boolean;
|
|
355
|
+
}): Promise<Record<string, unknown>>;
|
|
356
|
+
/**
|
|
357
|
+
* Refreshes the user-keyed simplified KYC status from `GET /kyc/status`,
|
|
358
|
+
* stores it on state, publishes {@link KycControllerStatusChangedEvent}, and
|
|
359
|
+
* schedules short-interval polling while the status is `pending`.
|
|
360
|
+
*
|
|
361
|
+
* @returns The latest status payload.
|
|
362
|
+
*/
|
|
363
|
+
refreshKycStatus(): Promise<{
|
|
364
|
+
status: KycUserStatus;
|
|
365
|
+
sumsubSessionId: string | null;
|
|
366
|
+
errorCode: string | null;
|
|
367
|
+
}>;
|
|
368
|
+
/**
|
|
369
|
+
* Fetches the current UKYC session status for the active sub-flow and records
|
|
370
|
+
* it on state. Useful for a one-off refresh outside the automatic polling
|
|
371
|
+
* loop that {@link startSumSub} runs.
|
|
372
|
+
*
|
|
373
|
+
* @returns The fetched session status.
|
|
374
|
+
* @throws If there is no active SumSub session to query.
|
|
375
|
+
*/
|
|
376
|
+
getSessionStatus(): Promise<KycSessionStatus>;
|
|
377
|
+
/**
|
|
378
|
+
* Resets the flow to idle, clearing session tokens and sub-flow state while
|
|
379
|
+
* preserving persisted terms acceptance and the per-product cache.
|
|
380
|
+
*/
|
|
381
|
+
reset(): void;
|
|
382
|
+
/**
|
|
383
|
+
* Restores the controller to its default state, discarding everything
|
|
384
|
+
* {@link reset} deliberately keeps: the session email, the persisted terms
|
|
385
|
+
* acceptance, the per-product KYC-required cache and the user-keyed status.
|
|
386
|
+
*
|
|
387
|
+
* Intended for a full wallet reset, where no trace of the previous
|
|
388
|
+
* customer may survive into the next wallet.
|
|
389
|
+
*/
|
|
390
|
+
clearState(): void;
|
|
391
|
+
}
|
|
392
|
+
export {};
|
|
393
|
+
//# sourceMappingURL=KycController.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KycController.d.mts","sourceRoot":"","sources":["../src/KycController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAE3B,kCAAkC;AACnC,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AACrD,OAAO,KAAK,EACV,4CAA4C,EAC5C,4CAA4C,EAC7C,uDAAuD;AACxD,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAM5C,OAAO,KAAK,EAAE,0BAA0B,EAAE,gDAA+C;AACzF,OAAO,KAAK,EAAE,uBAAuB,EAAE,6CAA4C;AAKnF,OAAO,KAAK,EAEV,mBAAmB,EACnB,aAAa,EACb,QAAQ,EACR,UAAU,EACV,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,SAAS,EACV,oBAAmB;AAcpB,eAAO,MAAM,cAAc,kBAAkB,CAAC;AAsF9C;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,0CAA0C;IAC1C,KAAK,EAAE,QAAQ,CAAC;IAChB,2DAA2D;IAC3D,aAAa,EAAE,MAAM,CAAC;IACtB,4CAA4C;IAC5C,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB,oEAAoE;IACpE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB,yEAAyE;IACzE,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,gEAAgE;IAChE,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC;;;;OAIG;IACH,mBAAmB,EAAE,SAAS,GAAG,IAAI,CAAC;IACtC;;;;;OAKG;IACH,iBAAiB,EAAE,OAAO,GAAG,IAAI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,kBAAkB,IAAI,MAAM;IAM5B;;;;;;;OAOG;IACG,gBAAgB,CAAC,MAAM,EAAE;QAC7B,OAAO,EAAE,UAAU,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC,OAAO,CAAC;IA+CpB;;;;;;OAMG;IACH,YAAY,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,UAAU,CAAA;KAAE,GAAG,OAAO,GAAG,SAAS;IAIlE;;;;;;;;;;;;OAYG;IACH,mBAAmB,IAAI,mBAAmB,GAAG,IAAI;IAwIjD;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACG,WAAW,CAAC,MAAM,CAAC,EAAE;QACzB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAoKpC;;;;;;OAMG;IACG,gBAAgB,IAAI,OAAO,CAAC;QAChC,MAAM,EAAE,aAAa,CAAC;QACtB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;QAC/B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;KAC1B,CAAC;IAoIF;;;;;;;OAOG;IACG,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAmHnD;;;OAGG;IACH,KAAK,IAAI,IAAI;IAyBb;;;;;;;OAOG;IACH,UAAU,IAAI,IAAI;CA2FnB"}
|
|
@@ -10,15 +10,15 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _KycController_instances, _KycController_sumsubLauncher, _KycController_keypair, _KycController_authClientToken, _KycController_generation, _KycController_sessionStatusPollIntervalMs, _KycController_pollTimer, _KycController_pollToken, _KycController_userStatusPollIntervalMs, _KycController_userStatusPollTimer, _KycController_userStatusPolling, _KycController_userStatusPollToken, _KycController_localUserSecretStore, _KycController_startConsentsSession, _KycController_recordSessionDisclaimers, _KycController_createSession, _KycController_clearAcceptedTerms, _KycController_clearMoonPaySession, _KycController_dropTermsUnlessForVendor, _KycController_hasTermsForVendor, _KycController_handleCheckOutcome, _KycController_handleAuthOutcome, _KycController_continueAfterAuthentication, _KycController_requireTermsReacceptance, _KycController_buildUkycSessionVendorFields, _KycController_createUkycSession, _KycController_fetchAndApplyUserStatus, _KycController_applyUserStatus, _KycController_ensureUserStatusPolling, _KycController_stopUserStatusPolling, _KycController_startSessionStatusPolling, _KycController_pollSessionStatusOnce, _KycController_stopPolling, _KycController_cancelPendingSession, _KycController_updateIfCurrent, _KycController_applyUpdate, _KycController_assertAttestedServerPublicKey, _KycController_fail;
|
|
13
|
-
import { BaseController } from
|
|
14
|
-
import { stringToBytes } from
|
|
15
|
-
import { x25519 } from
|
|
16
|
-
import { decryptCredentials, generateKeyPair } from
|
|
17
|
-
import { deriveClientMaterial } from
|
|
18
|
-
import { verifyJwtChain } from
|
|
19
|
-
import { getOrCreateLocalUserSecret } from
|
|
20
|
-
import { encodeStorageAccessTokenForHeader, signStorageAccessToken
|
|
21
|
-
import { wrapEncryptionKey } from
|
|
13
|
+
import { BaseController } from "@metamask/base-controller";
|
|
14
|
+
import { stringToBytes } from "@metamask/utils";
|
|
15
|
+
import { x25519 } from "@noble/curves/ed25519";
|
|
16
|
+
import { decryptCredentials, generateKeyPair } from "./crypto.mjs";
|
|
17
|
+
import { deriveClientMaterial } from "./ukyc/deriveClientMaterial.mjs";
|
|
18
|
+
import { verifyJwtChain } from "./ukyc/jwtChain.mjs";
|
|
19
|
+
import { getOrCreateLocalUserSecret } from "./ukyc/localUserSecret.mjs";
|
|
20
|
+
import { encodeStorageAccessTokenForHeader, signStorageAccessToken } from "./ukyc/storageAccessToken.mjs";
|
|
21
|
+
import { wrapEncryptionKey } from "./ukyc/wrapEncryptionKey.mjs";
|
|
22
22
|
// === GENERAL ===
|
|
23
23
|
export const controllerName = 'KycController';
|
|
24
24
|
const FRAMES_BASE_URL = 'https://blocks.moonpay.com/platform/v1';
|
|
@@ -1835,4 +1835,4 @@ async function _KycController_pollSessionStatusOnce(sessionId, token) {
|
|
|
1835
1835
|
state.phase = 'error';
|
|
1836
1836
|
});
|
|
1837
1837
|
};
|
|
1838
|
-
//# sourceMappingURL=KycController.
|
|
1838
|
+
//# sourceMappingURL=KycController.mjs.map
|