Skip to content

Update sinon and @types/sinon to latest versions - #352

Merged
Gudahtt merged 2 commits into
developfrom
update-sinon
Feb 18, 2021
Merged

Gudahtt merged 2 commits into
developfrom
update-sinon

Conversation

@Gudahtt

@Gudahtt Gudahtt commented Feb 17, 2021 •

Copy link
Copy Markdown
Member

sinon has been updated from v7 to v9. There have been no breaking changes that affect our usage.

The types we were using were far behind though, so updating those has revealed pre-existing mistakes in how we were using sinon in a few places.

For one of the type errors, I replaced a window.fetch mock with nock, as that seemed like the simplest way to fix the type error.

@Gudahtt
Gudahtt requested a review from a team as a code owner February 17, 2021 15:26
`sinon` has been updated from v7 to v9. There have been no breaking
changes that affect our usage.

The types we were using were _far_ behind though, so updating those has
revealed pre-existing mistakes in how we were using `sinon` in a few
places.

For one of the type errors, I replaced a `window.fetch` mock with
`nock`, as that seemed like the simplest way to fix the type error.

@kumavis kumavis 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.

sinon me up for this excellent improvement

@Gudahtt
Gudahtt merged commit da282f4 into develop Feb 18, 2021
@Gudahtt
Gudahtt deleted the update-sinon branch February 18, 2021 04:25
rickycodes added a commit that referenced this pull request Feb 18, 2021
…ba into feature/migrate-to-etherscan

* 'feature/migrate-to-etherscan' of github.com:MetaMask/gaba:
  Update `sinon` and `@types/sinon` to latest versions (#352)
  Fix `tsconfig.json` indentation (#355)
  Replace `fetch-mock` with `nock` (#340)
  Update `ethereumjs-wallet` from v0.6.5 to v1.0.1 (#347)
  Add `babel-runtime` dependency required by `ethjs-query` (#341)
  Update `@metamask/eslint-config` from v3 to v4.1.0 (#344)
  Add `docs` to list of ignored eslint patterns (#345)
  Update `uuid` from `v3.3.3` to `v8.3.2` (#346)
  Update approval controller test import (#339)
  Add Dependabot config (#343)
  Update `typedoc` (#342)
  Remove unused test module (#338)
  Replace `await-semaphore` with `async-mutex` (#334)
  Update `eth-json-rpc-filters` in lockfile (#336)
Mrtenz pushed a commit that referenced this pull request Oct 16, 2025
We're migrating this to `/core` tomorrow.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> <sup>[Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) is
generating a summary for commit
12ea2d39ea956bfe9e357e09e33639067e24d705. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Mrtenz pushed a commit that referenced this pull request Oct 16, 2025
Naz-Ovh pushed a commit to 0x-fork/metamask-core that referenced this pull request Sep 13, 2026
…r identity tokens (MetaMask#10164)

## Explanation

Adds `AuthenticationController.getOidcToken(claims, audience)` so KYC
(and later Iron) can mint a partner identity token from a signed-in
wallet.

This is a copy of `getCustomerServiceToken`, pointed at `POST
/api/v2/oidc/token`. It returns only `access_token`. HTTP 422 throws
typed `EmailRequiredError` when the profile has no verified email.

MCA-339. Backend mint is
`consensys-vertical-apps/va-mmcx-authentication-api` `MetaMask#352`. This PR
does not bump extension or mobile.

## Changelog

- Added `AuthenticationController.getOidcToken` and messenger action
`AuthenticationController:getOidcToken`
- Added `EmailRequiredError` for HTTP 422 `email_required`

## References

- https://consensyssoftware.atlassian.net/browse/MCA-339
- MetaMask#9442 (same pattern)

## Pre-merge checklist

- [x] I've added a changelog entry
- [x] I've added or updated unit tests

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> New authenticated token-minting on the auth path (partner JWTs may
carry email), but behavior follows the existing getCustomerServiceToken
pattern with typed 422 handling and broad unit coverage.
> 
> **Overview**
> Adds **`AuthenticationController.getPartnerIdentityToken(claims,
audience, entropySourceId?)`** and the messenger action
**`AuthenticationController:getPartnerIdentityToken`**, mirroring the
existing customer-service token exchange. After login/unlock checks, it
uses the Hydra OIDC bearer to call **`POST /api/v2/oidc/token`** with
**`claims`** (today only **`email`**) and partner **`audience`**
(**`kyc`** or **`iron`**) and returns the minted **`access_token`**.
> 
> The auth SDK gains **`getPartnerIdentityToken`** on the HTTP layer
plus SRP/SIWE JWT bearer flows and the public **`JwtBearerAuth`**
wrapper, with typed **`OidcTokenClaims`** / **`OidcTokenAudience`**.
**`EmailRequiredError`** is introduced for HTTP **422** when the profile
has no verified email; other failures map to **`SignInError`** like the
customer-service path. Tests, nock fixtures, and controller mocks for
**`/oidc/token`** are included, and the unreleased changelog documents
the API.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
2b92c5a. 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: Tamas <1022631+chakra-guy@users.noreply.github.com>
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