@nadohq/mobile-client 0.27.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 (204) hide show
  1. package/README.md +73 -0
  2. package/dist/MobileClient-9JSAzblH.cjs +218 -0
  3. package/dist/MobileClient-9JSAzblH.cjs.map +1 -0
  4. package/dist/MobileClient.cjs +4 -0
  5. package/dist/MobileClient.d.cts +114 -0
  6. package/dist/MobileClient.d.cts.map +1 -0
  7. package/dist/MobileClient.d.ts +114 -0
  8. package/dist/MobileClient.d.ts.map +1 -0
  9. package/dist/MobileClient.js +185 -0
  10. package/dist/MobileClient.js.map +1 -0
  11. package/dist/MobileServerFailureError-Belp_yef.d.cts +25 -0
  12. package/dist/MobileServerFailureError-Belp_yef.d.cts.map +1 -0
  13. package/dist/MobileServerFailureError-DqM0T6CB.d.ts +25 -0
  14. package/dist/MobileServerFailureError-DqM0T6CB.d.ts.map +1 -0
  15. package/dist/buildSignedMobileRequest-BsbBkU0K.d.cts +14 -0
  16. package/dist/buildSignedMobileRequest-BsbBkU0K.d.cts.map +1 -0
  17. package/dist/buildSignedMobileRequest-CDRsRNHm.d.ts +14 -0
  18. package/dist/buildSignedMobileRequest-CDRsRNHm.d.ts.map +1 -0
  19. package/dist/canonicalize-Dm7sXwPg.d.cts +14 -0
  20. package/dist/canonicalize-Dm7sXwPg.d.cts.map +1 -0
  21. package/dist/canonicalize-PX6dTIdF.d.ts +14 -0
  22. package/dist/canonicalize-PX6dTIdF.d.ts.map +1 -0
  23. package/dist/clientTypes-DWW2N66c.d.ts +168 -0
  24. package/dist/clientTypes-DWW2N66c.d.ts.map +1 -0
  25. package/dist/clientTypes-Et0PUa2d.d.cts +168 -0
  26. package/dist/clientTypes-Et0PUa2d.d.cts.map +1 -0
  27. package/dist/dataMappers.cjs +89 -0
  28. package/dist/dataMappers.cjs.map +1 -0
  29. package/dist/dataMappers.d.cts +27 -0
  30. package/dist/dataMappers.d.cts.map +1 -0
  31. package/dist/dataMappers.d.ts +27 -0
  32. package/dist/dataMappers.d.ts.map +1 -0
  33. package/dist/dataMappers.js +84 -0
  34. package/dist/dataMappers.js.map +1 -0
  35. package/dist/eip712MethodByType-DJgXal9r.d.ts +10 -0
  36. package/dist/eip712MethodByType-DJgXal9r.d.ts.map +1 -0
  37. package/dist/eip712MethodByType-DLh9MRsD.d.cts +10 -0
  38. package/dist/eip712MethodByType-DLh9MRsD.d.cts.map +1 -0
  39. package/dist/endpoints.cjs +14 -0
  40. package/dist/endpoints.cjs.map +1 -0
  41. package/dist/endpoints.d.cts +10 -0
  42. package/dist/endpoints.d.cts.map +1 -0
  43. package/dist/endpoints.d.ts +10 -0
  44. package/dist/endpoints.d.ts.map +1 -0
  45. package/dist/endpoints.js +13 -0
  46. package/dist/endpoints.js.map +1 -0
  47. package/dist/index.cjs +27 -0
  48. package/dist/index.d.cts +18 -0
  49. package/dist/index.d.ts +18 -0
  50. package/dist/index.js +15 -0
  51. package/dist/mobileErrorCodes-D8KzJXbU.d.cts +29 -0
  52. package/dist/mobileErrorCodes-D8KzJXbU.d.cts.map +1 -0
  53. package/dist/mobileErrorCodes-DM09jnNe.d.ts +29 -0
  54. package/dist/mobileErrorCodes-DM09jnNe.d.ts.map +1 -0
  55. package/dist/nonce-DCOrXXkQ.d.ts +15 -0
  56. package/dist/nonce-DCOrXXkQ.d.ts.map +1 -0
  57. package/dist/nonce-zGyisRlj.d.cts +15 -0
  58. package/dist/nonce-zGyisRlj.d.cts.map +1 -0
  59. package/dist/patterns-B9J2ldpx.d.cts +8 -0
  60. package/dist/patterns-B9J2ldpx.d.cts.map +1 -0
  61. package/dist/patterns-BbxH3_VA.d.ts +8 -0
  62. package/dist/patterns-BbxH3_VA.d.ts.map +1 -0
  63. package/dist/payloadHash-Bmhzs78N.d.ts +13 -0
  64. package/dist/payloadHash-Bmhzs78N.d.ts.map +1 -0
  65. package/dist/payloadHash-nj8WuLUP.d.cts +13 -0
  66. package/dist/payloadHash-nj8WuLUP.d.cts.map +1 -0
  67. package/dist/serverBaseTypes-BicXMrZV.d.cts +43 -0
  68. package/dist/serverBaseTypes-BicXMrZV.d.cts.map +1 -0
  69. package/dist/serverBaseTypes-ewbo8l4R.d.ts +43 -0
  70. package/dist/serverBaseTypes-ewbo8l4R.d.ts.map +1 -0
  71. package/dist/serverExecuteTypes-CXnMjKnt.d.ts +11 -0
  72. package/dist/serverExecuteTypes-CXnMjKnt.d.ts.map +1 -0
  73. package/dist/serverExecuteTypes-DKYK1V7C.d.cts +11 -0
  74. package/dist/serverExecuteTypes-DKYK1V7C.d.cts.map +1 -0
  75. package/dist/serverModelTypes-CQgfqgW3.d.cts +69 -0
  76. package/dist/serverModelTypes-CQgfqgW3.d.cts.map +1 -0
  77. package/dist/serverModelTypes-vEPhHIit.d.ts +69 -0
  78. package/dist/serverModelTypes-vEPhHIit.d.ts.map +1 -0
  79. package/dist/serverQueryTypes-BI-2TD8F.d.ts +53 -0
  80. package/dist/serverQueryTypes-BI-2TD8F.d.ts.map +1 -0
  81. package/dist/serverQueryTypes-D7Yharse.d.cts +53 -0
  82. package/dist/serverQueryTypes-D7Yharse.d.cts.map +1 -0
  83. package/dist/serverResponseGuards-C_vZIgGl.d.ts +16 -0
  84. package/dist/serverResponseGuards-C_vZIgGl.d.ts.map +1 -0
  85. package/dist/serverResponseGuards-DjCNL3CR.d.cts +16 -0
  86. package/dist/serverResponseGuards-DjCNL3CR.d.cts.map +1 -0
  87. package/dist/signing/buildSignedMobileRequest.cjs +47 -0
  88. package/dist/signing/buildSignedMobileRequest.cjs.map +1 -0
  89. package/dist/signing/buildSignedMobileRequest.d.cts +2 -0
  90. package/dist/signing/buildSignedMobileRequest.d.ts +2 -0
  91. package/dist/signing/buildSignedMobileRequest.js +45 -0
  92. package/dist/signing/buildSignedMobileRequest.js.map +1 -0
  93. package/dist/signing/canonicalize.cjs +68 -0
  94. package/dist/signing/canonicalize.cjs.map +1 -0
  95. package/dist/signing/canonicalize.d.cts +2 -0
  96. package/dist/signing/canonicalize.d.ts +2 -0
  97. package/dist/signing/canonicalize.js +67 -0
  98. package/dist/signing/canonicalize.js.map +1 -0
  99. package/dist/signing/eip712MethodByType.cjs +20 -0
  100. package/dist/signing/eip712MethodByType.cjs.map +1 -0
  101. package/dist/signing/eip712MethodByType.d.cts +2 -0
  102. package/dist/signing/eip712MethodByType.d.ts +2 -0
  103. package/dist/signing/eip712MethodByType.js +19 -0
  104. package/dist/signing/eip712MethodByType.js.map +1 -0
  105. package/dist/signing/index.cjs +11 -0
  106. package/dist/signing/index.d.cts +7 -0
  107. package/dist/signing/index.d.ts +7 -0
  108. package/dist/signing/index.js +6 -0
  109. package/dist/signing/nonce.cjs +19 -0
  110. package/dist/signing/nonce.cjs.map +1 -0
  111. package/dist/signing/nonce.d.cts +2 -0
  112. package/dist/signing/nonce.d.ts +2 -0
  113. package/dist/signing/nonce.js +18 -0
  114. package/dist/signing/nonce.js.map +1 -0
  115. package/dist/signing/payloadHash.cjs +17 -0
  116. package/dist/signing/payloadHash.cjs.map +1 -0
  117. package/dist/signing/payloadHash.d.cts +2 -0
  118. package/dist/signing/payloadHash.d.ts +2 -0
  119. package/dist/signing/payloadHash.js +15 -0
  120. package/dist/signing/payloadHash.js.map +1 -0
  121. package/dist/signing/types.cjs +0 -0
  122. package/dist/signing/types.d.cts +2 -0
  123. package/dist/signing/types.d.ts +2 -0
  124. package/dist/signing/types.js +1 -0
  125. package/dist/types/MobileServerFailureError.cjs +17 -0
  126. package/dist/types/MobileServerFailureError.cjs.map +1 -0
  127. package/dist/types/MobileServerFailureError.d.cts +2 -0
  128. package/dist/types/MobileServerFailureError.d.ts +2 -0
  129. package/dist/types/MobileServerFailureError.js +16 -0
  130. package/dist/types/MobileServerFailureError.js.map +1 -0
  131. package/dist/types/clientTypes.cjs +0 -0
  132. package/dist/types/clientTypes.d.cts +2 -0
  133. package/dist/types/clientTypes.d.ts +2 -0
  134. package/dist/types/clientTypes.js +1 -0
  135. package/dist/types/index.cjs +5 -0
  136. package/dist/types/index.d.cts +8 -0
  137. package/dist/types/index.d.ts +8 -0
  138. package/dist/types/index.js +3 -0
  139. package/dist/types/mobileErrorCodes.cjs +27 -0
  140. package/dist/types/mobileErrorCodes.cjs.map +1 -0
  141. package/dist/types/mobileErrorCodes.d.cts +2 -0
  142. package/dist/types/mobileErrorCodes.d.ts +2 -0
  143. package/dist/types/mobileErrorCodes.js +26 -0
  144. package/dist/types/mobileErrorCodes.js.map +1 -0
  145. package/dist/types/serverBaseTypes.cjs +0 -0
  146. package/dist/types/serverBaseTypes.d.cts +2 -0
  147. package/dist/types/serverBaseTypes.d.ts +2 -0
  148. package/dist/types/serverBaseTypes.js +1 -0
  149. package/dist/types/serverExecuteTypes.cjs +0 -0
  150. package/dist/types/serverExecuteTypes.d.cts +2 -0
  151. package/dist/types/serverExecuteTypes.d.ts +2 -0
  152. package/dist/types/serverExecuteTypes.js +1 -0
  153. package/dist/types/serverModelTypes.cjs +0 -0
  154. package/dist/types/serverModelTypes.d.cts +2 -0
  155. package/dist/types/serverModelTypes.d.ts +2 -0
  156. package/dist/types/serverModelTypes.js +1 -0
  157. package/dist/types/serverQueryTypes.cjs +0 -0
  158. package/dist/types/serverQueryTypes.d.cts +2 -0
  159. package/dist/types/serverQueryTypes.d.ts +2 -0
  160. package/dist/types/serverQueryTypes.js +1 -0
  161. package/dist/types-B76Pn7Sy.d.ts +73 -0
  162. package/dist/types-B76Pn7Sy.d.ts.map +1 -0
  163. package/dist/types-uCD4BNZR.d.cts +73 -0
  164. package/dist/types-uCD4BNZR.d.cts.map +1 -0
  165. package/dist/utils/index.cjs +6 -0
  166. package/dist/utils/index.d.cts +3 -0
  167. package/dist/utils/index.d.ts +3 -0
  168. package/dist/utils/index.js +3 -0
  169. package/dist/utils/patterns.cjs +10 -0
  170. package/dist/utils/patterns.cjs.map +1 -0
  171. package/dist/utils/patterns.d.cts +2 -0
  172. package/dist/utils/patterns.d.ts +2 -0
  173. package/dist/utils/patterns.js +9 -0
  174. package/dist/utils/patterns.js.map +1 -0
  175. package/dist/utils/serverResponseGuards.cjs +19 -0
  176. package/dist/utils/serverResponseGuards.cjs.map +1 -0
  177. package/dist/utils/serverResponseGuards.d.cts +2 -0
  178. package/dist/utils/serverResponseGuards.d.ts +2 -0
  179. package/dist/utils/serverResponseGuards.js +17 -0
  180. package/dist/utils/serverResponseGuards.js.map +1 -0
  181. package/package.json +58 -0
  182. package/src/MobileClient.ts +395 -0
  183. package/src/dataMappers.ts +106 -0
  184. package/src/endpoints.ts +10 -0
  185. package/src/index.ts +5 -0
  186. package/src/signing/buildSignedMobileRequest.ts +58 -0
  187. package/src/signing/canonicalize.ts +69 -0
  188. package/src/signing/eip712MethodByType.ts +19 -0
  189. package/src/signing/index.ts +6 -0
  190. package/src/signing/nonce.ts +16 -0
  191. package/src/signing/payloadHash.ts +12 -0
  192. package/src/signing/signing.test.ts +224 -0
  193. package/src/signing/types.ts +71 -0
  194. package/src/types/MobileServerFailureError.ts +18 -0
  195. package/src/types/clientTypes.ts +182 -0
  196. package/src/types/index.ts +7 -0
  197. package/src/types/mobileErrorCodes.ts +27 -0
  198. package/src/types/serverBaseTypes.ts +43 -0
  199. package/src/types/serverExecuteTypes.ts +12 -0
  200. package/src/types/serverModelTypes.ts +74 -0
  201. package/src/types/serverQueryTypes.ts +74 -0
  202. package/src/utils/index.ts +2 -0
  203. package/src/utils/patterns.ts +4 -0
  204. package/src/utils/serverResponseGuards.ts +27 -0
@@ -0,0 +1,47 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("../MobileClient-9JSAzblH.cjs");
3
+ const require_signing_canonicalize = require("./canonicalize.cjs");
4
+ const require_signing_eip712MethodByType = require("./eip712MethodByType.cjs");
5
+ const require_signing_nonce = require("./nonce.cjs");
6
+ const require_signing_payloadHash = require("./payloadHash.cjs");
7
+ let _nadohq_shared = require("@nadohq/shared");
8
+ //#region src/signing/buildSignedMobileRequest.ts
9
+ /**
10
+ * Builds and signs a mobile service API request: canonicalizes the inner payload, derives `sender` from the
11
+ * subaccount owner (never the signer), computes the EIP-712 `payloadHash`, signs the `NadoAuthentication`
12
+ * typed data, and returns the flattened signed body ready to POST.
13
+ */
14
+ async function buildSignedMobileRequest(params) {
15
+ const { walletClient, subaccountOwner, subaccountName, chainId, verifyingAddr, inner } = params;
16
+ const canonicalInner = require_signing_canonicalize.canonicalizeMobileInner(inner);
17
+ const sender = (0, _nadohq_shared.subaccountToHex)({
18
+ subaccountOwner,
19
+ subaccountName
20
+ });
21
+ const payloadHash = require_signing_payloadHash.getMobilePayloadHash(canonicalInner);
22
+ const nonce = params.nonce ?? require_signing_nonce.getMobileNonce();
23
+ const method = require_signing_eip712MethodByType.MOBILE_EIP712_METHOD_BY_TYPE[canonicalInner.type];
24
+ const signature = await (0, _nadohq_shared.getSignedTransactionRequest)({
25
+ requestType: "nado_authentication",
26
+ requestParams: {
27
+ method,
28
+ subaccountOwner,
29
+ subaccountName,
30
+ payloadHash,
31
+ nonce: nonce.toString()
32
+ },
33
+ chainId,
34
+ verifyingContract: verifyingAddr,
35
+ walletClient
36
+ });
37
+ return {
38
+ ...canonicalInner,
39
+ signature,
40
+ sender,
41
+ nonce: nonce.toString()
42
+ };
43
+ }
44
+ //#endregion
45
+ exports.buildSignedMobileRequest = buildSignedMobileRequest;
46
+
47
+ //# sourceMappingURL=buildSignedMobileRequest.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildSignedMobileRequest.cjs","names":["canonicalizeMobileInner","getMobilePayloadHash","getMobileNonce","MOBILE_EIP712_METHOD_BY_TYPE"],"sources":["../../src/signing/buildSignedMobileRequest.ts"],"sourcesContent":["import { getSignedTransactionRequest, subaccountToHex } from '@nadohq/shared';\nimport { canonicalizeMobileInner } from './canonicalize';\nimport { MOBILE_EIP712_METHOD_BY_TYPE } from './eip712MethodByType';\nimport { getMobileNonce } from './nonce';\nimport { getMobilePayloadHash } from './payloadHash';\nimport {\n BuildSignedMobileRequestParams,\n MobileSignedInner,\n MobileSignedRequest,\n} from './types';\n\n/**\n * Builds and signs a mobile service API request: canonicalizes the inner payload, derives `sender` from the\n * subaccount owner (never the signer), computes the EIP-712 `payloadHash`, signs the `NadoAuthentication`\n * typed data, and returns the flattened signed body ready to POST.\n */\nexport async function buildSignedMobileRequest<T extends MobileSignedInner>(\n params: BuildSignedMobileRequestParams & { inner: T },\n): Promise<MobileSignedRequest<T>> {\n const {\n walletClient,\n subaccountOwner,\n subaccountName,\n chainId,\n verifyingAddr,\n inner,\n } = params;\n\n const canonicalInner = canonicalizeMobileInner(inner) as T;\n const sender = subaccountToHex({\n subaccountOwner,\n subaccountName,\n });\n const payloadHash = getMobilePayloadHash(canonicalInner);\n const nonce = params.nonce ?? getMobileNonce();\n const method = MOBILE_EIP712_METHOD_BY_TYPE[canonicalInner.type];\n\n const signature = await getSignedTransactionRequest({\n requestType: 'nado_authentication',\n requestParams: {\n method,\n subaccountOwner,\n subaccountName,\n payloadHash,\n nonce: nonce.toString(),\n },\n chainId,\n verifyingContract: verifyingAddr,\n walletClient,\n });\n\n return {\n ...canonicalInner,\n signature,\n sender,\n nonce: nonce.toString(),\n };\n}\n"],"mappings":";;;;;;;;;;;;;AAgBA,eAAsB,yBACpB,QACiC;CACjC,MAAM,EACJ,cACA,iBACA,gBACA,SACA,eACA,UACE;CAEJ,MAAM,iBAAiBA,6BAAAA,wBAAwB,KAAK;CACpD,MAAM,UAAA,GAAA,eAAA,iBAAyB;EAC7B;EACA;CACF,CAAC;CACD,MAAM,cAAcC,4BAAAA,qBAAqB,cAAc;CACvD,MAAM,QAAQ,OAAO,SAASC,sBAAAA,eAAe;CAC7C,MAAM,SAASC,mCAAAA,6BAA6B,eAAe;CAE3D,MAAM,YAAY,OAAA,GAAA,eAAA,6BAAkC;EAClD,aAAa;EACb,eAAe;GACb;GACA;GACA;GACA;GACA,OAAO,MAAM,SAAS;EACxB;EACA;EACA,mBAAmB;EACnB;CACF,CAAC;CAED,OAAO;EACL,GAAG;EACH;EACA;EACA,OAAO,MAAM,SAAS;CACxB;AACF"}
@@ -0,0 +1,2 @@
1
+ import { t as buildSignedMobileRequest } from "../buildSignedMobileRequest-BsbBkU0K.cjs";
2
+ export { buildSignedMobileRequest };
@@ -0,0 +1,2 @@
1
+ import { t as buildSignedMobileRequest } from "../buildSignedMobileRequest-CDRsRNHm.js";
2
+ export { buildSignedMobileRequest };
@@ -0,0 +1,45 @@
1
+ import { canonicalizeMobileInner } from "./canonicalize.js";
2
+ import { MOBILE_EIP712_METHOD_BY_TYPE } from "./eip712MethodByType.js";
3
+ import { getMobileNonce } from "./nonce.js";
4
+ import { getMobilePayloadHash } from "./payloadHash.js";
5
+ import { getSignedTransactionRequest, subaccountToHex } from "@nadohq/shared";
6
+ //#region src/signing/buildSignedMobileRequest.ts
7
+ /**
8
+ * Builds and signs a mobile service API request: canonicalizes the inner payload, derives `sender` from the
9
+ * subaccount owner (never the signer), computes the EIP-712 `payloadHash`, signs the `NadoAuthentication`
10
+ * typed data, and returns the flattened signed body ready to POST.
11
+ */
12
+ async function buildSignedMobileRequest(params) {
13
+ const { walletClient, subaccountOwner, subaccountName, chainId, verifyingAddr, inner } = params;
14
+ const canonicalInner = canonicalizeMobileInner(inner);
15
+ const sender = subaccountToHex({
16
+ subaccountOwner,
17
+ subaccountName
18
+ });
19
+ const payloadHash = getMobilePayloadHash(canonicalInner);
20
+ const nonce = params.nonce ?? getMobileNonce();
21
+ const method = MOBILE_EIP712_METHOD_BY_TYPE[canonicalInner.type];
22
+ const signature = await getSignedTransactionRequest({
23
+ requestType: "nado_authentication",
24
+ requestParams: {
25
+ method,
26
+ subaccountOwner,
27
+ subaccountName,
28
+ payloadHash,
29
+ nonce: nonce.toString()
30
+ },
31
+ chainId,
32
+ verifyingContract: verifyingAddr,
33
+ walletClient
34
+ });
35
+ return {
36
+ ...canonicalInner,
37
+ signature,
38
+ sender,
39
+ nonce: nonce.toString()
40
+ };
41
+ }
42
+ //#endregion
43
+ export { buildSignedMobileRequest };
44
+
45
+ //# sourceMappingURL=buildSignedMobileRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildSignedMobileRequest.js","names":[],"sources":["../../src/signing/buildSignedMobileRequest.ts"],"sourcesContent":["import { getSignedTransactionRequest, subaccountToHex } from '@nadohq/shared';\nimport { canonicalizeMobileInner } from './canonicalize';\nimport { MOBILE_EIP712_METHOD_BY_TYPE } from './eip712MethodByType';\nimport { getMobileNonce } from './nonce';\nimport { getMobilePayloadHash } from './payloadHash';\nimport {\n BuildSignedMobileRequestParams,\n MobileSignedInner,\n MobileSignedRequest,\n} from './types';\n\n/**\n * Builds and signs a mobile service API request: canonicalizes the inner payload, derives `sender` from the\n * subaccount owner (never the signer), computes the EIP-712 `payloadHash`, signs the `NadoAuthentication`\n * typed data, and returns the flattened signed body ready to POST.\n */\nexport async function buildSignedMobileRequest<T extends MobileSignedInner>(\n params: BuildSignedMobileRequestParams & { inner: T },\n): Promise<MobileSignedRequest<T>> {\n const {\n walletClient,\n subaccountOwner,\n subaccountName,\n chainId,\n verifyingAddr,\n inner,\n } = params;\n\n const canonicalInner = canonicalizeMobileInner(inner) as T;\n const sender = subaccountToHex({\n subaccountOwner,\n subaccountName,\n });\n const payloadHash = getMobilePayloadHash(canonicalInner);\n const nonce = params.nonce ?? getMobileNonce();\n const method = MOBILE_EIP712_METHOD_BY_TYPE[canonicalInner.type];\n\n const signature = await getSignedTransactionRequest({\n requestType: 'nado_authentication',\n requestParams: {\n method,\n subaccountOwner,\n subaccountName,\n payloadHash,\n nonce: nonce.toString(),\n },\n chainId,\n verifyingContract: verifyingAddr,\n walletClient,\n });\n\n return {\n ...canonicalInner,\n signature,\n sender,\n nonce: nonce.toString(),\n };\n}\n"],"mappings":";;;;;;;;;;;AAgBA,eAAsB,yBACpB,QACiC;CACjC,MAAM,EACJ,cACA,iBACA,gBACA,SACA,eACA,UACE;CAEJ,MAAM,iBAAiB,wBAAwB,KAAK;CACpD,MAAM,SAAS,gBAAgB;EAC7B;EACA;CACF,CAAC;CACD,MAAM,cAAc,qBAAqB,cAAc;CACvD,MAAM,QAAQ,OAAO,SAAS,eAAe;CAC7C,MAAM,SAAS,6BAA6B,eAAe;CAE3D,MAAM,YAAY,MAAM,4BAA4B;EAClD,aAAa;EACb,eAAe;GACb;GACA;GACA;GACA;GACA,OAAO,MAAM,SAAS;EACxB;EACA;EACA,mBAAmB;EACnB;CACF,CAAC;CAED,OAAO;EACL,GAAG;EACH;EACA;EACA,OAAO,MAAM,SAAS;CACxB;AACF"}
@@ -0,0 +1,68 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/signing/canonicalize.ts
3
+ /**
4
+ * Rebuilds an inner payload with its keys in the backend's struct declaration order (`type` first, then the
5
+ * remaining fields in the exact order the backend serializes them). msgpack encodes object keys in insertion
6
+ * order and the payload hash must be reproducible regardless of how the caller constructed the object, so
7
+ * every inner payload — and each of its sub-types — is canonicalized here before hashing. This function (with
8
+ * {@link canonicalizeNotificationPreferences} for nested preferences) is the source of truth for that order.
9
+ */
10
+ function canonicalizeMobileInner(inner) {
11
+ switch (inner.type) {
12
+ case "claim_username": return {
13
+ type: "claim_username",
14
+ display_name: inner.display_name
15
+ };
16
+ case "update_username": return {
17
+ type: "update_username",
18
+ display_name: inner.display_name
19
+ };
20
+ case "set_private_mode": return {
21
+ type: "set_private_mode",
22
+ private_mode: inner.private_mode
23
+ };
24
+ case "self_identity": return { type: "self_identity" };
25
+ case "register_expo_token": return {
26
+ type: "register_expo_token",
27
+ expo_token: inner.expo_token,
28
+ platform: inner.platform,
29
+ locale: inner.locale,
30
+ app_version: inner.app_version
31
+ };
32
+ case "unregister_expo_token": return {
33
+ type: "unregister_expo_token",
34
+ expo_token: inner.expo_token
35
+ };
36
+ case "update_preferences": return {
37
+ type: "update_preferences",
38
+ preferences: canonicalizeNotificationPreferences(inner.preferences)
39
+ };
40
+ case "notification_preferences": return { type: "notification_preferences" };
41
+ case "registered_devices": return { type: "registered_devices" };
42
+ default: throw new Error(`canonicalizeMobileInner: unhandled inner payload type: ${JSON.stringify(inner)}`);
43
+ }
44
+ }
45
+ /**
46
+ * Rebuilds notification preferences with keys in the backend's struct declaration order, so the msgpack
47
+ * encoding matches the backend's `rmp_serde::to_vec_named` output field-for-field.
48
+ */
49
+ function canonicalizeNotificationPreferences(preferences) {
50
+ return {
51
+ schema_version: preferences.schema_version,
52
+ categories: preferences.categories.map((category) => ({
53
+ category: category.category,
54
+ enabled: category.enabled,
55
+ scopes: category.scopes.map((scope) => scope.type === "subaccount" ? {
56
+ type: "subaccount",
57
+ subaccount: scope.subaccount
58
+ } : {
59
+ type: "product",
60
+ product_id: scope.product_id
61
+ })
62
+ }))
63
+ };
64
+ }
65
+ //#endregion
66
+ exports.canonicalizeMobileInner = canonicalizeMobileInner;
67
+
68
+ //# sourceMappingURL=canonicalize.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonicalize.cjs","names":[],"sources":["../../src/signing/canonicalize.ts"],"sourcesContent":["import { MobileServerNotificationPreferences } from '../types/serverModelTypes';\nimport { MobileSignedInner } from './types';\n\n/**\n * Rebuilds an inner payload with its keys in the backend's struct declaration order (`type` first, then the\n * remaining fields in the exact order the backend serializes them). msgpack encodes object keys in insertion\n * order and the payload hash must be reproducible regardless of how the caller constructed the object, so\n * every inner payload — and each of its sub-types — is canonicalized here before hashing. This function (with\n * {@link canonicalizeNotificationPreferences} for nested preferences) is the source of truth for that order.\n */\nexport function canonicalizeMobileInner(\n inner: MobileSignedInner,\n): MobileSignedInner {\n switch (inner.type) {\n case 'claim_username':\n return { type: 'claim_username', display_name: inner.display_name };\n case 'update_username':\n return { type: 'update_username', display_name: inner.display_name };\n case 'set_private_mode':\n return { type: 'set_private_mode', private_mode: inner.private_mode };\n case 'self_identity':\n return { type: 'self_identity' };\n case 'register_expo_token':\n return {\n type: 'register_expo_token',\n expo_token: inner.expo_token,\n platform: inner.platform,\n locale: inner.locale,\n app_version: inner.app_version,\n };\n case 'unregister_expo_token':\n return { type: 'unregister_expo_token', expo_token: inner.expo_token };\n case 'update_preferences':\n return {\n type: 'update_preferences',\n preferences: canonicalizeNotificationPreferences(inner.preferences),\n };\n case 'notification_preferences':\n return { type: 'notification_preferences' };\n case 'registered_devices':\n return { type: 'registered_devices' };\n default: {\n throw new Error(\n `canonicalizeMobileInner: unhandled inner payload type: ${JSON.stringify(inner)}`,\n );\n }\n }\n}\n\n/**\n * Rebuilds notification preferences with keys in the backend's struct declaration order, so the msgpack\n * encoding matches the backend's `rmp_serde::to_vec_named` output field-for-field.\n */\nfunction canonicalizeNotificationPreferences(\n preferences: MobileServerNotificationPreferences,\n): MobileServerNotificationPreferences {\n return {\n schema_version: preferences.schema_version,\n categories: preferences.categories.map((category) => ({\n category: category.category,\n enabled: category.enabled,\n scopes: category.scopes.map((scope) =>\n scope.type === 'subaccount'\n ? { type: 'subaccount', subaccount: scope.subaccount }\n : { type: 'product', product_id: scope.product_id },\n ),\n })),\n };\n}\n"],"mappings":";;;;;;;;;AAUA,SAAgB,wBACd,OACmB;CACnB,QAAQ,MAAM,MAAd;EACE,KAAK,kBACH,OAAO;GAAE,MAAM;GAAkB,cAAc,MAAM;EAAa;EACpE,KAAK,mBACH,OAAO;GAAE,MAAM;GAAmB,cAAc,MAAM;EAAa;EACrE,KAAK,oBACH,OAAO;GAAE,MAAM;GAAoB,cAAc,MAAM;EAAa;EACtE,KAAK,iBACH,OAAO,EAAE,MAAM,gBAAgB;EACjC,KAAK,uBACH,OAAO;GACL,MAAM;GACN,YAAY,MAAM;GAClB,UAAU,MAAM;GAChB,QAAQ,MAAM;GACd,aAAa,MAAM;EACrB;EACF,KAAK,yBACH,OAAO;GAAE,MAAM;GAAyB,YAAY,MAAM;EAAW;EACvE,KAAK,sBACH,OAAO;GACL,MAAM;GACN,aAAa,oCAAoC,MAAM,WAAW;EACpE;EACF,KAAK,4BACH,OAAO,EAAE,MAAM,2BAA2B;EAC5C,KAAK,sBACH,OAAO,EAAE,MAAM,qBAAqB;EACtC,SACE,MAAM,IAAI,MACR,0DAA0D,KAAK,UAAU,KAAK,GAChF;CAEJ;AACF;;;;;AAMA,SAAS,oCACP,aACqC;CACrC,OAAO;EACL,gBAAgB,YAAY;EAC5B,YAAY,YAAY,WAAW,KAAK,cAAc;GACpD,UAAU,SAAS;GACnB,SAAS,SAAS;GAClB,QAAQ,SAAS,OAAO,KAAK,UAC3B,MAAM,SAAS,eACX;IAAE,MAAM;IAAc,YAAY,MAAM;GAAW,IACnD;IAAE,MAAM;IAAW,YAAY,MAAM;GAAW,CACtD;EACF,EAAE;CACJ;AACF"}
@@ -0,0 +1,2 @@
1
+ import { t as canonicalizeMobileInner } from "../canonicalize-Dm7sXwPg.cjs";
2
+ export { canonicalizeMobileInner };
@@ -0,0 +1,2 @@
1
+ import { t as canonicalizeMobileInner } from "../canonicalize-PX6dTIdF.js";
2
+ export { canonicalizeMobileInner };
@@ -0,0 +1,67 @@
1
+ //#region src/signing/canonicalize.ts
2
+ /**
3
+ * Rebuilds an inner payload with its keys in the backend's struct declaration order (`type` first, then the
4
+ * remaining fields in the exact order the backend serializes them). msgpack encodes object keys in insertion
5
+ * order and the payload hash must be reproducible regardless of how the caller constructed the object, so
6
+ * every inner payload — and each of its sub-types — is canonicalized here before hashing. This function (with
7
+ * {@link canonicalizeNotificationPreferences} for nested preferences) is the source of truth for that order.
8
+ */
9
+ function canonicalizeMobileInner(inner) {
10
+ switch (inner.type) {
11
+ case "claim_username": return {
12
+ type: "claim_username",
13
+ display_name: inner.display_name
14
+ };
15
+ case "update_username": return {
16
+ type: "update_username",
17
+ display_name: inner.display_name
18
+ };
19
+ case "set_private_mode": return {
20
+ type: "set_private_mode",
21
+ private_mode: inner.private_mode
22
+ };
23
+ case "self_identity": return { type: "self_identity" };
24
+ case "register_expo_token": return {
25
+ type: "register_expo_token",
26
+ expo_token: inner.expo_token,
27
+ platform: inner.platform,
28
+ locale: inner.locale,
29
+ app_version: inner.app_version
30
+ };
31
+ case "unregister_expo_token": return {
32
+ type: "unregister_expo_token",
33
+ expo_token: inner.expo_token
34
+ };
35
+ case "update_preferences": return {
36
+ type: "update_preferences",
37
+ preferences: canonicalizeNotificationPreferences(inner.preferences)
38
+ };
39
+ case "notification_preferences": return { type: "notification_preferences" };
40
+ case "registered_devices": return { type: "registered_devices" };
41
+ default: throw new Error(`canonicalizeMobileInner: unhandled inner payload type: ${JSON.stringify(inner)}`);
42
+ }
43
+ }
44
+ /**
45
+ * Rebuilds notification preferences with keys in the backend's struct declaration order, so the msgpack
46
+ * encoding matches the backend's `rmp_serde::to_vec_named` output field-for-field.
47
+ */
48
+ function canonicalizeNotificationPreferences(preferences) {
49
+ return {
50
+ schema_version: preferences.schema_version,
51
+ categories: preferences.categories.map((category) => ({
52
+ category: category.category,
53
+ enabled: category.enabled,
54
+ scopes: category.scopes.map((scope) => scope.type === "subaccount" ? {
55
+ type: "subaccount",
56
+ subaccount: scope.subaccount
57
+ } : {
58
+ type: "product",
59
+ product_id: scope.product_id
60
+ })
61
+ }))
62
+ };
63
+ }
64
+ //#endregion
65
+ export { canonicalizeMobileInner };
66
+
67
+ //# sourceMappingURL=canonicalize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonicalize.js","names":[],"sources":["../../src/signing/canonicalize.ts"],"sourcesContent":["import { MobileServerNotificationPreferences } from '../types/serverModelTypes';\nimport { MobileSignedInner } from './types';\n\n/**\n * Rebuilds an inner payload with its keys in the backend's struct declaration order (`type` first, then the\n * remaining fields in the exact order the backend serializes them). msgpack encodes object keys in insertion\n * order and the payload hash must be reproducible regardless of how the caller constructed the object, so\n * every inner payload — and each of its sub-types — is canonicalized here before hashing. This function (with\n * {@link canonicalizeNotificationPreferences} for nested preferences) is the source of truth for that order.\n */\nexport function canonicalizeMobileInner(\n inner: MobileSignedInner,\n): MobileSignedInner {\n switch (inner.type) {\n case 'claim_username':\n return { type: 'claim_username', display_name: inner.display_name };\n case 'update_username':\n return { type: 'update_username', display_name: inner.display_name };\n case 'set_private_mode':\n return { type: 'set_private_mode', private_mode: inner.private_mode };\n case 'self_identity':\n return { type: 'self_identity' };\n case 'register_expo_token':\n return {\n type: 'register_expo_token',\n expo_token: inner.expo_token,\n platform: inner.platform,\n locale: inner.locale,\n app_version: inner.app_version,\n };\n case 'unregister_expo_token':\n return { type: 'unregister_expo_token', expo_token: inner.expo_token };\n case 'update_preferences':\n return {\n type: 'update_preferences',\n preferences: canonicalizeNotificationPreferences(inner.preferences),\n };\n case 'notification_preferences':\n return { type: 'notification_preferences' };\n case 'registered_devices':\n return { type: 'registered_devices' };\n default: {\n throw new Error(\n `canonicalizeMobileInner: unhandled inner payload type: ${JSON.stringify(inner)}`,\n );\n }\n }\n}\n\n/**\n * Rebuilds notification preferences with keys in the backend's struct declaration order, so the msgpack\n * encoding matches the backend's `rmp_serde::to_vec_named` output field-for-field.\n */\nfunction canonicalizeNotificationPreferences(\n preferences: MobileServerNotificationPreferences,\n): MobileServerNotificationPreferences {\n return {\n schema_version: preferences.schema_version,\n categories: preferences.categories.map((category) => ({\n category: category.category,\n enabled: category.enabled,\n scopes: category.scopes.map((scope) =>\n scope.type === 'subaccount'\n ? { type: 'subaccount', subaccount: scope.subaccount }\n : { type: 'product', product_id: scope.product_id },\n ),\n })),\n };\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,wBACd,OACmB;CACnB,QAAQ,MAAM,MAAd;EACE,KAAK,kBACH,OAAO;GAAE,MAAM;GAAkB,cAAc,MAAM;EAAa;EACpE,KAAK,mBACH,OAAO;GAAE,MAAM;GAAmB,cAAc,MAAM;EAAa;EACrE,KAAK,oBACH,OAAO;GAAE,MAAM;GAAoB,cAAc,MAAM;EAAa;EACtE,KAAK,iBACH,OAAO,EAAE,MAAM,gBAAgB;EACjC,KAAK,uBACH,OAAO;GACL,MAAM;GACN,YAAY,MAAM;GAClB,UAAU,MAAM;GAChB,QAAQ,MAAM;GACd,aAAa,MAAM;EACrB;EACF,KAAK,yBACH,OAAO;GAAE,MAAM;GAAyB,YAAY,MAAM;EAAW;EACvE,KAAK,sBACH,OAAO;GACL,MAAM;GACN,aAAa,oCAAoC,MAAM,WAAW;EACpE;EACF,KAAK,4BACH,OAAO,EAAE,MAAM,2BAA2B;EAC5C,KAAK,sBACH,OAAO,EAAE,MAAM,qBAAqB;EACtC,SACE,MAAM,IAAI,MACR,0DAA0D,KAAK,UAAU,KAAK,GAChF;CAEJ;AACF;;;;;AAMA,SAAS,oCACP,aACqC;CACrC,OAAO;EACL,gBAAgB,YAAY;EAC5B,YAAY,YAAY,WAAW,KAAK,cAAc;GACpD,UAAU,SAAS;GACnB,SAAS,SAAS;GAClB,QAAQ,SAAS,OAAO,KAAK,UAC3B,MAAM,SAAS,eACX;IAAE,MAAM;IAAc,YAAY,MAAM;GAAW,IACnD;IAAE,MAAM;IAAW,YAAY,MAAM;GAAW,CACtD;EACF,EAAE;CACJ;AACF"}
@@ -0,0 +1,20 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/signing/eip712MethodByType.ts
3
+ /**
4
+ * EIP-712 `method` string for each signed inner payload type.
5
+ */
6
+ const MOBILE_EIP712_METHOD_BY_TYPE = {
7
+ claim_username: "mobile:execute_claim_username",
8
+ update_username: "mobile:execute_update_username",
9
+ set_private_mode: "mobile:execute_set_private_mode",
10
+ self_identity: "mobile:query_self_identity",
11
+ register_expo_token: "mobile:execute_register_expo_token",
12
+ unregister_expo_token: "mobile:execute_unregister_expo_token",
13
+ update_preferences: "mobile:execute_update_preferences",
14
+ notification_preferences: "mobile:query_notification_preferences",
15
+ registered_devices: "mobile:query_registered_devices"
16
+ };
17
+ //#endregion
18
+ exports.MOBILE_EIP712_METHOD_BY_TYPE = MOBILE_EIP712_METHOD_BY_TYPE;
19
+
20
+ //# sourceMappingURL=eip712MethodByType.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eip712MethodByType.cjs","names":[],"sources":["../../src/signing/eip712MethodByType.ts"],"sourcesContent":["import { MobileSignedInner } from './types';\n\n/**\n * EIP-712 `method` string for each signed inner payload type.\n */\nexport const MOBILE_EIP712_METHOD_BY_TYPE: Record<\n MobileSignedInner['type'],\n string\n> = {\n claim_username: 'mobile:execute_claim_username',\n update_username: 'mobile:execute_update_username',\n set_private_mode: 'mobile:execute_set_private_mode',\n self_identity: 'mobile:query_self_identity',\n register_expo_token: 'mobile:execute_register_expo_token',\n unregister_expo_token: 'mobile:execute_unregister_expo_token',\n update_preferences: 'mobile:execute_update_preferences',\n notification_preferences: 'mobile:query_notification_preferences',\n registered_devices: 'mobile:query_registered_devices',\n};\n"],"mappings":";;;;;AAKA,MAAa,+BAGT;CACF,gBAAgB;CAChB,iBAAiB;CACjB,kBAAkB;CAClB,eAAe;CACf,qBAAqB;CACrB,uBAAuB;CACvB,oBAAoB;CACpB,0BAA0B;CAC1B,oBAAoB;AACtB"}
@@ -0,0 +1,2 @@
1
+ import { t as MOBILE_EIP712_METHOD_BY_TYPE } from "../eip712MethodByType-DLh9MRsD.cjs";
2
+ export { MOBILE_EIP712_METHOD_BY_TYPE };
@@ -0,0 +1,2 @@
1
+ import { t as MOBILE_EIP712_METHOD_BY_TYPE } from "../eip712MethodByType-DJgXal9r.js";
2
+ export { MOBILE_EIP712_METHOD_BY_TYPE };
@@ -0,0 +1,19 @@
1
+ //#region src/signing/eip712MethodByType.ts
2
+ /**
3
+ * EIP-712 `method` string for each signed inner payload type.
4
+ */
5
+ const MOBILE_EIP712_METHOD_BY_TYPE = {
6
+ claim_username: "mobile:execute_claim_username",
7
+ update_username: "mobile:execute_update_username",
8
+ set_private_mode: "mobile:execute_set_private_mode",
9
+ self_identity: "mobile:query_self_identity",
10
+ register_expo_token: "mobile:execute_register_expo_token",
11
+ unregister_expo_token: "mobile:execute_unregister_expo_token",
12
+ update_preferences: "mobile:execute_update_preferences",
13
+ notification_preferences: "mobile:query_notification_preferences",
14
+ registered_devices: "mobile:query_registered_devices"
15
+ };
16
+ //#endregion
17
+ export { MOBILE_EIP712_METHOD_BY_TYPE };
18
+
19
+ //# sourceMappingURL=eip712MethodByType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eip712MethodByType.js","names":[],"sources":["../../src/signing/eip712MethodByType.ts"],"sourcesContent":["import { MobileSignedInner } from './types';\n\n/**\n * EIP-712 `method` string for each signed inner payload type.\n */\nexport const MOBILE_EIP712_METHOD_BY_TYPE: Record<\n MobileSignedInner['type'],\n string\n> = {\n claim_username: 'mobile:execute_claim_username',\n update_username: 'mobile:execute_update_username',\n set_private_mode: 'mobile:execute_set_private_mode',\n self_identity: 'mobile:query_self_identity',\n register_expo_token: 'mobile:execute_register_expo_token',\n unregister_expo_token: 'mobile:execute_unregister_expo_token',\n update_preferences: 'mobile:execute_update_preferences',\n notification_preferences: 'mobile:query_notification_preferences',\n registered_devices: 'mobile:query_registered_devices',\n};\n"],"mappings":";;;;AAKA,MAAa,+BAGT;CACF,gBAAgB;CAChB,iBAAiB;CACjB,kBAAkB;CAClB,eAAe;CACf,qBAAqB;CACrB,uBAAuB;CACvB,oBAAoB;CACpB,0BAA0B;CAC1B,oBAAoB;AACtB"}
@@ -0,0 +1,11 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_signing_canonicalize = require("./canonicalize.cjs");
3
+ const require_signing_eip712MethodByType = require("./eip712MethodByType.cjs");
4
+ const require_signing_nonce = require("./nonce.cjs");
5
+ const require_signing_payloadHash = require("./payloadHash.cjs");
6
+ const require_signing_buildSignedMobileRequest = require("./buildSignedMobileRequest.cjs");
7
+ exports.MOBILE_EIP712_METHOD_BY_TYPE = require_signing_eip712MethodByType.MOBILE_EIP712_METHOD_BY_TYPE;
8
+ exports.buildSignedMobileRequest = require_signing_buildSignedMobileRequest.buildSignedMobileRequest;
9
+ exports.canonicalizeMobileInner = require_signing_canonicalize.canonicalizeMobileInner;
10
+ exports.getMobileNonce = require_signing_nonce.getMobileNonce;
11
+ exports.getMobilePayloadHash = require_signing_payloadHash.getMobilePayloadHash;
@@ -0,0 +1,7 @@
1
+ import { i as MobileSignedRequest, n as MobileSignedInner, r as MobileSignedInnerParams, t as BuildSignedMobileRequestParams } from "../types-uCD4BNZR.cjs";
2
+ import { t as buildSignedMobileRequest } from "../buildSignedMobileRequest-BsbBkU0K.cjs";
3
+ import { t as canonicalizeMobileInner } from "../canonicalize-Dm7sXwPg.cjs";
4
+ import { t as MOBILE_EIP712_METHOD_BY_TYPE } from "../eip712MethodByType-DLh9MRsD.cjs";
5
+ import { t as getMobileNonce } from "../nonce-zGyisRlj.cjs";
6
+ import { t as getMobilePayloadHash } from "../payloadHash-nj8WuLUP.cjs";
7
+ export { BuildSignedMobileRequestParams, MOBILE_EIP712_METHOD_BY_TYPE, MobileSignedInner, MobileSignedInnerParams, MobileSignedRequest, buildSignedMobileRequest, canonicalizeMobileInner, getMobileNonce, getMobilePayloadHash };
@@ -0,0 +1,7 @@
1
+ import { i as MobileSignedRequest, n as MobileSignedInner, r as MobileSignedInnerParams, t as BuildSignedMobileRequestParams } from "../types-B76Pn7Sy.js";
2
+ import { t as buildSignedMobileRequest } from "../buildSignedMobileRequest-CDRsRNHm.js";
3
+ import { t as canonicalizeMobileInner } from "../canonicalize-PX6dTIdF.js";
4
+ import { t as MOBILE_EIP712_METHOD_BY_TYPE } from "../eip712MethodByType-DJgXal9r.js";
5
+ import { t as getMobileNonce } from "../nonce-DCOrXXkQ.js";
6
+ import { t as getMobilePayloadHash } from "../payloadHash-Bmhzs78N.js";
7
+ export { BuildSignedMobileRequestParams, MOBILE_EIP712_METHOD_BY_TYPE, MobileSignedInner, MobileSignedInnerParams, MobileSignedRequest, buildSignedMobileRequest, canonicalizeMobileInner, getMobileNonce, getMobilePayloadHash };
@@ -0,0 +1,6 @@
1
+ import { canonicalizeMobileInner } from "./canonicalize.js";
2
+ import { MOBILE_EIP712_METHOD_BY_TYPE } from "./eip712MethodByType.js";
3
+ import { getMobileNonce } from "./nonce.js";
4
+ import { getMobilePayloadHash } from "./payloadHash.js";
5
+ import { buildSignedMobileRequest } from "./buildSignedMobileRequest.js";
6
+ export { MOBILE_EIP712_METHOD_BY_TYPE, buildSignedMobileRequest, canonicalizeMobileInner, getMobileNonce, getMobilePayloadHash };
@@ -0,0 +1,19 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/signing/nonce.ts
3
+ /**
4
+ * Generates a `nonce` for a signed mobile service API request, following the same shape as `getOrderNonce`:
5
+ * a receive-deadline timestamp in the high digits plus a random low-digits component to avoid collisions. The
6
+ * server reads `nonce / 1_000_000` as a millisecond receive deadline, which must be later than server time
7
+ * and no more than 100s ahead — hence the 30s default window. The random low six digits keep nonces
8
+ * generated within the same millisecond distinct.
9
+ *
10
+ * @param deadlineMs - Receive deadline in milliseconds; defaults to 30s ahead of now.
11
+ * @param randomInt - Random integer in `[0, 1_000_000)` placed in the low six digits to avoid collisions.
12
+ */
13
+ function getMobileNonce(deadlineMs = Date.now() + 3e4, randomInt = Math.floor(Math.random() * 1e6)) {
14
+ return BigInt(deadlineMs) * 1000000n + BigInt(randomInt);
15
+ }
16
+ //#endregion
17
+ exports.getMobileNonce = getMobileNonce;
18
+
19
+ //# sourceMappingURL=nonce.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nonce.cjs","names":[],"sources":["../../src/signing/nonce.ts"],"sourcesContent":["/**\n * Generates a `nonce` for a signed mobile service API request, following the same shape as `getOrderNonce`:\n * a receive-deadline timestamp in the high digits plus a random low-digits component to avoid collisions. The\n * server reads `nonce / 1_000_000` as a millisecond receive deadline, which must be later than server time\n * and no more than 100s ahead — hence the 30s default window. The random low six digits keep nonces\n * generated within the same millisecond distinct.\n *\n * @param deadlineMs - Receive deadline in milliseconds; defaults to 30s ahead of now.\n * @param randomInt - Random integer in `[0, 1_000_000)` placed in the low six digits to avoid collisions.\n */\nexport function getMobileNonce(\n deadlineMs: number = Date.now() + 30_000,\n randomInt: number = Math.floor(Math.random() * 1_000_000),\n): bigint {\n return BigInt(deadlineMs) * 1_000_000n + BigInt(randomInt);\n}\n"],"mappings":";;;;;;;;;;;;AAUA,SAAgB,eACd,aAAqB,KAAK,IAAI,IAAI,KAClC,YAAoB,KAAK,MAAM,KAAK,OAAO,IAAI,GAAS,GAChD;CACR,OAAO,OAAO,UAAU,IAAI,WAAa,OAAO,SAAS;AAC3D"}
@@ -0,0 +1,2 @@
1
+ import { t as getMobileNonce } from "../nonce-zGyisRlj.cjs";
2
+ export { getMobileNonce };
@@ -0,0 +1,2 @@
1
+ import { t as getMobileNonce } from "../nonce-DCOrXXkQ.js";
2
+ export { getMobileNonce };
@@ -0,0 +1,18 @@
1
+ //#region src/signing/nonce.ts
2
+ /**
3
+ * Generates a `nonce` for a signed mobile service API request, following the same shape as `getOrderNonce`:
4
+ * a receive-deadline timestamp in the high digits plus a random low-digits component to avoid collisions. The
5
+ * server reads `nonce / 1_000_000` as a millisecond receive deadline, which must be later than server time
6
+ * and no more than 100s ahead — hence the 30s default window. The random low six digits keep nonces
7
+ * generated within the same millisecond distinct.
8
+ *
9
+ * @param deadlineMs - Receive deadline in milliseconds; defaults to 30s ahead of now.
10
+ * @param randomInt - Random integer in `[0, 1_000_000)` placed in the low six digits to avoid collisions.
11
+ */
12
+ function getMobileNonce(deadlineMs = Date.now() + 3e4, randomInt = Math.floor(Math.random() * 1e6)) {
13
+ return BigInt(deadlineMs) * 1000000n + BigInt(randomInt);
14
+ }
15
+ //#endregion
16
+ export { getMobileNonce };
17
+
18
+ //# sourceMappingURL=nonce.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nonce.js","names":[],"sources":["../../src/signing/nonce.ts"],"sourcesContent":["/**\n * Generates a `nonce` for a signed mobile service API request, following the same shape as `getOrderNonce`:\n * a receive-deadline timestamp in the high digits plus a random low-digits component to avoid collisions. The\n * server reads `nonce / 1_000_000` as a millisecond receive deadline, which must be later than server time\n * and no more than 100s ahead — hence the 30s default window. The random low six digits keep nonces\n * generated within the same millisecond distinct.\n *\n * @param deadlineMs - Receive deadline in milliseconds; defaults to 30s ahead of now.\n * @param randomInt - Random integer in `[0, 1_000_000)` placed in the low six digits to avoid collisions.\n */\nexport function getMobileNonce(\n deadlineMs: number = Date.now() + 30_000,\n randomInt: number = Math.floor(Math.random() * 1_000_000),\n): bigint {\n return BigInt(deadlineMs) * 1_000_000n + BigInt(randomInt);\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAgB,eACd,aAAqB,KAAK,IAAI,IAAI,KAClC,YAAoB,KAAK,MAAM,KAAK,OAAO,IAAI,GAAS,GAChD;CACR,OAAO,OAAO,UAAU,IAAI,WAAa,OAAO,SAAS;AAC3D"}
@@ -0,0 +1,17 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("../MobileClient-9JSAzblH.cjs");
3
+ let _msgpack_msgpack = require("@msgpack/msgpack");
4
+ let viem = require("viem");
5
+ //#region src/signing/payloadHash.ts
6
+ /**
7
+ * Computes the EIP-712 `payloadHash` for a canonicalized inner payload: `keccak256(msgpack(inner))`.
8
+ *
9
+ * @param inner - A canonicalized inner payload; callers must run {@link canonicalizeMobileInner} first.
10
+ */
11
+ function getMobilePayloadHash(inner) {
12
+ return (0, viem.keccak256)((0, _msgpack_msgpack.encode)(inner));
13
+ }
14
+ //#endregion
15
+ exports.getMobilePayloadHash = getMobilePayloadHash;
16
+
17
+ //# sourceMappingURL=payloadHash.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payloadHash.cjs","names":[],"sources":["../../src/signing/payloadHash.ts"],"sourcesContent":["import { encode } from '@msgpack/msgpack';\nimport { Hex, keccak256 } from 'viem';\nimport { MobileSignedInner } from './types';\n\n/**\n * Computes the EIP-712 `payloadHash` for a canonicalized inner payload: `keccak256(msgpack(inner))`.\n *\n * @param inner - A canonicalized inner payload; callers must run {@link canonicalizeMobileInner} first.\n */\nexport function getMobilePayloadHash(inner: MobileSignedInner): Hex {\n return keccak256(encode(inner));\n}\n"],"mappings":";;;;;;;;;;AASA,SAAgB,qBAAqB,OAA+B;CAClE,QAAA,GAAA,KAAA,YAAA,GAAA,iBAAA,QAAwB,KAAK,CAAC;AAChC"}
@@ -0,0 +1,2 @@
1
+ import { t as getMobilePayloadHash } from "../payloadHash-nj8WuLUP.cjs";
2
+ export { getMobilePayloadHash };
@@ -0,0 +1,2 @@
1
+ import { t as getMobilePayloadHash } from "../payloadHash-Bmhzs78N.js";
2
+ export { getMobilePayloadHash };
@@ -0,0 +1,15 @@
1
+ import { encode } from "@msgpack/msgpack";
2
+ import { keccak256 } from "viem";
3
+ //#region src/signing/payloadHash.ts
4
+ /**
5
+ * Computes the EIP-712 `payloadHash` for a canonicalized inner payload: `keccak256(msgpack(inner))`.
6
+ *
7
+ * @param inner - A canonicalized inner payload; callers must run {@link canonicalizeMobileInner} first.
8
+ */
9
+ function getMobilePayloadHash(inner) {
10
+ return keccak256(encode(inner));
11
+ }
12
+ //#endregion
13
+ export { getMobilePayloadHash };
14
+
15
+ //# sourceMappingURL=payloadHash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payloadHash.js","names":[],"sources":["../../src/signing/payloadHash.ts"],"sourcesContent":["import { encode } from '@msgpack/msgpack';\nimport { Hex, keccak256 } from 'viem';\nimport { MobileSignedInner } from './types';\n\n/**\n * Computes the EIP-712 `payloadHash` for a canonicalized inner payload: `keccak256(msgpack(inner))`.\n *\n * @param inner - A canonicalized inner payload; callers must run {@link canonicalizeMobileInner} first.\n */\nexport function getMobilePayloadHash(inner: MobileSignedInner): Hex {\n return keccak256(encode(inner));\n}\n"],"mappings":";;;;;;;;AASA,SAAgB,qBAAqB,OAA+B;CAClE,OAAO,UAAU,OAAO,KAAK,CAAC;AAChC"}
File without changes
@@ -0,0 +1,2 @@
1
+ import { i as MobileSignedRequest, n as MobileSignedInner, r as MobileSignedInnerParams, t as BuildSignedMobileRequestParams } from "../types-uCD4BNZR.cjs";
2
+ export { BuildSignedMobileRequestParams, MobileSignedInner, MobileSignedInnerParams, MobileSignedRequest };
@@ -0,0 +1,2 @@
1
+ import { i as MobileSignedRequest, n as MobileSignedInner, r as MobileSignedInnerParams, t as BuildSignedMobileRequestParams } from "../types-B76Pn7Sy.js";
2
+ export { BuildSignedMobileRequestParams, MobileSignedInner, MobileSignedInnerParams, MobileSignedRequest };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/types/MobileServerFailureError.ts
3
+ /**
4
+ * Error thrown when the mobile service API returns a failure envelope, either as a non-2xx HTTP response
5
+ * or a 2xx response with `status: 'failure'`.
6
+ */
7
+ var MobileServerFailureError = class extends Error {
8
+ constructor(responseData, httpStatus) {
9
+ super(`${responseData.error_code}: ${responseData.error}`);
10
+ this.responseData = responseData;
11
+ this.httpStatus = httpStatus;
12
+ }
13
+ };
14
+ //#endregion
15
+ exports.MobileServerFailureError = MobileServerFailureError;
16
+
17
+ //# sourceMappingURL=MobileServerFailureError.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MobileServerFailureError.cjs","names":[],"sources":["../../src/types/MobileServerFailureError.ts"],"sourcesContent":["import { MobileServerFailureResponse } from './serverBaseTypes';\n\n/**\n * Error thrown when the mobile service API returns a failure envelope, either as a non-2xx HTTP response\n * or a 2xx response with `status: 'failure'`.\n */\nexport class MobileServerFailureError extends Error {\n constructor(\n readonly responseData: MobileServerFailureResponse,\n /**\n * HTTP status code of the response, e.g. `404` for `PROFILE_NOT_FOUND`. Unlike the engine, the mobile\n * backend maps domain failures onto HTTP statuses.\n */\n readonly httpStatus: number,\n ) {\n super(`${responseData.error_code}: ${responseData.error}`);\n }\n}\n"],"mappings":";;;;;;AAMA,IAAa,2BAAb,cAA8C,MAAM;CAClD,YACE,cAKA,YACA;EACA,MAAM,GAAG,aAAa,WAAW,IAAI,aAAa,OAAO;EAPhD,KAAA,eAAA;EAKA,KAAA,aAAA;CAGX;AACF"}
@@ -0,0 +1,2 @@
1
+ import { t as MobileServerFailureError } from "../MobileServerFailureError-Belp_yef.cjs";
2
+ export { MobileServerFailureError };
@@ -0,0 +1,2 @@
1
+ import { t as MobileServerFailureError } from "../MobileServerFailureError-DqM0T6CB.js";
2
+ export { MobileServerFailureError };
@@ -0,0 +1,16 @@
1
+ //#region src/types/MobileServerFailureError.ts
2
+ /**
3
+ * Error thrown when the mobile service API returns a failure envelope, either as a non-2xx HTTP response
4
+ * or a 2xx response with `status: 'failure'`.
5
+ */
6
+ var MobileServerFailureError = class extends Error {
7
+ constructor(responseData, httpStatus) {
8
+ super(`${responseData.error_code}: ${responseData.error}`);
9
+ this.responseData = responseData;
10
+ this.httpStatus = httpStatus;
11
+ }
12
+ };
13
+ //#endregion
14
+ export { MobileServerFailureError };
15
+
16
+ //# sourceMappingURL=MobileServerFailureError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MobileServerFailureError.js","names":[],"sources":["../../src/types/MobileServerFailureError.ts"],"sourcesContent":["import { MobileServerFailureResponse } from './serverBaseTypes';\n\n/**\n * Error thrown when the mobile service API returns a failure envelope, either as a non-2xx HTTP response\n * or a 2xx response with `status: 'failure'`.\n */\nexport class MobileServerFailureError extends Error {\n constructor(\n readonly responseData: MobileServerFailureResponse,\n /**\n * HTTP status code of the response, e.g. `404` for `PROFILE_NOT_FOUND`. Unlike the engine, the mobile\n * backend maps domain failures onto HTTP statuses.\n */\n readonly httpStatus: number,\n ) {\n super(`${responseData.error_code}: ${responseData.error}`);\n }\n}\n"],"mappings":";;;;;AAMA,IAAa,2BAAb,cAA8C,MAAM;CAClD,YACE,cAKA,YACA;EACA,MAAM,GAAG,aAAa,WAAW,IAAI,aAAa,OAAO;EAPhD,KAAA,eAAA;EAKA,KAAA,aAAA;CAGX;AACF"}
File without changes
@@ -0,0 +1,2 @@
1
+ import { _ as MobileUpdateNotificationPreferencesParams, a as GetMobileUsernameAvailabilityParams, c as MobileNotificationCategoryPreference, d as MobilePublicProfile, f as MobileRegisterExpoTokenParams, g as MobileUnregisterExpoTokenParams, h as MobileSignedRequestParams, i as GetMobileSelfIdentityParams, l as MobileNotificationPreferenceScope, m as MobileSetPrivateModeParams, n as GetMobilePublicProfileParams, o as MobileClaimUsernameParams, p as MobileRegisteredDevice, r as GetMobileRegisteredDevicesParams, s as MobileIdentity, t as GetMobileNotificationPreferencesParams, u as MobileNotificationPreferences, v as MobileUpdateUsernameParams, y as MobileUsernameAvailability } from "../clientTypes-Et0PUa2d.cjs";
2
+ export { GetMobileNotificationPreferencesParams, GetMobilePublicProfileParams, GetMobileRegisteredDevicesParams, GetMobileSelfIdentityParams, GetMobileUsernameAvailabilityParams, MobileClaimUsernameParams, MobileIdentity, MobileNotificationCategoryPreference, MobileNotificationPreferenceScope, MobileNotificationPreferences, MobilePublicProfile, MobileRegisterExpoTokenParams, MobileRegisteredDevice, MobileSetPrivateModeParams, MobileSignedRequestParams, MobileUnregisterExpoTokenParams, MobileUpdateNotificationPreferencesParams, MobileUpdateUsernameParams, MobileUsernameAvailability };
@@ -0,0 +1,2 @@
1
+ import { _ as MobileUpdateNotificationPreferencesParams, a as GetMobileUsernameAvailabilityParams, c as MobileNotificationCategoryPreference, d as MobilePublicProfile, f as MobileRegisterExpoTokenParams, g as MobileUnregisterExpoTokenParams, h as MobileSignedRequestParams, i as GetMobileSelfIdentityParams, l as MobileNotificationPreferenceScope, m as MobileSetPrivateModeParams, n as GetMobilePublicProfileParams, o as MobileClaimUsernameParams, p as MobileRegisteredDevice, r as GetMobileRegisteredDevicesParams, s as MobileIdentity, t as GetMobileNotificationPreferencesParams, u as MobileNotificationPreferences, v as MobileUpdateUsernameParams, y as MobileUsernameAvailability } from "../clientTypes-DWW2N66c.js";
2
+ export { GetMobileNotificationPreferencesParams, GetMobilePublicProfileParams, GetMobileRegisteredDevicesParams, GetMobileSelfIdentityParams, GetMobileUsernameAvailabilityParams, MobileClaimUsernameParams, MobileIdentity, MobileNotificationCategoryPreference, MobileNotificationPreferenceScope, MobileNotificationPreferences, MobilePublicProfile, MobileRegisterExpoTokenParams, MobileRegisteredDevice, MobileSetPrivateModeParams, MobileSignedRequestParams, MobileUnregisterExpoTokenParams, MobileUpdateNotificationPreferencesParams, MobileUpdateUsernameParams, MobileUsernameAvailability };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_types_MobileServerFailureError = require("./MobileServerFailureError.cjs");
3
+ const require_types_mobileErrorCodes = require("./mobileErrorCodes.cjs");
4
+ exports.MOBILE_ERROR_CODES = require_types_mobileErrorCodes.MOBILE_ERROR_CODES;
5
+ exports.MobileServerFailureError = require_types_MobileServerFailureError.MobileServerFailureError;
@@ -0,0 +1,8 @@
1
+ import { a as MobileServerNotificationPreferenceScope, c as MobileServerRegisteredDevice, i as MobileServerNotificationCategoryPreference, n as MobileNotificationPlatform, o as MobileServerNotificationPreferences, r as MobileServerIdentity, s as MobileServerProfile, t as MobileNotificationCategory } from "../serverModelTypes-CQgfqgW3.cjs";
2
+ import { _ as MobileUpdateNotificationPreferencesParams, a as GetMobileUsernameAvailabilityParams, c as MobileNotificationCategoryPreference, d as MobilePublicProfile, f as MobileRegisterExpoTokenParams, g as MobileUnregisterExpoTokenParams, h as MobileSignedRequestParams, i as GetMobileSelfIdentityParams, l as MobileNotificationPreferenceScope, m as MobileSetPrivateModeParams, n as GetMobilePublicProfileParams, o as MobileClaimUsernameParams, p as MobileRegisteredDevice, r as GetMobileRegisteredDevicesParams, s as MobileIdentity, t as GetMobileNotificationPreferencesParams, u as MobileNotificationPreferences, v as MobileUpdateUsernameParams, y as MobileUsernameAvailability } from "../clientTypes-Et0PUa2d.cjs";
3
+ import { a as MobileServerSuccessResponse, i as MobileServerRequestType, n as MobileServerPublicQueryParamsByType, r as MobileServerPublicQueryType, t as MobileServerFailureResponse } from "../serverBaseTypes-BicXMrZV.cjs";
4
+ import { n as MobileErrorCode, t as MOBILE_ERROR_CODES } from "../mobileErrorCodes-D8KzJXbU.cjs";
5
+ import { t as MobileServerFailureError } from "../MobileServerFailureError-Belp_yef.cjs";
6
+ import { t as MobileServerExecuteResult } from "../serverExecuteTypes-DKYK1V7C.cjs";
7
+ import { a as MobileServerRegisteredDevicesResponse, c as MobileServerUsernameAvailabilityResponse, i as MobileServerPublicQueryRequest, n as MobileServerProfileRequest, o as MobileServerSelfIdentityResponse, r as MobileServerProfileResponse, s as MobileServerUsernameAvailabilityRequest, t as MobileServerNotificationPreferencesResponse } from "../serverQueryTypes-D7Yharse.cjs";
8
+ export { GetMobileNotificationPreferencesParams, GetMobilePublicProfileParams, GetMobileRegisteredDevicesParams, GetMobileSelfIdentityParams, GetMobileUsernameAvailabilityParams, MOBILE_ERROR_CODES, MobileClaimUsernameParams, MobileErrorCode, MobileIdentity, MobileNotificationCategory, MobileNotificationCategoryPreference, MobileNotificationPlatform, MobileNotificationPreferenceScope, MobileNotificationPreferences, MobilePublicProfile, MobileRegisterExpoTokenParams, MobileRegisteredDevice, MobileServerExecuteResult, MobileServerFailureError, MobileServerFailureResponse, MobileServerIdentity, MobileServerNotificationCategoryPreference, MobileServerNotificationPreferenceScope, MobileServerNotificationPreferences, MobileServerNotificationPreferencesResponse, MobileServerProfile, MobileServerProfileRequest, MobileServerProfileResponse, MobileServerPublicQueryParamsByType, MobileServerPublicQueryRequest, MobileServerPublicQueryType, MobileServerRegisteredDevice, MobileServerRegisteredDevicesResponse, MobileServerRequestType, MobileServerSelfIdentityResponse, MobileServerSuccessResponse, MobileServerUsernameAvailabilityRequest, MobileServerUsernameAvailabilityResponse, MobileSetPrivateModeParams, MobileSignedRequestParams, MobileUnregisterExpoTokenParams, MobileUpdateNotificationPreferencesParams, MobileUpdateUsernameParams, MobileUsernameAvailability };