@metamask-previews/kyc-controller 0.0.0-preview-add047418 → 0.0.0-preview-965e373
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 +1 -0
- package/dist/KycController.cjs +20 -2
- 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 +20 -2
- package/dist/KycController.mjs.map +1 -1
- package/dist/KycService-method-action-types.cjs.map +1 -1
- package/dist/KycService-method-action-types.d.cts +4 -1
- package/dist/KycService-method-action-types.d.cts.map +1 -1
- package/dist/KycService-method-action-types.d.mts +4 -1
- package/dist/KycService-method-action-types.d.mts.map +1 -1
- package/dist/KycService-method-action-types.mjs.map +1 -1
- package/dist/KycService.cjs +6 -1
- package/dist/KycService.cjs.map +1 -1
- package/dist/KycService.d.cts +14 -1
- package/dist/KycService.d.cts.map +1 -1
- package/dist/KycService.d.mts +14 -1
- package/dist/KycService.d.mts.map +1 -1
- package/dist/KycService.mjs +6 -1
- package/dist/KycService.mjs.map +1 -1
- package/dist/ukyc/wrapEncryptionKey.cjs +2 -3
- package/dist/ukyc/wrapEncryptionKey.cjs.map +1 -1
- package/dist/ukyc/wrapEncryptionKey.d.cts +6 -9
- package/dist/ukyc/wrapEncryptionKey.d.cts.map +1 -1
- package/dist/ukyc/wrapEncryptionKey.d.mts +6 -9
- package/dist/ukyc/wrapEncryptionKey.d.mts.map +1 -1
- package/dist/ukyc/wrapEncryptionKey.mjs +2 -3
- package/dist/ukyc/wrapEncryptionKey.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/ukyc/wrapUserKey.cjs +0 -80
- package/dist/ukyc/wrapUserKey.cjs.map +0 -1
- package/dist/ukyc/wrapUserKey.d.cts +0 -26
- package/dist/ukyc/wrapUserKey.d.cts.map +0 -1
- package/dist/ukyc/wrapUserKey.d.mts +0 -26
- package/dist/ukyc/wrapUserKey.d.mts.map +0 -1
- package/dist/ukyc/wrapUserKey.mjs +0 -76
- package/dist/ukyc/wrapUserKey.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
29
29
|
|
|
30
30
|
### Changed
|
|
31
31
|
|
|
32
|
+
- **BREAKING:** Require `sessionClientPublicKey` (unpadded base64url X25519 public key) and `residenceCountry` (ISO 3166-1 alpha-3) on `KycService.createUkycSession` (`POST /sessions`). The controller generates the per-session keypair before creating the session and uses the private half to wrap authorizations; residence country is taken from the resolved geo country. ([#9993](https://github.com/MetaMask/core/pull/9993))
|
|
32
33
|
- **BREAKING:** Replace wrapping-key exchange (`KycService.getWrappingKey`) and sending wrapped keys at session creation with encryption schemas from `createUkycSession` plus `setAuthorizations` (`POST /sessions/{id}/authorizations`). `createUkycSession` no longer accepts `wrappedEncryptionKey` or `ukycCapabilityToken`; both secrets are wrapped on the client against per-secret schemas and posted separately. ([#9944](https://github.com/MetaMask/core/pull/9944))
|
|
33
34
|
- **BREAKING:** Replace `KycService.submitConsents` (`POST /consents`) with session-scoped `fetchSessionDisclaimers` / `submitSessionDisclaimers` plus vendor T&C recording via `submitVendorDisclaimers`. Consents now use `{ key, version }` document records plus `credentialReusabilityConsentGiven` instead of Iron disclaimer ids and boolean T&C flags, and they require a UKYC session id. Iron content ids are posted separately to `POST /vendors/{vendor}/disclaimers`. The consents path records vendor T&Cs, then creates the UKYC session, then records session disclaimers. A 409 conflict is re-checked with a GET and only treated as success when every accepted document is consented. ([#9979](https://github.com/MetaMask/core/pull/9979))
|
|
34
35
|
- Make the `fetch` option on the `KycService` constructor optional; it now defaults to the runtime's native `fetch` (browser, React Native, Node 18+), so consumers no longer need to inject one. ([#9908](https://github.com/MetaMask/core/pull/9908))
|
package/dist/KycController.cjs
CHANGED
|
@@ -17,6 +17,7 @@ const base_controller_1 = require("@metamask/base-controller");
|
|
|
17
17
|
const utils_1 = require("@metamask/utils");
|
|
18
18
|
const ed25519_1 = require("@noble/curves/ed25519");
|
|
19
19
|
const crypto_js_1 = require("./crypto.cjs");
|
|
20
|
+
const encoding_js_1 = require("./encoding.cjs");
|
|
20
21
|
const deriveClientMaterial_js_1 = require("./ukyc/deriveClientMaterial.cjs");
|
|
21
22
|
const jwtChain_js_1 = require("./ukyc/jwtChain.cjs");
|
|
22
23
|
const localUserSecret_js_1 = require("./ukyc/localUserSecret.cjs");
|
|
@@ -1600,11 +1601,28 @@ async function _KycController_continueAfterAuthentication() {
|
|
|
1600
1601
|
async function _KycController_createUkycSession(generation) {
|
|
1601
1602
|
const jwtToken = MOCK_JWT_TOKEN;
|
|
1602
1603
|
// Establish a per-session X25519 keypair used to seal both secrets. The
|
|
1603
|
-
// private half stays on the device;
|
|
1604
|
-
//
|
|
1604
|
+
// private half stays on the device; the public half is registered on the
|
|
1605
|
+
// session so the server can open later authorizations. Each encryption
|
|
1606
|
+
// schema from session creation supplies the matching server public key.
|
|
1605
1607
|
const sessionClientPrivateKey = ed25519_1.x25519.utils.randomSecretKey();
|
|
1608
|
+
const sessionClientPublicKey = (0, encoding_js_1.toBase64Url)(ed25519_1.x25519.getPublicKey(sessionClientPrivateKey));
|
|
1609
|
+
// Residence is the ISO 3166-1 alpha-3 country already resolved for
|
|
1610
|
+
// disclaimers / KYC-required; fetch it if this sub-flow started without
|
|
1611
|
+
// that earlier step.
|
|
1612
|
+
const residenceCountry = this.state.geoCountry ??
|
|
1613
|
+
(await this.messenger.call('KycService:getGeoCountry'));
|
|
1614
|
+
if (__classPrivateFieldGet(this, _KycController_generation, "f") !== generation) {
|
|
1615
|
+
return null;
|
|
1616
|
+
}
|
|
1617
|
+
if (residenceCountry !== this.state.geoCountry) {
|
|
1618
|
+
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_updateIfCurrent).call(this, generation, (state) => {
|
|
1619
|
+
state.geoCountry = residenceCountry;
|
|
1620
|
+
});
|
|
1621
|
+
}
|
|
1606
1622
|
const { sessionId, encryptionDataKey, ukycCapabilityToken: capabilityTokenSchema, } = await this.messenger.call('KycService:createUkycSession', {
|
|
1607
1623
|
jwtToken,
|
|
1624
|
+
sessionClientPublicKey,
|
|
1625
|
+
residenceCountry,
|
|
1608
1626
|
...__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_buildUkycSessionVendorFields).call(this),
|
|
1609
1627
|
});
|
|
1610
1628
|
if (__classPrivateFieldGet(this, _KycController_generation, "f") !== generation) {
|