@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
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { KycController, getDefaultKycControllerState, controllerName } from "./KycController.mjs";
|
|
2
|
+
export { KycService, serviceName } from "./KycService.mjs";
|
|
3
|
+
export { selectIsKycRequiredForProduct, selectKycPhase, selectKycSumSub } from "./selectors.mjs";
|
|
4
|
+
export { alpha2ToAlpha3, ALPHA2_TO_ALPHA3 } from "./countryCodes.mjs";
|
|
5
|
+
export { decryptCredentials, generateKeyPair } from "./crypto.mjs";
|
|
6
|
+
// UKYC storage-access-token utilities. Exported so a signed capability token can
|
|
7
|
+
// be minted for testing UKYC Storage (see `mintUkycTestToken`).
|
|
8
|
+
export { UKYC_CAPABILITY_AUTH_SCHEME, UKYC_KWIL_AUDIENCE, UKYC_STORAGE_ACCESS_TOKEN_AUDIENCE, UKYC_STORAGE_ACCESS_TOKEN_AUDIENCES, UKYC_STORAGE_ACCESS_TOKEN_VERSION } from "./ukyc/constants.mjs";
|
|
9
|
+
export { deriveClientMaterial, encodeClientMaterial } from "./ukyc/deriveClientMaterial.mjs";
|
|
10
|
+
export { encodeStorageAccessTokenForHeader, signStorageAccessToken } from "./ukyc/storageAccessToken.mjs";
|
|
11
|
+
export { mintUkycTestToken } from "./ukyc/testToken.mjs";
|
|
12
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,4BAA4B,EAC5B,cAAc,EACf,4BAA2B;AA+B5B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,yBAAwB;AA0C1D,OAAO,EACL,6BAA6B,EAC7B,cAAc,EACd,eAAe,EAChB,wBAAuB;AAExB,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,2BAA0B;AACrE,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,qBAAoB;AA0BlE,iFAAiF;AACjF,gEAAgE;AAChE,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,kCAAkC,EAClC,mCAAmC,EACnC,iCAAiC,EAClC,6BAA4B;AAC7B,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACrB,wCAAuC;AAKxC,OAAO,EACL,iCAAiC,EACjC,sBAAsB,EACvB,sCAAqC;AAQtC,OAAO,EAAE,iBAAiB,EAAE,6BAA4B","sourcesContent":["export {\n KycController,\n getDefaultKycControllerState,\n controllerName,\n} from './KycController.js';\nexport type {\n KycControllerActions,\n KycControllerEvents,\n KycControllerGetStateAction,\n KycControllerMessenger,\n KycControllerOptions,\n KycControllerState,\n KycControllerStateChangeEvent,\n KycControllerStatusChangedEvent,\n} from './KycController.js';\nexport type {\n KycControllerAcceptTermsAndStartSessionAction,\n KycControllerBuildAuthFrameUrlAction,\n KycControllerBuildCheckFrameUrlAction,\n KycControllerBuildResetFrameUrlAction,\n KycControllerCheckKycRequiredAction,\n KycControllerClearSavedTermsAction,\n KycControllerClearStateAction,\n KycControllerCreateVendorCustomerAction,\n KycControllerGetCustomerIdentityAction,\n KycControllerGetKycStatusAction,\n KycControllerGetSessionStatusAction,\n KycControllerHandleFrameMessageAction,\n KycControllerInitializeAction,\n KycControllerLoadDisclaimersAction,\n KycControllerRefreshKycStatusAction,\n KycControllerResetAction,\n KycControllerStartSumSubAction,\n} from './KycController-method-action-types.js';\n\nexport { KycService, serviceName } from './KycService.js';\nexport type {\n ApplicantAccessTokenResponse,\n CapabilityAuthorization,\n CheckKycRequiredParams,\n CreateVendorCustomerParams,\n CreateSessionParams,\n CreateUkycSessionParams,\n EncryptionSchema,\n FetchSessionDisclaimersParams,\n GetSessionStatusParams,\n VendorCustomerResponse,\n JwksResponse,\n KycServiceActions,\n KycServiceCacheUpdatedEvent,\n KycServiceEvents,\n KycServiceGranularCacheUpdatedEvent,\n KycServiceInvalidateQueriesAction,\n KycServiceMessenger,\n KycServiceOptions,\n SetAuthorizationsParams,\n SubmitSessionDisclaimersParams,\n SubmitVendorDisclaimersParams,\n UkycSessionResponse,\n} from './KycService.js';\nexport type {\n KycServiceCheckKycRequiredAction,\n KycServiceCreateVendorCustomerAction,\n KycServiceCreateJourneyAction,\n KycServiceCreateSessionAction,\n KycServiceCreateUkycSessionAction,\n KycServiceFetchDisclaimersAction,\n KycServiceFetchJwksAction,\n KycServiceFetchKycStatusAction,\n KycServiceFetchSessionDisclaimersAction,\n KycServiceGetGeoCountryAction,\n KycServiceGetSessionStatusAction,\n KycServiceSetAuthorizationsAction,\n KycServiceSubmitSessionDisclaimersAction,\n KycServiceSubmitVendorDisclaimersAction,\n} from './KycService-method-action-types.js';\n\nexport {\n selectIsKycRequiredForProduct,\n selectKycPhase,\n selectKycSumSub,\n} from './selectors.js';\n\nexport { alpha2ToAlpha3, ALPHA2_TO_ALPHA3 } from './countryCodes.js';\nexport { decryptCredentials, generateKeyPair } from './crypto.js';\nexport type {\n DecryptedCredentials,\n DecryptResult,\n EncryptedCredentialsEnvelope,\n X25519KeyPair,\n} from './crypto.js';\n\nexport type {\n KycConsentDocument,\n KycConsentRecord,\n KycCustomerIdentity,\n KycDisclaimer,\n KycPhase,\n KycProduct,\n KycSessionDisclaimers,\n KycSessionStatus,\n KycSumSubLaunchParams,\n KycSumSubLauncher,\n KycSumSubStatus,\n KycUserStatus,\n KycUserStatusResponse,\n KycVendor,\n KycVendorSigning,\n} from './types.js';\n\n// UKYC storage-access-token utilities. Exported so a signed capability token can\n// be minted for testing UKYC Storage (see `mintUkycTestToken`).\nexport {\n UKYC_CAPABILITY_AUTH_SCHEME,\n UKYC_KWIL_AUDIENCE,\n UKYC_STORAGE_ACCESS_TOKEN_AUDIENCE,\n UKYC_STORAGE_ACCESS_TOKEN_AUDIENCES,\n UKYC_STORAGE_ACCESS_TOKEN_VERSION,\n} from './ukyc/constants.js';\nexport {\n deriveClientMaterial,\n encodeClientMaterial,\n} from './ukyc/deriveClientMaterial.js';\nexport type {\n EncodedUkycClientMaterial,\n UkycClientMaterial,\n} from './ukyc/deriveClientMaterial.js';\nexport {\n encodeStorageAccessTokenForHeader,\n signStorageAccessToken,\n} from './ukyc/storageAccessToken.js';\nexport type {\n SignStorageAccessTokenParams,\n UkycStorageAccessToken,\n UkycStorageAccessTokenPayload,\n UkycStorageOperation,\n UkycTokenPresenter,\n} from './ukyc/storageAccessToken.js';\nexport { mintUkycTestToken } from './ukyc/testToken.js';\nexport type {\n MintedUkycTestToken,\n MintUkycTestTokenParams,\n} from './ukyc/testToken.js';\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.selectIsKycRequiredForProduct = exports.selectKycSumSub = exports.selectKycPhase = void 0;
|
|
4
|
+
const reselect_1 = require("reselect");
|
|
5
|
+
const selectKycRequiredByProduct = (state) => state.kycRequiredByProduct;
|
|
6
|
+
/**
|
|
7
|
+
* Selects the current flow phase.
|
|
8
|
+
*
|
|
9
|
+
* @param state - The KycController state.
|
|
10
|
+
* @returns The current phase.
|
|
11
|
+
*/
|
|
12
|
+
const selectKycPhase = (state) => state.phase;
|
|
13
|
+
exports.selectKycPhase = selectKycPhase;
|
|
14
|
+
/**
|
|
15
|
+
* Selects the SumSub sub-flow state.
|
|
16
|
+
*
|
|
17
|
+
* @param state - The KycController state.
|
|
18
|
+
* @returns The SumSub state.
|
|
19
|
+
*/
|
|
20
|
+
const selectKycSumSub = (state) => state.sumsub;
|
|
21
|
+
exports.selectKycSumSub = selectKycSumSub;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a selector that returns whether KYC is required for a product.
|
|
24
|
+
*
|
|
25
|
+
* @param product - The consuming feature.
|
|
26
|
+
* @returns A selector returning the cached requirement, or `undefined`.
|
|
27
|
+
*/
|
|
28
|
+
const selectIsKycRequiredForProduct = (product) => (0, reselect_1.createSelector)([selectKycRequiredByProduct], (map) => map[product]);
|
|
29
|
+
exports.selectIsKycRequiredForProduct = selectIsKycRequiredForProduct;
|
|
30
|
+
//# sourceMappingURL=selectors.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.cjs","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":";;;AAAA,uCAA0C;AAK1C,MAAM,0BAA0B,GAAG,CACjC,KAAyB,EACmB,EAAE,CAAC,KAAK,CAAC,oBAAoB,CAAC;AAE5E;;;;;GAKG;AACI,MAAM,cAAc,GAAG,CAC5B,KAAyB,EACI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;AAFjC,QAAA,cAAc,kBAEmB;AAE9C;;;;;GAKG;AACI,MAAM,eAAe,GAAG,CAC7B,KAAyB,EACK,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;AAFnC,QAAA,eAAe,mBAEoB;AAEhD;;;;;GAKG;AACI,MAAM,6BAA6B,GAAG,CAC3C,OAAmB,EACmC,EAAE,CACxD,IAAA,yBAAc,EACZ,CAAC,0BAA0B,CAAC,EAC5B,CAAC,GAAG,EAAuB,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAC3C,CAAC;AANS,QAAA,6BAA6B,iCAMtC","sourcesContent":["import { createSelector } from 'reselect';\n\nimport type { KycControllerState } from './KycController.js';\nimport type { KycProduct } from './types.js';\n\nconst selectKycRequiredByProduct = (\n state: KycControllerState,\n): KycControllerState['kycRequiredByProduct'] => state.kycRequiredByProduct;\n\n/**\n * Selects the current flow phase.\n *\n * @param state - The KycController state.\n * @returns The current phase.\n */\nexport const selectKycPhase = (\n state: KycControllerState,\n): KycControllerState['phase'] => state.phase;\n\n/**\n * Selects the SumSub sub-flow state.\n *\n * @param state - The KycController state.\n * @returns The SumSub state.\n */\nexport const selectKycSumSub = (\n state: KycControllerState,\n): KycControllerState['sumsub'] => state.sumsub;\n\n/**\n * Creates a selector that returns whether KYC is required for a product.\n *\n * @param product - The consuming feature.\n * @returns A selector returning the cached requirement, or `undefined`.\n */\nexport const selectIsKycRequiredForProduct = (\n product: KycProduct,\n): ((state: KycControllerState) => boolean | undefined) =>\n createSelector(\n [selectKycRequiredByProduct],\n (map): boolean | undefined => map[product],\n );\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { KycControllerState } from
|
|
2
|
-
import type { KycProduct } from
|
|
1
|
+
import type { KycControllerState } from "./KycController.cjs";
|
|
2
|
+
import type { KycProduct } from "./types.cjs";
|
|
3
3
|
/**
|
|
4
4
|
* Selects the current flow phase.
|
|
5
5
|
*
|
|
@@ -20,5 +20,5 @@ export declare const selectKycSumSub: (state: KycControllerState) => KycControll
|
|
|
20
20
|
* @param product - The consuming feature.
|
|
21
21
|
* @returns A selector returning the cached requirement, or `undefined`.
|
|
22
22
|
*/
|
|
23
|
-
export declare const selectIsKycRequiredForProduct: (product: KycProduct) => (
|
|
24
|
-
//# sourceMappingURL=selectors.d.
|
|
23
|
+
export declare const selectIsKycRequiredForProduct: (product: KycProduct) => (state: KycControllerState) => boolean | undefined;
|
|
24
|
+
//# sourceMappingURL=selectors.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.d.cts","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,4BAA2B;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAmB;AAM7C;;;;;GAKG;AACH,eAAO,MAAM,cAAc,UAClB,kBAAkB,KACxB,kBAAkB,CAAC,OAAO,CAAgB,CAAC;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,eAAe,UACnB,kBAAkB,KACxB,kBAAkB,CAAC,QAAQ,CAAiB,CAAC;AAEhD;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,YAC/B,UAAU,aACT,kBAAkB,KAAK,OAAO,GAAG,SAI1C,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { KycControllerState } from "./KycController.mjs";
|
|
2
|
+
import type { KycProduct } from "./types.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Selects the current flow phase.
|
|
5
|
+
*
|
|
6
|
+
* @param state - The KycController state.
|
|
7
|
+
* @returns The current phase.
|
|
8
|
+
*/
|
|
9
|
+
export declare const selectKycPhase: (state: KycControllerState) => KycControllerState['phase'];
|
|
10
|
+
/**
|
|
11
|
+
* Selects the SumSub sub-flow state.
|
|
12
|
+
*
|
|
13
|
+
* @param state - The KycController state.
|
|
14
|
+
* @returns The SumSub state.
|
|
15
|
+
*/
|
|
16
|
+
export declare const selectKycSumSub: (state: KycControllerState) => KycControllerState['sumsub'];
|
|
17
|
+
/**
|
|
18
|
+
* Creates a selector that returns whether KYC is required for a product.
|
|
19
|
+
*
|
|
20
|
+
* @param product - The consuming feature.
|
|
21
|
+
* @returns A selector returning the cached requirement, or `undefined`.
|
|
22
|
+
*/
|
|
23
|
+
export declare const selectIsKycRequiredForProduct: (product: KycProduct) => (state: KycControllerState) => boolean | undefined;
|
|
24
|
+
//# sourceMappingURL=selectors.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.d.mts","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,4BAA2B;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAmB;AAM7C;;;;;GAKG;AACH,eAAO,MAAM,cAAc,UAClB,kBAAkB,KACxB,kBAAkB,CAAC,OAAO,CAAgB,CAAC;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,eAAe,UACnB,kBAAkB,KACxB,kBAAkB,CAAC,QAAQ,CAAiB,CAAC;AAEhD;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,YAC/B,UAAU,aACT,kBAAkB,KAAK,OAAO,GAAG,SAI1C,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createSelector } from
|
|
1
|
+
import { createSelector } from "reselect";
|
|
2
2
|
const selectKycRequiredByProduct = (state) => state.kycRequiredByProduct;
|
|
3
3
|
/**
|
|
4
4
|
* Selects the current flow phase.
|
|
@@ -21,4 +21,4 @@ export const selectKycSumSub = (state) => state.sumsub;
|
|
|
21
21
|
* @returns A selector returning the cached requirement, or `undefined`.
|
|
22
22
|
*/
|
|
23
23
|
export const selectIsKycRequiredForProduct = (product) => createSelector([selectKycRequiredByProduct], (map) => map[product]);
|
|
24
|
-
//# sourceMappingURL=selectors.
|
|
24
|
+
//# sourceMappingURL=selectors.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.mjs","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB;AAK1C,MAAM,0BAA0B,GAAG,CACjC,KAAyB,EACmB,EAAE,CAAC,KAAK,CAAC,oBAAoB,CAAC;AAE5E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,KAAyB,EACI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,KAAyB,EACK,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,OAAmB,EACmC,EAAE,CACxD,cAAc,CACZ,CAAC,0BAA0B,CAAC,EAC5B,CAAC,GAAG,EAAuB,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAC3C,CAAC","sourcesContent":["import { createSelector } from 'reselect';\n\nimport type { KycControllerState } from './KycController.js';\nimport type { KycProduct } from './types.js';\n\nconst selectKycRequiredByProduct = (\n state: KycControllerState,\n): KycControllerState['kycRequiredByProduct'] => state.kycRequiredByProduct;\n\n/**\n * Selects the current flow phase.\n *\n * @param state - The KycController state.\n * @returns The current phase.\n */\nexport const selectKycPhase = (\n state: KycControllerState,\n): KycControllerState['phase'] => state.phase;\n\n/**\n * Selects the SumSub sub-flow state.\n *\n * @param state - The KycController state.\n * @returns The SumSub state.\n */\nexport const selectKycSumSub = (\n state: KycControllerState,\n): KycControllerState['sumsub'] => state.sumsub;\n\n/**\n * Creates a selector that returns whether KYC is required for a product.\n *\n * @param product - The consuming feature.\n * @returns A selector returning the cached requirement, or `undefined`.\n */\nexport const selectIsKycRequiredForProduct = (\n product: KycProduct,\n): ((state: KycControllerState) => boolean | undefined) =>\n createSelector(\n [selectKycRequiredByProduct],\n (map): boolean | undefined => map[product],\n );\n"]}
|
package/dist/types.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared types for the KYC controller and service.
|
|
4
|
+
*
|
|
5
|
+
* The KYC flow is vendor-backed (currently MoonPay for identity + SumSub for
|
|
6
|
+
* document verification) but the surface exposed to consumers (ramps, card) is
|
|
7
|
+
* intentionally vendor-neutral so a future vendor swap does not ripple out.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
//# sourceMappingURL=types.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * Shared types for the KYC controller and service.\n *\n * The KYC flow is vendor-backed (currently MoonPay for identity + SumSub for\n * document verification) but the surface exposed to consumers (ramps, card) is\n * intentionally vendor-neutral so a future vendor swap does not ripple out.\n */\n\n/**\n * A MetaMask feature that consumes KYC. Used to key the per-product\n * \"is KYC required\" cache so ramps, card, and money can share one controller.\n */\nexport type KycProduct = 'ramps' | 'card' | 'money';\n\n/**\n * Identity vendors supported behind the KYC surface.\n *\n * - `moonpay` — MoonPay Check/Auth frames + SumSub documents.\n * - `iron` — Iron-only Money/VBA path: empty-shell customer → consents →\n * SumSub, with no MoonPay Check/Auth frames.\n */\nexport type KycVendor = 'moonpay' | 'iron';\n\n/**\n * Vendor-scoped identity for the currently authenticated KYC customer.\n *\n * Exposed to consumers (e.g. ramps) that must attach the vendor customer id to\n * downstream provider calls without reading the full KYC state, which also\n * holds session/access tokens. The identifier is session-scoped: it is only\n * available once the customer has authenticated through the current flow and\n * is cleared on `reset()`.\n */\nexport type KycCustomerIdentity = {\n /** The identity vendor that issued {@link KycCustomerIdentity.id}. */\n vendor: KycVendor;\n /** The vendor customer id (e.g. MoonPay customer UUID). */\n id: string;\n};\n\n/**\n * User-keyed KYC status returned by `GET /kyc/status` and stored for toast /\n * banner rendering. Collapses vendor + SumSub / relay state into the offsite\n * contract.\n */\nexport type KycUserStatus =\n | 'not-started'\n | 'pending'\n | 'need-more-information'\n | 'terminal-failure'\n | 'completed';\n\n/**\n * Payload from `GET /kyc/status`, including optional fields that power the\n * 3-state error contract (retryable SumSub vs terminal vs EDD).\n */\nexport type KycUserStatusResponse = {\n status: KycUserStatus;\n /** Present when the user can reopen a SumSub session (retryable path). */\n sumsubSessionId?: string;\n /** Machine-readable error code for terminal / EDD UX. */\n errorCode?: string;\n};\n\n/**\n * Phases of the end-to-end identity flow.\n *\n * - `idle` — nothing started.\n * - `terms` — waiting for the customer to accept the vendor terms.\n * - `session` — creating the vendor session (MoonPay) or creating the UKYC\n * session and recording session-scoped disclaimers (non-MoonPay vendors).\n * - `check` — running the invisible connection-check frame (MoonPay only).\n * - `auth` — running the visible authentication (OTP) frame (MoonPay only).\n * - `form` — authenticated. When the flow is scoped to a product, the\n * KYC-required check runs automatically from here; otherwise the consumer\n * drives it manually via `checkKycRequired`. Consents-path vendors skip\n * this phase.\n * - `submit` — submitting the KYC-required check / launching SumSub.\n * - `done` — flow complete; see `kycRequiredByProduct` / `sumsub` /\n * `userStatus`. When KYC is required, the document-verification sub-flow is\n * launched automatically.\n * - `error` — flow halted; see `error`.\n */\nexport type KycPhase =\n | 'idle'\n | 'terms'\n | 'session'\n | 'check'\n | 'auth'\n | 'form'\n | 'submit'\n | 'done'\n | 'error';\n\n/**\n * Progress of the SumSub document-verification sub-flow.\n *\n * - `polling` — the SDK finished and the controller is polling the UKYC\n * backend for the session's final decision (see `KycSessionStatus`). The\n * sub-flow resolves to `complete` or `failed` once a terminal status arrives.\n * - `vendorProcessing` — session creation reported that the applicant is\n * already approved on the relay (`kycStatus`) while the vendor is still\n * finalizing its own decision (`finalStatus`). There is nothing left for the\n * applicant to do, so the SDK is not launched; see `statusMessage`.\n */\nexport type KycSumSubStatus =\n | 'idle'\n | 'creatingSession'\n | 'fetchingToken'\n | 'launching'\n | 'inProgress'\n | 'polling'\n | 'complete'\n | 'failed'\n | 'vendorProcessing';\n\n/**\n * The status of a UKYC session, returned by the `GET /sessions/{id}/status`\n * endpoint and polled after the SumSub SDK completes to determine the final\n * verification decision.\n */\nexport type KycSessionStatus = {\n /**\n * The overall status of the session. Terminal values (e.g. `approved`,\n * `completed`, `rejected`, `failed`, `blocked`) end polling; any other value\n * keeps polling.\n */\n finalStatus: string;\n /** Optional human-readable message describing the status. */\n statusMessage?: string;\n /** The vendor-agnostic external user id associated with the session. */\n externalUserId: string;\n /** The KYC decision status. */\n kycStatus: string;\n /** The identity vendor that handled the session. */\n vendor: string;\n /** The vendor-specific status. */\n vendorStatus: string;\n};\n\n/**\n * A single disclaimer/term the customer must accept before a vendor session is\n * created (`GET /vendors/{vendor}/disclaimers`).\n */\nexport type KycDisclaimer = {\n id: string;\n // Mirrors the vendor API response field, which is snake_case.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n display_name: string;\n url: string;\n};\n\n/**\n * A vendor T&C signing returned by `POST /vendors/{vendor}/disclaimers`.\n */\nexport type KycVendorSigning = {\n /** Iron signing id. */\n id: string;\n // Mirrors the vendor API response field, which is snake_case.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n customer_id: string;\n // Mirrors the vendor API response field, which is snake_case.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n content_id?: string;\n};\n\n/**\n * A legal document in the session-scoped idOS / KYC-provider catalog\n * (`GET`/`POST /sessions/{sessionId}/disclaimers`).\n */\nexport type KycConsentDocument = {\n /** Stable identifier of the legal document. */\n key: string;\n /** Version of the document currently in force. */\n version: string;\n /** Human-readable document title. */\n title: string;\n /** URL the document body is hosted at. */\n url: string;\n /** Whether this session already consented to this document version. */\n consented: boolean;\n};\n\n/**\n * A consent record posted for a catalog document. `key` and `version` must\n * match the current session catalog.\n */\nexport type KycConsentRecord = {\n key: string;\n version: string;\n};\n\n/**\n * Session-scoped disclaimer catalog returned by\n * `GET`/`POST /sessions/{sessionId}/disclaimers`.\n */\nexport type KycSessionDisclaimers = {\n /** idOS legal documents. */\n idOS: KycConsentDocument[];\n /** KYC provider (SumSub) legal documents. */\n kycProvider: KycConsentDocument[];\n /** Whether the user consented to reuse existing idOS credentials. */\n credentialReusabilityConsentGiven: boolean;\n};\n\n/**\n * Parameters passed to a platform SumSub launcher.\n */\nexport type KycSumSubLaunchParams = {\n /**\n * The applicant access token used to initialize the SumSub SDK.\n */\n applicantAccessToken: string;\n\n /**\n * Called by the SDK when the access token expires; must resolve with a fresh\n * applicant access token.\n */\n onTokenExpiration: () => Promise<string>;\n\n /**\n * Called when the SDK reports a status transition.\n */\n onStatusChange?: (prevStatus: string, newStatus: string) => void;\n\n /**\n * BCP-47 locale for the SDK UI.\n */\n locale?: string;\n\n /**\n * Enables SDK debug logging.\n */\n debug?: boolean;\n};\n\n/**\n * Platform adapter that launches the native/web SumSub SDK.\n *\n * The KYC controller is platform-agnostic and does not import any SDK; each\n * client (mobile / extension / web) injects an implementation of this\n * interface. The controller owns all orchestration (session creation, token\n * exchange, token refresh, state) and only delegates the actual SDK\n * presentation to `launch`.\n */\nexport type KycSumSubLauncher = {\n /**\n * Whether the underlying SDK is available in the current runtime (e.g. the\n * native module is linked). When `false`, `startSumSub` fails fast.\n */\n isAvailable(): boolean;\n\n /**\n * Presents the SumSub verification flow and resolves with the SDK result.\n */\n launch(params: KycSumSubLaunchParams): Promise<Record<string, unknown>>;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"}
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for the KYC controller and service.
|
|
3
|
+
*
|
|
4
|
+
* The KYC flow is vendor-backed (currently MoonPay for identity + SumSub for
|
|
5
|
+
* document verification) but the surface exposed to consumers (ramps, card) is
|
|
6
|
+
* intentionally vendor-neutral so a future vendor swap does not ripple out.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* A MetaMask feature that consumes KYC. Used to key the per-product
|
|
10
|
+
* "is KYC required" cache so ramps, card, and money can share one controller.
|
|
11
|
+
*/
|
|
12
|
+
export type KycProduct = 'ramps' | 'card' | 'money';
|
|
13
|
+
/**
|
|
14
|
+
* Identity vendors supported behind the KYC surface.
|
|
15
|
+
*
|
|
16
|
+
* - `moonpay` — MoonPay Check/Auth frames + SumSub documents.
|
|
17
|
+
* - `iron` — Iron-only Money/VBA path: empty-shell customer → consents →
|
|
18
|
+
* SumSub, with no MoonPay Check/Auth frames.
|
|
19
|
+
*/
|
|
20
|
+
export type KycVendor = 'moonpay' | 'iron';
|
|
21
|
+
/**
|
|
22
|
+
* Vendor-scoped identity for the currently authenticated KYC customer.
|
|
23
|
+
*
|
|
24
|
+
* Exposed to consumers (e.g. ramps) that must attach the vendor customer id to
|
|
25
|
+
* downstream provider calls without reading the full KYC state, which also
|
|
26
|
+
* holds session/access tokens. The identifier is session-scoped: it is only
|
|
27
|
+
* available once the customer has authenticated through the current flow and
|
|
28
|
+
* is cleared on `reset()`.
|
|
29
|
+
*/
|
|
30
|
+
export type KycCustomerIdentity = {
|
|
31
|
+
/** The identity vendor that issued {@link KycCustomerIdentity.id}. */
|
|
32
|
+
vendor: KycVendor;
|
|
33
|
+
/** The vendor customer id (e.g. MoonPay customer UUID). */
|
|
34
|
+
id: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* User-keyed KYC status returned by `GET /kyc/status` and stored for toast /
|
|
38
|
+
* banner rendering. Collapses vendor + SumSub / relay state into the offsite
|
|
39
|
+
* contract.
|
|
40
|
+
*/
|
|
41
|
+
export type KycUserStatus = 'not-started' | 'pending' | 'need-more-information' | 'terminal-failure' | 'completed';
|
|
42
|
+
/**
|
|
43
|
+
* Payload from `GET /kyc/status`, including optional fields that power the
|
|
44
|
+
* 3-state error contract (retryable SumSub vs terminal vs EDD).
|
|
45
|
+
*/
|
|
46
|
+
export type KycUserStatusResponse = {
|
|
47
|
+
status: KycUserStatus;
|
|
48
|
+
/** Present when the user can reopen a SumSub session (retryable path). */
|
|
49
|
+
sumsubSessionId?: string;
|
|
50
|
+
/** Machine-readable error code for terminal / EDD UX. */
|
|
51
|
+
errorCode?: string;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Phases of the end-to-end identity flow.
|
|
55
|
+
*
|
|
56
|
+
* - `idle` — nothing started.
|
|
57
|
+
* - `terms` — waiting for the customer to accept the vendor terms.
|
|
58
|
+
* - `session` — creating the vendor session (MoonPay) or creating the UKYC
|
|
59
|
+
* session and recording session-scoped disclaimers (non-MoonPay vendors).
|
|
60
|
+
* - `check` — running the invisible connection-check frame (MoonPay only).
|
|
61
|
+
* - `auth` — running the visible authentication (OTP) frame (MoonPay only).
|
|
62
|
+
* - `form` — authenticated. When the flow is scoped to a product, the
|
|
63
|
+
* KYC-required check runs automatically from here; otherwise the consumer
|
|
64
|
+
* drives it manually via `checkKycRequired`. Consents-path vendors skip
|
|
65
|
+
* this phase.
|
|
66
|
+
* - `submit` — submitting the KYC-required check / launching SumSub.
|
|
67
|
+
* - `done` — flow complete; see `kycRequiredByProduct` / `sumsub` /
|
|
68
|
+
* `userStatus`. When KYC is required, the document-verification sub-flow is
|
|
69
|
+
* launched automatically.
|
|
70
|
+
* - `error` — flow halted; see `error`.
|
|
71
|
+
*/
|
|
72
|
+
export type KycPhase = 'idle' | 'terms' | 'session' | 'check' | 'auth' | 'form' | 'submit' | 'done' | 'error';
|
|
73
|
+
/**
|
|
74
|
+
* Progress of the SumSub document-verification sub-flow.
|
|
75
|
+
*
|
|
76
|
+
* - `polling` — the SDK finished and the controller is polling the UKYC
|
|
77
|
+
* backend for the session's final decision (see `KycSessionStatus`). The
|
|
78
|
+
* sub-flow resolves to `complete` or `failed` once a terminal status arrives.
|
|
79
|
+
* - `vendorProcessing` — session creation reported that the applicant is
|
|
80
|
+
* already approved on the relay (`kycStatus`) while the vendor is still
|
|
81
|
+
* finalizing its own decision (`finalStatus`). There is nothing left for the
|
|
82
|
+
* applicant to do, so the SDK is not launched; see `statusMessage`.
|
|
83
|
+
*/
|
|
84
|
+
export type KycSumSubStatus = 'idle' | 'creatingSession' | 'fetchingToken' | 'launching' | 'inProgress' | 'polling' | 'complete' | 'failed' | 'vendorProcessing';
|
|
85
|
+
/**
|
|
86
|
+
* The status of a UKYC session, returned by the `GET /sessions/{id}/status`
|
|
87
|
+
* endpoint and polled after the SumSub SDK completes to determine the final
|
|
88
|
+
* verification decision.
|
|
89
|
+
*/
|
|
90
|
+
export type KycSessionStatus = {
|
|
91
|
+
/**
|
|
92
|
+
* The overall status of the session. Terminal values (e.g. `approved`,
|
|
93
|
+
* `completed`, `rejected`, `failed`, `blocked`) end polling; any other value
|
|
94
|
+
* keeps polling.
|
|
95
|
+
*/
|
|
96
|
+
finalStatus: string;
|
|
97
|
+
/** Optional human-readable message describing the status. */
|
|
98
|
+
statusMessage?: string;
|
|
99
|
+
/** The vendor-agnostic external user id associated with the session. */
|
|
100
|
+
externalUserId: string;
|
|
101
|
+
/** The KYC decision status. */
|
|
102
|
+
kycStatus: string;
|
|
103
|
+
/** The identity vendor that handled the session. */
|
|
104
|
+
vendor: string;
|
|
105
|
+
/** The vendor-specific status. */
|
|
106
|
+
vendorStatus: string;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* A single disclaimer/term the customer must accept before a vendor session is
|
|
110
|
+
* created (`GET /vendors/{vendor}/disclaimers`).
|
|
111
|
+
*/
|
|
112
|
+
export type KycDisclaimer = {
|
|
113
|
+
id: string;
|
|
114
|
+
display_name: string;
|
|
115
|
+
url: string;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* A vendor T&C signing returned by `POST /vendors/{vendor}/disclaimers`.
|
|
119
|
+
*/
|
|
120
|
+
export type KycVendorSigning = {
|
|
121
|
+
/** Iron signing id. */
|
|
122
|
+
id: string;
|
|
123
|
+
customer_id: string;
|
|
124
|
+
content_id?: string;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* A legal document in the session-scoped idOS / KYC-provider catalog
|
|
128
|
+
* (`GET`/`POST /sessions/{sessionId}/disclaimers`).
|
|
129
|
+
*/
|
|
130
|
+
export type KycConsentDocument = {
|
|
131
|
+
/** Stable identifier of the legal document. */
|
|
132
|
+
key: string;
|
|
133
|
+
/** Version of the document currently in force. */
|
|
134
|
+
version: string;
|
|
135
|
+
/** Human-readable document title. */
|
|
136
|
+
title: string;
|
|
137
|
+
/** URL the document body is hosted at. */
|
|
138
|
+
url: string;
|
|
139
|
+
/** Whether this session already consented to this document version. */
|
|
140
|
+
consented: boolean;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* A consent record posted for a catalog document. `key` and `version` must
|
|
144
|
+
* match the current session catalog.
|
|
145
|
+
*/
|
|
146
|
+
export type KycConsentRecord = {
|
|
147
|
+
key: string;
|
|
148
|
+
version: string;
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Session-scoped disclaimer catalog returned by
|
|
152
|
+
* `GET`/`POST /sessions/{sessionId}/disclaimers`.
|
|
153
|
+
*/
|
|
154
|
+
export type KycSessionDisclaimers = {
|
|
155
|
+
/** idOS legal documents. */
|
|
156
|
+
idOS: KycConsentDocument[];
|
|
157
|
+
/** KYC provider (SumSub) legal documents. */
|
|
158
|
+
kycProvider: KycConsentDocument[];
|
|
159
|
+
/** Whether the user consented to reuse existing idOS credentials. */
|
|
160
|
+
credentialReusabilityConsentGiven: boolean;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Parameters passed to a platform SumSub launcher.
|
|
164
|
+
*/
|
|
165
|
+
export type KycSumSubLaunchParams = {
|
|
166
|
+
/**
|
|
167
|
+
* The applicant access token used to initialize the SumSub SDK.
|
|
168
|
+
*/
|
|
169
|
+
applicantAccessToken: string;
|
|
170
|
+
/**
|
|
171
|
+
* Called by the SDK when the access token expires; must resolve with a fresh
|
|
172
|
+
* applicant access token.
|
|
173
|
+
*/
|
|
174
|
+
onTokenExpiration: () => Promise<string>;
|
|
175
|
+
/**
|
|
176
|
+
* Called when the SDK reports a status transition.
|
|
177
|
+
*/
|
|
178
|
+
onStatusChange?: (prevStatus: string, newStatus: string) => void;
|
|
179
|
+
/**
|
|
180
|
+
* BCP-47 locale for the SDK UI.
|
|
181
|
+
*/
|
|
182
|
+
locale?: string;
|
|
183
|
+
/**
|
|
184
|
+
* Enables SDK debug logging.
|
|
185
|
+
*/
|
|
186
|
+
debug?: boolean;
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* Platform adapter that launches the native/web SumSub SDK.
|
|
190
|
+
*
|
|
191
|
+
* The KYC controller is platform-agnostic and does not import any SDK; each
|
|
192
|
+
* client (mobile / extension / web) injects an implementation of this
|
|
193
|
+
* interface. The controller owns all orchestration (session creation, token
|
|
194
|
+
* exchange, token refresh, state) and only delegates the actual SDK
|
|
195
|
+
* presentation to `launch`.
|
|
196
|
+
*/
|
|
197
|
+
export type KycSumSubLauncher = {
|
|
198
|
+
/**
|
|
199
|
+
* Whether the underlying SDK is available in the current runtime (e.g. the
|
|
200
|
+
* native module is linked). When `false`, `startSumSub` fails fast.
|
|
201
|
+
*/
|
|
202
|
+
isAvailable(): boolean;
|
|
203
|
+
/**
|
|
204
|
+
* Presents the SumSub verification flow and resolves with the SDK result.
|
|
205
|
+
*/
|
|
206
|
+
launch(params: KycSumSubLaunchParams): Promise<Record<string, unknown>>;
|
|
207
|
+
};
|
|
208
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG","sourcesContent":["/**\n * Shared types for the KYC controller and service.\n *\n * The KYC flow is vendor-backed (currently MoonPay for identity + SumSub for\n * document verification) but the surface exposed to consumers (ramps, card) is\n * intentionally vendor-neutral so a future vendor swap does not ripple out.\n */\n\n/**\n * A MetaMask feature that consumes KYC. Used to key the per-product\n * \"is KYC required\" cache so ramps, card, and money can share one controller.\n */\nexport type KycProduct = 'ramps' | 'card' | 'money';\n\n/**\n * Identity vendors supported behind the KYC surface.\n *\n * - `moonpay` — MoonPay Check/Auth frames + SumSub documents.\n * - `iron` — Iron-only Money/VBA path: empty-shell customer → consents →\n * SumSub, with no MoonPay Check/Auth frames.\n */\nexport type KycVendor = 'moonpay' | 'iron';\n\n/**\n * Vendor-scoped identity for the currently authenticated KYC customer.\n *\n * Exposed to consumers (e.g. ramps) that must attach the vendor customer id to\n * downstream provider calls without reading the full KYC state, which also\n * holds session/access tokens. The identifier is session-scoped: it is only\n * available once the customer has authenticated through the current flow and\n * is cleared on `reset()`.\n */\nexport type KycCustomerIdentity = {\n /** The identity vendor that issued {@link KycCustomerIdentity.id}. */\n vendor: KycVendor;\n /** The vendor customer id (e.g. MoonPay customer UUID). */\n id: string;\n};\n\n/**\n * User-keyed KYC status returned by `GET /kyc/status` and stored for toast /\n * banner rendering. Collapses vendor + SumSub / relay state into the offsite\n * contract.\n */\nexport type KycUserStatus =\n | 'not-started'\n | 'pending'\n | 'need-more-information'\n | 'terminal-failure'\n | 'completed';\n\n/**\n * Payload from `GET /kyc/status`, including optional fields that power the\n * 3-state error contract (retryable SumSub vs terminal vs EDD).\n */\nexport type KycUserStatusResponse = {\n status: KycUserStatus;\n /** Present when the user can reopen a SumSub session (retryable path). */\n sumsubSessionId?: string;\n /** Machine-readable error code for terminal / EDD UX. */\n errorCode?: string;\n};\n\n/**\n * Phases of the end-to-end identity flow.\n *\n * - `idle` — nothing started.\n * - `terms` — waiting for the customer to accept the vendor terms.\n * - `session` — creating the vendor session (MoonPay) or creating the UKYC\n * session and recording session-scoped disclaimers (non-MoonPay vendors).\n * - `check` — running the invisible connection-check frame (MoonPay only).\n * - `auth` — running the visible authentication (OTP) frame (MoonPay only).\n * - `form` — authenticated. When the flow is scoped to a product, the\n * KYC-required check runs automatically from here; otherwise the consumer\n * drives it manually via `checkKycRequired`. Consents-path vendors skip\n * this phase.\n * - `submit` — submitting the KYC-required check / launching SumSub.\n * - `done` — flow complete; see `kycRequiredByProduct` / `sumsub` /\n * `userStatus`. When KYC is required, the document-verification sub-flow is\n * launched automatically.\n * - `error` — flow halted; see `error`.\n */\nexport type KycPhase =\n | 'idle'\n | 'terms'\n | 'session'\n | 'check'\n | 'auth'\n | 'form'\n | 'submit'\n | 'done'\n | 'error';\n\n/**\n * Progress of the SumSub document-verification sub-flow.\n *\n * - `polling` — the SDK finished and the controller is polling the UKYC\n * backend for the session's final decision (see `KycSessionStatus`). The\n * sub-flow resolves to `complete` or `failed` once a terminal status arrives.\n * - `vendorProcessing` — session creation reported that the applicant is\n * already approved on the relay (`kycStatus`) while the vendor is still\n * finalizing its own decision (`finalStatus`). There is nothing left for the\n * applicant to do, so the SDK is not launched; see `statusMessage`.\n */\nexport type KycSumSubStatus =\n | 'idle'\n | 'creatingSession'\n | 'fetchingToken'\n | 'launching'\n | 'inProgress'\n | 'polling'\n | 'complete'\n | 'failed'\n | 'vendorProcessing';\n\n/**\n * The status of a UKYC session, returned by the `GET /sessions/{id}/status`\n * endpoint and polled after the SumSub SDK completes to determine the final\n * verification decision.\n */\nexport type KycSessionStatus = {\n /**\n * The overall status of the session. Terminal values (e.g. `approved`,\n * `completed`, `rejected`, `failed`, `blocked`) end polling; any other value\n * keeps polling.\n */\n finalStatus: string;\n /** Optional human-readable message describing the status. */\n statusMessage?: string;\n /** The vendor-agnostic external user id associated with the session. */\n externalUserId: string;\n /** The KYC decision status. */\n kycStatus: string;\n /** The identity vendor that handled the session. */\n vendor: string;\n /** The vendor-specific status. */\n vendorStatus: string;\n};\n\n/**\n * A single disclaimer/term the customer must accept before a vendor session is\n * created (`GET /vendors/{vendor}/disclaimers`).\n */\nexport type KycDisclaimer = {\n id: string;\n // Mirrors the vendor API response field, which is snake_case.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n display_name: string;\n url: string;\n};\n\n/**\n * A vendor T&C signing returned by `POST /vendors/{vendor}/disclaimers`.\n */\nexport type KycVendorSigning = {\n /** Iron signing id. */\n id: string;\n // Mirrors the vendor API response field, which is snake_case.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n customer_id: string;\n // Mirrors the vendor API response field, which is snake_case.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n content_id?: string;\n};\n\n/**\n * A legal document in the session-scoped idOS / KYC-provider catalog\n * (`GET`/`POST /sessions/{sessionId}/disclaimers`).\n */\nexport type KycConsentDocument = {\n /** Stable identifier of the legal document. */\n key: string;\n /** Version of the document currently in force. */\n version: string;\n /** Human-readable document title. */\n title: string;\n /** URL the document body is hosted at. */\n url: string;\n /** Whether this session already consented to this document version. */\n consented: boolean;\n};\n\n/**\n * A consent record posted for a catalog document. `key` and `version` must\n * match the current session catalog.\n */\nexport type KycConsentRecord = {\n key: string;\n version: string;\n};\n\n/**\n * Session-scoped disclaimer catalog returned by\n * `GET`/`POST /sessions/{sessionId}/disclaimers`.\n */\nexport type KycSessionDisclaimers = {\n /** idOS legal documents. */\n idOS: KycConsentDocument[];\n /** KYC provider (SumSub) legal documents. */\n kycProvider: KycConsentDocument[];\n /** Whether the user consented to reuse existing idOS credentials. */\n credentialReusabilityConsentGiven: boolean;\n};\n\n/**\n * Parameters passed to a platform SumSub launcher.\n */\nexport type KycSumSubLaunchParams = {\n /**\n * The applicant access token used to initialize the SumSub SDK.\n */\n applicantAccessToken: string;\n\n /**\n * Called by the SDK when the access token expires; must resolve with a fresh\n * applicant access token.\n */\n onTokenExpiration: () => Promise<string>;\n\n /**\n * Called when the SDK reports a status transition.\n */\n onStatusChange?: (prevStatus: string, newStatus: string) => void;\n\n /**\n * BCP-47 locale for the SDK UI.\n */\n locale?: string;\n\n /**\n * Enables SDK debug logging.\n */\n debug?: boolean;\n};\n\n/**\n * Platform adapter that launches the native/web SumSub SDK.\n *\n * The KYC controller is platform-agnostic and does not import any SDK; each\n * client (mobile / extension / web) injects an implementation of this\n * interface. The controller owns all orchestration (session creation, token\n * exchange, token refresh, state) and only delegates the actual SDK\n * presentation to `launch`.\n */\nexport type KycSumSubLauncher = {\n /**\n * Whether the underlying SDK is available in the current runtime (e.g. the\n * native module is linked). When `false`, `startSumSub` fails fast.\n */\n isAvailable(): boolean;\n\n /**\n * Presents the SumSub verification flow and resolves with the SDK result.\n */\n launch(params: KycSumSubLaunchParams): Promise<Record<string, unknown>>;\n};\n"]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Constants for the UKYC client-derived key material and storage-authorization
|
|
4
|
+
* layer. See the architecture doc, section "Client-Derived Material".
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.UKYC_JWKS_PATH = exports.UKYC_CAPABILITY_AUTH_SCHEME = exports.UKYC_STORAGE_ACCESS_TOKEN_AUDIENCES = exports.UKYC_KWIL_AUDIENCE = exports.UKYC_STORAGE_ACCESS_TOKEN_AUDIENCE = exports.UKYC_STORAGE_ACCESS_TOKEN_VERSION = exports.UKYC_KDF_INFO = exports.UKYC_DERIVED_KEY_SIZES = exports.UKYC_LOCAL_USER_SECRET_SIZE_BYTES = exports.UKYC_LOCAL_USER_SECRET_PATH = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Fully-qualified key path for the `local_user_secret` in Encrypted User
|
|
10
|
+
* Storage.
|
|
11
|
+
*/
|
|
12
|
+
exports.UKYC_LOCAL_USER_SECRET_PATH = `ukyc.local_user_secret`;
|
|
13
|
+
/**
|
|
14
|
+
* Size of the `local_user_secret` in bytes. 32 bytes (256 bits) provides high
|
|
15
|
+
* entropy and matches the input length expected by the HKDF-SHA256 derivations
|
|
16
|
+
* below.
|
|
17
|
+
*/
|
|
18
|
+
exports.UKYC_LOCAL_USER_SECRET_SIZE_BYTES = 32;
|
|
19
|
+
/**
|
|
20
|
+
* Byte length of each value derived from `local_user_secret`.
|
|
21
|
+
*
|
|
22
|
+
* `signingKey` is 32 bytes because it is used directly as the Ed25519
|
|
23
|
+
* private key (for Ed25519 the 32-byte seed *is* the private key).
|
|
24
|
+
*/
|
|
25
|
+
exports.UKYC_DERIVED_KEY_SIZES = {
|
|
26
|
+
storageId: 32,
|
|
27
|
+
dataEncryptionKey: 32,
|
|
28
|
+
signingKey: 32,
|
|
29
|
+
relayTunnelKey: 32,
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* HKDF `info` labels providing domain separation between the values derived
|
|
33
|
+
* from `local_user_secret`.
|
|
34
|
+
*/
|
|
35
|
+
exports.UKYC_KDF_INFO = {
|
|
36
|
+
storageId: 'metamask.ukyc.storage.v1.storage_id',
|
|
37
|
+
dataEncryptionKey: 'metamask.ukyc.storage.v1.data_encryption_key',
|
|
38
|
+
signingKey: 'metamask.ukyc.storage.v1.signing_key',
|
|
39
|
+
relayTunnelKey: 'metamask.ukyc.storage.v1.relay_tunnel_key',
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Version bound into every `storage_access_token` payload.
|
|
43
|
+
*/
|
|
44
|
+
exports.UKYC_STORAGE_ACCESS_TOKEN_VERSION = 1;
|
|
45
|
+
/**
|
|
46
|
+
* Audience identifying the UKYC user-storage service. Required by UKYC Storage
|
|
47
|
+
* when it verifies a `storage_access_token`.
|
|
48
|
+
*/
|
|
49
|
+
exports.UKYC_STORAGE_ACCESS_TOKEN_AUDIENCE = 'metamask:user-storage:ukyc';
|
|
50
|
+
/**
|
|
51
|
+
* Audience identifying the idOS Kwil credential-registry nodes. Required by
|
|
52
|
+
* idOS Kwil when it verifies a `storage_access_token`.
|
|
53
|
+
*/
|
|
54
|
+
exports.UKYC_KWIL_AUDIENCE = 'idos:kwil';
|
|
55
|
+
/**
|
|
56
|
+
* Full audience list bound into every `storage_access_token` payload. `aud`
|
|
57
|
+
* lists every verifier that may accept the token, so both UKYC Storage and
|
|
58
|
+
* idOS Kwil can each find their own entry.
|
|
59
|
+
*/
|
|
60
|
+
exports.UKYC_STORAGE_ACCESS_TOKEN_AUDIENCES = [
|
|
61
|
+
exports.UKYC_STORAGE_ACCESS_TOKEN_AUDIENCE,
|
|
62
|
+
exports.UKYC_KWIL_AUDIENCE,
|
|
63
|
+
];
|
|
64
|
+
/**
|
|
65
|
+
* Authorization scheme under which a signed `storage_access_token` envelope is
|
|
66
|
+
* carried to UKYC Storage: `Authorization: AccessToken <base64url(envelope)>`.
|
|
67
|
+
* The credentials portion is what `encodeStorageAccessTokenForHeader` returns.
|
|
68
|
+
*/
|
|
69
|
+
exports.UKYC_CAPABILITY_AUTH_SCHEME = 'AccessToken';
|
|
70
|
+
/**
|
|
71
|
+
* Standard well-known path where the Fractal encryption service publishes its
|
|
72
|
+
* JWKS (the Ed25519 public keys used to sign the `jwtChain`).
|
|
73
|
+
*/
|
|
74
|
+
exports.UKYC_JWKS_PATH = '/.well-known/jwks.json';
|
|
75
|
+
//# sourceMappingURL=constants.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../../src/ukyc/constants.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;GAGG;AACU,QAAA,2BAA2B,GAAG,wBAAiC,CAAC;AAE7E;;;;GAIG;AACU,QAAA,iCAAiC,GAAG,EAAE,CAAC;AAEpD;;;;;GAKG;AACU,QAAA,sBAAsB,GAAG;IACpC,SAAS,EAAE,EAAE;IACb,iBAAiB,EAAE,EAAE;IACrB,UAAU,EAAE,EAAE;IACd,cAAc,EAAE,EAAE;CACV,CAAC;AAEX;;;GAGG;AACU,QAAA,aAAa,GAAG;IAC3B,SAAS,EAAE,qCAAqC;IAChD,iBAAiB,EAAE,8CAA8C;IACjE,UAAU,EAAE,sCAAsC;IAClD,cAAc,EAAE,2CAA2C;CACnD,CAAC;AAEX;;GAEG;AACU,QAAA,iCAAiC,GAAG,CAAC,CAAC;AAEnD;;;GAGG;AACU,QAAA,kCAAkC,GAC7C,4BAAqC,CAAC;AAExC;;;GAGG;AACU,QAAA,kBAAkB,GAAG,WAAoB,CAAC;AAEvD;;;;GAIG;AACU,QAAA,mCAAmC,GAAG;IACjD,0CAAkC;IAClC,0BAAkB;CACV,CAAC;AAEX;;;;GAIG;AACU,QAAA,2BAA2B,GAAG,aAAsB,CAAC;AAElE;;;GAGG;AACU,QAAA,cAAc,GAAG,wBAAwB,CAAC","sourcesContent":["/**\n * Constants for the UKYC client-derived key material and storage-authorization\n * layer. See the architecture doc, section \"Client-Derived Material\".\n */\n\n/**\n * Fully-qualified key path for the `local_user_secret` in Encrypted User\n * Storage.\n */\nexport const UKYC_LOCAL_USER_SECRET_PATH = `ukyc.local_user_secret` as const;\n\n/**\n * Size of the `local_user_secret` in bytes. 32 bytes (256 bits) provides high\n * entropy and matches the input length expected by the HKDF-SHA256 derivations\n * below.\n */\nexport const UKYC_LOCAL_USER_SECRET_SIZE_BYTES = 32;\n\n/**\n * Byte length of each value derived from `local_user_secret`.\n *\n * `signingKey` is 32 bytes because it is used directly as the Ed25519\n * private key (for Ed25519 the 32-byte seed *is* the private key).\n */\nexport const UKYC_DERIVED_KEY_SIZES = {\n storageId: 32,\n dataEncryptionKey: 32,\n signingKey: 32,\n relayTunnelKey: 32,\n} as const;\n\n/**\n * HKDF `info` labels providing domain separation between the values derived\n * from `local_user_secret`.\n */\nexport const UKYC_KDF_INFO = {\n storageId: 'metamask.ukyc.storage.v1.storage_id',\n dataEncryptionKey: 'metamask.ukyc.storage.v1.data_encryption_key',\n signingKey: 'metamask.ukyc.storage.v1.signing_key',\n relayTunnelKey: 'metamask.ukyc.storage.v1.relay_tunnel_key',\n} as const;\n\n/**\n * Version bound into every `storage_access_token` payload.\n */\nexport const UKYC_STORAGE_ACCESS_TOKEN_VERSION = 1;\n\n/**\n * Audience identifying the UKYC user-storage service. Required by UKYC Storage\n * when it verifies a `storage_access_token`.\n */\nexport const UKYC_STORAGE_ACCESS_TOKEN_AUDIENCE =\n 'metamask:user-storage:ukyc' as const;\n\n/**\n * Audience identifying the idOS Kwil credential-registry nodes. Required by\n * idOS Kwil when it verifies a `storage_access_token`.\n */\nexport const UKYC_KWIL_AUDIENCE = 'idos:kwil' as const;\n\n/**\n * Full audience list bound into every `storage_access_token` payload. `aud`\n * lists every verifier that may accept the token, so both UKYC Storage and\n * idOS Kwil can each find their own entry.\n */\nexport const UKYC_STORAGE_ACCESS_TOKEN_AUDIENCES = [\n UKYC_STORAGE_ACCESS_TOKEN_AUDIENCE,\n UKYC_KWIL_AUDIENCE,\n] as const;\n\n/**\n * Authorization scheme under which a signed `storage_access_token` envelope is\n * carried to UKYC Storage: `Authorization: AccessToken <base64url(envelope)>`.\n * The credentials portion is what `encodeStorageAccessTokenForHeader` returns.\n */\nexport const UKYC_CAPABILITY_AUTH_SCHEME = 'AccessToken' as const;\n\n/**\n * Standard well-known path where the Fractal encryption service publishes its\n * JWKS (the Ed25519 public keys used to sign the `jwtChain`).\n */\nexport const UKYC_JWKS_PATH = '/.well-known/jwks.json';\n"]}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Fully-qualified key path for the `local_user_secret` in Encrypted User
|
|
7
7
|
* Storage.
|
|
8
8
|
*/
|
|
9
|
-
export declare const UKYC_LOCAL_USER_SECRET_PATH:
|
|
9
|
+
export declare const UKYC_LOCAL_USER_SECRET_PATH: "ukyc.local_user_secret";
|
|
10
10
|
/**
|
|
11
11
|
* Size of the `local_user_secret` in bytes. 32 bytes (256 bits) provides high
|
|
12
12
|
* entropy and matches the input length expected by the HKDF-SHA256 derivations
|
|
@@ -30,10 +30,10 @@ export declare const UKYC_DERIVED_KEY_SIZES: {
|
|
|
30
30
|
* from `local_user_secret`.
|
|
31
31
|
*/
|
|
32
32
|
export declare const UKYC_KDF_INFO: {
|
|
33
|
-
readonly storageId:
|
|
34
|
-
readonly dataEncryptionKey:
|
|
35
|
-
readonly signingKey:
|
|
36
|
-
readonly relayTunnelKey:
|
|
33
|
+
readonly storageId: "metamask.ukyc.storage.v1.storage_id";
|
|
34
|
+
readonly dataEncryptionKey: "metamask.ukyc.storage.v1.data_encryption_key";
|
|
35
|
+
readonly signingKey: "metamask.ukyc.storage.v1.signing_key";
|
|
36
|
+
readonly relayTunnelKey: "metamask.ukyc.storage.v1.relay_tunnel_key";
|
|
37
37
|
};
|
|
38
38
|
/**
|
|
39
39
|
* Version bound into every `storage_access_token` payload.
|
|
@@ -43,12 +43,12 @@ export declare const UKYC_STORAGE_ACCESS_TOKEN_VERSION = 1;
|
|
|
43
43
|
* Audience identifying the UKYC user-storage service. Required by UKYC Storage
|
|
44
44
|
* when it verifies a `storage_access_token`.
|
|
45
45
|
*/
|
|
46
|
-
export declare const UKYC_STORAGE_ACCESS_TOKEN_AUDIENCE:
|
|
46
|
+
export declare const UKYC_STORAGE_ACCESS_TOKEN_AUDIENCE: "metamask:user-storage:ukyc";
|
|
47
47
|
/**
|
|
48
48
|
* Audience identifying the idOS Kwil credential-registry nodes. Required by
|
|
49
49
|
* idOS Kwil when it verifies a `storage_access_token`.
|
|
50
50
|
*/
|
|
51
|
-
export declare const UKYC_KWIL_AUDIENCE:
|
|
51
|
+
export declare const UKYC_KWIL_AUDIENCE: "idos:kwil";
|
|
52
52
|
/**
|
|
53
53
|
* Full audience list bound into every `storage_access_token` payload. `aud`
|
|
54
54
|
* lists every verifier that may accept the token, so both UKYC Storage and
|
|
@@ -60,10 +60,10 @@ export declare const UKYC_STORAGE_ACCESS_TOKEN_AUDIENCES: readonly ["metamask:us
|
|
|
60
60
|
* carried to UKYC Storage: `Authorization: AccessToken <base64url(envelope)>`.
|
|
61
61
|
* The credentials portion is what `encodeStorageAccessTokenForHeader` returns.
|
|
62
62
|
*/
|
|
63
|
-
export declare const UKYC_CAPABILITY_AUTH_SCHEME:
|
|
63
|
+
export declare const UKYC_CAPABILITY_AUTH_SCHEME: "AccessToken";
|
|
64
64
|
/**
|
|
65
65
|
* Standard well-known path where the Fractal encryption service publishes its
|
|
66
66
|
* JWKS (the Ed25519 public keys used to sign the `jwtChain`).
|
|
67
67
|
*/
|
|
68
68
|
export declare const UKYC_JWKS_PATH = "/.well-known/jwks.json";
|
|
69
|
-
//# sourceMappingURL=constants.d.
|
|
69
|
+
//# sourceMappingURL=constants.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../../src/ukyc/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,eAAO,MAAM,2BAA2B,0BAAoC,CAAC;AAE7E;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,KAAK,CAAC;AAEpD;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB;;;;;CAKzB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,iCAAiC,IAAI,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,kCAAkC,8BACR,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,kBAAkB,aAAuB,CAAC;AAEvD;;;;GAIG;AACH,eAAO,MAAM,mCAAmC,sDAGtC,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,eAAyB,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,cAAc,2BAA2B,CAAC"}
|