@metamask-previews/kyc-controller 0.0.0-preview-64bce4b11 → 0.0.0-preview-a38f058

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 CHANGED
@@ -42,9 +42,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
42
42
  - **BREAKING:** Require `sumsubTncSigned` and `idosTncSigned` on `acceptTermsAndStartSession` for every vendor, so callers explicitly declare T&C2 acceptance. Zero-argument calls and omitted flags fail instead of defaulting to `true`. ([#9908](https://github.com/MetaMask/core/pull/9908))
43
43
  - Rename `CreateUkycSessionParams.vendorId` to `vendor` for consistency with other service methods. ([#9908](https://github.com/MetaMask/core/pull/9908))
44
44
  - Bump `@metamask/base-data-service` from `^0.1.3` to `^1.0.0` ([#9972](https://github.com/MetaMask/core/pull/9972))
45
+ - Replace `KycController` `console.error` tracing with the `@metamask/utils` debug logger (`createProjectLogger` / `createModuleLogger`), so flow diagnostics are opt-in via `DEBUG=kyc-controller*` instead of always printing to the console. ([#10054](https://github.com/MetaMask/core/pull/10054))
45
46
 
46
47
  ### Fixed
47
48
 
49
+ - Stop routing `KycService` write endpoints through the query cache. Every `POST` (`createSession`, `checkKycRequired`, `createVendorCustomer`, `submitVendorDisclaimers`, `submitSessionDisclaimers`, `createUkycSession`, `setAuthorizations`, `createJourney`) now issues its request directly instead of via `fetchQuery`. Previously these were modelled as queries, so two overlapping calls sharing a `queryKey` were deduplicated into a single request — a second `createVendorCustomer` while the first was in flight never reached the API — and their responses were retained in the cache and published on the messenger as `cacheUpdated` payloads, which for these endpoints include session tokens and applicant access tokens. Writes are also no longer retried by the service policy, so a failed non-idempotent request cannot create duplicate records server-side. ([#10007](https://github.com/MetaMask/core/pull/10007))
48
50
  - Stop incorrectly prefixing the session client public key onto wrapped `encryptionDataKey` and `ukycCapabilityToken` values from `wrapEncryptionKey`. `data` is now ciphertext+tag only; the server already has the client public key from session creation. ([#10036](https://github.com/MetaMask/core/pull/10036))
49
51
  - Clear leftover MoonPay `sessionToken`, `accessToken`, and Check/Auth frame credentials when `initialize` or `createVendorCustomer` switches to another vendor, so `buildCheckFrameUrl` cannot return a MoonPay URL for a consents-path session. ([#9908](https://github.com/MetaMask/core/pull/9908))
50
52
  - Rewind the consents path when SumSub fails before completion (thrown step or SDK close without `Completed`), instead of refreshing user status and forcing `phase` to `done`. A terminal UKYC rejection after the SDK completed still finishes as `done` so the decision can be reflected in user status. ([#9908](https://github.com/MetaMask/core/pull/9908))
@@ -18,6 +18,7 @@ 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
20
  const encoding_js_1 = require("./encoding.cjs");
21
+ const logger_js_1 = require("./logger.cjs");
21
22
  const deriveClientMaterial_js_1 = require("./ukyc/deriveClientMaterial.cjs");
22
23
  const jwtChain_js_1 = require("./ukyc/jwtChain.cjs");
23
24
  const localUserSecret_js_1 = require("./ukyc/localUserSecret.cjs");
@@ -1242,7 +1243,7 @@ async function _KycController_startConsentsSession(consents) {
1242
1243
  await this.refreshKycStatus();
1243
1244
  }
1244
1245
  catch (statusError) {
1245
- console.error('KYC status refresh failed:', statusError);
1246
+ (0, logger_js_1.controllerLog)('KYC status refresh failed:', statusError);
1246
1247
  }
1247
1248
  __classPrivateFieldGet(this, _KycController_instances, "m", _KycController_updateIfCurrent).call(this, generation, (state) => {
1248
1249
  state.phase = 'done';
@@ -1278,7 +1279,7 @@ async function _KycController_startConsentsSession(consents) {
1278
1279
  await this.refreshKycStatus();
1279
1280
  }
1280
1281
  catch (statusError) {
1281
- console.error('KYC status refresh failed:', statusError);
1282
+ (0, logger_js_1.controllerLog)('KYC status refresh failed:', statusError);
1282
1283
  }
1283
1284
  __classPrivateFieldGet(this, _KycController_instances, "m", _KycController_updateIfCurrent).call(this, generation, (state) => {
1284
1285
  if (state.phase !== 'error' && state.phase !== 'done') {
@@ -1306,7 +1307,7 @@ async function _KycController_startConsentsSession(consents) {
1306
1307
  });
1307
1308
  return;
1308
1309
  }
1309
- console.error('Consents session failed:', error);
1310
+ (0, logger_js_1.controllerLog)('Consents session failed:', error);
1310
1311
  if (__classPrivateFieldGet(this, _KycController_generation, "f") !== generation) {
1311
1312
  return;
1312
1313
  }
@@ -1437,7 +1438,7 @@ async function _KycController_createSession() {
1437
1438
  });
1438
1439
  }
1439
1440
  catch (error) {
1440
- console.error('Session creation failed:', error);
1441
+ (0, logger_js_1.controllerLog)('Session creation failed:', error);
1441
1442
  // A reset() superseded this flow while the request was in flight; leave
1442
1443
  // the idle controller alone rather than forcing it back to `terms`.
1443
1444
  if (__classPrivateFieldGet(this, _KycController_generation, "f") !== generation) {