@metamask-previews/kyc-controller 0.0.0-preview-d8fceeabc → 0.0.0-preview-efd9e28b2
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/CHANGELOG.md +6 -0
- package/dist/KycController.cjs +250 -141
- package/dist/KycController.cjs.map +1 -1
- package/dist/KycController.d.cts.map +1 -1
- package/dist/KycController.d.mts.map +1 -1
- package/dist/KycController.mjs +250 -141
- package/dist/KycController.mjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +21 -1
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +21 -1
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,wDAM4B;AAL1B,iHAAA,aAAa,OAAA;AACb,gIAAA,4BAA4B,OAAA;AAC5B,4IAAA,wCAAwC,OAAA;AACxC,0IAAA,sCAAsC,OAAA;AACtC,kHAAA,cAAc,OAAA;AAgChB,kDAA0D;AAAjD,2GAAA,UAAU,OAAA;AAAE,4GAAA,WAAW,OAAA;AA6ChC,gDAIwB;AAHtB,6HAAA,6BAA6B,OAAA;AAC7B,8GAAA,cAAc,OAAA;AACd,+GAAA,eAAe,OAAA;AAGjB,sDAAqE;AAA5D,iHAAA,cAAc,OAAA;AAAE,mHAAA,gBAAgB,OAAA;AACzC,0CAAkE;AAAzD,+GAAA,kBAAkB,OAAA;AAAE,4GAAA,eAAe,OAAA;
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,wDAM4B;AAL1B,iHAAA,aAAa,OAAA;AACb,gIAAA,4BAA4B,OAAA;AAC5B,4IAAA,wCAAwC,OAAA;AACxC,0IAAA,sCAAsC,OAAA;AACtC,kHAAA,cAAc,OAAA;AAgChB,kDAA0D;AAAjD,2GAAA,UAAU,OAAA;AAAE,4GAAA,WAAW,OAAA;AA6ChC,gDAIwB;AAHtB,6HAAA,6BAA6B,OAAA;AAC7B,8GAAA,cAAc,OAAA;AACd,+GAAA,eAAe,OAAA;AAGjB,sDAAqE;AAA5D,iHAAA,cAAc,OAAA;AAAE,mHAAA,gBAAgB,OAAA;AACzC,0CAAkE;AAAzD,+GAAA,kBAAkB,OAAA;AAAE,4GAAA,eAAe,OAAA;AAiC5C,iFAAiF;AACjF,gEAAgE;AAChE,qDAM6B;AAL3B,2HAAA,2BAA2B,OAAA;AAC3B,kHAAA,kBAAkB,OAAA;AAClB,kIAAA,kCAAkC,OAAA;AAClC,mIAAA,mCAAmC,OAAA;AACnC,iIAAA,iCAAiC,OAAA;AAEnC,2EAGwC;AAFtC,+HAAA,oBAAoB,OAAA;AACpB,+HAAA,oBAAoB,OAAA;AAMtB,uEAGsC;AAFpC,0IAAA,iCAAiC,OAAA;AACjC,+HAAA,sBAAsB,OAAA;AASxB,qDAAwD;AAA/C,iHAAA,iBAAiB,OAAA","sourcesContent":["export {\n KycController,\n getDefaultKycControllerState,\n getDefaultKycProviderDisclaimersAccepted,\n getDefaultKycVendorDisclaimersAccepted,\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 FetchDisclaimersCatalogParams,\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 KycServiceFetchVendorDisclaimersAction,\n KycServiceFetchDisclaimersCatalogAction,\n KycServiceFetchIdosEnclaveJwksAction,\n KycServiceFetchIdosRelayJwksAction,\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 KycCatalogDocument,\n KycConsentDocument,\n KycConsentRecord,\n KycCustomerIdentity,\n KycDisclaimer,\n KycDisclaimersCatalog,\n KycPhase,\n KycProduct,\n KycProviderDisclaimersAccepted,\n KycSessionDisclaimers,\n KycSessionStatus,\n KycSumSubLaunchParams,\n KycSumSubLauncher,\n KycSumSubSdkStatus,\n KycSumSubStatus,\n KycUserStatus,\n KycUserStatusResponse,\n KycVendor,\n KycIronVendorDisclaimersAccepted,\n KycMoonpayVendorDisclaimersAccepted,\n KycVendorDisclaimersAccepted,\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"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -8,7 +8,7 @@ export { selectIsKycRequiredForProduct, selectKycPhase, selectKycSumSub, } from
|
|
|
8
8
|
export { alpha2ToAlpha3, ALPHA2_TO_ALPHA3 } from "./countryCodes.cjs";
|
|
9
9
|
export { decryptCredentials, generateKeyPair } from "./crypto.cjs";
|
|
10
10
|
export type { DecryptedCredentials, DecryptResult, EncryptedCredentialsEnvelope, X25519KeyPair, } from "./crypto.cjs";
|
|
11
|
-
export type { KycCatalogDocument, KycConsentDocument, KycConsentRecord, KycCustomerIdentity, KycDisclaimer, KycDisclaimersCatalog, KycPhase, KycProduct, KycProviderDisclaimersAccepted, KycSessionDisclaimers, KycSessionStatus, KycSumSubLaunchParams, KycSumSubLauncher, KycSumSubStatus, KycUserStatus, KycUserStatusResponse, KycVendor, KycIronVendorDisclaimersAccepted, KycMoonpayVendorDisclaimersAccepted, KycVendorDisclaimersAccepted, KycVendorSigning, } from "./types.cjs";
|
|
11
|
+
export type { KycCatalogDocument, KycConsentDocument, KycConsentRecord, KycCustomerIdentity, KycDisclaimer, KycDisclaimersCatalog, KycPhase, KycProduct, KycProviderDisclaimersAccepted, KycSessionDisclaimers, KycSessionStatus, KycSumSubLaunchParams, KycSumSubLauncher, KycSumSubSdkStatus, KycSumSubStatus, KycUserStatus, KycUserStatusResponse, KycVendor, KycIronVendorDisclaimersAccepted, KycMoonpayVendorDisclaimersAccepted, KycVendorDisclaimersAccepted, KycVendorSigning, } from "./types.cjs";
|
|
12
12
|
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.cjs";
|
|
13
13
|
export { deriveClientMaterial, encodeClientMaterial, } from "./ukyc/deriveClientMaterial.cjs";
|
|
14
14
|
export type { EncodedUkycClientMaterial, UkycClientMaterial, } from "./ukyc/deriveClientMaterial.cjs";
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,4BAA4B,EAC5B,wCAAwC,EACxC,sCAAsC,EACtC,cAAc,GACf,4BAA2B;AAC5B,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,2BAA2B,EAC3B,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,6BAA6B,EAC7B,+BAA+B,GAChC,4BAA2B;AAC5B,YAAY,EACV,6CAA6C,EAC7C,oCAAoC,EACpC,qCAAqC,EACrC,qCAAqC,EACrC,mCAAmC,EACnC,kCAAkC,EAClC,6BAA6B,EAC7B,uCAAuC,EACvC,sCAAsC,EACtC,+BAA+B,EAC/B,mCAAmC,EACnC,qCAAqC,EACrC,6BAA6B,EAC7B,kCAAkC,EAClC,mCAAmC,EACnC,wBAAwB,EACxB,8BAA8B,GAC/B,gDAA+C;AAEhD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,yBAAwB;AAC1D,YAAY,EACV,4BAA4B,EAC5B,uBAAuB,EACvB,sBAAsB,EACtB,0BAA0B,EAC1B,mBAAmB,EACnB,uBAAuB,EACvB,gBAAgB,EAChB,6BAA6B,EAC7B,6BAA6B,EAC7B,sBAAsB,EACtB,sBAAsB,EACtB,YAAY,EACZ,iBAAiB,EACjB,2BAA2B,EAC3B,gBAAgB,EAChB,mCAAmC,EACnC,iCAAiC,EACjC,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,EACvB,8BAA8B,EAC9B,6BAA6B,EAC7B,mBAAmB,GACpB,yBAAwB;AACzB,YAAY,EACV,gCAAgC,EAChC,oCAAoC,EACpC,6BAA6B,EAC7B,6BAA6B,EAC7B,iCAAiC,EACjC,sCAAsC,EACtC,uCAAuC,EACvC,oCAAoC,EACpC,kCAAkC,EAClC,8BAA8B,EAC9B,uCAAuC,EACvC,6BAA6B,EAC7B,gCAAgC,EAChC,iCAAiC,EACjC,wCAAwC,EACxC,uCAAuC,GACxC,6CAA4C;AAE7C,OAAO,EACL,6BAA6B,EAC7B,cAAc,EACd,eAAe,GAChB,wBAAuB;AAExB,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,2BAA0B;AACrE,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,qBAAoB;AAClE,YAAY,EACV,oBAAoB,EACpB,aAAa,EACb,4BAA4B,EAC5B,aAAa,GACd,qBAAoB;AAErB,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,qBAAqB,EACrB,QAAQ,EACR,UAAU,EACV,8BAA8B,EAC9B,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,qBAAqB,EACrB,SAAS,EACT,gCAAgC,EAChC,mCAAmC,EACnC,4BAA4B,EAC5B,gBAAgB,GACjB,oBAAmB;AAIpB,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,kCAAkC,EAClC,mCAAmC,EACnC,iCAAiC,GAClC,6BAA4B;AAC7B,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,wCAAuC;AACxC,YAAY,EACV,yBAAyB,EACzB,kBAAkB,GACnB,wCAAuC;AACxC,OAAO,EACL,iCAAiC,EACjC,sBAAsB,GACvB,sCAAqC;AACtC,YAAY,EACV,4BAA4B,EAC5B,sBAAsB,EACtB,6BAA6B,EAC7B,oBAAoB,EACpB,kBAAkB,GACnB,sCAAqC;AACtC,OAAO,EAAE,iBAAiB,EAAE,6BAA4B;AACxD,YAAY,EACV,mBAAmB,EACnB,uBAAuB,GACxB,6BAA4B"}
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,4BAA4B,EAC5B,wCAAwC,EACxC,sCAAsC,EACtC,cAAc,GAC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E,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,qBAAoB;AAClE,YAAY,EACV,oBAAoB,EACpB,aAAa,EACb,4BAA4B,EAC5B,aAAa,GACd,qBAAoB;AAErB,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,qBAAqB,EACrB,QAAQ,EACR,UAAU,EACV,8BAA8B,EAC9B,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,qBAAqB,EACrB,SAAS,EACT,gCAAgC,EAChC,mCAAmC,EACnC,4BAA4B,EAC5B,gBAAgB,GACjB,oBAAmB;AAIpB,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,kCAAkC,EAClC,mCAAmC,EACnC,iCAAiC,GAClC,6BAA4B;AAC7B,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,wCAAuC;AACxC,YAAY,EACV,yBAAyB,EACzB,kBAAkB,GACnB,wCAAuC;AACxC,OAAO,EACL,iCAAiC,EACjC,sBAAsB,GACvB,sCAAqC;AACtC,YAAY,EACV,4BAA4B,EAC5B,sBAAsB,EACtB,6BAA6B,EAC7B,oBAAoB,EACpB,kBAAkB,GACnB,sCAAqC;AACtC,OAAO,EAAE,iBAAiB,EAAE,6BAA4B;AACxD,YAAY,EACV,mBAAmB,EACnB,uBAAuB,GACxB,6BAA4B"}
|
package/dist/index.d.mts
CHANGED
|
@@ -8,7 +8,7 @@ export { selectIsKycRequiredForProduct, selectKycPhase, selectKycSumSub, } from
|
|
|
8
8
|
export { alpha2ToAlpha3, ALPHA2_TO_ALPHA3 } from "./countryCodes.mjs";
|
|
9
9
|
export { decryptCredentials, generateKeyPair } from "./crypto.mjs";
|
|
10
10
|
export type { DecryptedCredentials, DecryptResult, EncryptedCredentialsEnvelope, X25519KeyPair, } from "./crypto.mjs";
|
|
11
|
-
export type { KycCatalogDocument, KycConsentDocument, KycConsentRecord, KycCustomerIdentity, KycDisclaimer, KycDisclaimersCatalog, KycPhase, KycProduct, KycProviderDisclaimersAccepted, KycSessionDisclaimers, KycSessionStatus, KycSumSubLaunchParams, KycSumSubLauncher, KycSumSubStatus, KycUserStatus, KycUserStatusResponse, KycVendor, KycIronVendorDisclaimersAccepted, KycMoonpayVendorDisclaimersAccepted, KycVendorDisclaimersAccepted, KycVendorSigning, } from "./types.mjs";
|
|
11
|
+
export type { KycCatalogDocument, KycConsentDocument, KycConsentRecord, KycCustomerIdentity, KycDisclaimer, KycDisclaimersCatalog, KycPhase, KycProduct, KycProviderDisclaimersAccepted, KycSessionDisclaimers, KycSessionStatus, KycSumSubLaunchParams, KycSumSubLauncher, KycSumSubSdkStatus, KycSumSubStatus, KycUserStatus, KycUserStatusResponse, KycVendor, KycIronVendorDisclaimersAccepted, KycMoonpayVendorDisclaimersAccepted, KycVendorDisclaimersAccepted, KycVendorSigning, } from "./types.mjs";
|
|
12
12
|
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";
|
|
13
13
|
export { deriveClientMaterial, encodeClientMaterial, } from "./ukyc/deriveClientMaterial.mjs";
|
|
14
14
|
export type { EncodedUkycClientMaterial, UkycClientMaterial, } from "./ukyc/deriveClientMaterial.mjs";
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,4BAA4B,EAC5B,wCAAwC,EACxC,sCAAsC,EACtC,cAAc,GACf,4BAA2B;AAC5B,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,2BAA2B,EAC3B,sBAAsB,EACtB,oBAAoB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A4B,EAC5B,aAAa,GACd,qBAAoB;AAErB,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,qBAAqB,EACrB,QAAQ,EACR,UAAU,EACV,8BAA8B,EAC9B,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,qBAAqB,EACrB,SAAS,EACT,gCAAgC,EAChC,mCAAmC,EACnC,4BAA4B,EAC5B,gBAAgB,GACjB,oBAAmB;AAIpB,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,kCAAkC,EAClC,mCAAmC,EACnC,iCAAiC,GAClC,6BAA4B;AAC7B,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,wCAAuC;AACxC,YAAY,EACV,yBAAyB,EACzB,kBAAkB,GACnB,wCAAuC;AACxC,OAAO,EACL,iCAAiC,EACjC,sBAAsB,GACvB,sCAAqC;AACtC,YAAY,EACV,4BAA4B,EAC5B,sBAAsB,EACtB,6BAA6B,EAC7B,oBAAoB,EACpB,kBAAkB,GACnB,sCAAqC;AACtC,OAAO,EAAE,iBAAiB,EAAE,6BAA4B;AACxD,YAAY,EACV,mBAAmB,EACnB,uBAAuB,GACxB,6BAA4B"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,4BAA4B,EAC5B,wCAAwC,EACxC,sCAAsC,EACtC,cAAc,GACf,4BAA2B;AAC5B,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,2BAA2B,EAC3B,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,6BAA6B,EAC7B,+BAA+B,GAChC,4BAA2B;AAC5B,YAAY,EACV,6CAA6C,EAC7C,oCAAoC,EACpC,qCAAqC,EACrC,qCAAqC,EACrC,mCAAmC,EACnC,kCAAkC,EAClC,6BAA6B,EAC7B,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B,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,qBAAqB,EACrB,SAAS,EACT,gCAAgC,EAChC,mCAAmC,EACnC,4BAA4B,EAC5B,gBAAgB,GACjB,oBAAmB;AAIpB,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,kCAAkC,EAClC,mCAAmC,EACnC,iCAAiC,GAClC,6BAA4B;AAC7B,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,wCAAuC;AACxC,YAAY,EACV,yBAAyB,EACzB,kBAAkB,GACnB,wCAAuC;AACxC,OAAO,EACL,iCAAiC,EACjC,sBAAsB,GACvB,sCAAqC;AACtC,YAAY,EACV,4BAA4B,EAC5B,sBAAsB,EACtB,6BAA6B,EAC7B,oBAAoB,EACpB,kBAAkB,GACnB,sCAAqC;AACtC,OAAO,EAAE,iBAAiB,EAAE,6BAA4B;AACxD,YAAY,EACV,mBAAmB,EACnB,uBAAuB,GACxB,6BAA4B"}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,4BAA4B,EAC5B,wCAAwC,EACxC,sCAAsC,EACtC,cAAc,EACf,4BAA2B;AA+B5B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,yBAAwB;AA6C1D,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;
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,4BAA4B,EAC5B,wCAAwC,EACxC,sCAAsC,EACtC,cAAc,EACf,4BAA2B;AA+B5B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,yBAAwB;AA6C1D,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;AAiClE,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 getDefaultKycProviderDisclaimersAccepted,\n getDefaultKycVendorDisclaimersAccepted,\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 FetchDisclaimersCatalogParams,\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 KycServiceFetchVendorDisclaimersAction,\n KycServiceFetchDisclaimersCatalogAction,\n KycServiceFetchIdosEnclaveJwksAction,\n KycServiceFetchIdosRelayJwksAction,\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 KycCatalogDocument,\n KycConsentDocument,\n KycConsentRecord,\n KycCustomerIdentity,\n KycDisclaimer,\n KycDisclaimersCatalog,\n KycPhase,\n KycProduct,\n KycProviderDisclaimersAccepted,\n KycSessionDisclaimers,\n KycSessionStatus,\n KycSumSubLaunchParams,\n KycSumSubLauncher,\n KycSumSubSdkStatus,\n KycSumSubStatus,\n KycUserStatus,\n KycUserStatusResponse,\n KycVendor,\n KycIronVendorDisclaimersAccepted,\n KycMoonpayVendorDisclaimersAccepted,\n KycVendorDisclaimersAccepted,\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"]}
|
package/dist/types.cjs.map
CHANGED
|
@@ -1 +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 global idOS / KYC-provider catalog\n * (`GET /disclaimers`). Carries no consent state, which only exists within a\n * session.\n */\nexport type KycCatalogDocument = {\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};\n\n/**\n * A legal document in the session-scoped idOS / KYC-provider catalog\n * (`GET`/`POST /sessions/{sessionId}/disclaimers`).\n */\nexport type KycConsentDocument = KycCatalogDocument & {\n /** Whether the document version has already been consented to. */\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 * MoonPay vendor T&C1 acceptance persisted under\n * {@link KycVendorDisclaimersAccepted.moonpay}.\n */\nexport type KycMoonpayVendorDisclaimersAccepted = {\n /** ISO-8601 timestamp of terms acceptance for MoonPay. */\n termsAcceptedAt: string;\n};\n\n/**\n * Iron vendor T&C1 acceptance persisted under\n * {@link KycVendorDisclaimersAccepted.iron}.\n */\nexport type KycIronVendorDisclaimersAccepted = {\n /** IDs of Iron vendor disclaimers the customer accepted. */\n disclaimerIds: string[];\n};\n\n/**\n * Persisted KYC-provider disclaimer acceptance (T&C2) with a fixed `sumsub`\n * key.\n */\nexport type KycProviderDisclaimersAccepted = {\n sumsub: KycConsentRecord[] | null;\n};\n\n/**\n * Persisted vendor-disclaimer acceptance with fixed `moonpay` and `iron` keys.\n */\nexport type KycVendorDisclaimersAccepted = {\n moonpay: KycMoonpayVendorDisclaimersAccepted | null;\n iron: KycIronVendorDisclaimersAccepted | null;\n};\n\n/**\n * idOS / KYC-provider disclaimer catalog returned by\n * `GET /disclaimers?country=` (no session — no credential-reuse consent state).\n */\nexport type KycDisclaimersCatalog = {\n /** idOS legal documents. */\n idOS: KycCatalogDocument[];\n /** KYC provider (SumSub) legal documents. */\n kycProvider: KycCatalogDocument[];\n};\n\n/**\n * Session-scoped disclaimer catalog returned by\n * `GET`/`POST /sessions/{sessionId}/disclaimers`. Documents additionally report\n * whether that version was already consented to for the session.\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"]}
|
|
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 * - `abandoned` — the applicant closed the SDK before submitting. Unlike\n * `failed`, nothing went wrong, so `error` is left unset and consumers should\n * offer a retry rather than report a problem.\n */\nexport type KycSumSubStatus =\n | 'idle'\n | 'creatingSession'\n | 'fetchingToken'\n | 'launching'\n | 'inProgress'\n | 'polling'\n | 'complete'\n | 'abandoned'\n | 'failed'\n | 'vendorProcessing';\n\n/**\n * Status strings a SumSub SDK reports, through either the status-change\n * callback or the `launch` result. Distinct from {@link KycSumSubStatus},\n * which tracks the controller's own sub-flow.\n *\n * - `Ready` — initialized and presented; no step reported yet.\n * - `Failed` — the SDK itself could not run.\n * - `Initial` — no verification step has been passed.\n * - `Incomplete` — some but not all verification steps have been passed.\n * - `Pending` — the applicant submitted and review is pending.\n * - `TemporarilyDeclined` — the applicant was declined but may resubmit.\n * - `FinallyRejected` — the applicant was rejected for good.\n * - `Approved` — the applicant was approved.\n * - `ActionCompleted` — an applicant action (e.g. a liveness check) finished.\n * - `Completed` — normalized completion reported by non-native launchers.\n */\nexport type KycSumSubSdkStatus =\n | 'Ready'\n | 'Failed'\n | 'Initial'\n | 'Incomplete'\n | 'Pending'\n | 'TemporarilyDeclined'\n | 'FinallyRejected'\n | 'Approved'\n | 'ActionCompleted'\n | 'Completed';\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 global idOS / KYC-provider catalog\n * (`GET /disclaimers`). Carries no consent state, which only exists within a\n * session.\n */\nexport type KycCatalogDocument = {\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};\n\n/**\n * A legal document in the session-scoped idOS / KYC-provider catalog\n * (`GET`/`POST /sessions/{sessionId}/disclaimers`).\n */\nexport type KycConsentDocument = KycCatalogDocument & {\n /** Whether the document version has already been consented to. */\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 * MoonPay vendor T&C1 acceptance persisted under\n * {@link KycVendorDisclaimersAccepted.moonpay}.\n */\nexport type KycMoonpayVendorDisclaimersAccepted = {\n /** ISO-8601 timestamp of terms acceptance for MoonPay. */\n termsAcceptedAt: string;\n};\n\n/**\n * Iron vendor T&C1 acceptance persisted under\n * {@link KycVendorDisclaimersAccepted.iron}.\n */\nexport type KycIronVendorDisclaimersAccepted = {\n /** IDs of Iron vendor disclaimers the customer accepted. */\n disclaimerIds: string[];\n};\n\n/**\n * Persisted KYC-provider disclaimer acceptance (T&C2) with a fixed `sumsub`\n * key.\n */\nexport type KycProviderDisclaimersAccepted = {\n sumsub: KycConsentRecord[] | null;\n};\n\n/**\n * Persisted vendor-disclaimer acceptance with fixed `moonpay` and `iron` keys.\n */\nexport type KycVendorDisclaimersAccepted = {\n moonpay: KycMoonpayVendorDisclaimersAccepted | null;\n iron: KycIronVendorDisclaimersAccepted | null;\n};\n\n/**\n * idOS / KYC-provider disclaimer catalog returned by\n * `GET /disclaimers?country=` (no session — no credential-reuse consent state).\n */\nexport type KycDisclaimersCatalog = {\n /** idOS legal documents. */\n idOS: KycCatalogDocument[];\n /** KYC provider (SumSub) legal documents. */\n kycProvider: KycCatalogDocument[];\n};\n\n/**\n * Session-scoped disclaimer catalog returned by\n * `GET`/`POST /sessions/{sessionId}/disclaimers`. Documents additionally report\n * whether that version was already consented to for the session.\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"]}
|
package/dist/types.d.cts
CHANGED
|
@@ -80,8 +80,28 @@ export type KycPhase = 'idle' | 'terms' | 'session' | 'check' | 'auth' | 'form'
|
|
|
80
80
|
* already approved on the relay (`kycStatus`) while the vendor is still
|
|
81
81
|
* finalizing its own decision (`finalStatus`). There is nothing left for the
|
|
82
82
|
* applicant to do, so the SDK is not launched; see `statusMessage`.
|
|
83
|
+
* - `abandoned` — the applicant closed the SDK before submitting. Unlike
|
|
84
|
+
* `failed`, nothing went wrong, so `error` is left unset and consumers should
|
|
85
|
+
* offer a retry rather than report a problem.
|
|
83
86
|
*/
|
|
84
|
-
export type KycSumSubStatus = 'idle' | 'creatingSession' | 'fetchingToken' | 'launching' | 'inProgress' | 'polling' | 'complete' | 'failed' | 'vendorProcessing';
|
|
87
|
+
export type KycSumSubStatus = 'idle' | 'creatingSession' | 'fetchingToken' | 'launching' | 'inProgress' | 'polling' | 'complete' | 'abandoned' | 'failed' | 'vendorProcessing';
|
|
88
|
+
/**
|
|
89
|
+
* Status strings a SumSub SDK reports, through either the status-change
|
|
90
|
+
* callback or the `launch` result. Distinct from {@link KycSumSubStatus},
|
|
91
|
+
* which tracks the controller's own sub-flow.
|
|
92
|
+
*
|
|
93
|
+
* - `Ready` — initialized and presented; no step reported yet.
|
|
94
|
+
* - `Failed` — the SDK itself could not run.
|
|
95
|
+
* - `Initial` — no verification step has been passed.
|
|
96
|
+
* - `Incomplete` — some but not all verification steps have been passed.
|
|
97
|
+
* - `Pending` — the applicant submitted and review is pending.
|
|
98
|
+
* - `TemporarilyDeclined` — the applicant was declined but may resubmit.
|
|
99
|
+
* - `FinallyRejected` — the applicant was rejected for good.
|
|
100
|
+
* - `Approved` — the applicant was approved.
|
|
101
|
+
* - `ActionCompleted` — an applicant action (e.g. a liveness check) finished.
|
|
102
|
+
* - `Completed` — normalized completion reported by non-native launchers.
|
|
103
|
+
*/
|
|
104
|
+
export type KycSumSubSdkStatus = 'Ready' | 'Failed' | 'Initial' | 'Incomplete' | 'Pending' | 'TemporarilyDeclined' | 'FinallyRejected' | 'Approved' | 'ActionCompleted' | 'Completed';
|
|
85
105
|
/**
|
|
86
106
|
* The status of a UKYC session, returned by the `GET /sessions/{id}/status`
|
|
87
107
|
* endpoint and polled after the SumSub SDK completes to determine the final
|
package/dist/types.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;AAE3C;;;;;;;;GAQG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,sEAAs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;IAClC,qEAAqE;IACrE,iCAAiC,EAAE,OAAO,CAAC;CAC5C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,iBAAiB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAEzC;;OAEG;IACH,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAEjE;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,WAAW,IAAI,OAAO,CAAC;IAEvB;;OAEG;IACH,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACzE,CAAC"}
|
package/dist/types.d.mts
CHANGED
|
@@ -80,8 +80,28 @@ export type KycPhase = 'idle' | 'terms' | 'session' | 'check' | 'auth' | 'form'
|
|
|
80
80
|
* already approved on the relay (`kycStatus`) while the vendor is still
|
|
81
81
|
* finalizing its own decision (`finalStatus`). There is nothing left for the
|
|
82
82
|
* applicant to do, so the SDK is not launched; see `statusMessage`.
|
|
83
|
+
* - `abandoned` — the applicant closed the SDK before submitting. Unlike
|
|
84
|
+
* `failed`, nothing went wrong, so `error` is left unset and consumers should
|
|
85
|
+
* offer a retry rather than report a problem.
|
|
83
86
|
*/
|
|
84
|
-
export type KycSumSubStatus = 'idle' | 'creatingSession' | 'fetchingToken' | 'launching' | 'inProgress' | 'polling' | 'complete' | 'failed' | 'vendorProcessing';
|
|
87
|
+
export type KycSumSubStatus = 'idle' | 'creatingSession' | 'fetchingToken' | 'launching' | 'inProgress' | 'polling' | 'complete' | 'abandoned' | 'failed' | 'vendorProcessing';
|
|
88
|
+
/**
|
|
89
|
+
* Status strings a SumSub SDK reports, through either the status-change
|
|
90
|
+
* callback or the `launch` result. Distinct from {@link KycSumSubStatus},
|
|
91
|
+
* which tracks the controller's own sub-flow.
|
|
92
|
+
*
|
|
93
|
+
* - `Ready` — initialized and presented; no step reported yet.
|
|
94
|
+
* - `Failed` — the SDK itself could not run.
|
|
95
|
+
* - `Initial` — no verification step has been passed.
|
|
96
|
+
* - `Incomplete` — some but not all verification steps have been passed.
|
|
97
|
+
* - `Pending` — the applicant submitted and review is pending.
|
|
98
|
+
* - `TemporarilyDeclined` — the applicant was declined but may resubmit.
|
|
99
|
+
* - `FinallyRejected` — the applicant was rejected for good.
|
|
100
|
+
* - `Approved` — the applicant was approved.
|
|
101
|
+
* - `ActionCompleted` — an applicant action (e.g. a liveness check) finished.
|
|
102
|
+
* - `Completed` — normalized completion reported by non-native launchers.
|
|
103
|
+
*/
|
|
104
|
+
export type KycSumSubSdkStatus = 'Ready' | 'Failed' | 'Initial' | 'Incomplete' | 'Pending' | 'TemporarilyDeclined' | 'FinallyRejected' | 'Approved' | 'ActionCompleted' | 'Completed';
|
|
85
105
|
/**
|
|
86
106
|
* The status of a UKYC session, returned by the `GET /sessions/{id}/status`
|
|
87
107
|
* endpoint and polled after the SumSub SDK completes to determine the final
|
package/dist/types.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;AAE3C;;;;;;;;GAQG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,sEAAsE;IACtE,MAAM,EAAE,SAAS,CAAC;IAClB,2DAA2D;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;CAC5C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,iBAAiB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAEzC;;OAEG;IACH,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAEjE;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,WAAW,IAAI,OAAO,CAAC;IAEvB;;OAEG;IACH,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACzE,CAAC"}
|
package/dist/types.mjs.map
CHANGED
|
@@ -1 +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 global idOS / KYC-provider catalog\n * (`GET /disclaimers`). Carries no consent state, which only exists within a\n * session.\n */\nexport type KycCatalogDocument = {\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};\n\n/**\n * A legal document in the session-scoped idOS / KYC-provider catalog\n * (`GET`/`POST /sessions/{sessionId}/disclaimers`).\n */\nexport type KycConsentDocument = KycCatalogDocument & {\n /** Whether the document version has already been consented to. */\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 * MoonPay vendor T&C1 acceptance persisted under\n * {@link KycVendorDisclaimersAccepted.moonpay}.\n */\nexport type KycMoonpayVendorDisclaimersAccepted = {\n /** ISO-8601 timestamp of terms acceptance for MoonPay. */\n termsAcceptedAt: string;\n};\n\n/**\n * Iron vendor T&C1 acceptance persisted under\n * {@link KycVendorDisclaimersAccepted.iron}.\n */\nexport type KycIronVendorDisclaimersAccepted = {\n /** IDs of Iron vendor disclaimers the customer accepted. */\n disclaimerIds: string[];\n};\n\n/**\n * Persisted KYC-provider disclaimer acceptance (T&C2) with a fixed `sumsub`\n * key.\n */\nexport type KycProviderDisclaimersAccepted = {\n sumsub: KycConsentRecord[] | null;\n};\n\n/**\n * Persisted vendor-disclaimer acceptance with fixed `moonpay` and `iron` keys.\n */\nexport type KycVendorDisclaimersAccepted = {\n moonpay: KycMoonpayVendorDisclaimersAccepted | null;\n iron: KycIronVendorDisclaimersAccepted | null;\n};\n\n/**\n * idOS / KYC-provider disclaimer catalog returned by\n * `GET /disclaimers?country=` (no session — no credential-reuse consent state).\n */\nexport type KycDisclaimersCatalog = {\n /** idOS legal documents. */\n idOS: KycCatalogDocument[];\n /** KYC provider (SumSub) legal documents. */\n kycProvider: KycCatalogDocument[];\n};\n\n/**\n * Session-scoped disclaimer catalog returned by\n * `GET`/`POST /sessions/{sessionId}/disclaimers`. Documents additionally report\n * whether that version was already consented to for the session.\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"]}
|
|
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 * - `abandoned` — the applicant closed the SDK before submitting. Unlike\n * `failed`, nothing went wrong, so `error` is left unset and consumers should\n * offer a retry rather than report a problem.\n */\nexport type KycSumSubStatus =\n | 'idle'\n | 'creatingSession'\n | 'fetchingToken'\n | 'launching'\n | 'inProgress'\n | 'polling'\n | 'complete'\n | 'abandoned'\n | 'failed'\n | 'vendorProcessing';\n\n/**\n * Status strings a SumSub SDK reports, through either the status-change\n * callback or the `launch` result. Distinct from {@link KycSumSubStatus},\n * which tracks the controller's own sub-flow.\n *\n * - `Ready` — initialized and presented; no step reported yet.\n * - `Failed` — the SDK itself could not run.\n * - `Initial` — no verification step has been passed.\n * - `Incomplete` — some but not all verification steps have been passed.\n * - `Pending` — the applicant submitted and review is pending.\n * - `TemporarilyDeclined` — the applicant was declined but may resubmit.\n * - `FinallyRejected` — the applicant was rejected for good.\n * - `Approved` — the applicant was approved.\n * - `ActionCompleted` — an applicant action (e.g. a liveness check) finished.\n * - `Completed` — normalized completion reported by non-native launchers.\n */\nexport type KycSumSubSdkStatus =\n | 'Ready'\n | 'Failed'\n | 'Initial'\n | 'Incomplete'\n | 'Pending'\n | 'TemporarilyDeclined'\n | 'FinallyRejected'\n | 'Approved'\n | 'ActionCompleted'\n | 'Completed';\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 global idOS / KYC-provider catalog\n * (`GET /disclaimers`). Carries no consent state, which only exists within a\n * session.\n */\nexport type KycCatalogDocument = {\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};\n\n/**\n * A legal document in the session-scoped idOS / KYC-provider catalog\n * (`GET`/`POST /sessions/{sessionId}/disclaimers`).\n */\nexport type KycConsentDocument = KycCatalogDocument & {\n /** Whether the document version has already been consented to. */\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 * MoonPay vendor T&C1 acceptance persisted under\n * {@link KycVendorDisclaimersAccepted.moonpay}.\n */\nexport type KycMoonpayVendorDisclaimersAccepted = {\n /** ISO-8601 timestamp of terms acceptance for MoonPay. */\n termsAcceptedAt: string;\n};\n\n/**\n * Iron vendor T&C1 acceptance persisted under\n * {@link KycVendorDisclaimersAccepted.iron}.\n */\nexport type KycIronVendorDisclaimersAccepted = {\n /** IDs of Iron vendor disclaimers the customer accepted. */\n disclaimerIds: string[];\n};\n\n/**\n * Persisted KYC-provider disclaimer acceptance (T&C2) with a fixed `sumsub`\n * key.\n */\nexport type KycProviderDisclaimersAccepted = {\n sumsub: KycConsentRecord[] | null;\n};\n\n/**\n * Persisted vendor-disclaimer acceptance with fixed `moonpay` and `iron` keys.\n */\nexport type KycVendorDisclaimersAccepted = {\n moonpay: KycMoonpayVendorDisclaimersAccepted | null;\n iron: KycIronVendorDisclaimersAccepted | null;\n};\n\n/**\n * idOS / KYC-provider disclaimer catalog returned by\n * `GET /disclaimers?country=` (no session — no credential-reuse consent state).\n */\nexport type KycDisclaimersCatalog = {\n /** idOS legal documents. */\n idOS: KycCatalogDocument[];\n /** KYC provider (SumSub) legal documents. */\n kycProvider: KycCatalogDocument[];\n};\n\n/**\n * Session-scoped disclaimer catalog returned by\n * `GET`/`POST /sessions/{sessionId}/disclaimers`. Documents additionally report\n * whether that version was already consented to for the session.\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"]}
|
package/package.json
CHANGED