@metamask/money-account-upgrade-controller 1.1.0 → 1.2.0

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
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.0]
11
+
12
+ ### Changed
13
+
14
+ - Bump `@metamask/chomp-api-service` from `^1.0.0` to `^2.0.0` ([#8618](https://github.com/MetaMask/core/pull/8618))
15
+
16
+ ### Fixed
17
+
18
+ - Send the CHOMP authentication timestamp as a number instead of a string in the associate-address step. ([#8610](https://github.com/MetaMask/core/pull/8610))
19
+
10
20
  ## [1.1.0]
11
21
 
12
22
  ### Added
@@ -19,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
19
29
 
20
30
  - Add `MoneyAccountUpgradeController` with `upgradeAccount` method ([#8426](https://github.com/MetaMask/core/pull/8426))
21
31
 
22
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/money-account-upgrade-controller@1.1.0...HEAD
32
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/money-account-upgrade-controller@1.2.0...HEAD
33
+ [1.2.0]: https://github.com/MetaMask/core/compare/@metamask/money-account-upgrade-controller@1.1.0...@metamask/money-account-upgrade-controller@1.2.0
23
34
  [1.1.0]: https://github.com/MetaMask/core/compare/@metamask/money-account-upgrade-controller@1.0.0...@metamask/money-account-upgrade-controller@1.1.0
24
35
  [1.0.0]: https://github.com/MetaMask/core/releases/tag/@metamask/money-account-upgrade-controller@1.0.0
@@ -17,7 +17,7 @@ const ALREADY_ASSOCIATED_STATUS = 'already_associated';
17
17
  exports.associateAddressStep = {
18
18
  name: 'associate-address',
19
19
  async run({ messenger, address }) {
20
- const timestamp = Date.now().toString();
20
+ const timestamp = Date.now();
21
21
  const message = `CHOMP Authentication ${timestamp}`;
22
22
  const signature = (await messenger.call('KeyringController:signPersonalMessage', { data: message, from: address }));
23
23
  const response = await messenger.call('ChompApiService:associateAddress', {
@@ -1 +1 @@
1
- {"version":3,"file":"associate-address.cjs","sourceRoot":"","sources":["../../src/steps/associate-address.ts"],"names":[],"mappings":";;;AAIA,MAAM,yBAAyB,GAAG,oBAAoB,CAAC;AAEvD;;;;;;;;;;;GAWG;AACU,QAAA,oBAAoB,GAAS;IACxC,IAAI,EAAE,mBAAmB;IACzB,KAAK,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE;QAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;QACxC,MAAM,OAAO,GAAG,wBAAwB,SAAS,EAAE,CAAC;QAEpD,MAAM,SAAS,GAAG,CAAC,MAAM,SAAS,CAAC,IAAI,CACrC,uCAAuC,EACvC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CACjC,CAAQ,CAAC;QAEV,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,kCAAkC,EAAE;YACxE,SAAS;YACT,SAAS;YACT,OAAO;SACR,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,MAAM,KAAK,yBAAyB,EAAE,CAAC;YAClD,OAAO,cAAc,CAAC;QACxB,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;CACF,CAAC","sourcesContent":["import type { Hex } from '@metamask/utils';\n\nimport type { Step } from './step';\n\nconst ALREADY_ASSOCIATED_STATUS = 'already_associated';\n\n/**\n * Associates the Money Account address with the user's CHOMP profile.\n *\n * Signs `CHOMP Authentication {timestamp}` (EIP-191) with the account's key\n * and submits the signature to CHOMP, which verifies the timestamp is fresh,\n * recovers the signer, and records the profile–address mapping.\n *\n * CHOMP responds with 201 and `status: 'created'` when the association is\n * made, and 409 with `status: 'already_associated'` when the address is\n * already linked to a profile. The service surfaces both responses, so this\n * step reports `'already-done'` for the 409 case and `'completed'` otherwise.\n */\nexport const associateAddressStep: Step = {\n name: 'associate-address',\n async run({ messenger, address }) {\n const timestamp = Date.now().toString();\n const message = `CHOMP Authentication ${timestamp}`;\n\n const signature = (await messenger.call(\n 'KeyringController:signPersonalMessage',\n { data: message, from: address },\n )) as Hex;\n\n const response = await messenger.call('ChompApiService:associateAddress', {\n signature,\n timestamp,\n address,\n });\n\n if (response.status === ALREADY_ASSOCIATED_STATUS) {\n return 'already-done';\n }\n\n return 'completed';\n },\n};\n"]}
1
+ {"version":3,"file":"associate-address.cjs","sourceRoot":"","sources":["../../src/steps/associate-address.ts"],"names":[],"mappings":";;;AAIA,MAAM,yBAAyB,GAAG,oBAAoB,CAAC;AAEvD;;;;;;;;;;;GAWG;AACU,QAAA,oBAAoB,GAAS;IACxC,IAAI,EAAE,mBAAmB;IACzB,KAAK,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE;QAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAG,wBAAwB,SAAS,EAAE,CAAC;QAEpD,MAAM,SAAS,GAAG,CAAC,MAAM,SAAS,CAAC,IAAI,CACrC,uCAAuC,EACvC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CACjC,CAAQ,CAAC;QAEV,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,kCAAkC,EAAE;YACxE,SAAS;YACT,SAAS;YACT,OAAO;SACR,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,MAAM,KAAK,yBAAyB,EAAE,CAAC;YAClD,OAAO,cAAc,CAAC;QACxB,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;CACF,CAAC","sourcesContent":["import type { Hex } from '@metamask/utils';\n\nimport type { Step } from './step';\n\nconst ALREADY_ASSOCIATED_STATUS = 'already_associated';\n\n/**\n * Associates the Money Account address with the user's CHOMP profile.\n *\n * Signs `CHOMP Authentication {timestamp}` (EIP-191) with the account's key\n * and submits the signature to CHOMP, which verifies the timestamp is fresh,\n * recovers the signer, and records the profile–address mapping.\n *\n * CHOMP responds with 201 and `status: 'created'` when the association is\n * made, and 409 with `status: 'already_associated'` when the address is\n * already linked to a profile. The service surfaces both responses, so this\n * step reports `'already-done'` for the 409 case and `'completed'` otherwise.\n */\nexport const associateAddressStep: Step = {\n name: 'associate-address',\n async run({ messenger, address }) {\n const timestamp = Date.now();\n const message = `CHOMP Authentication ${timestamp}`;\n\n const signature = (await messenger.call(\n 'KeyringController:signPersonalMessage',\n { data: message, from: address },\n )) as Hex;\n\n const response = await messenger.call('ChompApiService:associateAddress', {\n signature,\n timestamp,\n address,\n });\n\n if (response.status === ALREADY_ASSOCIATED_STATUS) {\n return 'already-done';\n }\n\n return 'completed';\n },\n};\n"]}
@@ -14,7 +14,7 @@ const ALREADY_ASSOCIATED_STATUS = 'already_associated';
14
14
  export const associateAddressStep = {
15
15
  name: 'associate-address',
16
16
  async run({ messenger, address }) {
17
- const timestamp = Date.now().toString();
17
+ const timestamp = Date.now();
18
18
  const message = `CHOMP Authentication ${timestamp}`;
19
19
  const signature = (await messenger.call('KeyringController:signPersonalMessage', { data: message, from: address }));
20
20
  const response = await messenger.call('ChompApiService:associateAddress', {
@@ -1 +1 @@
1
- {"version":3,"file":"associate-address.mjs","sourceRoot":"","sources":["../../src/steps/associate-address.ts"],"names":[],"mappings":"AAIA,MAAM,yBAAyB,GAAG,oBAAoB,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAS;IACxC,IAAI,EAAE,mBAAmB;IACzB,KAAK,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE;QAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;QACxC,MAAM,OAAO,GAAG,wBAAwB,SAAS,EAAE,CAAC;QAEpD,MAAM,SAAS,GAAG,CAAC,MAAM,SAAS,CAAC,IAAI,CACrC,uCAAuC,EACvC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CACjC,CAAQ,CAAC;QAEV,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,kCAAkC,EAAE;YACxE,SAAS;YACT,SAAS;YACT,OAAO;SACR,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,MAAM,KAAK,yBAAyB,EAAE,CAAC;YAClD,OAAO,cAAc,CAAC;QACxB,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;CACF,CAAC","sourcesContent":["import type { Hex } from '@metamask/utils';\n\nimport type { Step } from './step';\n\nconst ALREADY_ASSOCIATED_STATUS = 'already_associated';\n\n/**\n * Associates the Money Account address with the user's CHOMP profile.\n *\n * Signs `CHOMP Authentication {timestamp}` (EIP-191) with the account's key\n * and submits the signature to CHOMP, which verifies the timestamp is fresh,\n * recovers the signer, and records the profile–address mapping.\n *\n * CHOMP responds with 201 and `status: 'created'` when the association is\n * made, and 409 with `status: 'already_associated'` when the address is\n * already linked to a profile. The service surfaces both responses, so this\n * step reports `'already-done'` for the 409 case and `'completed'` otherwise.\n */\nexport const associateAddressStep: Step = {\n name: 'associate-address',\n async run({ messenger, address }) {\n const timestamp = Date.now().toString();\n const message = `CHOMP Authentication ${timestamp}`;\n\n const signature = (await messenger.call(\n 'KeyringController:signPersonalMessage',\n { data: message, from: address },\n )) as Hex;\n\n const response = await messenger.call('ChompApiService:associateAddress', {\n signature,\n timestamp,\n address,\n });\n\n if (response.status === ALREADY_ASSOCIATED_STATUS) {\n return 'already-done';\n }\n\n return 'completed';\n },\n};\n"]}
1
+ {"version":3,"file":"associate-address.mjs","sourceRoot":"","sources":["../../src/steps/associate-address.ts"],"names":[],"mappings":"AAIA,MAAM,yBAAyB,GAAG,oBAAoB,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAS;IACxC,IAAI,EAAE,mBAAmB;IACzB,KAAK,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE;QAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAG,wBAAwB,SAAS,EAAE,CAAC;QAEpD,MAAM,SAAS,GAAG,CAAC,MAAM,SAAS,CAAC,IAAI,CACrC,uCAAuC,EACvC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CACjC,CAAQ,CAAC;QAEV,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,kCAAkC,EAAE;YACxE,SAAS;YACT,SAAS;YACT,OAAO;SACR,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,MAAM,KAAK,yBAAyB,EAAE,CAAC;YAClD,OAAO,cAAc,CAAC;QACxB,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;CACF,CAAC","sourcesContent":["import type { Hex } from '@metamask/utils';\n\nimport type { Step } from './step';\n\nconst ALREADY_ASSOCIATED_STATUS = 'already_associated';\n\n/**\n * Associates the Money Account address with the user's CHOMP profile.\n *\n * Signs `CHOMP Authentication {timestamp}` (EIP-191) with the account's key\n * and submits the signature to CHOMP, which verifies the timestamp is fresh,\n * recovers the signer, and records the profile–address mapping.\n *\n * CHOMP responds with 201 and `status: 'created'` when the association is\n * made, and 409 with `status: 'already_associated'` when the address is\n * already linked to a profile. The service surfaces both responses, so this\n * step reports `'already-done'` for the 409 case and `'completed'` otherwise.\n */\nexport const associateAddressStep: Step = {\n name: 'associate-address',\n async run({ messenger, address }) {\n const timestamp = Date.now();\n const message = `CHOMP Authentication ${timestamp}`;\n\n const signature = (await messenger.call(\n 'KeyringController:signPersonalMessage',\n { data: message, from: address },\n )) as Hex;\n\n const response = await messenger.call('ChompApiService:associateAddress', {\n signature,\n timestamp,\n address,\n });\n\n if (response.status === ALREADY_ASSOCIATED_STATUS) {\n return 'already-done';\n }\n\n return 'completed';\n },\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/money-account-upgrade-controller",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "MetaMask Money account upgrade controller",
5
5
  "keywords": [
6
6
  "Ethereum",
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "dependencies": {
56
56
  "@metamask/base-controller": "^9.1.0",
57
- "@metamask/chomp-api-service": "^1.0.0",
57
+ "@metamask/chomp-api-service": "^2.0.0",
58
58
  "@metamask/keyring-controller": "^25.2.0",
59
59
  "@metamask/messenger": "^1.1.1",
60
60
  "@metamask/network-controller": "^30.0.1",