@metamask/profile-sync-controller 9.0.0 → 10.1.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 (154) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/dist/controllers/authentication/AuthenticationController.cjs +53 -90
  3. package/dist/controllers/authentication/AuthenticationController.cjs.map +1 -1
  4. package/dist/controllers/authentication/AuthenticationController.d.cts +11 -23
  5. package/dist/controllers/authentication/AuthenticationController.d.cts.map +1 -1
  6. package/dist/controllers/authentication/AuthenticationController.d.mts +11 -23
  7. package/dist/controllers/authentication/AuthenticationController.d.mts.map +1 -1
  8. package/dist/controllers/authentication/AuthenticationController.mjs +53 -90
  9. package/dist/controllers/authentication/AuthenticationController.mjs.map +1 -1
  10. package/dist/controllers/authentication/mocks/mockResponses.cjs +10 -23
  11. package/dist/controllers/authentication/mocks/mockResponses.cjs.map +1 -1
  12. package/dist/controllers/authentication/mocks/mockResponses.d.cts +42 -10
  13. package/dist/controllers/authentication/mocks/mockResponses.d.cts.map +1 -1
  14. package/dist/controllers/authentication/mocks/mockResponses.d.mts +42 -10
  15. package/dist/controllers/authentication/mocks/mockResponses.d.mts.map +1 -1
  16. package/dist/controllers/authentication/mocks/mockResponses.mjs +9 -22
  17. package/dist/controllers/authentication/mocks/mockResponses.mjs.map +1 -1
  18. package/dist/controllers/user-storage/UserStorageController.cjs +76 -127
  19. package/dist/controllers/user-storage/UserStorageController.cjs.map +1 -1
  20. package/dist/controllers/user-storage/UserStorageController.d.cts +10 -4
  21. package/dist/controllers/user-storage/UserStorageController.d.cts.map +1 -1
  22. package/dist/controllers/user-storage/UserStorageController.d.mts +10 -4
  23. package/dist/controllers/user-storage/UserStorageController.d.mts.map +1 -1
  24. package/dist/controllers/user-storage/UserStorageController.mjs +76 -127
  25. package/dist/controllers/user-storage/UserStorageController.mjs.map +1 -1
  26. package/dist/controllers/user-storage/account-syncing/controller-integration.cjs +1 -1
  27. package/dist/controllers/user-storage/account-syncing/controller-integration.cjs.map +1 -1
  28. package/dist/controllers/user-storage/account-syncing/controller-integration.mjs +1 -1
  29. package/dist/controllers/user-storage/account-syncing/controller-integration.mjs.map +1 -1
  30. package/dist/controllers/user-storage/account-syncing/sync-utils.cjs +1 -0
  31. package/dist/controllers/user-storage/account-syncing/sync-utils.cjs.map +1 -1
  32. package/dist/controllers/user-storage/account-syncing/sync-utils.d.cts.map +1 -1
  33. package/dist/controllers/user-storage/account-syncing/sync-utils.d.mts.map +1 -1
  34. package/dist/controllers/user-storage/account-syncing/sync-utils.mjs +1 -0
  35. package/dist/controllers/user-storage/account-syncing/sync-utils.mjs.map +1 -1
  36. package/dist/controllers/user-storage/mocks/mockResponses.cjs +3 -3
  37. package/dist/controllers/user-storage/mocks/mockResponses.cjs.map +1 -1
  38. package/dist/controllers/user-storage/mocks/mockResponses.d.cts +1 -1
  39. package/dist/controllers/user-storage/mocks/mockResponses.d.cts.map +1 -1
  40. package/dist/controllers/user-storage/mocks/mockResponses.d.mts +1 -1
  41. package/dist/controllers/user-storage/mocks/mockResponses.d.mts.map +1 -1
  42. package/dist/controllers/user-storage/mocks/mockResponses.mjs +3 -3
  43. package/dist/controllers/user-storage/mocks/mockResponses.mjs.map +1 -1
  44. package/dist/controllers/user-storage/network-syncing/controller-integration.cjs +14 -14
  45. package/dist/controllers/user-storage/network-syncing/controller-integration.cjs.map +1 -1
  46. package/dist/controllers/user-storage/network-syncing/controller-integration.d.cts +3 -3
  47. package/dist/controllers/user-storage/network-syncing/controller-integration.d.cts.map +1 -1
  48. package/dist/controllers/user-storage/network-syncing/controller-integration.d.mts +3 -3
  49. package/dist/controllers/user-storage/network-syncing/controller-integration.d.mts.map +1 -1
  50. package/dist/controllers/user-storage/network-syncing/controller-integration.mjs +14 -14
  51. package/dist/controllers/user-storage/network-syncing/controller-integration.mjs.map +1 -1
  52. package/dist/controllers/user-storage/network-syncing/services.cjs +27 -23
  53. package/dist/controllers/user-storage/network-syncing/services.cjs.map +1 -1
  54. package/dist/controllers/user-storage/network-syncing/services.d.cts +16 -7
  55. package/dist/controllers/user-storage/network-syncing/services.d.cts.map +1 -1
  56. package/dist/controllers/user-storage/network-syncing/services.d.mts +16 -7
  57. package/dist/controllers/user-storage/network-syncing/services.d.mts.map +1 -1
  58. package/dist/controllers/user-storage/network-syncing/services.mjs +27 -23
  59. package/dist/controllers/user-storage/network-syncing/services.mjs.map +1 -1
  60. package/dist/controllers/user-storage/network-syncing/sync-mutations.cjs.map +1 -1
  61. package/dist/controllers/user-storage/network-syncing/sync-mutations.d.cts +13 -5
  62. package/dist/controllers/user-storage/network-syncing/sync-mutations.d.cts.map +1 -1
  63. package/dist/controllers/user-storage/network-syncing/sync-mutations.d.mts +13 -5
  64. package/dist/controllers/user-storage/network-syncing/sync-mutations.d.mts.map +1 -1
  65. package/dist/controllers/user-storage/network-syncing/sync-mutations.mjs.map +1 -1
  66. package/dist/controllers/user-storage/types.cjs +3 -0
  67. package/dist/controllers/user-storage/types.cjs.map +1 -0
  68. package/dist/controllers/user-storage/types.d.cts +23 -0
  69. package/dist/controllers/user-storage/types.d.cts.map +1 -0
  70. package/dist/controllers/user-storage/types.d.mts +23 -0
  71. package/dist/controllers/user-storage/types.d.mts.map +1 -0
  72. package/dist/controllers/user-storage/types.mjs +2 -0
  73. package/dist/controllers/user-storage/types.mjs.map +1 -0
  74. package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs +7 -8
  75. package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs.map +1 -1
  76. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts +2 -0
  77. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts.map +1 -1
  78. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts +2 -0
  79. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts.map +1 -1
  80. package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs +8 -9
  81. package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs.map +1 -1
  82. package/dist/sdk/authentication-jwt-bearer/services.cjs +10 -2
  83. package/dist/sdk/authentication-jwt-bearer/services.cjs.map +1 -1
  84. package/dist/sdk/authentication-jwt-bearer/services.d.cts +3 -1
  85. package/dist/sdk/authentication-jwt-bearer/services.d.cts.map +1 -1
  86. package/dist/sdk/authentication-jwt-bearer/services.d.mts +3 -1
  87. package/dist/sdk/authentication-jwt-bearer/services.d.mts.map +1 -1
  88. package/dist/sdk/authentication-jwt-bearer/services.mjs +10 -2
  89. package/dist/sdk/authentication-jwt-bearer/services.mjs.map +1 -1
  90. package/dist/sdk/authentication-jwt-bearer/types.cjs.map +1 -1
  91. package/dist/sdk/authentication-jwt-bearer/types.mjs.map +1 -1
  92. package/dist/sdk/authentication.cjs.map +1 -1
  93. package/dist/sdk/authentication.d.cts +1 -1
  94. package/dist/sdk/authentication.d.cts.map +1 -1
  95. package/dist/sdk/authentication.d.mts +1 -1
  96. package/dist/sdk/authentication.d.mts.map +1 -1
  97. package/dist/sdk/authentication.mjs.map +1 -1
  98. package/dist/sdk/mocks/auth.cjs +44 -0
  99. package/dist/sdk/mocks/auth.cjs.map +1 -0
  100. package/dist/sdk/mocks/auth.d.cts +39 -0
  101. package/dist/sdk/mocks/auth.d.cts.map +1 -0
  102. package/dist/sdk/mocks/auth.d.mts +39 -0
  103. package/dist/sdk/mocks/auth.d.mts.map +1 -0
  104. package/dist/sdk/mocks/auth.mjs +41 -0
  105. package/dist/sdk/mocks/auth.mjs.map +1 -0
  106. package/dist/sdk/mocks/userstorage.cjs +43 -0
  107. package/dist/sdk/mocks/userstorage.cjs.map +1 -0
  108. package/dist/sdk/mocks/userstorage.d.cts +10 -0
  109. package/dist/sdk/mocks/userstorage.d.cts.map +1 -0
  110. package/dist/sdk/mocks/userstorage.d.mts +10 -0
  111. package/dist/sdk/mocks/userstorage.d.mts.map +1 -0
  112. package/dist/sdk/mocks/userstorage.mjs +15 -0
  113. package/dist/sdk/mocks/userstorage.mjs.map +1 -0
  114. package/dist/sdk/user-storage.cjs +39 -43
  115. package/dist/sdk/user-storage.cjs.map +1 -1
  116. package/dist/sdk/user-storage.d.cts +13 -8
  117. package/dist/sdk/user-storage.d.cts.map +1 -1
  118. package/dist/sdk/user-storage.d.mts +13 -8
  119. package/dist/sdk/user-storage.d.mts.map +1 -1
  120. package/dist/sdk/user-storage.mjs +39 -43
  121. package/dist/sdk/user-storage.mjs.map +1 -1
  122. package/dist/sdk/utils/messaging-signing-snap-requests.cjs +12 -1
  123. package/dist/sdk/utils/messaging-signing-snap-requests.cjs.map +1 -1
  124. package/dist/sdk/utils/messaging-signing-snap-requests.d.cts +6 -0
  125. package/dist/sdk/utils/messaging-signing-snap-requests.d.cts.map +1 -1
  126. package/dist/sdk/utils/messaging-signing-snap-requests.d.mts +6 -0
  127. package/dist/sdk/utils/messaging-signing-snap-requests.d.mts.map +1 -1
  128. package/dist/sdk/utils/messaging-signing-snap-requests.mjs +10 -0
  129. package/dist/sdk/utils/messaging-signing-snap-requests.mjs.map +1 -1
  130. package/dist/shared/types/services.cjs +3 -0
  131. package/dist/shared/types/services.cjs.map +1 -0
  132. package/dist/shared/types/services.d.cts +10 -0
  133. package/dist/shared/types/services.d.cts.map +1 -0
  134. package/dist/shared/types/services.d.mts +10 -0
  135. package/dist/shared/types/services.d.mts.map +1 -0
  136. package/dist/shared/types/services.mjs +2 -0
  137. package/dist/shared/types/services.mjs.map +1 -0
  138. package/package.json +6 -6
  139. package/dist/controllers/authentication/services.cjs +0 -132
  140. package/dist/controllers/authentication/services.cjs.map +0 -1
  141. package/dist/controllers/authentication/services.d.cts +0 -72
  142. package/dist/controllers/authentication/services.d.cts.map +0 -1
  143. package/dist/controllers/authentication/services.d.mts +0 -72
  144. package/dist/controllers/authentication/services.d.mts.map +0 -1
  145. package/dist/controllers/authentication/services.mjs +0 -129
  146. package/dist/controllers/authentication/services.mjs.map +0 -1
  147. package/dist/controllers/user-storage/services.cjs +0 -306
  148. package/dist/controllers/user-storage/services.cjs.map +0 -1
  149. package/dist/controllers/user-storage/services.d.cts +0 -85
  150. package/dist/controllers/user-storage/services.d.cts.map +0 -1
  151. package/dist/controllers/user-storage/services.d.mts +0 -85
  152. package/dist/controllers/user-storage/services.d.mts.map +0 -1
  153. package/dist/controllers/user-storage/services.mjs +0 -276
  154. package/dist/controllers/user-storage/services.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../../src/sdk/authentication-jwt-bearer/types.ts"],"names":[],"mappings":";;;AAEA,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB;+DAC2D;IAC3D,uBAAW,CAAA;IAEX,2BAA2B;IAC3B,yBAAa,CAAA;AACf,CAAC,EAPW,QAAQ,wBAAR,QAAQ,QAOnB","sourcesContent":["import type { Env, Platform } from '../../shared/env';\n\nexport enum AuthType {\n /* sign in using a private key derived from your secret recovery phrase (SRP). \n Uses message signing snap to perform this operation */\n SRP = 'SRP',\n\n /* sign in with Ethereum */\n SiWE = 'SiWE',\n}\n\nexport type AuthConfig = {\n env: Env;\n platform: Platform;\n type: AuthType;\n};\n\nexport type AccessToken = {\n /**\n * The JWT Access Token\n */\n accessToken: string;\n /**\n * Expiration in seconds\n */\n expiresIn: number;\n /**\n * Date in milliseconds\n */\n obtainedAt: number;\n};\n\nexport type UserProfile = {\n /**\n * The \"Identifier\" used to log in with.\n */\n identifierId: string;\n /**\n * The Unique profile for a logged in user. A Profile can be logged in via multiple Identifiers\n */\n profileId: string;\n /**\n * Server MetaMetrics ID. Allows grouping of user events cross platform.\n */\n metaMetricsId: string;\n};\n\nexport type LoginResponse = {\n token: AccessToken;\n profile: UserProfile;\n};\n\nexport type IBaseAuth = {\n getAccessToken: () => Promise<string>;\n getUserProfile: () => Promise<UserProfile>;\n getIdentifier: () => Promise<string>;\n signMessage: (message: string) => Promise<string>;\n};\n\nexport type AuthStorageOptions = {\n getLoginResponse: () => Promise<LoginResponse | null>;\n setLoginResponse: (val: LoginResponse) => Promise<void>;\n};\n\nexport type AuthSigningOptions = {\n signMessage: (message: string) => Promise<string>;\n getIdentifier: () => Promise<string>;\n};\n\nexport type ErrorMessage = {\n message: string;\n error: string;\n};\n\nexport type Pair = {\n identifier: string;\n encryptedStorageKey: string;\n identifierType: 'SIWE' | 'SRP';\n signMessage: (message: string) => Promise<string>;\n};\n"]}
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../../src/sdk/authentication-jwt-bearer/types.ts"],"names":[],"mappings":";;;AAEA,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB;+DAC2D;IAC3D,uBAAW,CAAA;IAEX,2BAA2B;IAC3B,yBAAa,CAAA;AACf,CAAC,EAPW,QAAQ,wBAAR,QAAQ,QAOnB","sourcesContent":["import type { Env, Platform } from '../../shared/env';\n\nexport enum AuthType {\n /* sign in using a private key derived from your secret recovery phrase (SRP).\n Uses message signing snap to perform this operation */\n SRP = 'SRP',\n\n /* sign in with Ethereum */\n SiWE = 'SiWE',\n}\n\nexport type AuthConfig = {\n env: Env;\n platform: Platform;\n type: AuthType;\n};\n\nexport type AccessToken = {\n /**\n * The JWT Access Token\n */\n accessToken: string;\n /**\n * Expiration in seconds\n */\n expiresIn: number;\n /**\n * Date in milliseconds\n */\n obtainedAt: number;\n};\n\nexport type UserProfile = {\n /**\n * The \"Identifier\" used to log in with.\n */\n identifierId: string;\n /**\n * The Unique profile for a logged in user. A Profile can be logged in via multiple Identifiers\n */\n profileId: string;\n /**\n * Server MetaMetrics ID. Allows grouping of user events cross platform.\n */\n metaMetricsId: string;\n};\n\nexport type LoginResponse = {\n token: AccessToken;\n profile: UserProfile;\n};\n\nexport type IBaseAuth = {\n getAccessToken: () => Promise<string>;\n getUserProfile: () => Promise<UserProfile>;\n getIdentifier: () => Promise<string>;\n signMessage: (message: string) => Promise<string>;\n};\n\nexport type AuthStorageOptions = {\n getLoginResponse: () => Promise<LoginResponse | null>;\n setLoginResponse: (val: LoginResponse) => Promise<void>;\n};\n\nexport type AuthSigningOptions = {\n signMessage: (message: string) => Promise<string>;\n getIdentifier: () => Promise<string>;\n};\n\nexport type ErrorMessage = {\n message: string;\n error: string;\n};\n\nexport type Pair = {\n identifier: string;\n encryptedStorageKey: string;\n identifierType: 'SIWE' | 'SRP';\n signMessage: (message: string) => Promise<string>;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../../src/sdk/authentication-jwt-bearer/types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB;+DAC2D;IAC3D,uBAAW,CAAA;IAEX,2BAA2B;IAC3B,yBAAa,CAAA;AACf,CAAC,EAPW,QAAQ,KAAR,QAAQ,QAOnB","sourcesContent":["import type { Env, Platform } from '../../shared/env';\n\nexport enum AuthType {\n /* sign in using a private key derived from your secret recovery phrase (SRP). \n Uses message signing snap to perform this operation */\n SRP = 'SRP',\n\n /* sign in with Ethereum */\n SiWE = 'SiWE',\n}\n\nexport type AuthConfig = {\n env: Env;\n platform: Platform;\n type: AuthType;\n};\n\nexport type AccessToken = {\n /**\n * The JWT Access Token\n */\n accessToken: string;\n /**\n * Expiration in seconds\n */\n expiresIn: number;\n /**\n * Date in milliseconds\n */\n obtainedAt: number;\n};\n\nexport type UserProfile = {\n /**\n * The \"Identifier\" used to log in with.\n */\n identifierId: string;\n /**\n * The Unique profile for a logged in user. A Profile can be logged in via multiple Identifiers\n */\n profileId: string;\n /**\n * Server MetaMetrics ID. Allows grouping of user events cross platform.\n */\n metaMetricsId: string;\n};\n\nexport type LoginResponse = {\n token: AccessToken;\n profile: UserProfile;\n};\n\nexport type IBaseAuth = {\n getAccessToken: () => Promise<string>;\n getUserProfile: () => Promise<UserProfile>;\n getIdentifier: () => Promise<string>;\n signMessage: (message: string) => Promise<string>;\n};\n\nexport type AuthStorageOptions = {\n getLoginResponse: () => Promise<LoginResponse | null>;\n setLoginResponse: (val: LoginResponse) => Promise<void>;\n};\n\nexport type AuthSigningOptions = {\n signMessage: (message: string) => Promise<string>;\n getIdentifier: () => Promise<string>;\n};\n\nexport type ErrorMessage = {\n message: string;\n error: string;\n};\n\nexport type Pair = {\n identifier: string;\n encryptedStorageKey: string;\n identifierType: 'SIWE' | 'SRP';\n signMessage: (message: string) => Promise<string>;\n};\n"]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../../src/sdk/authentication-jwt-bearer/types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB;+DAC2D;IAC3D,uBAAW,CAAA;IAEX,2BAA2B;IAC3B,yBAAa,CAAA;AACf,CAAC,EAPW,QAAQ,KAAR,QAAQ,QAOnB","sourcesContent":["import type { Env, Platform } from '../../shared/env';\n\nexport enum AuthType {\n /* sign in using a private key derived from your secret recovery phrase (SRP).\n Uses message signing snap to perform this operation */\n SRP = 'SRP',\n\n /* sign in with Ethereum */\n SiWE = 'SiWE',\n}\n\nexport type AuthConfig = {\n env: Env;\n platform: Platform;\n type: AuthType;\n};\n\nexport type AccessToken = {\n /**\n * The JWT Access Token\n */\n accessToken: string;\n /**\n * Expiration in seconds\n */\n expiresIn: number;\n /**\n * Date in milliseconds\n */\n obtainedAt: number;\n};\n\nexport type UserProfile = {\n /**\n * The \"Identifier\" used to log in with.\n */\n identifierId: string;\n /**\n * The Unique profile for a logged in user. A Profile can be logged in via multiple Identifiers\n */\n profileId: string;\n /**\n * Server MetaMetrics ID. Allows grouping of user events cross platform.\n */\n metaMetricsId: string;\n};\n\nexport type LoginResponse = {\n token: AccessToken;\n profile: UserProfile;\n};\n\nexport type IBaseAuth = {\n getAccessToken: () => Promise<string>;\n getUserProfile: () => Promise<UserProfile>;\n getIdentifier: () => Promise<string>;\n signMessage: (message: string) => Promise<string>;\n};\n\nexport type AuthStorageOptions = {\n getLoginResponse: () => Promise<LoginResponse | null>;\n setLoginResponse: (val: LoginResponse) => Promise<void>;\n};\n\nexport type AuthSigningOptions = {\n signMessage: (message: string) => Promise<string>;\n getIdentifier: () => Promise<string>;\n};\n\nexport type ErrorMessage = {\n message: string;\n error: string;\n};\n\nexport type Pair = {\n identifier: string;\n encryptedStorageKey: string;\n identifierType: 'SIWE' | 'SRP';\n signMessage: (message: string) => Promise<string>;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"authentication.cjs","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yEAA0E;AAC1E,uEAAwE;AACxE,uEAG8C;AAE9C,iEAA6D;AAC7D,yCAA+D;AAc/D,MAAa,aAAa;IAOxB,YAAY,GAAG,IAAyB;;QAN/B,sCAAgB;QAEhB,qCAAU;QAEV,qCAA2C;QAGlD,uBAAA,IAAI,uBAAS,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,MAAA,CAAC;QAC1B,uBAAA,IAAI,sBAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,MAAA,CAAC;QAExB,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,gBAAQ,CAAC,GAAG,EAAE;YACjC,uBAAA,IAAI,sBAAQ,IAAI,2BAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAA,CAAC;YACnD,OAAO;SACR;QAED,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,gBAAQ,CAAC,IAAI,EAAE;YAClC,uBAAA,IAAI,sBAAQ,IAAI,6BAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAA,CAAC;YACpD,OAAO;SACR;QAED,MAAM,IAAI,iCAAwB,CAAC,uBAAuB,CAAC,CAAC;IAC9D,CAAC;IAED,iBAAiB,CAAC,QAAyB;QACzC,uBAAA,IAAI,0DAAW,MAAf,IAAI,EAAY,uBAAA,IAAI,2BAAM,EAAE,uBAAA,IAAI,0BAA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c,EACd,IAA0C;IAE1C,IAAI,IAAI,KAAK,gBAAQ,CAAC,GAAG,EAAE;QACzB,OAAO;KACR;IAED,MAAM,IAAI,iCAAwB,CAChC,iDAAiD,CAClD,CAAC;AACJ,CAAC;AAGH,uEAA0E;AAAjE,8GAAA,iBAAiB,OAAA;AAC1B,qEAAwE;AAA/D,4GAAA,gBAAgB,OAAA;AACzB,wEAAkD","sourcesContent":["import type { Eip1193Provider } from 'ethers';\n\nimport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe';\nimport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp';\nimport {\n getNonce,\n pairIdentifiers,\n} from './authentication-jwt-bearer/services';\nimport type { UserProfile, Pair } from './authentication-jwt-bearer/types';\nimport { AuthType } from './authentication-jwt-bearer/types';\nimport { PairError, UnsupportedAuthTypeError } from './errors';\nimport type { Env } from '../shared/env';\n\n// Computing the Classes, so we only get back the public methods for the interface.\n// TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\ntype Compute<T> = T extends infer U ? { [K in keyof U]: U[K] } : never;\ntype SIWEInterface = Compute<SIWEJwtBearerAuth>;\ntype SRPInterface = Compute<SRPJwtBearerAuth>;\n\ntype SiweParams = ConstructorParameters<typeof SIWEJwtBearerAuth>;\ntype SRPParams = ConstructorParameters<typeof SRPJwtBearerAuth>;\ntype JwtBearerAuthParams = SiweParams | SRPParams;\n\nexport class JwtBearerAuth implements SIWEInterface, SRPInterface {\n readonly #type: AuthType;\n\n readonly #env: Env;\n\n readonly #sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth;\n\n constructor(...args: JwtBearerAuthParams) {\n this.#type = args[0].type;\n this.#env = args[0].env;\n\n if (args[0].type === AuthType.SRP) {\n this.#sdk = new SRPJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n if (args[0].type === AuthType.SiWE) {\n this.#sdk = new SIWEJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n throw new UnsupportedAuthTypeError('unsupported auth type');\n }\n\n setCustomProvider(provider: Eip1193Provider) {\n this.#assertSRP(this.#type, this.#sdk);\n this.#sdk.setCustomProvider(provider);\n }\n\n async getAccessToken(): Promise<string> {\n return await this.#sdk.getAccessToken();\n }\n\n async connectSnap(): Promise<string> {\n this.#assertSRP(this.#type, this.#sdk);\n return this.#sdk.connectSnap();\n }\n\n async isSnapConnected(): Promise<boolean> {\n this.#assertSRP(this.#type, this.#sdk);\n return this.#sdk.isSnapConnected();\n }\n\n async getUserProfile(): Promise<UserProfile> {\n return await this.#sdk.getUserProfile();\n }\n\n async getIdentifier(): Promise<string> {\n return await this.#sdk.getIdentifier();\n }\n\n async signMessage(message: string): Promise<string> {\n return await this.#sdk.signMessage(message);\n }\n\n async pairIdentifiers(pairing: Pair[]): Promise<void> {\n const profile = await this.getUserProfile();\n const n = await getNonce(profile.profileId, this.#env);\n\n const logins = await Promise.all(\n pairing.map(async (p) => {\n try {\n const raw = `metamask:${n.nonce}:${p.identifier}`;\n const sig = await p.signMessage(raw);\n return {\n signature: sig,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n raw_message: raw,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n encrypted_storage_key: p.encryptedStorageKey,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n identifier_type: p.identifierType,\n };\n } catch (e) {\n /* istanbul ignore next */\n const errorMessage =\n e instanceof Error ? e.message : JSON.stringify(e ?? '');\n throw new PairError(\n `failed to sign pairing message: ${errorMessage}`,\n );\n }\n }),\n );\n\n const accessToken = await this.getAccessToken();\n await pairIdentifiers(n.nonce, logins, accessToken, this.#env);\n }\n\n prepare(signer: {\n address: string;\n chainId: number;\n signMessage: (message: string) => Promise<string>;\n domain: string;\n }): void {\n this.#assertSIWE(this.#type, this.#sdk);\n this.#sdk.prepare(signer);\n }\n\n #assertSIWE(\n type: AuthType,\n _sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts _sdk is SIWEJwtBearerAuth {\n if (type === AuthType.SiWE) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SIWE auth type',\n );\n }\n\n #assertSRP(\n type: AuthType,\n _sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts _sdk is SRPJwtBearerAuth {\n if (type === AuthType.SRP) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SRP auth type',\n );\n }\n}\n\nexport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe';\nexport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp';\nexport * from './authentication-jwt-bearer/types';\n"]}
1
+ {"version":3,"file":"authentication.cjs","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yEAA0E;AAC1E,uEAAwE;AACxE,uEAG8C;AAE9C,iEAA6D;AAC7D,yCAA+D;AAc/D,MAAa,aAAa;IAOxB,YAAY,GAAG,IAAyB;;QAN/B,sCAAgB;QAEhB,qCAAU;QAEV,qCAA2C;QAGlD,uBAAA,IAAI,uBAAS,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,MAAA,CAAC;QAC1B,uBAAA,IAAI,sBAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,MAAA,CAAC;QAExB,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,gBAAQ,CAAC,GAAG,EAAE;YACjC,uBAAA,IAAI,sBAAQ,IAAI,2BAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAA,CAAC;YACnD,OAAO;SACR;QAED,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,gBAAQ,CAAC,IAAI,EAAE;YAClC,uBAAA,IAAI,sBAAQ,IAAI,6BAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAA,CAAC;YACpD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A2BF;AA9HD,sCA8HC;sNAxBG,IAAc,EACd,IAA0C;IAE1C,IAAI,IAAI,KAAK,gBAAQ,CAAC,IAAI,EAAE;QAC1B,OAAO;KACR;IAED,MAAM,IAAI,iCAAwB,CAChC,kDAAkD,CACnD,CAAC;AACJ,CAAC,+DAGC,IAAc,EACd,IAA0C;IAE1C,IAAI,IAAI,KAAK,gBAAQ,CAAC,GAAG,EAAE;QACzB,OAAO;KACR;IAED,MAAM,IAAI,iCAAwB,CAChC,iDAAiD,CAClD,CAAC;AACJ,CAAC;AAGH,uEAA0E;AAAjE,8GAAA,iBAAiB,OAAA;AAC1B,qEAAwE;AAA/D,4GAAA,gBAAgB,OAAA;AACzB,wEAAkD","sourcesContent":["import type { Eip1193Provider } from 'ethers';\n\nimport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe';\nimport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp';\nimport {\n getNonce,\n pairIdentifiers,\n} from './authentication-jwt-bearer/services';\nimport type { UserProfile, Pair } from './authentication-jwt-bearer/types';\nimport { AuthType } from './authentication-jwt-bearer/types';\nimport { PairError, UnsupportedAuthTypeError } from './errors';\nimport type { Env } from '../shared/env';\n\n// Computing the Classes, so we only get back the public methods for the interface.\n// TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\ntype Compute<T> = T extends infer U ? { [K in keyof U]: U[K] } : never;\ntype SIWEInterface = Compute<SIWEJwtBearerAuth>;\nexport type SRPInterface = Compute<SRPJwtBearerAuth>;\n\ntype SiweParams = ConstructorParameters<typeof SIWEJwtBearerAuth>;\ntype SRPParams = ConstructorParameters<typeof SRPJwtBearerAuth>;\ntype JwtBearerAuthParams = SiweParams | SRPParams;\n\nexport class JwtBearerAuth implements SIWEInterface, SRPInterface {\n readonly #type: AuthType;\n\n readonly #env: Env;\n\n readonly #sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth;\n\n constructor(...args: JwtBearerAuthParams) {\n this.#type = args[0].type;\n this.#env = args[0].env;\n\n if (args[0].type === AuthType.SRP) {\n this.#sdk = new SRPJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n if (args[0].type === AuthType.SiWE) {\n this.#sdk = new SIWEJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n throw new UnsupportedAuthTypeError('unsupported auth type');\n }\n\n setCustomProvider(provider: Eip1193Provider) {\n this.#assertSRP(this.#type, this.#sdk);\n this.#sdk.setCustomProvider(provider);\n }\n\n async getAccessToken(): Promise<string> {\n return await this.#sdk.getAccessToken();\n }\n\n async connectSnap(): Promise<string> {\n this.#assertSRP(this.#type, this.#sdk);\n return this.#sdk.connectSnap();\n }\n\n async isSnapConnected(): Promise<boolean> {\n this.#assertSRP(this.#type, this.#sdk);\n return this.#sdk.isSnapConnected();\n }\n\n async getUserProfile(): Promise<UserProfile> {\n return await this.#sdk.getUserProfile();\n }\n\n async getIdentifier(): Promise<string> {\n return await this.#sdk.getIdentifier();\n }\n\n async signMessage(message: string): Promise<string> {\n return await this.#sdk.signMessage(message);\n }\n\n async pairIdentifiers(pairing: Pair[]): Promise<void> {\n const profile = await this.getUserProfile();\n const n = await getNonce(profile.profileId, this.#env);\n\n const logins = await Promise.all(\n pairing.map(async (p) => {\n try {\n const raw = `metamask:${n.nonce}:${p.identifier}`;\n const sig = await p.signMessage(raw);\n return {\n signature: sig,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n raw_message: raw,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n encrypted_storage_key: p.encryptedStorageKey,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n identifier_type: p.identifierType,\n };\n } catch (e) {\n /* istanbul ignore next */\n const errorMessage =\n e instanceof Error ? e.message : JSON.stringify(e ?? '');\n throw new PairError(\n `failed to sign pairing message: ${errorMessage}`,\n );\n }\n }),\n );\n\n const accessToken = await this.getAccessToken();\n await pairIdentifiers(n.nonce, logins, accessToken, this.#env);\n }\n\n prepare(signer: {\n address: string;\n chainId: number;\n signMessage: (message: string) => Promise<string>;\n domain: string;\n }): void {\n this.#assertSIWE(this.#type, this.#sdk);\n this.#sdk.prepare(signer);\n }\n\n #assertSIWE(\n type: AuthType,\n _sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts _sdk is SIWEJwtBearerAuth {\n if (type === AuthType.SiWE) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SIWE auth type',\n );\n }\n\n #assertSRP(\n type: AuthType,\n _sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts _sdk is SRPJwtBearerAuth {\n if (type === AuthType.SRP) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SRP auth type',\n );\n }\n}\n\nexport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe';\nexport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp';\nexport * from './authentication-jwt-bearer/types';\n"]}
@@ -6,7 +6,7 @@ type Compute<T> = T extends infer U ? {
6
6
  [K in keyof U]: U[K];
7
7
  } : never;
8
8
  type SIWEInterface = Compute<SIWEJwtBearerAuth>;
9
- type SRPInterface = Compute<SRPJwtBearerAuth>;
9
+ export type SRPInterface = Compute<SRPJwtBearerAuth>;
10
10
  type SiweParams = ConstructorParameters<typeof SIWEJwtBearerAuth>;
11
11
  type SRPParams = ConstructorParameters<typeof SRPJwtBearerAuth>;
12
12
  type JwtBearerAuthParams = SiweParams | SRPParams;
@@ -1 +1 @@
1
- {"version":3,"file":"authentication.d.cts","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe;AAE9C,OAAO,EAAE,iBAAiB,EAAE,kDAA8C;AAC1E,OAAO,EAAE,gBAAgB,EAAE,iDAA6C;AAKxE,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,8CAA0C;AAQ3E,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAA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CAAC;QAChB,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;QAClD,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG,IAAI;CA8BT;AAED,OAAO,EAAE,iBAAiB,EAAE,kDAA8C;AAC1E,OAAO,EAAE,gBAAgB,EAAE,iDAA6C;AACxE,sDAAkD"}
@@ -6,7 +6,7 @@ type Compute<T> = T extends infer U ? {
6
6
  [K in keyof U]: U[K];
7
7
  } : never;
8
8
  type SIWEInterface = Compute<SIWEJwtBearerAuth>;
9
- type SRPInterface = Compute<SRPJwtBearerAuth>;
9
+ export type SRPInterface = Compute<SRPJwtBearerAuth>;
10
10
  type SiweParams = ConstructorParameters<typeof SIWEJwtBearerAuth>;
11
11
  type SRPParams = ConstructorParameters<typeof SRPJwtBearerAuth>;
12
12
  type JwtBearerAuthParams = SiweParams | SRPParams;
@@ -1 +1 @@
1
- {"version":3,"file":"authentication.d.mts","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe;AAE9C,OAAO,EAAE,iBAAiB,EAAE,kDAA8C;AAC1E,OAAO,EAAE,gBAAgB,EAAE,iDAA6C;AAKxE,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,8CAA0C;AAQ3E,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,KAAK,CAAC;AACvE,KAAK,aAAa,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAChD,KAAK,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE9C,KAAK,UAAU,GAAG,qBAAqB,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,KAAK,SAAS,GAAG,qBAAqB,CAAC,OAAO,gBAAgB,CAAC,CAAC;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EAAE,kDAA8C;AAC1E,OAAO,EAAE,gBAAgB,EAAE,iDAA6C;AACxE,sDAAkD","sourcesContent":["import type { Eip1193Provider } from 'ethers';\n\nimport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe';\nimport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp';\nimport {\n getNonce,\n pairIdentifiers,\n} from './authentication-jwt-bearer/services';\nimport type { UserProfile, Pair } from './authentication-jwt-bearer/types';\nimport { AuthType } from './authentication-jwt-bearer/types';\nimport { PairError, UnsupportedAuthTypeError } from './errors';\nimport type { Env } from '../shared/env';\n\n// Computing the Classes, so we only get back the public methods for the interface.\n// TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\ntype Compute<T> = T extends infer U ? { [K in keyof U]: U[K] } : never;\ntype SIWEInterface = Compute<SIWEJwtBearerAuth>;\ntype SRPInterface = Compute<SRPJwtBearerAuth>;\n\ntype SiweParams = ConstructorParameters<typeof SIWEJwtBearerAuth>;\ntype SRPParams = ConstructorParameters<typeof SRPJwtBearerAuth>;\ntype JwtBearerAuthParams = SiweParams | SRPParams;\n\nexport class JwtBearerAuth implements SIWEInterface, SRPInterface {\n readonly #type: AuthType;\n\n readonly #env: Env;\n\n readonly #sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth;\n\n constructor(...args: JwtBearerAuthParams) {\n this.#type = args[0].type;\n this.#env = args[0].env;\n\n if (args[0].type === AuthType.SRP) {\n this.#sdk = new SRPJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n if (args[0].type === AuthType.SiWE) {\n this.#sdk = new SIWEJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n throw new UnsupportedAuthTypeError('unsupported auth type');\n }\n\n setCustomProvider(provider: Eip1193Provider) {\n this.#assertSRP(this.#type, this.#sdk);\n this.#sdk.setCustomProvider(provider);\n }\n\n async getAccessToken(): Promise<string> {\n return await this.#sdk.getAccessToken();\n }\n\n async connectSnap(): Promise<string> {\n this.#assertSRP(this.#type, this.#sdk);\n return this.#sdk.connectSnap();\n }\n\n async isSnapConnected(): Promise<boolean> {\n this.#assertSRP(this.#type, this.#sdk);\n return this.#sdk.isSnapConnected();\n }\n\n async getUserProfile(): Promise<UserProfile> {\n return await this.#sdk.getUserProfile();\n }\n\n async getIdentifier(): Promise<string> {\n return await this.#sdk.getIdentifier();\n }\n\n async signMessage(message: string): Promise<string> {\n return await this.#sdk.signMessage(message);\n }\n\n async pairIdentifiers(pairing: Pair[]): Promise<void> {\n const profile = await this.getUserProfile();\n const n = await getNonce(profile.profileId, this.#env);\n\n const logins = await Promise.all(\n pairing.map(async (p) => {\n try {\n const raw = `metamask:${n.nonce}:${p.identifier}`;\n const sig = await p.signMessage(raw);\n return {\n signature: sig,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n raw_message: raw,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n encrypted_storage_key: p.encryptedStorageKey,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n identifier_type: p.identifierType,\n };\n } catch (e) {\n /* istanbul ignore next */\n const errorMessage =\n e instanceof Error ? e.message : JSON.stringify(e ?? '');\n throw new PairError(\n `failed to sign pairing message: ${errorMessage}`,\n );\n }\n }),\n );\n\n const accessToken = await this.getAccessToken();\n await pairIdentifiers(n.nonce, logins, accessToken, this.#env);\n }\n\n prepare(signer: {\n address: string;\n chainId: number;\n signMessage: (message: string) => Promise<string>;\n domain: string;\n }): void {\n this.#assertSIWE(this.#type, this.#sdk);\n this.#sdk.prepare(signer);\n }\n\n #assertSIWE(\n type: AuthType,\n _sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts _sdk is SIWEJwtBearerAuth {\n if (type === AuthType.SiWE) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SIWE auth type',\n );\n }\n\n #assertSRP(\n type: AuthType,\n _sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts _sdk is SRPJwtBearerAuth {\n if (type === AuthType.SRP) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SRP auth type',\n );\n }\n}\n\nexport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe';\nexport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp';\nexport * from './authentication-jwt-bearer/types';\n"]}
1
+ {"version":3,"file":"authentication.mjs","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EAAE,iBAAiB,EAAE,kDAA8C;AAC1E,OAAO,EAAE,gBAAgB,EAAE,iDAA6C;AACxE,OAAO,EACL,QAAQ,EACR,eAAe,EAChB,iDAA6C;AAE9C,OAAO,EAAE,QAAQ,EAAE,8CAA0C;AAC7D,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,qBAAiB;AAc/D,MAAM,OAAO,aAAa;IAOxB,YAAY,GAAG,IAAyB;;QAN/B,sCAAgB;QAEhB,qCAAU;QAEV,qCAA2C;QAGlD,uBAAA,IAAI,uBAAS,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,MAAA,CAAC;QAC1B,uBAAA,IAAI,sBAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,MAAA,CAAC;QAExB,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,GAAG,EAAE;YACjC,uBAAA,IAAI,sBAAQ,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAA,CAAC;YACnD,OAAO;SACR;QAED,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,EAAE;YAClC,uBAAA,IAAI,sBAAQ,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAA,CAAC;YACpD,OAAO;SACR;QAED,MAAM,IAAI,wBAAwB,CAAC,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AAQ,CAAC,IAAI,EAAE;QAC1B,OAAO;KACR;IAED,MAAM,IAAI,wBAAwB,CAChC,kDAAkD,CACnD,CAAC;AACJ,CAAC,+DAGC,IAAc,EACd,IAA0C;IAE1C,IAAI,IAAI,KAAK,QAAQ,CAAC,GAAG,EAAE;QACzB,OAAO;KACR;IAED,MAAM,IAAI,wBAAwB,CAChC,iDAAiD,CAClD,CAAC;AACJ,CAAC;AAGH,OAAO,EAAE,iBAAiB,EAAE,kDAA8C;AAC1E,OAAO,EAAE,gBAAgB,EAAE,iDAA6C;AACxE,sDAAkD","sourcesContent":["import type { Eip1193Provider } from 'ethers';\n\nimport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe';\nimport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp';\nimport {\n getNonce,\n pairIdentifiers,\n} from './authentication-jwt-bearer/services';\nimport type { UserProfile, Pair } from './authentication-jwt-bearer/types';\nimport { AuthType } from './authentication-jwt-bearer/types';\nimport { PairError, UnsupportedAuthTypeError } from './errors';\nimport type { Env } from '../shared/env';\n\n// Computing the Classes, so we only get back the public methods for the interface.\n// TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\ntype Compute<T> = T extends infer U ? { [K in keyof U]: U[K] } : never;\ntype SIWEInterface = Compute<SIWEJwtBearerAuth>;\nexport type SRPInterface = Compute<SRPJwtBearerAuth>;\n\ntype SiweParams = ConstructorParameters<typeof SIWEJwtBearerAuth>;\ntype SRPParams = ConstructorParameters<typeof SRPJwtBearerAuth>;\ntype JwtBearerAuthParams = SiweParams | SRPParams;\n\nexport class JwtBearerAuth implements SIWEInterface, SRPInterface {\n readonly #type: AuthType;\n\n readonly #env: Env;\n\n readonly #sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth;\n\n constructor(...args: JwtBearerAuthParams) {\n this.#type = args[0].type;\n this.#env = args[0].env;\n\n if (args[0].type === AuthType.SRP) {\n this.#sdk = new SRPJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n if (args[0].type === AuthType.SiWE) {\n this.#sdk = new SIWEJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n throw new UnsupportedAuthTypeError('unsupported auth type');\n }\n\n setCustomProvider(provider: Eip1193Provider) {\n this.#assertSRP(this.#type, this.#sdk);\n this.#sdk.setCustomProvider(provider);\n }\n\n async getAccessToken(): Promise<string> {\n return await this.#sdk.getAccessToken();\n }\n\n async connectSnap(): Promise<string> {\n this.#assertSRP(this.#type, this.#sdk);\n return this.#sdk.connectSnap();\n }\n\n async isSnapConnected(): Promise<boolean> {\n this.#assertSRP(this.#type, this.#sdk);\n return this.#sdk.isSnapConnected();\n }\n\n async getUserProfile(): Promise<UserProfile> {\n return await this.#sdk.getUserProfile();\n }\n\n async getIdentifier(): Promise<string> {\n return await this.#sdk.getIdentifier();\n }\n\n async signMessage(message: string): Promise<string> {\n return await this.#sdk.signMessage(message);\n }\n\n async pairIdentifiers(pairing: Pair[]): Promise<void> {\n const profile = await this.getUserProfile();\n const n = await getNonce(profile.profileId, this.#env);\n\n const logins = await Promise.all(\n pairing.map(async (p) => {\n try {\n const raw = `metamask:${n.nonce}:${p.identifier}`;\n const sig = await p.signMessage(raw);\n return {\n signature: sig,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n raw_message: raw,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n encrypted_storage_key: p.encryptedStorageKey,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n\n identifier_type: p.identifierType,\n };\n } catch (e) {\n /* istanbul ignore next */\n const errorMessage =\n e instanceof Error ? e.message : JSON.stringify(e ?? '');\n throw new PairError(\n `failed to sign pairing message: ${errorMessage}`,\n );\n }\n }),\n );\n\n const accessToken = await this.getAccessToken();\n await pairIdentifiers(n.nonce, logins, accessToken, this.#env);\n }\n\n prepare(signer: {\n address: string;\n chainId: number;\n signMessage: (message: string) => Promise<string>;\n domain: string;\n }): void {\n this.#assertSIWE(this.#type, this.#sdk);\n this.#sdk.prepare(signer);\n }\n\n #assertSIWE(\n type: AuthType,\n _sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts _sdk is SIWEJwtBearerAuth {\n if (type === AuthType.SiWE) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SIWE auth type',\n );\n }\n\n #assertSRP(\n type: AuthType,\n _sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts _sdk is SRPJwtBearerAuth {\n if (type === AuthType.SRP) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SRP auth type',\n );\n }\n}\n\nexport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe';\nexport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp';\nexport * from './authentication-jwt-bearer/types';\n"]}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MOCK_OIDC_TOKEN_RESPONSE = exports.MOCK_SRP_LOGIN_RESPONSE = exports.MOCK_SIWE_LOGIN_RESPONSE = exports.MOCK_NONCE_RESPONSE = exports.MOCK_ACCESS_JWT = exports.MOCK_JWT = exports.MOCK_PAIR_IDENTIFIERS_URL = exports.MOCK_SIWE_LOGIN_URL = exports.MOCK_OIDC_TOKEN_URL = exports.MOCK_SRP_LOGIN_URL = exports.MOCK_NONCE_URL = void 0;
4
+ const env_1 = require("../../shared/env.cjs");
5
+ const services_1 = require("../authentication-jwt-bearer/services.cjs");
6
+ exports.MOCK_NONCE_URL = (0, services_1.NONCE_URL)(env_1.Env.PRD);
7
+ exports.MOCK_SRP_LOGIN_URL = (0, services_1.SRP_LOGIN_URL)(env_1.Env.PRD);
8
+ exports.MOCK_OIDC_TOKEN_URL = (0, services_1.OIDC_TOKEN_URL)(env_1.Env.PRD);
9
+ exports.MOCK_SIWE_LOGIN_URL = (0, services_1.SIWE_LOGIN_URL)(env_1.Env.PRD);
10
+ exports.MOCK_PAIR_IDENTIFIERS_URL = (0, services_1.PAIR_IDENTIFIERS)(env_1.Env.PRD);
11
+ exports.MOCK_JWT = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImIwNzE2N2U2LWJjNWUtNDgyZC1hNjRhLWU1MjQ0MjY2MGU3NyJ9.eyJzdWIiOiI1MzE0ODc5YWM2NDU1OGI3OTQ5ZmI4NWIzMjg2ZjZjNjUwODAzYmFiMTY0Y2QyOWNmMmM3YzdmMjMzMWMwZTRlIiwiaWF0IjoxNzA2MTEzMDYyLCJleHAiOjE3NjkxODUwNjMsImlzcyI6ImF1dGgubWV0YW1hc2suaW8iLCJhdWQiOiJwb3J0Zm9saW8ubWV0YW1hc2suaW8ifQ.E5UL6oABNweS8t5a6IBTqTf7NLOJbrhJSmEcsr7kwLp4bGvcENJzACwnsHDkA6PlzfDV09ZhAGU_F3hlS0j-erbY0k0AFR-GAtyS7E9N02D8RgUDz5oDR65CKmzM8JilgFA8UvruJ6OJGogroaOSOqzRES_s8MjHpP47RJ9lXrUesajsbOudXbuksXWg5QmWip6LLvjwr8UUzcJzNQilyIhiEpo4WdzWM4R3VtTwr4rHnWEvtYnYCov1jmI2w3YQ48y0M-3Y9IOO0ov_vlITRrOnR7Y7fRUGLUFmU5msD8mNWRywjQFLHfJJ1yNP5aJ8TkuCK3sC6kcUH335IVvukQ';
12
+ exports.MOCK_ACCESS_JWT = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
13
+ exports.MOCK_NONCE_RESPONSE = {
14
+ nonce: 'xGMm9SoihEKeAEfV',
15
+ identifier: '0xd8641601Cb79a94FD872fE42d5b4a067A44a7e88',
16
+ expires_in: 300,
17
+ };
18
+ exports.MOCK_SIWE_LOGIN_RESPONSE = {
19
+ token: exports.MOCK_JWT,
20
+ expires_in: 3600,
21
+ profile: {
22
+ profile_id: 'fa2bbf82-bd9a-4e6b-aabc-9ca0d0319b6e',
23
+ metametrics_id: 'de742679-4960-4977-a415-4718b5f8e86c',
24
+ identifier_id: 'ec9a4e9906836497efad2fd4d4290b34d2c6a2c0d93eb174aa3cd88a133adbaf',
25
+ identifier_type: 'SIWE',
26
+ encrypted_storage_key: '2c6a2c0d93eb174aa3cd88a133adbaf',
27
+ },
28
+ };
29
+ exports.MOCK_SRP_LOGIN_RESPONSE = {
30
+ token: exports.MOCK_JWT,
31
+ expires_in: 3600,
32
+ profile: {
33
+ profile_id: 'f88227bd-b615-41a3-b0be-467dd781a4ad',
34
+ metametrics_id: '561ec651-a844-4b36-a451-04d6eac35740',
35
+ identifier_id: 'da9a9fc7b09edde9cc23cec9b7e11a71fb0ab4d2ddd8af8af905306f3e1456fb',
36
+ identifier_type: 'SRP',
37
+ encrypted_storage_key: 'd2ddd8af8af905306f3e1456fb',
38
+ },
39
+ };
40
+ exports.MOCK_OIDC_TOKEN_RESPONSE = {
41
+ access_token: exports.MOCK_ACCESS_JWT,
42
+ expires_in: 3600,
43
+ };
44
+ //# sourceMappingURL=auth.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.cjs","sourceRoot":"","sources":["../../../src/sdk/mocks/auth.ts"],"names":[],"mappings":";;;AAAA,8CAAuC;AACvC,wEAM+C;AAElC,QAAA,cAAc,GAAG,IAAA,oBAAS,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;AACpC,QAAA,kBAAkB,GAAG,IAAA,wBAAa,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;AAC5C,QAAA,mBAAmB,GAAG,IAAA,yBAAc,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;AAC9C,QAAA,mBAAmB,GAAG,IAAA,yBAAc,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;AAC9C,QAAA,yBAAyB,GAAG,IAAA,2BAAgB,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;AAEtD,QAAA,QAAQ,GACnB,opBAAopB,CAAC;AAE1oB,QAAA,eAAe,GAC1B,6JAA6J,CAAC;AAEnJ,QAAA,mBAAmB,GAAG;IACjC,KAAK,EAAE,kBAAkB;IACzB,UAAU,EAAE,4CAA4C;IACxD,UAAU,EAAE,GAAG;CAChB,CAAC;AAEW,QAAA,wBAAwB,GAAG;IACtC,KAAK,EAAE,gBAAQ;IACf,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE;QACP,UAAU,EAAE,sCAAsC;QAClD,cAAc,EAAE,sCAAsC;QACtD,aAAa,EACX,kEAAkE;QACpE,eAAe,EAAE,MAAM;QACvB,qBAAqB,EAAE,iCAAiC;KACzD;CACF,CAAC;AAEW,QAAA,uBAAuB,GAAG;IACrC,KAAK,EAAE,gBAAQ;IACf,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE;QACP,UAAU,EAAE,sCAAsC;QAClD,cAAc,EAAE,sCAAsC;QACtD,aAAa,EACX,kEAAkE;QACpE,eAAe,EAAE,KAAK;QACtB,qBAAqB,EAAE,4BAA4B;KACpD;CACF,CAAC;AAEW,QAAA,wBAAwB,GAAG;IACtC,YAAY,EAAE,uBAAe;IAC7B,UAAU,EAAE,IAAI;CACjB,CAAC","sourcesContent":["import { 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\nexport const MOCK_NONCE_URL = NONCE_URL(Env.PRD);\nexport const MOCK_SRP_LOGIN_URL = SRP_LOGIN_URL(Env.PRD);\nexport const MOCK_OIDC_TOKEN_URL = OIDC_TOKEN_URL(Env.PRD);\nexport const MOCK_SIWE_LOGIN_URL = SIWE_LOGIN_URL(Env.PRD);\nexport const MOCK_PAIR_IDENTIFIERS_URL = PAIR_IDENTIFIERS(Env.PRD);\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\nexport const MOCK_NONCE_RESPONSE = {\n nonce: 'xGMm9SoihEKeAEfV',\n identifier: '0xd8641601Cb79a94FD872fE42d5b4a067A44a7e88',\n expires_in: 300,\n};\n\nexport const MOCK_SIWE_LOGIN_RESPONSE = {\n token: MOCK_JWT,\n expires_in: 3600,\n profile: {\n profile_id: 'fa2bbf82-bd9a-4e6b-aabc-9ca0d0319b6e',\n metametrics_id: 'de742679-4960-4977-a415-4718b5f8e86c',\n identifier_id:\n 'ec9a4e9906836497efad2fd4d4290b34d2c6a2c0d93eb174aa3cd88a133adbaf',\n identifier_type: 'SIWE',\n encrypted_storage_key: '2c6a2c0d93eb174aa3cd88a133adbaf',\n },\n};\n\nexport const MOCK_SRP_LOGIN_RESPONSE = {\n token: MOCK_JWT,\n expires_in: 3600,\n profile: {\n profile_id: 'f88227bd-b615-41a3-b0be-467dd781a4ad',\n metametrics_id: '561ec651-a844-4b36-a451-04d6eac35740',\n identifier_id:\n 'da9a9fc7b09edde9cc23cec9b7e11a71fb0ab4d2ddd8af8af905306f3e1456fb',\n identifier_type: 'SRP',\n encrypted_storage_key: 'd2ddd8af8af905306f3e1456fb',\n },\n};\n\nexport const MOCK_OIDC_TOKEN_RESPONSE = {\n access_token: MOCK_ACCESS_JWT,\n expires_in: 3600,\n};\n"]}
@@ -0,0 +1,39 @@
1
+ export declare const MOCK_NONCE_URL: string;
2
+ export declare const MOCK_SRP_LOGIN_URL: string;
3
+ export declare const MOCK_OIDC_TOKEN_URL: string;
4
+ export declare const MOCK_SIWE_LOGIN_URL: string;
5
+ export declare const MOCK_PAIR_IDENTIFIERS_URL: string;
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_NONCE_RESPONSE: {
9
+ nonce: string;
10
+ identifier: string;
11
+ expires_in: number;
12
+ };
13
+ export declare const MOCK_SIWE_LOGIN_RESPONSE: {
14
+ token: string;
15
+ expires_in: number;
16
+ profile: {
17
+ profile_id: string;
18
+ metametrics_id: string;
19
+ identifier_id: string;
20
+ identifier_type: string;
21
+ encrypted_storage_key: string;
22
+ };
23
+ };
24
+ export declare const MOCK_SRP_LOGIN_RESPONSE: {
25
+ token: string;
26
+ expires_in: number;
27
+ profile: {
28
+ profile_id: string;
29
+ metametrics_id: string;
30
+ identifier_id: string;
31
+ identifier_type: string;
32
+ encrypted_storage_key: string;
33
+ };
34
+ };
35
+ export declare const MOCK_OIDC_TOKEN_RESPONSE: {
36
+ access_token: string;
37
+ expires_in: number;
38
+ };
39
+ //# sourceMappingURL=auth.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.cts","sourceRoot":"","sources":["../../../src/sdk/mocks/auth.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc,QAAqB,CAAC;AACjD,eAAO,MAAM,kBAAkB,QAAyB,CAAC;AACzD,eAAO,MAAM,mBAAmB,QAA0B,CAAC;AAC3D,eAAO,MAAM,mBAAmB,QAA0B,CAAC;AAC3D,eAAO,MAAM,yBAAyB,QAA4B,CAAC;AAEnE,eAAO,MAAM,QAAQ,upBACioB,CAAC;AAEvpB,eAAO,MAAM,eAAe,gKACmI,CAAC;AAEhK,eAAO,MAAM,mBAAmB;;;;CAI/B,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;CAWpC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;CAWnC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;CAGpC,CAAC"}
@@ -0,0 +1,39 @@
1
+ export declare const MOCK_NONCE_URL: string;
2
+ export declare const MOCK_SRP_LOGIN_URL: string;
3
+ export declare const MOCK_OIDC_TOKEN_URL: string;
4
+ export declare const MOCK_SIWE_LOGIN_URL: string;
5
+ export declare const MOCK_PAIR_IDENTIFIERS_URL: string;
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_NONCE_RESPONSE: {
9
+ nonce: string;
10
+ identifier: string;
11
+ expires_in: number;
12
+ };
13
+ export declare const MOCK_SIWE_LOGIN_RESPONSE: {
14
+ token: string;
15
+ expires_in: number;
16
+ profile: {
17
+ profile_id: string;
18
+ metametrics_id: string;
19
+ identifier_id: string;
20
+ identifier_type: string;
21
+ encrypted_storage_key: string;
22
+ };
23
+ };
24
+ export declare const MOCK_SRP_LOGIN_RESPONSE: {
25
+ token: string;
26
+ expires_in: number;
27
+ profile: {
28
+ profile_id: string;
29
+ metametrics_id: string;
30
+ identifier_id: string;
31
+ identifier_type: string;
32
+ encrypted_storage_key: string;
33
+ };
34
+ };
35
+ export declare const MOCK_OIDC_TOKEN_RESPONSE: {
36
+ access_token: string;
37
+ expires_in: number;
38
+ };
39
+ //# sourceMappingURL=auth.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.mts","sourceRoot":"","sources":["../../../src/sdk/mocks/auth.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc,QAAqB,CAAC;AACjD,eAAO,MAAM,kBAAkB,QAAyB,CAAC;AACzD,eAAO,MAAM,mBAAmB,QAA0B,CAAC;AAC3D,eAAO,MAAM,mBAAmB,QAA0B,CAAC;AAC3D,eAAO,MAAM,yBAAyB,QAA4B,CAAC;AAEnE,eAAO,MAAM,QAAQ,upBACioB,CAAC;AAEvpB,eAAO,MAAM,eAAe,gKACmI,CAAC;AAEhK,eAAO,MAAM,mBAAmB;;;;CAI/B,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;CAWpC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;CAWnC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;CAGpC,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { Env } from "../../shared/env.mjs";
2
+ import { NONCE_URL, SIWE_LOGIN_URL, SRP_LOGIN_URL, OIDC_TOKEN_URL, PAIR_IDENTIFIERS } from "../authentication-jwt-bearer/services.mjs";
3
+ export const MOCK_NONCE_URL = NONCE_URL(Env.PRD);
4
+ export const MOCK_SRP_LOGIN_URL = SRP_LOGIN_URL(Env.PRD);
5
+ export const MOCK_OIDC_TOKEN_URL = OIDC_TOKEN_URL(Env.PRD);
6
+ export const MOCK_SIWE_LOGIN_URL = SIWE_LOGIN_URL(Env.PRD);
7
+ export const MOCK_PAIR_IDENTIFIERS_URL = PAIR_IDENTIFIERS(Env.PRD);
8
+ export const MOCK_JWT = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImIwNzE2N2U2LWJjNWUtNDgyZC1hNjRhLWU1MjQ0MjY2MGU3NyJ9.eyJzdWIiOiI1MzE0ODc5YWM2NDU1OGI3OTQ5ZmI4NWIzMjg2ZjZjNjUwODAzYmFiMTY0Y2QyOWNmMmM3YzdmMjMzMWMwZTRlIiwiaWF0IjoxNzA2MTEzMDYyLCJleHAiOjE3NjkxODUwNjMsImlzcyI6ImF1dGgubWV0YW1hc2suaW8iLCJhdWQiOiJwb3J0Zm9saW8ubWV0YW1hc2suaW8ifQ.E5UL6oABNweS8t5a6IBTqTf7NLOJbrhJSmEcsr7kwLp4bGvcENJzACwnsHDkA6PlzfDV09ZhAGU_F3hlS0j-erbY0k0AFR-GAtyS7E9N02D8RgUDz5oDR65CKmzM8JilgFA8UvruJ6OJGogroaOSOqzRES_s8MjHpP47RJ9lXrUesajsbOudXbuksXWg5QmWip6LLvjwr8UUzcJzNQilyIhiEpo4WdzWM4R3VtTwr4rHnWEvtYnYCov1jmI2w3YQ48y0M-3Y9IOO0ov_vlITRrOnR7Y7fRUGLUFmU5msD8mNWRywjQFLHfJJ1yNP5aJ8TkuCK3sC6kcUH335IVvukQ';
9
+ export const MOCK_ACCESS_JWT = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
10
+ export const MOCK_NONCE_RESPONSE = {
11
+ nonce: 'xGMm9SoihEKeAEfV',
12
+ identifier: '0xd8641601Cb79a94FD872fE42d5b4a067A44a7e88',
13
+ expires_in: 300,
14
+ };
15
+ export const MOCK_SIWE_LOGIN_RESPONSE = {
16
+ token: MOCK_JWT,
17
+ expires_in: 3600,
18
+ profile: {
19
+ profile_id: 'fa2bbf82-bd9a-4e6b-aabc-9ca0d0319b6e',
20
+ metametrics_id: 'de742679-4960-4977-a415-4718b5f8e86c',
21
+ identifier_id: 'ec9a4e9906836497efad2fd4d4290b34d2c6a2c0d93eb174aa3cd88a133adbaf',
22
+ identifier_type: 'SIWE',
23
+ encrypted_storage_key: '2c6a2c0d93eb174aa3cd88a133adbaf',
24
+ },
25
+ };
26
+ export const MOCK_SRP_LOGIN_RESPONSE = {
27
+ token: MOCK_JWT,
28
+ expires_in: 3600,
29
+ profile: {
30
+ profile_id: 'f88227bd-b615-41a3-b0be-467dd781a4ad',
31
+ metametrics_id: '561ec651-a844-4b36-a451-04d6eac35740',
32
+ identifier_id: 'da9a9fc7b09edde9cc23cec9b7e11a71fb0ab4d2ddd8af8af905306f3e1456fb',
33
+ identifier_type: 'SRP',
34
+ encrypted_storage_key: 'd2ddd8af8af905306f3e1456fb',
35
+ },
36
+ };
37
+ export const MOCK_OIDC_TOKEN_RESPONSE = {
38
+ access_token: MOCK_ACCESS_JWT,
39
+ expires_in: 3600,
40
+ };
41
+ //# sourceMappingURL=auth.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.mjs","sourceRoot":"","sources":["../../../src/sdk/mocks/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,6BAAyB;AACvC,OAAO,EACL,SAAS,EACT,cAAc,EACd,aAAa,EACb,cAAc,EACd,gBAAgB,EACjB,kDAA8C;AAE/C,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACjD,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACzD,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,yBAAyB,GAAG,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEnE,MAAM,CAAC,MAAM,QAAQ,GACnB,opBAAopB,CAAC;AAEvpB,MAAM,CAAC,MAAM,eAAe,GAC1B,6JAA6J,CAAC;AAEhK,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,KAAK,EAAE,kBAAkB;IACzB,UAAU,EAAE,4CAA4C;IACxD,UAAU,EAAE,GAAG;CAChB,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,KAAK,EAAE,QAAQ;IACf,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE;QACP,UAAU,EAAE,sCAAsC;QAClD,cAAc,EAAE,sCAAsC;QACtD,aAAa,EACX,kEAAkE;QACpE,eAAe,EAAE,MAAM;QACvB,qBAAqB,EAAE,iCAAiC;KACzD;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,KAAK,EAAE,QAAQ;IACf,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE;QACP,UAAU,EAAE,sCAAsC;QAClD,cAAc,EAAE,sCAAsC;QACtD,aAAa,EACX,kEAAkE;QACpE,eAAe,EAAE,KAAK;QACtB,qBAAqB,EAAE,4BAA4B;KACpD;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,YAAY,EAAE,eAAe;IAC7B,UAAU,EAAE,IAAI;CACjB,CAAC","sourcesContent":["import { 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\nexport const MOCK_NONCE_URL = NONCE_URL(Env.PRD);\nexport const MOCK_SRP_LOGIN_URL = SRP_LOGIN_URL(Env.PRD);\nexport const MOCK_OIDC_TOKEN_URL = OIDC_TOKEN_URL(Env.PRD);\nexport const MOCK_SIWE_LOGIN_URL = SIWE_LOGIN_URL(Env.PRD);\nexport const MOCK_PAIR_IDENTIFIERS_URL = PAIR_IDENTIFIERS(Env.PRD);\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\nexport const MOCK_NONCE_RESPONSE = {\n nonce: 'xGMm9SoihEKeAEfV',\n identifier: '0xd8641601Cb79a94FD872fE42d5b4a067A44a7e88',\n expires_in: 300,\n};\n\nexport const MOCK_SIWE_LOGIN_RESPONSE = {\n token: MOCK_JWT,\n expires_in: 3600,\n profile: {\n profile_id: 'fa2bbf82-bd9a-4e6b-aabc-9ca0d0319b6e',\n metametrics_id: 'de742679-4960-4977-a415-4718b5f8e86c',\n identifier_id:\n 'ec9a4e9906836497efad2fd4d4290b34d2c6a2c0d93eb174aa3cd88a133adbaf',\n identifier_type: 'SIWE',\n encrypted_storage_key: '2c6a2c0d93eb174aa3cd88a133adbaf',\n },\n};\n\nexport const MOCK_SRP_LOGIN_RESPONSE = {\n token: MOCK_JWT,\n expires_in: 3600,\n profile: {\n profile_id: 'f88227bd-b615-41a3-b0be-467dd781a4ad',\n metametrics_id: '561ec651-a844-4b36-a451-04d6eac35740',\n identifier_id:\n 'da9a9fc7b09edde9cc23cec9b7e11a71fb0ab4d2ddd8af8af905306f3e1456fb',\n identifier_type: 'SRP',\n encrypted_storage_key: 'd2ddd8af8af905306f3e1456fb',\n },\n};\n\nexport const MOCK_OIDC_TOKEN_RESPONSE = {\n access_token: MOCK_ACCESS_JWT,\n expires_in: 3600,\n};\n"]}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.MOCK_STORAGE_RESPONSE = exports.MOCK_NOTIFICATIONS_DATA_ENCRYPTED = exports.MOCK_NOTIFICATIONS_DATA = exports.MOCK_STORAGE_KEY = exports.MOCK_STORAGE_URL_ALL_FEATURE_ENTRIES = exports.MOCK_STORAGE_URL = void 0;
27
+ const encryption_1 = __importStar(require("../../shared/encryption/index.cjs"));
28
+ const env_1 = require("../../shared/env.cjs");
29
+ const storage_schema_1 = require("../../shared/storage-schema.cjs");
30
+ const user_storage_1 = require("../user-storage.cjs");
31
+ // Example mock notifications storage entry (wildcard)
32
+ exports.MOCK_STORAGE_URL = (0, user_storage_1.STORAGE_URL)(env_1.Env.PRD, `${storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`);
33
+ exports.MOCK_STORAGE_URL_ALL_FEATURE_ENTRIES = (0, user_storage_1.STORAGE_URL)(env_1.Env.PRD, storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications);
34
+ exports.MOCK_STORAGE_KEY = (0, encryption_1.createSHA256Hash)('mockStorageKey');
35
+ exports.MOCK_NOTIFICATIONS_DATA = '{ is_compact: false }';
36
+ const MOCK_NOTIFICATIONS_DATA_ENCRYPTED = async (data) => await encryption_1.default.encryptString(data ?? exports.MOCK_NOTIFICATIONS_DATA, exports.MOCK_STORAGE_KEY);
37
+ exports.MOCK_NOTIFICATIONS_DATA_ENCRYPTED = MOCK_NOTIFICATIONS_DATA_ENCRYPTED;
38
+ const MOCK_STORAGE_RESPONSE = async (data) => ({
39
+ HashedKey: '8485d2c14c333ebca415140a276adaf546619b0efc204586b73a5d400a18a5e2',
40
+ Data: await (0, exports.MOCK_NOTIFICATIONS_DATA_ENCRYPTED)(data),
41
+ });
42
+ exports.MOCK_STORAGE_RESPONSE = MOCK_STORAGE_RESPONSE;
43
+ //# sourceMappingURL=userstorage.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userstorage.cjs","sourceRoot":"","sources":["../../../src/sdk/mocks/userstorage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gFAAuE;AACvE,8CAAuC;AACvC,oEAAyE;AACzE,sDAA8C;AAE9C,sDAAsD;AACzC,QAAA,gBAAgB,GAAG,IAAA,0BAAW,EACzC,SAAG,CAAC,GAAG,EACP,GAAG,2CAA0B,CAAC,aAAa,wBAAwB,CACpE,CAAC;AACW,QAAA,oCAAoC,GAAG,IAAA,0BAAW,EAC7D,SAAG,CAAC,GAAG,EACP,2CAA0B,CAAC,aAAa,CACzC,CAAC;AAEW,QAAA,gBAAgB,GAAG,IAAA,6BAAgB,EAAC,gBAAgB,CAAC,CAAC;AACtD,QAAA,uBAAuB,GAAG,uBAAuB,CAAC;AACxD,MAAM,iCAAiC,GAAG,KAAK,EAAE,IAAa,EAAE,EAAE,CACvE,MAAM,oBAAU,CAAC,aAAa,CAC5B,IAAI,IAAI,+BAAuB,EAC/B,wBAAgB,CACjB,CAAC;AAJS,QAAA,iCAAiC,qCAI1C;AAEG,MAAM,qBAAqB,GAAG,KAAK,EAAE,IAAa,EAAE,EAAE,CAAC,CAAC;IAC7D,SAAS,EAAE,kEAAkE;IAC7E,IAAI,EAAE,MAAM,IAAA,yCAAiC,EAAC,IAAI,CAAC;CACpD,CAAC,CAAC;AAHU,QAAA,qBAAqB,yBAG/B","sourcesContent":["import encryption, { createSHA256Hash } from '../../shared/encryption';\nimport { Env } from '../../shared/env';\nimport { USER_STORAGE_FEATURE_NAMES } from '../../shared/storage-schema';\nimport { STORAGE_URL } from '../user-storage';\n\n// Example mock notifications storage entry (wildcard)\nexport const MOCK_STORAGE_URL = STORAGE_URL(\n Env.PRD,\n `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`,\n);\nexport const MOCK_STORAGE_URL_ALL_FEATURE_ENTRIES = STORAGE_URL(\n Env.PRD,\n USER_STORAGE_FEATURE_NAMES.notifications,\n);\n\nexport const MOCK_STORAGE_KEY = createSHA256Hash('mockStorageKey');\nexport const MOCK_NOTIFICATIONS_DATA = '{ is_compact: false }';\nexport const MOCK_NOTIFICATIONS_DATA_ENCRYPTED = async (data?: string) =>\n await encryption.encryptString(\n data ?? MOCK_NOTIFICATIONS_DATA,\n MOCK_STORAGE_KEY,\n );\n\nexport const MOCK_STORAGE_RESPONSE = async (data?: string) => ({\n HashedKey: '8485d2c14c333ebca415140a276adaf546619b0efc204586b73a5d400a18a5e2',\n Data: await MOCK_NOTIFICATIONS_DATA_ENCRYPTED(data),\n});\n"]}
@@ -0,0 +1,10 @@
1
+ export declare const MOCK_STORAGE_URL: string;
2
+ export declare const MOCK_STORAGE_URL_ALL_FEATURE_ENTRIES: string;
3
+ export declare const MOCK_STORAGE_KEY: string;
4
+ export declare const MOCK_NOTIFICATIONS_DATA = "{ is_compact: false }";
5
+ export declare const MOCK_NOTIFICATIONS_DATA_ENCRYPTED: (data?: string) => Promise<string>;
6
+ export declare const MOCK_STORAGE_RESPONSE: (data?: string) => Promise<{
7
+ HashedKey: string;
8
+ Data: string;
9
+ }>;
10
+ //# sourceMappingURL=userstorage.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userstorage.d.cts","sourceRoot":"","sources":["../../../src/sdk/mocks/userstorage.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB,QAG5B,CAAC;AACF,eAAO,MAAM,oCAAoC,QAGhD,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAqC,CAAC;AACnE,eAAO,MAAM,uBAAuB,0BAA0B,CAAC;AAC/D,eAAO,MAAM,iCAAiC,UAAiB,MAAM,oBAIlE,CAAC;AAEJ,eAAO,MAAM,qBAAqB,UAAiB,MAAM;;;EAGvD,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare const MOCK_STORAGE_URL: string;
2
+ export declare const MOCK_STORAGE_URL_ALL_FEATURE_ENTRIES: string;
3
+ export declare const MOCK_STORAGE_KEY: string;
4
+ export declare const MOCK_NOTIFICATIONS_DATA = "{ is_compact: false }";
5
+ export declare const MOCK_NOTIFICATIONS_DATA_ENCRYPTED: (data?: string) => Promise<string>;
6
+ export declare const MOCK_STORAGE_RESPONSE: (data?: string) => Promise<{
7
+ HashedKey: string;
8
+ Data: string;
9
+ }>;
10
+ //# sourceMappingURL=userstorage.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userstorage.d.mts","sourceRoot":"","sources":["../../../src/sdk/mocks/userstorage.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB,QAG5B,CAAC;AACF,eAAO,MAAM,oCAAoC,QAGhD,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAqC,CAAC;AACnE,eAAO,MAAM,uBAAuB,0BAA0B,CAAC;AAC/D,eAAO,MAAM,iCAAiC,UAAiB,MAAM,oBAIlE,CAAC;AAEJ,eAAO,MAAM,qBAAqB,UAAiB,MAAM;;;EAGvD,CAAC"}
@@ -0,0 +1,15 @@
1
+ import encryption, { createSHA256Hash } from "../../shared/encryption/index.mjs";
2
+ import { Env } from "../../shared/env.mjs";
3
+ import { USER_STORAGE_FEATURE_NAMES } from "../../shared/storage-schema.mjs";
4
+ import { STORAGE_URL } from "../user-storage.mjs";
5
+ // Example mock notifications storage entry (wildcard)
6
+ export const MOCK_STORAGE_URL = STORAGE_URL(Env.PRD, `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`);
7
+ export const MOCK_STORAGE_URL_ALL_FEATURE_ENTRIES = STORAGE_URL(Env.PRD, USER_STORAGE_FEATURE_NAMES.notifications);
8
+ export const MOCK_STORAGE_KEY = createSHA256Hash('mockStorageKey');
9
+ export const MOCK_NOTIFICATIONS_DATA = '{ is_compact: false }';
10
+ export const MOCK_NOTIFICATIONS_DATA_ENCRYPTED = async (data) => await encryption.encryptString(data ?? MOCK_NOTIFICATIONS_DATA, MOCK_STORAGE_KEY);
11
+ export const MOCK_STORAGE_RESPONSE = async (data) => ({
12
+ HashedKey: '8485d2c14c333ebca415140a276adaf546619b0efc204586b73a5d400a18a5e2',
13
+ Data: await MOCK_NOTIFICATIONS_DATA_ENCRYPTED(data),
14
+ });
15
+ //# sourceMappingURL=userstorage.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userstorage.mjs","sourceRoot":"","sources":["../../../src/sdk/mocks/userstorage.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAE,gBAAgB,EAAE,0CAAgC;AACvE,OAAO,EAAE,GAAG,EAAE,6BAAyB;AACvC,OAAO,EAAE,0BAA0B,EAAE,wCAAoC;AACzE,OAAO,EAAE,WAAW,EAAE,4BAAwB;AAE9C,sDAAsD;AACtD,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CACzC,GAAG,CAAC,GAAG,EACP,GAAG,0BAA0B,CAAC,aAAa,wBAAwB,CACpE,CAAC;AACF,MAAM,CAAC,MAAM,oCAAoC,GAAG,WAAW,CAC7D,GAAG,CAAC,GAAG,EACP,0BAA0B,CAAC,aAAa,CACzC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;AACnE,MAAM,CAAC,MAAM,uBAAuB,GAAG,uBAAuB,CAAC;AAC/D,MAAM,CAAC,MAAM,iCAAiC,GAAG,KAAK,EAAE,IAAa,EAAE,EAAE,CACvE,MAAM,UAAU,CAAC,aAAa,CAC5B,IAAI,IAAI,uBAAuB,EAC/B,gBAAgB,CACjB,CAAC;AAEJ,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,EAAE,IAAa,EAAE,EAAE,CAAC,CAAC;IAC7D,SAAS,EAAE,kEAAkE;IAC7E,IAAI,EAAE,MAAM,iCAAiC,CAAC,IAAI,CAAC;CACpD,CAAC,CAAC","sourcesContent":["import encryption, { createSHA256Hash } from '../../shared/encryption';\nimport { Env } from '../../shared/env';\nimport { USER_STORAGE_FEATURE_NAMES } from '../../shared/storage-schema';\nimport { STORAGE_URL } from '../user-storage';\n\n// Example mock notifications storage entry (wildcard)\nexport const MOCK_STORAGE_URL = STORAGE_URL(\n Env.PRD,\n `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`,\n);\nexport const MOCK_STORAGE_URL_ALL_FEATURE_ENTRIES = STORAGE_URL(\n Env.PRD,\n USER_STORAGE_FEATURE_NAMES.notifications,\n);\n\nexport const MOCK_STORAGE_KEY = createSHA256Hash('mockStorageKey');\nexport const MOCK_NOTIFICATIONS_DATA = '{ is_compact: false }';\nexport const MOCK_NOTIFICATIONS_DATA_ENCRYPTED = async (data?: string) =>\n await encryption.encryptString(\n data ?? MOCK_NOTIFICATIONS_DATA,\n MOCK_STORAGE_KEY,\n );\n\nexport const MOCK_STORAGE_RESPONSE = async (data?: string) => ({\n HashedKey: '8485d2c14c333ebca415140a276adaf546619b0efc204586b73a5d400a18a5e2',\n Data: await MOCK_NOTIFICATIONS_DATA_ENCRYPTED(data),\n});\n"]}