Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/kyc-controller/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,6 @@ Reference client (metamask-mobile):
| `app/core/Engine/controllers/kyc/kyc-service-init.ts` | Construct service. |
| `app/core/Engine/controllers/kyc/reactNativeSumSubLauncher.ts` | Native SumSub adapter. |
| `app/core/Engine/messengers/kyc/*.ts` | Messenger delegation. |
| `app/components/Views/MoonpayDemo/useKycFlow.ts` | React ↔ controller binding. |
| `app/components/Views/MoonpayDemo/useKycFlow.ts` | React ↔ controller binding. |
| `app/components/Views/MoonpayDemo/useMoonpayFrame.ts` | WebView postMessage bridge. |
| `app/selectors/kycController.ts` | Redux selectors. |
3 changes: 2 additions & 1 deletion packages/kyc-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Add Iron (Money/VBA) KYC path to `@metamask/kyc-controller`: `vendor: 'iron'` skips MoonPay Check/Auth frames; `KycService` clients for `/vendors/iron/*`, `POST /consents`, and `GET /kyc/status`; `refreshKycStatus` + `statusChanged` for Money toast state ([#9852](https://github.com/MetaMask/core/pull/9852))
- Initial release of the `@metamask/kyc-controller` package for managing KYC / identity verification state across MetaMask clients ([#9781](https://github.com/MetaMask/core/pull/9781))
- Add `KycController` and `KycService` for managing KYC / identity verification state across MetaMask clients ([#9615](https://github.com/MetaMask/core/pull/9615))
- Add `KycController` and `KycService` for managing KYC / identity verification state across MetaMask clients ([#9615](https://github.com/MetaMask/core/pull/9615))
- `KycController` (`BaseController`) owns the flow state machine, the Check/Auth frame message protocol, X25519 credential decryption, and SumSub orchestration via an injected `KycSumSubLauncher` adapter.
- `KycService` extends `BaseDataService` and performs the Universal KYC (UKYC) HTTP calls via an injected `fetch`, sourcing the auth bearer token and geolocation through the messenger.
- Exposes a vendor-neutral, per-product surface (`ramps`, `card`) plus reselect selectors.
Expand Down
2 changes: 1 addition & 1 deletion packages/kyc-controller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ This watches `src/**/*.ts` and re-runs the build on each change (it also perform

## Contributing

This package is part of a monorepo. Instructions for contributing can be found in the [monorepo README](https://github.com/MetaMask/core#readme).
This package is part of a monorepo. Instructions for contributing can be found in the [monorepo README](https://github.com/MetaMask/core#readme).
4 changes: 3 additions & 1 deletion packages/kyc-controller/scripts/mint-ukyc-test-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ if (flags['expires-at']) {
} else if (flags['expires-in']) {
const issuedAt = params.issuedAt ?? new Date();
params.issuedAt = issuedAt;
params.expiresAt = new Date(issuedAt.getTime() + parseDurationMs(flags['expires-in']));
params.expiresAt = new Date(
issuedAt.getTime() + parseDurationMs(flags['expires-in']),
);
}

const result = mintUkycTestToken(params);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,27 @@ import type { KycController } from './KycController.js';
* authentication completes (and chains into document verification when KYC
* is required). When omitted, the flow stops at `form` and the consumer must
* call `checkKycRequired` manually.
* @param params.vendor - Identity vendor for this flow. Pass `iron` for the
* Money/VBA path (no MoonPay Check/Auth frames). Defaults to `moonpay`.
*/
export type KycControllerInitializeAction = {
type: `KycController:initialize`;
handler: KycController['initialize'];
};

/**
* Creates (or resumes) an Iron empty-shell customer. Exposed so Money can
* ensure the customer exists before showing T&C screens independently of
* {@link initialize}.
*
* @param params - The parameters.
* @param params.email - Email for the Iron customer.
*/
export type KycControllerCreateIronCustomerAction = {
type: `KycController:createIronCustomer`;
handler: KycController['createIronCustomer'];
};

/**
* Loads the disclaimers for the resolved (or provided) country.
*
Expand All @@ -42,6 +57,10 @@ export type KycControllerLoadDisclaimersAction = {
* @param params.product - The consuming feature the flow runs for. See
* {@link initialize} for how the product drives the automatic post
* authentication continuation.
* @param params.sumsubTncSigned - Iron path: whether Sumsub T&C were
* accepted (T&C2). Defaults to `true` when omitted.
* @param params.idosTncSigned - Iron path: whether idOS T&C were accepted
* (T&C2). Defaults to `true` when omitted.
*/
export type KycControllerAcceptTermsAndStartSessionAction = {
type: `KycController:acceptTermsAndStartSession`;
Expand Down Expand Up @@ -154,6 +173,18 @@ export type KycControllerStartSumSubAction = {
handler: KycController['startSumSub'];
};

/**
* Refreshes the user-keyed simplified KYC status from `GET /kyc/status`,
* stores it on state, publishes {@link KycControllerStatusChangedEvent}, and
* schedules short-interval polling while the status is `pending`.
*
* @returns The latest status payload.
*/
export type KycControllerRefreshKycStatusAction = {
type: `KycController:refreshKycStatus`;
handler: KycController['refreshKycStatus'];
};

/**
* Fetches the current UKYC session status for the active sub-flow and records
* it on state. Useful for a one-off refresh outside the automatic polling
Expand Down Expand Up @@ -181,6 +212,7 @@ export type KycControllerResetAction = {
*/
export type KycControllerMethodActions =
| KycControllerInitializeAction
| KycControllerCreateIronCustomerAction
| KycControllerLoadDisclaimersAction
| KycControllerAcceptTermsAndStartSessionAction
| KycControllerClearSavedTermsAction
Expand All @@ -191,5 +223,6 @@ export type KycControllerMethodActions =
| KycControllerCheckKycRequiredAction
| KycControllerGetKycStatusAction
| KycControllerStartSumSubAction
| KycControllerRefreshKycStatusAction
| KycControllerGetSessionStatusAction
| KycControllerResetAction;
Loading