Skip to content

feat(kyc-controller): add a data-shares lookup - #11158

Merged
georgeweiler merged 4 commits into
mainfrom
claude/kyc-controller-get-data-shares-aa6cb8
Oct 28, 2026
Merged

georgeweiler merged 4 commits into
mainfrom
claude/kyc-controller-get-data-shares-aa6cb8

Conversation

@georgeweiler

@georgeweiler georgeweiler commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Explanation

MetaMask Mobile is adding an "Identity verification" screen in Settings that shows a customer's KYC status and the vendors their verified identity data has been shared with. The idOS relay serves that list from GET /api/kyc/external-user-id/{externalUserId}/shares, but @metamask/kyc-controller had no way to call it — KycService could fetch session status, not who data was shared with.

This adds that lookup. It is additive only: no new controller state, no persistence, and no change to the existing VBA onboarding flow or any existing method.

  • KycDataShare (src/types.ts) — { kycSessionId, vendor, sharedAt }, where sharedAt is an ISO 8601 date-time string.
  • KycService.getDataShares({ externalUserId }) — issues the relay request through the same private request helper and wallet bearer-token path as the other relay calls, validates the response with superstruct like its neighbours, and unwraps the { shares } envelope. vendor is validated as a plain string (as SessionStatusResponseStruct.vendor already is) so a vendor this package does not model does not invalidate the whole list.
  • KycController.getDataShares() — resolves the external user id from state.sessionStatus. When state is cold it first fetches the latest session for the vendor on state (without writing it to state). If no session can be resolved at all it returns [], so the mobile screen renders an empty "Shared with" list instead of an error.
  • Both methods are exposed as messenger actions (KycService:getDataShares, KycController:getDataShares), and the new types are exported from the package entry point.

Unblocks MetaMask/metamask-mobile#38381, which is written against this API and currently does not type-check for exactly these two missing pieces.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

🤖 Generated with Claude Code


Note

Low Risk
Read-only additive HTTP lookup with no state or onboarding flow changes; failures are localized to the new call path when relay config or auth is missing.

Overview
Adds an additive API so clients can show which vendors a user's verified KYC data was shared with, backed by the idOS relay GET /api/kyc/external-user-id/{externalUserId}/shares endpoint.

KycService.getDataShares({ externalUserId }) calls the relay (wallet bearer auth, same path as other relay usage), validates { shares } with superstruct, and returns metadata records (kycSessionId, vendor, sharedAt). vendor is a plain string so unknown relay vendors do not fail the whole list. Missing idosRelayBaseUrl throws; bad HTTP or shape throws as elsewhere in the service.

KycController.getDataShares() resolves externalUserId from sessionStatus on state, or on cold state fetches the latest session for the stored vendor without persisting it. No vendor or no session yields [] instead of an error for empty UI states. No new controller state or persistence.

New KycDataShare, GetDataSharesParams, and messenger actions KycService:getDataShares / KycController:getDataShares are exported; changelog and tests cover service and controller behavior.

Reviewed by Cursor Bugbot for commit a046e10. Bugbot is set up for automated code reviews on this repo. Configure here.

Adds `KycService.getDataShares` and a `KycController.getDataShares`
passthrough so clients can list the vendors a customer's verified
identity data has been shared with.

The service reads `GET /api/kyc/external-user-id/{externalUserId}/shares`
on the idOS relay through the existing authenticated request helper and
unwraps the `{ shares }` envelope. The controller resolves the external
user id from `state.sessionStatus`, falling back to the latest session
for the vendor on state, and returns an empty list when no session can be
resolved.

This is additive: no new state, no persistence, and no change to the
existing session flow.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@georgeweiler
georgeweiler requested a review from a team as a code owner October 28, 2026 12:06
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@georgeweiler
georgeweiler requested a review from a team as a code owner October 28, 2026 12:07

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9e81d3d. Configure here.

Comment thread packages/kyc-controller/src/types.ts Resolved
The relay returns vendors this package does not model, so KycDataShare.vendor matches the string validation and KycSessionStatus.vendor.

Co-authored-by: Cursor <cursoragent@cursor.com>
`KycDataShare.vendor` is now a plain string, so narrowing the validated
shares to `KycDataShare[]` is a no-op that oxlint rejects.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@georgeweiler
georgeweiler added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit b4b2b33 Oct 28, 2026
46 checks passed
@georgeweiler
georgeweiler deleted the claude/kyc-controller-get-data-shares-aa6cb8 branch October 28, 2026 17:50
This was referenced Oct 29, 2026
@Akaryatrh Akaryatrh mentioned this pull request Nov 2, 2026
1 of 4 tasks
Naz-Ovh pushed a commit to 0x-fork/metamask-core that referenced this pull request Nov 4, 2026
## Explanation

Scoped release so clients can pick up MetaMask#11158 and MetaMask#11099. Monorepo
release **1378.0.0** because
[Release/1377.0.0](MetaMask#11203) is
already open.

- **`@metamask/kyc-controller` 0.13.0 → 0.14.0** (minor). Both changes
are additive, so they stay in one minor.
- `KycService.getDataShares` and `KycController.getDataShares` list the
vendors a customer's verified identity data has been shared with
(MetaMask#11158). Both are messenger actions. No new controller state, and no
change to existing methods.
- `KycController.ensureLocalUserSecret` creates and stores the UKYC
`local_user_secret` when one does not already exist (MetaMask#11099).
`startSession` still creates the secret when this method has not been
called. The secret is not returned.

No workspace package depends on `kyc-controller`, so nothing else is
published. Other packages with unreleased changes are deferred.

## References

- Ships MetaMask#11158
- Ships MetaMask#11099
- Unblocks MetaMask/metamask-mobile#38381

## Checklist

- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> The diff is version and changelog metadata only; functional changes
were merged in earlier PRs and are not modified here.
> 
> **Overview**
> This is a **scoped release PR** that bumps the monorepo to
**1378.0.0** and publishes **`@metamask/kyc-controller` 0.13.0 →
0.14.0**, with the package changelog cut from `[Unreleased]` into
**`[0.14.0]`** (compare links updated accordingly). No application
source files change in this diff—only `package.json` versions and
`CHANGELOG.md`.
> 
> The **0.14.0** notes document additive KYC work clients can pick up
after publish, including **`getDataShares`** on the service and
controller (messenger actions, no new persisted state),
**`ensureLocalUserSecret`** to create/store the UKYC `local_user_secret`
before session start when desired, optional **`currentStep`** on session
status (plus related **`finalStatus`** mapping when step is `kyc`), and
the associated exports/types called out in the changelog.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
b880f85. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: jiexi <jiexiluan@gmail.com>
Naz-Ovh pushed a commit to 0x-fork/metamask-core that referenced this pull request Nov 4, 2026
## Explanation

Reverts MetaMask#11205 (`Release 1378.0.0`), which was merged before its
predecessor
[Release/1377.0.0](MetaMask#11203) had been
released. The release numbering assumed 1377 would land first, so this
release has to come off `main`.

The revert restores:

- Root version `1378.0.0` → `1376.0.0`
- `@metamask/kyc-controller` `0.14.0` → `0.13.0`
- The `ensureLocalUserSecret` (MetaMask#11099), `getDataShares` (MetaMask#11158) and
`currentStep` (MetaMask#11094) entries move back under `[Unreleased]`

Nothing was published. The `main` run for the merge failed on an
unrelated `rate-limit-controller` test, so the `Publish release` job was
skipped. No tags were created, and npm still lists
`@metamask/kyc-controller` at `0.13.0`.

## References

- Reverts MetaMask#11205

## Checklist

- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them

Made with [Cursor](https://cursor.com)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Version and changelog-only revert with no code changes; aligns `main`
with unpublished release state.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
9311ab8. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Naz-Ovh pushed a commit to 0x-fork/metamask-core that referenced this pull request Nov 4, 2026
## Explanation

Release **1380.0.0**. This PR bumps `@metamask/kyc-controller` from
`0.13.0` to `0.14.0` (minor). The unreleased changelog adds public API:
optional `currentStep` on `KycSessionStatus`,
`KycController.ensureLocalUserSecret`, and `getDataShares` on both the
service and the controller, plus their exported types. It also maps a
session that reports `finalStatus: pending` with `currentStep: kyc` back
to `finalStatus: new`, which restores the previous meaning of `pending`
(only after SumSub is fully submitted). That behavior change is not
marked breaking. The root monorepo version is bumped to `1380.0.0`.

No other package in this repo depends on `@metamask/kyc-controller`, so
no other packages are included. Dev-only commits since `0.13.0` (the
`nock` bump and a test import change) are left out of the changelog.

## References

- Ships [MetaMask#11094](MetaMask#11094),
[MetaMask#11099](MetaMask#11099), and
[MetaMask#11158](MetaMask#11158)
- Previous merged release:
[MetaMask#11210](MetaMask#11210)

## Checklist

- [ ] I've updated the test suite for new or updated code as appropriate
(N/A: version bump and changelog only)
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate (N/A)
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them (N/A: no breaking changes)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Version and changelog-only release with no new runtime changes in this
PR; consumer impact comes from the already-merged kyc-controller APIs
and status mapping described in the changelog.
> 
> **Overview**
> This PR cuts **release 1380.0.0** for the core monorepo by bumping the
root version from `1379.0.0` to **1380.0.0**
> 
> It publishes **`@metamask/kyc-controller` `0.14.0`**, moving the
existing Unreleased changelog into a **`[0.14.0]`** section and updating
compare links. There is **no application code in the diff**—only version
and changelog housekeeping.
> 
> The **0.14.0** notes document what consumers get from earlier merged
work: optional **`currentStep`** on **`KycSessionStatus`**,
**`ensureLocalUserSecret`**, **`getDataShares`** on the service and
controller, related exports, and a **behavior tweak** that maps API
**`pending` + `currentStep: kyc`** back to **`finalStatus: new`** so
partially submitted flows are not treated like post–SumSub pending.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
1727a26. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Signed-off-by: Sébastien Van Eyck <sebastien.vaneyck@consensys.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants