@metamask/profile-sync-controller 8.1.1 → 9.0.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.
Files changed (169) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/README.md +32 -0
  3. package/auth/mocks/package.json +2 -2
  4. package/dist/controllers/authentication/index.cjs +1 -1
  5. package/dist/controllers/authentication/index.cjs.map +1 -1
  6. package/dist/controllers/authentication/index.d.cts +1 -1
  7. package/dist/controllers/authentication/index.d.cts.map +1 -1
  8. package/dist/controllers/authentication/index.d.mts +1 -1
  9. package/dist/controllers/authentication/index.d.mts.map +1 -1
  10. package/dist/controllers/authentication/index.mjs +1 -1
  11. package/dist/controllers/authentication/index.mjs.map +1 -1
  12. package/dist/controllers/authentication/mocks/index.cjs.map +1 -0
  13. package/dist/controllers/authentication/mocks/index.d.cts.map +1 -0
  14. package/dist/controllers/authentication/mocks/index.d.mts.map +1 -0
  15. package/dist/controllers/authentication/mocks/index.mjs.map +1 -0
  16. package/dist/controllers/authentication/mocks/mockResponses.cjs.map +1 -0
  17. package/dist/controllers/authentication/mocks/mockResponses.d.cts.map +1 -0
  18. package/dist/controllers/authentication/mocks/mockResponses.d.mts.map +1 -0
  19. package/dist/controllers/authentication/mocks/mockResponses.mjs.map +1 -0
  20. package/dist/controllers/user-storage/account-syncing/controller-integration.cjs +1 -1
  21. package/dist/controllers/user-storage/account-syncing/controller-integration.cjs.map +1 -1
  22. package/dist/controllers/user-storage/account-syncing/controller-integration.mjs +1 -1
  23. package/dist/controllers/user-storage/account-syncing/controller-integration.mjs.map +1 -1
  24. package/dist/controllers/user-storage/account-syncing/utils.cjs +2 -2
  25. package/dist/controllers/user-storage/account-syncing/utils.cjs.map +1 -1
  26. package/dist/controllers/user-storage/account-syncing/utils.mjs +2 -2
  27. package/dist/controllers/user-storage/account-syncing/utils.mjs.map +1 -1
  28. package/dist/controllers/user-storage/index.cjs +1 -1
  29. package/dist/controllers/user-storage/index.cjs.map +1 -1
  30. package/dist/controllers/user-storage/index.d.cts +1 -1
  31. package/dist/controllers/user-storage/index.d.cts.map +1 -1
  32. package/dist/controllers/user-storage/index.d.mts +1 -1
  33. package/dist/controllers/user-storage/index.d.mts.map +1 -1
  34. package/dist/controllers/user-storage/index.mjs +1 -1
  35. package/dist/controllers/user-storage/index.mjs.map +1 -1
  36. package/dist/controllers/user-storage/mocks/index.cjs.map +1 -0
  37. package/dist/controllers/user-storage/mocks/index.d.cts.map +1 -0
  38. package/dist/controllers/user-storage/mocks/index.d.mts.map +1 -0
  39. package/dist/controllers/user-storage/mocks/index.mjs.map +1 -0
  40. package/dist/controllers/user-storage/mocks/mockResponses.cjs.map +1 -0
  41. package/dist/controllers/user-storage/mocks/mockResponses.d.cts.map +1 -0
  42. package/dist/controllers/user-storage/mocks/mockResponses.d.mts.map +1 -0
  43. package/dist/controllers/user-storage/mocks/mockResponses.mjs.map +1 -0
  44. package/dist/controllers/user-storage/mocks/mockStorage.cjs.map +1 -0
  45. package/dist/controllers/user-storage/mocks/mockStorage.d.cts.map +1 -0
  46. package/dist/controllers/user-storage/mocks/mockStorage.d.mts.map +1 -0
  47. package/dist/controllers/user-storage/mocks/mockStorage.mjs.map +1 -0
  48. package/package.json +14 -14
  49. package/user-storage/mocks/package.json +2 -2
  50. package/dist/controllers/authentication/__fixtures__/index.cjs.map +0 -1
  51. package/dist/controllers/authentication/__fixtures__/index.d.cts.map +0 -1
  52. package/dist/controllers/authentication/__fixtures__/index.d.mts.map +0 -1
  53. package/dist/controllers/authentication/__fixtures__/index.mjs.map +0 -1
  54. package/dist/controllers/authentication/__fixtures__/mockResponses.cjs.map +0 -1
  55. package/dist/controllers/authentication/__fixtures__/mockResponses.d.cts.map +0 -1
  56. package/dist/controllers/authentication/__fixtures__/mockResponses.d.mts.map +0 -1
  57. package/dist/controllers/authentication/__fixtures__/mockResponses.mjs.map +0 -1
  58. package/dist/controllers/authentication/__fixtures__/mockServices.cjs +0 -37
  59. package/dist/controllers/authentication/__fixtures__/mockServices.cjs.map +0 -1
  60. package/dist/controllers/authentication/__fixtures__/mockServices.d.cts +0 -10
  61. package/dist/controllers/authentication/__fixtures__/mockServices.d.cts.map +0 -1
  62. package/dist/controllers/authentication/__fixtures__/mockServices.d.mts +0 -10
  63. package/dist/controllers/authentication/__fixtures__/mockServices.d.mts.map +0 -1
  64. package/dist/controllers/authentication/__fixtures__/mockServices.mjs +0 -35
  65. package/dist/controllers/authentication/__fixtures__/mockServices.mjs.map +0 -1
  66. package/dist/controllers/user-storage/__fixtures__/index.cjs.map +0 -1
  67. package/dist/controllers/user-storage/__fixtures__/index.d.cts.map +0 -1
  68. package/dist/controllers/user-storage/__fixtures__/index.d.mts.map +0 -1
  69. package/dist/controllers/user-storage/__fixtures__/index.mjs.map +0 -1
  70. package/dist/controllers/user-storage/__fixtures__/mockMessenger.cjs +0 -167
  71. package/dist/controllers/user-storage/__fixtures__/mockMessenger.cjs.map +0 -1
  72. package/dist/controllers/user-storage/__fixtures__/mockMessenger.d.cts +0 -105
  73. package/dist/controllers/user-storage/__fixtures__/mockMessenger.d.cts.map +0 -1
  74. package/dist/controllers/user-storage/__fixtures__/mockMessenger.d.mts +0 -105
  75. package/dist/controllers/user-storage/__fixtures__/mockMessenger.d.mts.map +0 -1
  76. package/dist/controllers/user-storage/__fixtures__/mockMessenger.mjs +0 -162
  77. package/dist/controllers/user-storage/__fixtures__/mockMessenger.mjs.map +0 -1
  78. package/dist/controllers/user-storage/__fixtures__/mockResponses.cjs.map +0 -1
  79. package/dist/controllers/user-storage/__fixtures__/mockResponses.d.cts.map +0 -1
  80. package/dist/controllers/user-storage/__fixtures__/mockResponses.d.mts.map +0 -1
  81. package/dist/controllers/user-storage/__fixtures__/mockResponses.mjs.map +0 -1
  82. package/dist/controllers/user-storage/__fixtures__/mockServices.cjs +0 -82
  83. package/dist/controllers/user-storage/__fixtures__/mockServices.cjs.map +0 -1
  84. package/dist/controllers/user-storage/__fixtures__/mockServices.d.cts +0 -15
  85. package/dist/controllers/user-storage/__fixtures__/mockServices.d.cts.map +0 -1
  86. package/dist/controllers/user-storage/__fixtures__/mockServices.d.mts +0 -15
  87. package/dist/controllers/user-storage/__fixtures__/mockServices.d.mts.map +0 -1
  88. package/dist/controllers/user-storage/__fixtures__/mockServices.mjs +0 -76
  89. package/dist/controllers/user-storage/__fixtures__/mockServices.mjs.map +0 -1
  90. package/dist/controllers/user-storage/__fixtures__/mockStorage.cjs.map +0 -1
  91. package/dist/controllers/user-storage/__fixtures__/mockStorage.d.cts.map +0 -1
  92. package/dist/controllers/user-storage/__fixtures__/mockStorage.d.mts.map +0 -1
  93. package/dist/controllers/user-storage/__fixtures__/mockStorage.mjs.map +0 -1
  94. package/dist/controllers/user-storage/__fixtures__/test-utils.cjs +0 -78
  95. package/dist/controllers/user-storage/__fixtures__/test-utils.cjs.map +0 -1
  96. package/dist/controllers/user-storage/__fixtures__/test-utils.d.cts +0 -38
  97. package/dist/controllers/user-storage/__fixtures__/test-utils.d.cts.map +0 -1
  98. package/dist/controllers/user-storage/__fixtures__/test-utils.d.mts +0 -38
  99. package/dist/controllers/user-storage/__fixtures__/test-utils.d.mts.map +0 -1
  100. package/dist/controllers/user-storage/__fixtures__/test-utils.mjs +0 -68
  101. package/dist/controllers/user-storage/__fixtures__/test-utils.mjs.map +0 -1
  102. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.cjs +0 -178
  103. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.cjs.map +0 -1
  104. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.d.cts +0 -91
  105. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.d.cts.map +0 -1
  106. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.d.mts +0 -91
  107. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.d.mts.map +0 -1
  108. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.mjs +0 -174
  109. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.mjs.map +0 -1
  110. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.cjs +0 -58
  111. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.cjs.map +0 -1
  112. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.d.cts +0 -87
  113. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.d.cts.map +0 -1
  114. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.d.mts +0 -87
  115. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.d.mts.map +0 -1
  116. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.mjs +0 -52
  117. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.mjs.map +0 -1
  118. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.cjs +0 -43
  119. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.cjs.map +0 -1
  120. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.cts +0 -11
  121. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.cts.map +0 -1
  122. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.mts +0 -11
  123. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.mts.map +0 -1
  124. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.mjs +0 -36
  125. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.mjs.map +0 -1
  126. package/dist/sdk/__fixtures__/mock-auth.cjs +0 -124
  127. package/dist/sdk/__fixtures__/mock-auth.cjs.map +0 -1
  128. package/dist/sdk/__fixtures__/mock-auth.d.cts +0 -42
  129. package/dist/sdk/__fixtures__/mock-auth.d.cts.map +0 -1
  130. package/dist/sdk/__fixtures__/mock-auth.d.mts +0 -42
  131. package/dist/sdk/__fixtures__/mock-auth.d.mts.map +0 -1
  132. package/dist/sdk/__fixtures__/mock-auth.mjs +0 -119
  133. package/dist/sdk/__fixtures__/mock-auth.mjs.map +0 -1
  134. package/dist/sdk/__fixtures__/mock-userstorage.cjs +0 -111
  135. package/dist/sdk/__fixtures__/mock-userstorage.cjs.map +0 -1
  136. package/dist/sdk/__fixtures__/mock-userstorage.d.cts +0 -20
  137. package/dist/sdk/__fixtures__/mock-userstorage.d.cts.map +0 -1
  138. package/dist/sdk/__fixtures__/mock-userstorage.d.mts +0 -20
  139. package/dist/sdk/__fixtures__/mock-userstorage.d.mts.map +0 -1
  140. package/dist/sdk/__fixtures__/mock-userstorage.mjs +0 -81
  141. package/dist/sdk/__fixtures__/mock-userstorage.mjs.map +0 -1
  142. package/dist/sdk/__fixtures__/test-utils.cjs +0 -90
  143. package/dist/sdk/__fixtures__/test-utils.cjs.map +0 -1
  144. package/dist/sdk/__fixtures__/test-utils.d.cts +0 -37
  145. package/dist/sdk/__fixtures__/test-utils.d.cts.map +0 -1
  146. package/dist/sdk/__fixtures__/test-utils.d.mts +0 -37
  147. package/dist/sdk/__fixtures__/test-utils.d.mts.map +0 -1
  148. package/dist/sdk/__fixtures__/test-utils.mjs +0 -84
  149. package/dist/sdk/__fixtures__/test-utils.mjs.map +0 -1
  150. /package/dist/controllers/authentication/{__fixtures__ → mocks}/index.cjs +0 -0
  151. /package/dist/controllers/authentication/{__fixtures__ → mocks}/index.d.cts +0 -0
  152. /package/dist/controllers/authentication/{__fixtures__ → mocks}/index.d.mts +0 -0
  153. /package/dist/controllers/authentication/{__fixtures__ → mocks}/index.mjs +0 -0
  154. /package/dist/controllers/authentication/{__fixtures__ → mocks}/mockResponses.cjs +0 -0
  155. /package/dist/controllers/authentication/{__fixtures__ → mocks}/mockResponses.d.cts +0 -0
  156. /package/dist/controllers/authentication/{__fixtures__ → mocks}/mockResponses.d.mts +0 -0
  157. /package/dist/controllers/authentication/{__fixtures__ → mocks}/mockResponses.mjs +0 -0
  158. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/index.cjs +0 -0
  159. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/index.d.cts +0 -0
  160. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/index.d.mts +0 -0
  161. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/index.mjs +0 -0
  162. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockResponses.cjs +0 -0
  163. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockResponses.d.cts +0 -0
  164. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockResponses.d.mts +0 -0
  165. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockResponses.mjs +0 -0
  166. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockStorage.cjs +0 -0
  167. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockStorage.d.cts +0 -0
  168. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockStorage.d.mts +0 -0
  169. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockStorage.mjs +0 -0
@@ -1,52 +0,0 @@
1
- import { KeyringTypes } from "@metamask/keyring-controller";
2
- import { MOCK_INTERNAL_ACCOUNTS } from "./mockAccounts.mjs";
3
- import { createSHA256Hash } from "../../../../shared/encryption/index.mjs";
4
- import { mockUserStorageMessenger } from "../../__fixtures__/mockMessenger.mjs";
5
- import { mapInternalAccountToUserStorageAccount } from "../utils.mjs";
6
- /**
7
- * Test Utility - create a mock user storage messenger for account syncing tests
8
- *
9
- * @param options - options for the mock messenger
10
- * @param options.accounts - options for the accounts part of the controller
11
- * @param options.accounts.accountsList - list of accounts to return for the 'AccountsController:listAccounts' action
12
- * @returns Mock User Storage Messenger
13
- */
14
- export function mockUserStorageMessengerForAccountSyncing(options) {
15
- const messengerMocks = mockUserStorageMessenger();
16
- messengerMocks.mockKeyringAddAccounts.mockImplementation(async () => {
17
- messengerMocks.baseMessenger.publish('AccountsController:accountAdded', MOCK_INTERNAL_ACCOUNTS.ONE[0]);
18
- });
19
- messengerMocks.mockKeyringGetAccounts.mockImplementation(async () => {
20
- return (options?.accounts?.accountsList
21
- ?.filter((a) => a.metadata.keyring.type === KeyringTypes.hd)
22
- .map((a) => a.address) ??
23
- MOCK_INTERNAL_ACCOUNTS.ALL.map((a) => a.address));
24
- });
25
- messengerMocks.mockAccountsListAccounts.mockReturnValue((options?.accounts?.accountsList ??
26
- MOCK_INTERNAL_ACCOUNTS.ALL));
27
- return messengerMocks;
28
- }
29
- /**
30
- * Test Utility - creates a realistic expected batch upsert payload
31
- *
32
- * @param data - data supposed to be upserted
33
- * @param storageKey - storage key
34
- * @returns expected body
35
- */
36
- export function createExpectedAccountSyncBatchUpsertBody(data, storageKey) {
37
- return data.map(([entryKey, entryValue]) => [
38
- createSHA256Hash(String(entryKey) + storageKey),
39
- JSON.stringify(mapInternalAccountToUserStorageAccount(entryValue)),
40
- ]);
41
- }
42
- /**
43
- * Test Utility - creates a realistic expected batch delete payload
44
- *
45
- * @param data - data supposed to be deleted
46
- * @param storageKey - storage key
47
- * @returns expected body
48
- */
49
- export function createExpectedAccountSyncBatchDeleteBody(data, storageKey) {
50
- return data.map((entryKey) => createSHA256Hash(String(entryKey) + storageKey));
51
- }
52
- //# sourceMappingURL=test-utils.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-utils.mjs","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/account-syncing/__fixtures__/test-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAG5D,OAAO,EAAE,sBAAsB,EAAE,2BAAuB;AACxD,OAAO,EAAE,gBAAgB,EAAE,gDAAsC;AACjE,OAAO,EAAE,wBAAwB,EAAE,6CAAyC;AAC5E,OAAO,EAAE,sCAAsC,EAAE,qBAAiB;AAElE;;;;;;;GAOG;AACH,MAAM,UAAU,yCAAyC,CAAC,OAIzD;IACC,MAAM,cAAc,GAAG,wBAAwB,EAAE,CAAC;IAElD,cAAc,CAAC,sBAAsB,CAAC,kBAAkB,CAAC,KAAK,IAAI,EAAE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,CAAC,GAAG,UAAU,CAAC,CAChD,CAAC;AACJ,CAAC","sourcesContent":["import { KeyringTypes } from '@metamask/keyring-controller';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\n\nimport { MOCK_INTERNAL_ACCOUNTS } from './mockAccounts';\nimport { createSHA256Hash } from '../../../../shared/encryption';\nimport { mockUserStorageMessenger } from '../../__fixtures__/mockMessenger';\nimport { mapInternalAccountToUserStorageAccount } from '../utils';\n\n/**\n * Test Utility - create a mock user storage messenger for account syncing tests\n *\n * @param options - options for the mock messenger\n * @param options.accounts - options for the accounts part of the controller\n * @param options.accounts.accountsList - list of accounts to return for the 'AccountsController:listAccounts' action\n * @returns Mock User Storage Messenger\n */\nexport function mockUserStorageMessengerForAccountSyncing(options?: {\n accounts?: {\n accountsList?: InternalAccount[];\n };\n}) {\n const messengerMocks = mockUserStorageMessenger();\n\n messengerMocks.mockKeyringAddAccounts.mockImplementation(async () => {\n messengerMocks.baseMessenger.publish(\n 'AccountsController:accountAdded',\n MOCK_INTERNAL_ACCOUNTS.ONE[0] as InternalAccount,\n );\n });\n\n messengerMocks.mockKeyringGetAccounts.mockImplementation(async () => {\n return (\n options?.accounts?.accountsList\n ?.filter((a) => a.metadata.keyring.type === KeyringTypes.hd)\n .map((a) => a.address) ??\n MOCK_INTERNAL_ACCOUNTS.ALL.map((a) => a.address)\n );\n });\n\n messengerMocks.mockAccountsListAccounts.mockReturnValue(\n (options?.accounts?.accountsList ??\n MOCK_INTERNAL_ACCOUNTS.ALL) as InternalAccount[],\n );\n\n return messengerMocks;\n}\n\n/**\n * Test Utility - creates a realistic expected batch upsert payload\n *\n * @param data - data supposed to be upserted\n * @param storageKey - storage key\n * @returns expected body\n */\nexport function createExpectedAccountSyncBatchUpsertBody(\n data: [string, InternalAccount][],\n storageKey: string,\n) {\n return data.map(([entryKey, entryValue]) => [\n createSHA256Hash(String(entryKey) + storageKey),\n JSON.stringify(mapInternalAccountToUserStorageAccount(entryValue)),\n ]);\n}\n\n/**\n * Test Utility - creates a realistic expected batch delete payload\n *\n * @param data - data supposed to be deleted\n * @param storageKey - storage key\n * @returns expected body\n */\nexport function createExpectedAccountSyncBatchDeleteBody(\n data: string[],\n storageKey: string,\n) {\n return data.map((entryKey) =>\n createSHA256Hash(String(entryKey) + storageKey),\n );\n}\n"]}
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createMockInfuraRpcEndpoint = exports.createMockCustomRpcEndpoint = exports.createMockRemoteNetworkConfiguration = exports.createMockNetworkConfiguration = void 0;
4
- const network_controller_1 = require("@metamask/network-controller");
5
- const createMockNetworkConfiguration = (override) => {
6
- return {
7
- chainId: '0x1337',
8
- blockExplorerUrls: ['https://etherscan.io'],
9
- defaultRpcEndpointIndex: 0,
10
- name: 'Mock Network',
11
- nativeCurrency: 'MOCK TOKEN',
12
- rpcEndpoints: [],
13
- defaultBlockExplorerUrlIndex: 0,
14
- ...override,
15
- };
16
- };
17
- exports.createMockNetworkConfiguration = createMockNetworkConfiguration;
18
- const createMockRemoteNetworkConfiguration = (override) => {
19
- return {
20
- v: '1',
21
- ...(0, exports.createMockNetworkConfiguration)(),
22
- ...override,
23
- };
24
- };
25
- exports.createMockRemoteNetworkConfiguration = createMockRemoteNetworkConfiguration;
26
- const createMockCustomRpcEndpoint = (override) => {
27
- return {
28
- type: network_controller_1.RpcEndpointType.Custom,
29
- networkClientId: '1111-1111-1111',
30
- url: `https://FAKE_RPC/`,
31
- ...override,
32
- };
33
- };
34
- exports.createMockCustomRpcEndpoint = createMockCustomRpcEndpoint;
35
- const createMockInfuraRpcEndpoint = () => {
36
- return {
37
- type: network_controller_1.RpcEndpointType.Infura,
38
- networkClientId: 'mainnet',
39
- url: `https://mainnet.infura.io/v3/{infuraProjectId}`,
40
- };
41
- };
42
- exports.createMockInfuraRpcEndpoint = createMockInfuraRpcEndpoint;
43
- //# sourceMappingURL=mockNetwork.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mockNetwork.cjs","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.ts"],"names":[],"mappings":";;;AACA,qEAA+D;AAMxD,MAAM,8BAA8B,GAAG,CAC5C,QAAwC,EAClB,EAAE;IACxB,OAAO;QACL,OAAO,EAAE,QAAQ;QACjB,iBAAiB,EAAE,CAAC,sBAAsB,CAAC;QAC3C,uBAAuB,EAAE,CAAC;QAC1B,IAAI,EAAE,cAAc;QACpB,cAAc,EAAE,YAAY;QAC5B,YAAY,EAAE,EAAE;QAChB,4BAA4B,EAAE,CAAC;QAC/B,GAAG,QAAQ;KACZ,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,8BAA8B,kCAazC;AAEK,MAAM,oCAAoC,GAAG,CAClD,QAA8C,EAClB,EAAE;IAC9B,OAAO;QACL,CAAC,EAAE,GAAG;QACN,GAAG,IAAA,sCAA8B,GAAE;QACnC,GAAG,QAAQ;KACZ,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,oCAAoC,wCAQ/C;AAEK,MAAM,2BAA2B,GAAG,CACzC,QAAyE,EAC5D,EAAE;IACf,OAAO;QACL,IAAI,EAAE,oCAAe,CAAC,MAAM;QAC5B,eAAe,EAAE,gBAAgB;QACjC,GAAG,EAAE,mBAAmB;QACxB,GAAG,QAAQ;KACG,CAAC;AACnB,CAAC,CAAC;AATW,QAAA,2BAA2B,+BAStC;AAEK,MAAM,2BAA2B,GAAG,GAAgB,EAAE;IAC3D,OAAO;QACL,IAAI,EAAE,oCAAe,CAAC,MAAM;QAC5B,eAAe,EAAE,SAAS;QAC1B,GAAG,EAAE,gDAAgD;KACtD,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,2BAA2B,+BAMtC","sourcesContent":["import type { NetworkConfiguration } from '@metamask/network-controller';\nimport { RpcEndpointType } from '@metamask/network-controller';\n\nimport type { RemoteNetworkConfiguration } from '../types';\n\nexport type RPCEndpoint = NetworkConfiguration['rpcEndpoints'][number];\n\nexport const createMockNetworkConfiguration = (\n override?: Partial<NetworkConfiguration>,\n): NetworkConfiguration => {\n return {\n chainId: '0x1337',\n blockExplorerUrls: ['https://etherscan.io'],\n defaultRpcEndpointIndex: 0,\n name: 'Mock Network',\n nativeCurrency: 'MOCK TOKEN',\n rpcEndpoints: [],\n defaultBlockExplorerUrlIndex: 0,\n ...override,\n };\n};\n\nexport const createMockRemoteNetworkConfiguration = (\n override?: Partial<RemoteNetworkConfiguration>,\n): RemoteNetworkConfiguration => {\n return {\n v: '1',\n ...createMockNetworkConfiguration(),\n ...override,\n };\n};\n\nexport const createMockCustomRpcEndpoint = (\n override: Partial<Extract<RPCEndpoint, { type: RpcEndpointType.Custom }>>,\n): RPCEndpoint => {\n return {\n type: RpcEndpointType.Custom,\n networkClientId: '1111-1111-1111',\n url: `https://FAKE_RPC/`,\n ...override,\n } as RPCEndpoint;\n};\n\nexport const createMockInfuraRpcEndpoint = (): RPCEndpoint => {\n return {\n type: RpcEndpointType.Infura,\n networkClientId: 'mainnet',\n url: `https://mainnet.infura.io/v3/{infuraProjectId}`,\n };\n};\n"]}
@@ -1,11 +0,0 @@
1
- import type { NetworkConfiguration } from "@metamask/network-controller";
2
- import { RpcEndpointType } from "@metamask/network-controller";
3
- import type { RemoteNetworkConfiguration } from "../types.cjs";
4
- export type RPCEndpoint = NetworkConfiguration['rpcEndpoints'][number];
5
- export declare const createMockNetworkConfiguration: (override?: Partial<NetworkConfiguration>) => NetworkConfiguration;
6
- export declare const createMockRemoteNetworkConfiguration: (override?: Partial<RemoteNetworkConfiguration>) => RemoteNetworkConfiguration;
7
- export declare const createMockCustomRpcEndpoint: (override: Partial<Extract<RPCEndpoint, {
8
- type: RpcEndpointType.Custom;
9
- }>>) => RPCEndpoint;
10
- export declare const createMockInfuraRpcEndpoint: () => RPCEndpoint;
11
- //# sourceMappingURL=mockNetwork.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mockNetwork.d.cts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,qCAAqC;AACzE,OAAO,EAAE,eAAe,EAAE,qCAAqC;AAE/D,OAAO,KAAK,EAAE,0BAA0B,EAAE,qBAAiB;AAE3D,MAAM,MAAM,WAAW,GAAG,oBAAoB,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvE,eAAO,MAAM,8BAA8B,cAC9B,QAAQ,oBAAoB,CAAC,KACvC,oBAWF,CAAC;AAEF,eAAO,MAAM,oCAAoC,cACpC,QAAQ,0BAA0B,CAAC,KAC7C,0BAMF,CAAC;AAEF,eAAO,MAAM,2BAA2B,aAC5B,QAAQ,QAAQ,WAAW,EAAE;IAAE,IAAI,EAAE,gBAAgB,MAAM,CAAA;CAAE,CAAC,CAAC,KACxE,WAOF,CAAC;AAEF,eAAO,MAAM,2BAA2B,QAAO,WAM9C,CAAC"}
@@ -1,11 +0,0 @@
1
- import type { NetworkConfiguration } from "@metamask/network-controller";
2
- import { RpcEndpointType } from "@metamask/network-controller";
3
- import type { RemoteNetworkConfiguration } from "../types.mjs";
4
- export type RPCEndpoint = NetworkConfiguration['rpcEndpoints'][number];
5
- export declare const createMockNetworkConfiguration: (override?: Partial<NetworkConfiguration>) => NetworkConfiguration;
6
- export declare const createMockRemoteNetworkConfiguration: (override?: Partial<RemoteNetworkConfiguration>) => RemoteNetworkConfiguration;
7
- export declare const createMockCustomRpcEndpoint: (override: Partial<Extract<RPCEndpoint, {
8
- type: RpcEndpointType.Custom;
9
- }>>) => RPCEndpoint;
10
- export declare const createMockInfuraRpcEndpoint: () => RPCEndpoint;
11
- //# sourceMappingURL=mockNetwork.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mockNetwork.d.mts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,qCAAqC;AACzE,OAAO,EAAE,eAAe,EAAE,qCAAqC;AAE/D,OAAO,KAAK,EAAE,0BAA0B,EAAE,qBAAiB;AAE3D,MAAM,MAAM,WAAW,GAAG,oBAAoB,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvE,eAAO,MAAM,8BAA8B,cAC9B,QAAQ,oBAAoB,CAAC,KACvC,oBAWF,CAAC;AAEF,eAAO,MAAM,oCAAoC,cACpC,QAAQ,0BAA0B,CAAC,KAC7C,0BAMF,CAAC;AAEF,eAAO,MAAM,2BAA2B,aAC5B,QAAQ,QAAQ,WAAW,EAAE;IAAE,IAAI,EAAE,gBAAgB,MAAM,CAAA;CAAE,CAAC,CAAC,KACxE,WAOF,CAAC;AAEF,eAAO,MAAM,2BAA2B,QAAO,WAM9C,CAAC"}
@@ -1,36 +0,0 @@
1
- import { RpcEndpointType } from "@metamask/network-controller";
2
- export const createMockNetworkConfiguration = (override) => {
3
- return {
4
- chainId: '0x1337',
5
- blockExplorerUrls: ['https://etherscan.io'],
6
- defaultRpcEndpointIndex: 0,
7
- name: 'Mock Network',
8
- nativeCurrency: 'MOCK TOKEN',
9
- rpcEndpoints: [],
10
- defaultBlockExplorerUrlIndex: 0,
11
- ...override,
12
- };
13
- };
14
- export const createMockRemoteNetworkConfiguration = (override) => {
15
- return {
16
- v: '1',
17
- ...createMockNetworkConfiguration(),
18
- ...override,
19
- };
20
- };
21
- export const createMockCustomRpcEndpoint = (override) => {
22
- return {
23
- type: RpcEndpointType.Custom,
24
- networkClientId: '1111-1111-1111',
25
- url: `https://FAKE_RPC/`,
26
- ...override,
27
- };
28
- };
29
- export const createMockInfuraRpcEndpoint = () => {
30
- return {
31
- type: RpcEndpointType.Infura,
32
- networkClientId: 'mainnet',
33
- url: `https://mainnet.infura.io/v3/{infuraProjectId}`,
34
- };
35
- };
36
- //# sourceMappingURL=mockNetwork.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mockNetwork.mjs","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,qCAAqC;AAM/D,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAC5C,QAAwC,EAClB,EAAE;IACxB,OAAO;QACL,OAAO,EAAE,QAAQ;QACjB,iBAAiB,EAAE,CAAC,sBAAsB,CAAC;QAC3C,uBAAuB,EAAE,CAAC;QAC1B,IAAI,EAAE,cAAc;QACpB,cAAc,EAAE,YAAY;QAC5B,YAAY,EAAE,EAAE;QAChB,4BAA4B,EAAE,CAAC;QAC/B,GAAG,QAAQ;KACZ,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAClD,QAA8C,EAClB,EAAE;IAC9B,OAAO;QACL,CAAC,EAAE,GAAG;QACN,GAAG,8BAA8B,EAAE;QACnC,GAAG,QAAQ;KACZ,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACzC,QAAyE,EAC5D,EAAE;IACf,OAAO;QACL,IAAI,EAAE,eAAe,CAAC,MAAM;QAC5B,eAAe,EAAE,gBAAgB;QACjC,GAAG,EAAE,mBAAmB;QACxB,GAAG,QAAQ;KACG,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAgB,EAAE;IAC3D,OAAO;QACL,IAAI,EAAE,eAAe,CAAC,MAAM;QAC5B,eAAe,EAAE,SAAS;QAC1B,GAAG,EAAE,gDAAgD;KACtD,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { NetworkConfiguration } from '@metamask/network-controller';\nimport { RpcEndpointType } from '@metamask/network-controller';\n\nimport type { RemoteNetworkConfiguration } from '../types';\n\nexport type RPCEndpoint = NetworkConfiguration['rpcEndpoints'][number];\n\nexport const createMockNetworkConfiguration = (\n override?: Partial<NetworkConfiguration>,\n): NetworkConfiguration => {\n return {\n chainId: '0x1337',\n blockExplorerUrls: ['https://etherscan.io'],\n defaultRpcEndpointIndex: 0,\n name: 'Mock Network',\n nativeCurrency: 'MOCK TOKEN',\n rpcEndpoints: [],\n defaultBlockExplorerUrlIndex: 0,\n ...override,\n };\n};\n\nexport const createMockRemoteNetworkConfiguration = (\n override?: Partial<RemoteNetworkConfiguration>,\n): RemoteNetworkConfiguration => {\n return {\n v: '1',\n ...createMockNetworkConfiguration(),\n ...override,\n };\n};\n\nexport const createMockCustomRpcEndpoint = (\n override: Partial<Extract<RPCEndpoint, { type: RpcEndpointType.Custom }>>,\n): RPCEndpoint => {\n return {\n type: RpcEndpointType.Custom,\n networkClientId: '1111-1111-1111',\n url: `https://FAKE_RPC/`,\n ...override,\n } as RPCEndpoint;\n};\n\nexport const createMockInfuraRpcEndpoint = (): RPCEndpoint => {\n return {\n type: RpcEndpointType.Infura,\n networkClientId: 'mainnet',\n url: `https://mainnet.infura.io/v3/{infuraProjectId}`,\n };\n};\n"]}
@@ -1,124 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.arrangeAuthAPIs = exports.handleMockOAuth2Token = exports.handleMockSrpLogin = exports.handleMockPairIdentifiers = exports.handleMockSiweLogin = exports.handleMockNonce = exports.MOCK_OIDC_TOKEN_RESPONSE = exports.MOCK_SRP_LOGIN_RESPONSE = exports.MOCK_ACCESS_JWT = exports.MOCK_JWT = void 0;
7
- const nock_1 = __importDefault(require("nock"));
8
- const env_1 = require("../../shared/env.cjs");
9
- const services_1 = require("../authentication-jwt-bearer/services.cjs");
10
- const MOCK_NONCE_URL = (0, services_1.NONCE_URL)(env_1.Env.DEV);
11
- const MOCK_SIWE_LOGIN_URL = (0, services_1.SIWE_LOGIN_URL)(env_1.Env.DEV);
12
- const MOCK_PAIR_IDENTIFIERS_URL = (0, services_1.PAIR_IDENTIFIERS)(env_1.Env.DEV);
13
- const MOCK_SRP_LOGIN_URL = (0, services_1.SRP_LOGIN_URL)(env_1.Env.DEV);
14
- const MOCK_OIDC_TOKEN_URL = (0, services_1.OIDC_TOKEN_URL)(env_1.Env.DEV);
15
- exports.MOCK_JWT = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImIwNzE2N2U2LWJjNWUtNDgyZC1hNjRhLWU1MjQ0MjY2MGU3NyJ9.eyJzdWIiOiI1MzE0ODc5YWM2NDU1OGI3OTQ5ZmI4NWIzMjg2ZjZjNjUwODAzYmFiMTY0Y2QyOWNmMmM3YzdmMjMzMWMwZTRlIiwiaWF0IjoxNzA2MTEzMDYyLCJleHAiOjE3NjkxODUwNjMsImlzcyI6ImF1dGgubWV0YW1hc2suaW8iLCJhdWQiOiJwb3J0Zm9saW8ubWV0YW1hc2suaW8ifQ.E5UL6oABNweS8t5a6IBTqTf7NLOJbrhJSmEcsr7kwLp4bGvcENJzACwnsHDkA6PlzfDV09ZhAGU_F3hlS0j-erbY0k0AFR-GAtyS7E9N02D8RgUDz5oDR65CKmzM8JilgFA8UvruJ6OJGogroaOSOqzRES_s8MjHpP47RJ9lXrUesajsbOudXbuksXWg5QmWip6LLvjwr8UUzcJzNQilyIhiEpo4WdzWM4R3VtTwr4rHnWEvtYnYCov1jmI2w3YQ48y0M-3Y9IOO0ov_vlITRrOnR7Y7fRUGLUFmU5msD8mNWRywjQFLHfJJ1yNP5aJ8TkuCK3sC6kcUH335IVvukQ';
16
- exports.MOCK_ACCESS_JWT = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
17
- const MOCK_NONCE_RESPONSE = {
18
- nonce: 'xGMm9SoihEKeAEfV',
19
- identifier: '0xd8641601Cb79a94FD872fE42d5b4a067A44a7e88',
20
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
21
- expires_in: 300,
22
- };
23
- const MOCK_SIWE_LOGIN_RESPONSE = {
24
- token: exports.MOCK_JWT,
25
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
26
- expires_in: 3600,
27
- profile: {
28
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
29
- profile_id: 'fa2bbf82-bd9a-4e6b-aabc-9ca0d0319b6e',
30
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
31
- metametrics_id: 'de742679-4960-4977-a415-4718b5f8e86c',
32
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
33
- identifier_id: 'ec9a4e9906836497efad2fd4d4290b34d2c6a2c0d93eb174aa3cd88a133adbaf',
34
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
35
- identifier_type: 'SIWE',
36
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
37
- encrypted_storage_key: '2c6a2c0d93eb174aa3cd88a133adbaf',
38
- },
39
- };
40
- exports.MOCK_SRP_LOGIN_RESPONSE = {
41
- token: exports.MOCK_JWT,
42
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
43
- expires_in: 3600,
44
- profile: {
45
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
46
- profile_id: 'f88227bd-b615-41a3-b0be-467dd781a4ad',
47
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
48
- metametrics_id: '561ec651-a844-4b36-a451-04d6eac35740',
49
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
50
- identifier_id: 'da9a9fc7b09edde9cc23cec9b7e11a71fb0ab4d2ddd8af8af905306f3e1456fb',
51
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
52
- identifier_type: 'SRP',
53
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
54
- encrypted_storage_key: 'd2ddd8af8af905306f3e1456fb',
55
- },
56
- };
57
- exports.MOCK_OIDC_TOKEN_RESPONSE = {
58
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
59
- access_token: exports.MOCK_ACCESS_JWT,
60
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
61
- expires_in: 3600,
62
- };
63
- const handleMockNonce = (mockReply) => {
64
- const reply = mockReply ?? { status: 200, body: MOCK_NONCE_RESPONSE };
65
- const mockNonceEndpoint = (0, nock_1.default)(MOCK_NONCE_URL)
66
- .persist()
67
- .get('')
68
- .query(true)
69
- .reply(reply.status, reply.body);
70
- return mockNonceEndpoint;
71
- };
72
- exports.handleMockNonce = handleMockNonce;
73
- const handleMockSiweLogin = (mockReply) => {
74
- const reply = mockReply ?? { status: 200, body: MOCK_SIWE_LOGIN_RESPONSE };
75
- const mockLoginEndpoint = (0, nock_1.default)(MOCK_SIWE_LOGIN_URL)
76
- .persist()
77
- .post('')
78
- .reply(reply.status, reply.body);
79
- return mockLoginEndpoint;
80
- };
81
- exports.handleMockSiweLogin = handleMockSiweLogin;
82
- const handleMockPairIdentifiers = (mockReply) => {
83
- const reply = mockReply ?? { status: 204 };
84
- const mockPairIdentifiersEndpoint = (0, nock_1.default)(MOCK_PAIR_IDENTIFIERS_URL)
85
- .persist()
86
- .post('')
87
- .reply(reply.status, reply.body);
88
- return mockPairIdentifiersEndpoint;
89
- };
90
- exports.handleMockPairIdentifiers = handleMockPairIdentifiers;
91
- const handleMockSrpLogin = (mockReply) => {
92
- const reply = mockReply ?? { status: 200, body: exports.MOCK_SRP_LOGIN_RESPONSE };
93
- const mockLoginEndpoint = (0, nock_1.default)(MOCK_SRP_LOGIN_URL)
94
- .persist()
95
- .post('')
96
- .reply(reply.status, reply.body);
97
- return mockLoginEndpoint;
98
- };
99
- exports.handleMockSrpLogin = handleMockSrpLogin;
100
- const handleMockOAuth2Token = (mockReply) => {
101
- const reply = mockReply ?? { status: 200, body: exports.MOCK_OIDC_TOKEN_RESPONSE };
102
- const mockTokenEndpoint = (0, nock_1.default)(MOCK_OIDC_TOKEN_URL)
103
- .persist()
104
- .post('')
105
- .reply(reply.status, reply.body);
106
- return mockTokenEndpoint;
107
- };
108
- exports.handleMockOAuth2Token = handleMockOAuth2Token;
109
- const arrangeAuthAPIs = (options) => {
110
- const mockNonceUrl = (0, exports.handleMockNonce)(options?.mockNonceUrl);
111
- const mockOAuth2TokenUrl = (0, exports.handleMockOAuth2Token)(options?.mockOAuth2TokenUrl);
112
- const mockSrpLoginUrl = (0, exports.handleMockSrpLogin)(options?.mockSrpLoginUrl);
113
- const mockSiweLoginUrl = (0, exports.handleMockSiweLogin)(options?.mockSiweLoginUrl);
114
- const mockPairIdentifiersUrl = (0, exports.handleMockPairIdentifiers)(options?.mockPairIdentifiers);
115
- return {
116
- mockNonceUrl,
117
- mockOAuth2TokenUrl,
118
- mockSrpLoginUrl,
119
- mockSiweLoginUrl,
120
- mockPairIdentifiersUrl,
121
- };
122
- };
123
- exports.arrangeAuthAPIs = arrangeAuthAPIs;
124
- //# sourceMappingURL=mock-auth.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mock-auth.cjs","sourceRoot":"","sources":["../../../src/sdk/__fixtures__/mock-auth.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,8CAAuC;AACvC,wEAM+C;AAO/C,MAAM,cAAc,GAAG,IAAA,oBAAS,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;AAC1C,MAAM,mBAAmB,GAAG,IAAA,yBAAc,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;AACpD,MAAM,yBAAyB,GAAG,IAAA,2BAAgB,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;AAC5D,MAAM,kBAAkB,GAAG,IAAA,wBAAa,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,mBAAmB,GAAG,IAAA,yBAAc,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;AAEvC,QAAA,QAAQ,GACnB,opBAAopB,CAAC;AAE1oB,QAAA,eAAe,GAC1B,6JAA6J,CAAC;AAEhK,MAAM,m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AAiB,CAAC;AAC3B,CAAC,CAAC;AARW,QAAA,kBAAkB,sBAQ7B;AAEK,MAAM,qBAAqB,GAAG,CAAC,SAAqB,EAAE,EAAE;IAC7D,MAAM,KAAK,GAAG,SAAS,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,gCAAwB,EAAE,CAAC;IAC3E,MAAM,iBAAiB,GAAG,IAAA,cAAI,EAAC,mBAAmB,CAAC;SAChD,OAAO,EAAE;SACT,IAAI,CAAC,EAAE,CAAC;SACR,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAEnC,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AARW,QAAA,qBAAqB,yBAQhC;AAEK,MAAM,eAAe,GAAG,CAAC,OAM/B,EAAE,EAAE;IACH,MAAM,YAAY,GAAG,IAAA,uBAAe,EAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC5D,MAAM,kBAAkB,GAAG,IAAA,6BAAqB,EAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;IAC9E,MAAM,eAAe,GAAG,IAAA,0BAAkB,EAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACrE,MAAM,gBAAgB,GAAG,IAAA,2BAAmB,EAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IACxE,MAAM,sBAAsB,GAAG,IAAA,iCAAyB,EACtD,OAAO,EAAE,mBAAmB,CAC7B,CAAC;IAEF,OAAO;QACL,YAAY;QACZ,kBAAkB;QAClB,eAAe;QACf,gBAAgB;QAChB,sBAAsB;KACvB,CAAC;AACJ,CAAC,CAAC;AAtBW,QAAA,eAAe,mBAsB1B","sourcesContent":["import nock from 'nock';\n\nimport { Env } from '../../shared/env';\nimport {\n NONCE_URL,\n SIWE_LOGIN_URL,\n SRP_LOGIN_URL,\n OIDC_TOKEN_URL,\n PAIR_IDENTIFIERS,\n} from '../authentication-jwt-bearer/services';\n\ntype MockReply = {\n status: nock.StatusCode;\n body?: nock.Body;\n};\n\nconst MOCK_NONCE_URL = NONCE_URL(Env.DEV);\nconst MOCK_SIWE_LOGIN_URL = SIWE_LOGIN_URL(Env.DEV);\nconst MOCK_PAIR_IDENTIFIERS_URL = PAIR_IDENTIFIERS(Env.DEV);\nconst MOCK_SRP_LOGIN_URL = SRP_LOGIN_URL(Env.DEV);\nconst MOCK_OIDC_TOKEN_URL = OIDC_TOKEN_URL(Env.DEV);\n\nexport const MOCK_JWT =\n 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImIwNzE2N2U2LWJjNWUtNDgyZC1hNjRhLWU1MjQ0MjY2MGU3NyJ9.eyJzdWIiOiI1MzE0ODc5YWM2NDU1OGI3OTQ5ZmI4NWIzMjg2ZjZjNjUwODAzYmFiMTY0Y2QyOWNmMmM3YzdmMjMzMWMwZTRlIiwiaWF0IjoxNzA2MTEzMDYyLCJleHAiOjE3NjkxODUwNjMsImlzcyI6ImF1dGgubWV0YW1hc2suaW8iLCJhdWQiOiJwb3J0Zm9saW8ubWV0YW1hc2suaW8ifQ.E5UL6oABNweS8t5a6IBTqTf7NLOJbrhJSmEcsr7kwLp4bGvcENJzACwnsHDkA6PlzfDV09ZhAGU_F3hlS0j-erbY0k0AFR-GAtyS7E9N02D8RgUDz5oDR65CKmzM8JilgFA8UvruJ6OJGogroaOSOqzRES_s8MjHpP47RJ9lXrUesajsbOudXbuksXWg5QmWip6LLvjwr8UUzcJzNQilyIhiEpo4WdzWM4R3VtTwr4rHnWEvtYnYCov1jmI2w3YQ48y0M-3Y9IOO0ov_vlITRrOnR7Y7fRUGLUFmU5msD8mNWRywjQFLHfJJ1yNP5aJ8TkuCK3sC6kcUH335IVvukQ';\n\nexport const MOCK_ACCESS_JWT =\n 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';\n\nconst MOCK_NONCE_RESPONSE = {\n nonce: 'xGMm9SoihEKeAEfV',\n identifier: '0xd8641601Cb79a94FD872fE42d5b4a067A44a7e88',\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n expires_in: 300,\n};\n\nconst MOCK_SIWE_LOGIN_RESPONSE = {\n token: MOCK_JWT,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n expires_in: 3600,\n profile: {\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n profile_id: 'fa2bbf82-bd9a-4e6b-aabc-9ca0d0319b6e',\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n metametrics_id: 'de742679-4960-4977-a415-4718b5f8e86c',\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n identifier_id:\n 'ec9a4e9906836497efad2fd4d4290b34d2c6a2c0d93eb174aa3cd88a133adbaf',\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n identifier_type: 'SIWE',\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n encrypted_storage_key: '2c6a2c0d93eb174aa3cd88a133adbaf',\n },\n};\n\nexport const MOCK_SRP_LOGIN_RESPONSE = {\n token: MOCK_JWT,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n expires_in: 3600,\n profile: {\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n profile_id: 'f88227bd-b615-41a3-b0be-467dd781a4ad',\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n metametrics_id: '561ec651-a844-4b36-a451-04d6eac35740',\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n identifier_id:\n 'da9a9fc7b09edde9cc23cec9b7e11a71fb0ab4d2ddd8af8af905306f3e1456fb',\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n identifier_type: 'SRP',\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n encrypted_storage_key: 'd2ddd8af8af905306f3e1456fb',\n },\n};\n\nexport const MOCK_OIDC_TOKEN_RESPONSE = {\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n access_token: MOCK_ACCESS_JWT,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n expires_in: 3600,\n};\n\nexport const handleMockNonce = (mockReply?: MockReply) => {\n const reply = mockReply ?? { status: 200, body: MOCK_NONCE_RESPONSE };\n\n const mockNonceEndpoint = nock(MOCK_NONCE_URL)\n .persist()\n .get('')\n .query(true)\n .reply(reply.status, reply.body);\n\n return mockNonceEndpoint;\n};\n\nexport const handleMockSiweLogin = (mockReply?: MockReply) => {\n const reply = mockReply ?? { status: 200, body: MOCK_SIWE_LOGIN_RESPONSE };\n const mockLoginEndpoint = nock(MOCK_SIWE_LOGIN_URL)\n .persist()\n .post('')\n .reply(reply.status, reply.body);\n\n return mockLoginEndpoint;\n};\n\nexport const handleMockPairIdentifiers = (mockReply?: MockReply) => {\n const reply = mockReply ?? { status: 204 };\n const mockPairIdentifiersEndpoint = nock(MOCK_PAIR_IDENTIFIERS_URL)\n .persist()\n .post('')\n .reply(reply.status, reply.body);\n\n return mockPairIdentifiersEndpoint;\n};\n\nexport const handleMockSrpLogin = (mockReply?: MockReply) => {\n const reply = mockReply ?? { status: 200, body: MOCK_SRP_LOGIN_RESPONSE };\n const mockLoginEndpoint = nock(MOCK_SRP_LOGIN_URL)\n .persist()\n .post('')\n .reply(reply.status, reply.body);\n\n return mockLoginEndpoint;\n};\n\nexport const handleMockOAuth2Token = (mockReply?: MockReply) => {\n const reply = mockReply ?? { status: 200, body: MOCK_OIDC_TOKEN_RESPONSE };\n const mockTokenEndpoint = nock(MOCK_OIDC_TOKEN_URL)\n .persist()\n .post('')\n .reply(reply.status, reply.body);\n\n return mockTokenEndpoint;\n};\n\nexport const arrangeAuthAPIs = (options?: {\n mockNonceUrl?: MockReply;\n mockOAuth2TokenUrl?: MockReply;\n mockSrpLoginUrl?: MockReply;\n mockSiweLoginUrl?: MockReply;\n mockPairIdentifiers?: MockReply;\n}) => {\n const mockNonceUrl = handleMockNonce(options?.mockNonceUrl);\n const mockOAuth2TokenUrl = handleMockOAuth2Token(options?.mockOAuth2TokenUrl);\n const mockSrpLoginUrl = handleMockSrpLogin(options?.mockSrpLoginUrl);\n const mockSiweLoginUrl = handleMockSiweLogin(options?.mockSiweLoginUrl);\n const mockPairIdentifiersUrl = handleMockPairIdentifiers(\n options?.mockPairIdentifiers,\n );\n\n return {\n mockNonceUrl,\n mockOAuth2TokenUrl,\n mockSrpLoginUrl,\n mockSiweLoginUrl,\n mockPairIdentifiersUrl,\n };\n};\n"]}
@@ -1,42 +0,0 @@
1
- import nock from "nock";
2
- type MockReply = {
3
- status: nock.StatusCode;
4
- body?: nock.Body;
5
- };
6
- export declare const MOCK_JWT = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImIwNzE2N2U2LWJjNWUtNDgyZC1hNjRhLWU1MjQ0MjY2MGU3NyJ9.eyJzdWIiOiI1MzE0ODc5YWM2NDU1OGI3OTQ5ZmI4NWIzMjg2ZjZjNjUwODAzYmFiMTY0Y2QyOWNmMmM3YzdmMjMzMWMwZTRlIiwiaWF0IjoxNzA2MTEzMDYyLCJleHAiOjE3NjkxODUwNjMsImlzcyI6ImF1dGgubWV0YW1hc2suaW8iLCJhdWQiOiJwb3J0Zm9saW8ubWV0YW1hc2suaW8ifQ.E5UL6oABNweS8t5a6IBTqTf7NLOJbrhJSmEcsr7kwLp4bGvcENJzACwnsHDkA6PlzfDV09ZhAGU_F3hlS0j-erbY0k0AFR-GAtyS7E9N02D8RgUDz5oDR65CKmzM8JilgFA8UvruJ6OJGogroaOSOqzRES_s8MjHpP47RJ9lXrUesajsbOudXbuksXWg5QmWip6LLvjwr8UUzcJzNQilyIhiEpo4WdzWM4R3VtTwr4rHnWEvtYnYCov1jmI2w3YQ48y0M-3Y9IOO0ov_vlITRrOnR7Y7fRUGLUFmU5msD8mNWRywjQFLHfJJ1yNP5aJ8TkuCK3sC6kcUH335IVvukQ";
7
- export declare const MOCK_ACCESS_JWT = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
8
- export declare const MOCK_SRP_LOGIN_RESPONSE: {
9
- token: string;
10
- expires_in: number;
11
- profile: {
12
- profile_id: string;
13
- metametrics_id: string;
14
- identifier_id: string;
15
- identifier_type: string;
16
- encrypted_storage_key: string;
17
- };
18
- };
19
- export declare const MOCK_OIDC_TOKEN_RESPONSE: {
20
- access_token: string;
21
- expires_in: number;
22
- };
23
- export declare const handleMockNonce: (mockReply?: MockReply) => nock.Scope;
24
- export declare const handleMockSiweLogin: (mockReply?: MockReply) => nock.Scope;
25
- export declare const handleMockPairIdentifiers: (mockReply?: MockReply) => nock.Scope;
26
- export declare const handleMockSrpLogin: (mockReply?: MockReply) => nock.Scope;
27
- export declare const handleMockOAuth2Token: (mockReply?: MockReply) => nock.Scope;
28
- export declare const arrangeAuthAPIs: (options?: {
29
- mockNonceUrl?: MockReply;
30
- mockOAuth2TokenUrl?: MockReply;
31
- mockSrpLoginUrl?: MockReply;
32
- mockSiweLoginUrl?: MockReply;
33
- mockPairIdentifiers?: MockReply;
34
- }) => {
35
- mockNonceUrl: nock.Scope;
36
- mockOAuth2TokenUrl: nock.Scope;
37
- mockSrpLoginUrl: nock.Scope;
38
- mockSiweLoginUrl: nock.Scope;
39
- mockPairIdentifiersUrl: nock.Scope;
40
- };
41
- export {};
42
- //# sourceMappingURL=mock-auth.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mock-auth.d.cts","sourceRoot":"","sources":["../../../src/sdk/__fixtures__/mock-auth.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,aAAa;AAWxB,KAAK,SAAS,GAAG;IACf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3J0Zm9saW8ubWV0YW1hc2suaW8ifQ.E5UL6oABNweS8t5a6IBTqTf7NLOJbrhJSmEcsr7kwLp4bGvcENJzACwnsHDkA6PlzfDV09ZhAGU_F3hlS0j-erbY0k0AFR-GAtyS7E9N02D8RgUDz5oDR65CKmzM8JilgFA8UvruJ6OJGogroaOSOqzRES_s8MjHpP47RJ9lXrUesajsbOudXbuksXWg5QmWip6LLvjwr8UUzcJzNQilyIhiEpo4WdzWM4R3VtTwr4rHnWEvtYnYCov1jmI2w3YQ48y0M-3Y9IOO0ov_vlITRrOnR7Y7fRUGLUFmU5msD8mNWRywjQFLHfJJ1yNP5aJ8TkuCK3sC6kcUH335IVvukQ";
7
- export declare const MOCK_ACCESS_JWT = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
8
- export declare const MOCK_SRP_LOGIN_RESPONSE: {
9
- token: string;
10
- expires_in: number;
11
- profile: {
12
- profile_id: string;
13
- metametrics_id: string;
14
- identifier_id: string;
15
- identifier_type: string;
16
- encrypted_storage_key: string;
17
- };
18
- };
19
- export declare const MOCK_OIDC_TOKEN_RESPONSE: {
20
- access_token: string;
21
- expires_in: number;
22
- };
23
- export declare const handleMockNonce: (mockReply?: MockReply) => nock.Scope;
24
- export declare const handleMockSiweLogin: (mockReply?: MockReply) => nock.Scope;
25
- export declare const handleMockPairIdentifiers: (mockReply?: MockReply) => nock.Scope;
26
- export declare const handleMockSrpLogin: (mockReply?: MockReply) => nock.Scope;
27
- export declare const handleMockOAuth2Token: (mockReply?: MockReply) => nock.Scope;
28
- export declare const arrangeAuthAPIs: (options?: {
29
- mockNonceUrl?: MockReply;
30
- mockOAuth2TokenUrl?: MockReply;
31
- mockSrpLoginUrl?: MockReply;
32
- mockSiweLoginUrl?: MockReply;
33
- mockPairIdentifiers?: MockReply;
34
- }) => {
35
- mockNonceUrl: nock.Scope;
36
- mockOAuth2TokenUrl: nock.Scope;
37
- mockSrpLoginUrl: nock.Scope;
38
- mockSiweLoginUrl: nock.Scope;
39
- mockPairIdentifiersUrl: nock.Scope;
40
- };
41
- export {};
42
- //# sourceMappingURL=mock-auth.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mock-auth.d.mts","sourceRoot":"","sources":["../../../src/sdk/__fixtures__/mock-auth.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,aAAa;AAWxB,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC;CAClB,CAAC;AAQF,eAAO,MAAM,QAAQ,upBACioB,CAAC;AAEvpB,eAAO,MAAM,eAAe,gKACmI,CAAC;AAmChK,eAAO,MAAM,uBAAuB;;;;;;;;;;CAuBnC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;CAOpC,CAAC;AAEF,eAAO,MAAM,eAAe,eAAgB,SAAS,eAUpD,CAAC;AAEF,eAAO,MAAM,mBAAmB,eAAgB,SAAS,eAQxD,CAAC;AAEF,eAAO,MAAM,yBAAyB,eAAgB,SAAS,eAQ9D,CAAC;AAEF,eAAO,MAAM,kBAAkB,eAAgB,SAAS,eAQvD,CAAC;AAEF,eAAO,MAAM,qBAAqB,eAAgB,SAAS,eAQ1D,CAAC;AAEF,eAAO,MAAM,eAAe,aAAc;IACxC,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAC/B,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,mBAAmB,CAAC,EAAE,SAAS,CAAC;CACjC;;;;;;CAgBA,CAAC"}
@@ -1,119 +0,0 @@
1
- function $importDefault(module) {
2
- if (module?.__esModule) {
3
- return module.default;
4
- }
5
- return module;
6
- }
7
- import $nock from "nock";
8
- const nock = $importDefault($nock);
9
- import { Env } from "../../shared/env.mjs";
10
- import { NONCE_URL, SIWE_LOGIN_URL, SRP_LOGIN_URL, OIDC_TOKEN_URL, PAIR_IDENTIFIERS } from "../authentication-jwt-bearer/services.mjs";
11
- const MOCK_NONCE_URL = NONCE_URL(Env.DEV);
12
- const MOCK_SIWE_LOGIN_URL = SIWE_LOGIN_URL(Env.DEV);
13
- const MOCK_PAIR_IDENTIFIERS_URL = PAIR_IDENTIFIERS(Env.DEV);
14
- const MOCK_SRP_LOGIN_URL = SRP_LOGIN_URL(Env.DEV);
15
- const MOCK_OIDC_TOKEN_URL = OIDC_TOKEN_URL(Env.DEV);
16
- export const MOCK_JWT = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImIwNzE2N2U2LWJjNWUtNDgyZC1hNjRhLWU1MjQ0MjY2MGU3NyJ9.eyJzdWIiOiI1MzE0ODc5YWM2NDU1OGI3OTQ5ZmI4NWIzMjg2ZjZjNjUwODAzYmFiMTY0Y2QyOWNmMmM3YzdmMjMzMWMwZTRlIiwiaWF0IjoxNzA2MTEzMDYyLCJleHAiOjE3NjkxODUwNjMsImlzcyI6ImF1dGgubWV0YW1hc2suaW8iLCJhdWQiOiJwb3J0Zm9saW8ubWV0YW1hc2suaW8ifQ.E5UL6oABNweS8t5a6IBTqTf7NLOJbrhJSmEcsr7kwLp4bGvcENJzACwnsHDkA6PlzfDV09ZhAGU_F3hlS0j-erbY0k0AFR-GAtyS7E9N02D8RgUDz5oDR65CKmzM8JilgFA8UvruJ6OJGogroaOSOqzRES_s8MjHpP47RJ9lXrUesajsbOudXbuksXWg5QmWip6LLvjwr8UUzcJzNQilyIhiEpo4WdzWM4R3VtTwr4rHnWEvtYnYCov1jmI2w3YQ48y0M-3Y9IOO0ov_vlITRrOnR7Y7fRUGLUFmU5msD8mNWRywjQFLHfJJ1yNP5aJ8TkuCK3sC6kcUH335IVvukQ';
17
- export const MOCK_ACCESS_JWT = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
18
- const MOCK_NONCE_RESPONSE = {
19
- nonce: 'xGMm9SoihEKeAEfV',
20
- identifier: '0xd8641601Cb79a94FD872fE42d5b4a067A44a7e88',
21
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
22
- expires_in: 300,
23
- };
24
- const MOCK_SIWE_LOGIN_RESPONSE = {
25
- token: MOCK_JWT,
26
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
27
- expires_in: 3600,
28
- profile: {
29
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
30
- profile_id: 'fa2bbf82-bd9a-4e6b-aabc-9ca0d0319b6e',
31
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
32
- metametrics_id: 'de742679-4960-4977-a415-4718b5f8e86c',
33
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
34
- identifier_id: 'ec9a4e9906836497efad2fd4d4290b34d2c6a2c0d93eb174aa3cd88a133adbaf',
35
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
36
- identifier_type: 'SIWE',
37
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
38
- encrypted_storage_key: '2c6a2c0d93eb174aa3cd88a133adbaf',
39
- },
40
- };
41
- export const MOCK_SRP_LOGIN_RESPONSE = {
42
- token: MOCK_JWT,
43
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
44
- expires_in: 3600,
45
- profile: {
46
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
47
- profile_id: 'f88227bd-b615-41a3-b0be-467dd781a4ad',
48
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
49
- metametrics_id: '561ec651-a844-4b36-a451-04d6eac35740',
50
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
51
- identifier_id: 'da9a9fc7b09edde9cc23cec9b7e11a71fb0ab4d2ddd8af8af905306f3e1456fb',
52
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
53
- identifier_type: 'SRP',
54
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
55
- encrypted_storage_key: 'd2ddd8af8af905306f3e1456fb',
56
- },
57
- };
58
- export const MOCK_OIDC_TOKEN_RESPONSE = {
59
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
60
- access_token: MOCK_ACCESS_JWT,
61
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
62
- expires_in: 3600,
63
- };
64
- export const handleMockNonce = (mockReply) => {
65
- const reply = mockReply ?? { status: 200, body: MOCK_NONCE_RESPONSE };
66
- const mockNonceEndpoint = nock(MOCK_NONCE_URL)
67
- .persist()
68
- .get('')
69
- .query(true)
70
- .reply(reply.status, reply.body);
71
- return mockNonceEndpoint;
72
- };
73
- export const handleMockSiweLogin = (mockReply) => {
74
- const reply = mockReply ?? { status: 200, body: MOCK_SIWE_LOGIN_RESPONSE };
75
- const mockLoginEndpoint = nock(MOCK_SIWE_LOGIN_URL)
76
- .persist()
77
- .post('')
78
- .reply(reply.status, reply.body);
79
- return mockLoginEndpoint;
80
- };
81
- export const handleMockPairIdentifiers = (mockReply) => {
82
- const reply = mockReply ?? { status: 204 };
83
- const mockPairIdentifiersEndpoint = nock(MOCK_PAIR_IDENTIFIERS_URL)
84
- .persist()
85
- .post('')
86
- .reply(reply.status, reply.body);
87
- return mockPairIdentifiersEndpoint;
88
- };
89
- export const handleMockSrpLogin = (mockReply) => {
90
- const reply = mockReply ?? { status: 200, body: MOCK_SRP_LOGIN_RESPONSE };
91
- const mockLoginEndpoint = nock(MOCK_SRP_LOGIN_URL)
92
- .persist()
93
- .post('')
94
- .reply(reply.status, reply.body);
95
- return mockLoginEndpoint;
96
- };
97
- export const handleMockOAuth2Token = (mockReply) => {
98
- const reply = mockReply ?? { status: 200, body: MOCK_OIDC_TOKEN_RESPONSE };
99
- const mockTokenEndpoint = nock(MOCK_OIDC_TOKEN_URL)
100
- .persist()
101
- .post('')
102
- .reply(reply.status, reply.body);
103
- return mockTokenEndpoint;
104
- };
105
- export const arrangeAuthAPIs = (options) => {
106
- const mockNonceUrl = handleMockNonce(options?.mockNonceUrl);
107
- const mockOAuth2TokenUrl = handleMockOAuth2Token(options?.mockOAuth2TokenUrl);
108
- const mockSrpLoginUrl = handleMockSrpLogin(options?.mockSrpLoginUrl);
109
- const mockSiweLoginUrl = handleMockSiweLogin(options?.mockSiweLoginUrl);
110
- const mockPairIdentifiersUrl = handleMockPairIdentifiers(options?.mockPairIdentifiers);
111
- return {
112
- mockNonceUrl,
113
- mockOAuth2TokenUrl,
114
- mockSrpLoginUrl,
115
- mockSiweLoginUrl,
116
- mockPairIdentifiersUrl,
117
- };
118
- };
119
- //# sourceMappingURL=mock-auth.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mock-auth.mjs","sourceRoot":"","sources":["../../../src/sdk/__fixtures__/mock-auth.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,KAAI,aAAa;;AAExB,OAAO,EAAE,GAAG,EAAE,6BAAyB;AACvC,OAAO,EACL,SAAS,EACT,cAAc,EACd,aAAa,EACb,cAAc,EACd,gBAAgB,EACjB,kDAA8C;AAO/C,MAAM,cAAc,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC1C,MAAM,mBAAmB,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACpD,MAAM,yBAAyB,GAAG,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC5D,MAAM,kBAAkB,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,mBAAmB,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEpD,MAAM,CAAC,MAAM,QAAQ,GACnB,opBAAopB,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C,IAAI,CAAC,CAAC;IAEnC,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,SAAqB,EAAE,EAAE;IAC7D,MAAM,KAAK,GAAG,SAAS,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,wBAAwB,EAAE,CAAC;IAC3E,MAAM,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,CAAC;SAChD,OAAO,EAAE;SACT,IAAI,CAAC,EAAE,CAAC;SACR,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAEnC,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAM/B,EAAE,EAAE;IACH,MAAM,YAAY,GAAG,eAAe,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC5D,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;IAC9E,MAAM,eAAe,GAAG,kBAAkB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACrE,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IACxE,MAAM,sBAAsB,GAAG,yBAAyB,CACtD,OAAO,EAAE,mBAAmB,CAC7B,CAAC;IAEF,OAAO;QACL,YAAY;QACZ,kBAAkB;QAClB,eAAe;QACf,gBAAgB;QAChB,sBAAsB;KACvB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import nock from 'nock';\n\nimport { Env } from '../../shared/env';\nimport {\n NONCE_URL,\n SIWE_LOGIN_URL,\n SRP_LOGIN_URL,\n OIDC_TOKEN_URL,\n PAIR_IDENTIFIERS,\n} from '../authentication-jwt-bearer/services';\n\ntype MockReply = {\n status: nock.StatusCode;\n body?: nock.Body;\n};\n\nconst MOCK_NONCE_URL = NONCE_URL(Env.DEV);\nconst M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ESPONSE = {\n nonce: 'xGMm9SoihEKeAEfV',\n identifier: '0xd8641601Cb79a94FD872fE42d5b4a067A44a7e88',\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n expires_in: 300,\n};\n\nconst MOCK_SIWE_LOGIN_RESPONSE = {\n token: MOCK_JWT,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n expires_in: 3600,\n profile: {\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n profile_id: 'fa2bbf82-bd9a-4e6b-aabc-9ca0d0319b6e',\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n metametrics_id: 'de742679-4960-4977-a415-4718b5f8e86c',\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n identifier_id:\n 'ec9a4e9906836497efad2fd4d4290b34d2c6a2c0d93eb174aa3cd88a133adbaf',\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n identifier_type: 'SIWE',\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n encrypted_storage_key: '2c6a2c0d93eb174aa3cd88a133adbaf',\n },\n};\n\nexport const MOCK_SRP_LOGIN_RESPONSE = {\n token: MOCK_JWT,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n expires_in: 3600,\n profile: {\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n profile_id: 'f88227bd-b615-41a3-b0be-467dd781a4ad',\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n metametrics_id: '561ec651-a844-4b36-a451-04d6eac35740',\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n identifier_id:\n 'da9a9fc7b09edde9cc23cec9b7e11a71fb0ab4d2ddd8af8af905306f3e1456fb',\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n identifier_type: 'SRP',\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n encrypted_storage_key: 'd2ddd8af8af905306f3e1456fb',\n },\n};\n\nexport const MOCK_OIDC_TOKEN_RESPONSE = {\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n access_token: MOCK_ACCESS_JWT,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n expires_in: 3600,\n};\n\nexport const handleMockNonce = (mockReply?: MockReply) => {\n const reply = mockReply ?? { status: 200, body: MOCK_NONCE_RESPONSE };\n\n const mockNonceEndpoint = nock(MOCK_NONCE_URL)\n .persist()\n .get('')\n .query(true)\n .reply(reply.status, reply.body);\n\n return mockNonceEndpoint;\n};\n\nexport const handleMockSiweLogin = (mockReply?: MockReply) => {\n const reply = mockReply ?? { status: 200, body: MOCK_SIWE_LOGIN_RESPONSE };\n const mockLoginEndpoint = nock(MOCK_SIWE_LOGIN_URL)\n .persist()\n .post('')\n .reply(reply.status, reply.body);\n\n return mockLoginEndpoint;\n};\n\nexport const handleMockPairIdentifiers = (mockReply?: MockReply) => {\n const reply = mockReply ?? { status: 204 };\n const mockPairIdentifiersEndpoint = nock(MOCK_PAIR_IDENTIFIERS_URL)\n .persist()\n .post('')\n .reply(reply.status, reply.body);\n\n return mockPairIdentifiersEndpoint;\n};\n\nexport const handleMockSrpLogin = (mockReply?: MockReply) => {\n const reply = mockReply ?? { status: 200, body: MOCK_SRP_LOGIN_RESPONSE };\n const mockLoginEndpoint = nock(MOCK_SRP_LOGIN_URL)\n .persist()\n .post('')\n .reply(reply.status, reply.body);\n\n return mockLoginEndpoint;\n};\n\nexport const handleMockOAuth2Token = (mockReply?: MockReply) => {\n const reply = mockReply ?? { status: 200, body: MOCK_OIDC_TOKEN_RESPONSE };\n const mockTokenEndpoint = nock(MOCK_OIDC_TOKEN_URL)\n .persist()\n .post('')\n .reply(reply.status, reply.body);\n\n return mockTokenEndpoint;\n};\n\nexport const arrangeAuthAPIs = (options?: {\n mockNonceUrl?: MockReply;\n mockOAuth2TokenUrl?: MockReply;\n mockSrpLoginUrl?: MockReply;\n mockSiweLoginUrl?: MockReply;\n mockPairIdentifiers?: MockReply;\n}) => {\n const mockNonceUrl = handleMockNonce(options?.mockNonceUrl);\n const mockOAuth2TokenUrl = handleMockOAuth2Token(options?.mockOAuth2TokenUrl);\n const mockSrpLoginUrl = handleMockSrpLogin(options?.mockSrpLoginUrl);\n const mockSiweLoginUrl = handleMockSiweLogin(options?.mockSiweLoginUrl);\n const mockPairIdentifiersUrl = handleMockPairIdentifiers(\n options?.mockPairIdentifiers,\n );\n\n return {\n mockNonceUrl,\n mockOAuth2TokenUrl,\n mockSrpLoginUrl,\n mockSiweLoginUrl,\n mockPairIdentifiersUrl,\n };\n};\n"]}