@metamask/snaps-rpc-methods 8.1.0 → 9.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 (100) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/dist/{chunk-MXCJWR45.mjs → chunk-2CTOCP34.mjs} +8 -8
  3. package/dist/chunk-2CTOCP34.mjs.map +1 -0
  4. package/dist/{chunk-TKXU7ZXP.mjs → chunk-2L2ATCIK.mjs} +2 -2
  5. package/dist/{chunk-YG7W4CDT.js → chunk-33MTKZ4H.js} +11 -4
  6. package/dist/chunk-33MTKZ4H.js.map +1 -0
  7. package/dist/{chunk-3W4SMZFD.mjs → chunk-3XL562LA.mjs} +4 -4
  8. package/dist/{chunk-LGUJMQC7.js → chunk-4BPNRCZJ.js} +5 -4
  9. package/dist/chunk-4BPNRCZJ.js.map +1 -0
  10. package/dist/{chunk-IDZGMGIB.js → chunk-DLVPMPRZ.js} +8 -8
  11. package/dist/chunk-DLVPMPRZ.js.map +1 -0
  12. package/dist/{chunk-AOWUGDER.js → chunk-E27BGHCR.js} +3 -3
  13. package/dist/{chunk-INB4AX37.js → chunk-F3VP6B2X.js} +7 -7
  14. package/dist/{chunk-Y4LNTDZ2.mjs → chunk-FR26QD3N.mjs} +3 -3
  15. package/dist/{chunk-PG32JMWC.mjs → chunk-I3QG3QZL.mjs} +5 -5
  16. package/dist/{chunk-S7AR3ROH.js → chunk-IE6EHYEG.js} +3 -3
  17. package/dist/{chunk-Q5W3YGEB.js → chunk-IVD2ORDS.js} +3 -3
  18. package/dist/{chunk-IBV23QOX.mjs → chunk-KIXPIIY5.mjs} +2 -2
  19. package/dist/{chunk-AYJK7MSH.js → chunk-LLH2T5NT.js} +5 -5
  20. package/dist/{chunk-TNRH2LRU.mjs → chunk-LXJBBRQ4.mjs} +2 -2
  21. package/dist/{chunk-R2M4YLJ7.js → chunk-M2JQCKR7.js} +3 -3
  22. package/dist/{chunk-RIALLTR7.js → chunk-O2VSIMDY.js} +9 -9
  23. package/dist/{chunk-UDB4MUXI.js → chunk-PPR53SPJ.js} +8 -4
  24. package/dist/chunk-PPR53SPJ.js.map +1 -0
  25. package/dist/{chunk-RX7WZZ32.js → chunk-QAKSH24Z.js} +8 -8
  26. package/dist/{chunk-GP6TDVNT.js → chunk-QSVAU6X4.js} +5 -5
  27. package/dist/{chunk-6WUIFFMQ.mjs → chunk-R3DRYUNH.mjs} +5 -4
  28. package/dist/chunk-R3DRYUNH.mjs.map +1 -0
  29. package/dist/{chunk-VNH2GKLV.mjs → chunk-T3O2PFSR.mjs} +3 -3
  30. package/dist/{chunk-NESDQ4PF.mjs → chunk-TE4W25CA.mjs} +2 -2
  31. package/dist/{chunk-L675SYPP.mjs → chunk-TUIJOZXZ.mjs} +4 -4
  32. package/dist/{chunk-SGQXD5K7.mjs → chunk-W33UWNA2.mjs} +11 -4
  33. package/dist/chunk-W33UWNA2.mjs.map +1 -0
  34. package/dist/{chunk-634BK2VP.mjs → chunk-WEUKWKAQ.mjs} +10 -6
  35. package/dist/chunk-WEUKWKAQ.mjs.map +1 -0
  36. package/dist/index.js +14 -14
  37. package/dist/index.mjs +13 -13
  38. package/dist/permissions.js +9 -9
  39. package/dist/permissions.mjs +8 -8
  40. package/dist/permitted/createInterface.js +2 -2
  41. package/dist/permitted/createInterface.mjs +1 -1
  42. package/dist/permitted/handlers.js +5 -5
  43. package/dist/permitted/handlers.mjs +4 -4
  44. package/dist/permitted/index.js +7 -7
  45. package/dist/permitted/index.mjs +6 -6
  46. package/dist/permitted/invokeKeyring.js +3 -3
  47. package/dist/permitted/invokeKeyring.mjs +2 -2
  48. package/dist/permitted/invokeSnapSugar.js +2 -2
  49. package/dist/permitted/invokeSnapSugar.mjs +1 -1
  50. package/dist/permitted/middleware.js +7 -7
  51. package/dist/permitted/middleware.mjs +6 -6
  52. package/dist/restricted/caveats/index.js +5 -5
  53. package/dist/restricted/caveats/index.mjs +4 -4
  54. package/dist/restricted/getBip32Entropy.js +3 -3
  55. package/dist/restricted/getBip32Entropy.mjs +2 -2
  56. package/dist/restricted/getBip32PublicKey.js +3 -3
  57. package/dist/restricted/getBip32PublicKey.mjs +2 -2
  58. package/dist/restricted/getEntropy.js +3 -3
  59. package/dist/restricted/getEntropy.mjs +2 -2
  60. package/dist/restricted/index.js +8 -8
  61. package/dist/restricted/index.mjs +7 -7
  62. package/dist/restricted/manageState.js +3 -3
  63. package/dist/restricted/manageState.mjs +2 -2
  64. package/dist/tsconfig.build.tsbuildinfo +1 -1
  65. package/dist/types/permitted/createInterface.d.ts +46 -4
  66. package/dist/types/permitted/handlers.d.ts +2 -2
  67. package/dist/types/permitted/invokeSnapSugar.d.ts +12 -7
  68. package/dist/types/permitted/updateInterface.d.ts +42 -2
  69. package/dist/types/restricted/dialog.d.ts +252 -180
  70. package/dist/types/restricted/getBip32PublicKey.d.ts +2 -5
  71. package/dist/types/utils.d.ts +7 -5
  72. package/dist/utils.js +2 -2
  73. package/dist/utils.mjs +1 -1
  74. package/package.json +5 -5
  75. package/dist/chunk-634BK2VP.mjs.map +0 -1
  76. package/dist/chunk-6WUIFFMQ.mjs.map +0 -1
  77. package/dist/chunk-IDZGMGIB.js.map +0 -1
  78. package/dist/chunk-LGUJMQC7.js.map +0 -1
  79. package/dist/chunk-MXCJWR45.mjs.map +0 -1
  80. package/dist/chunk-SGQXD5K7.mjs.map +0 -1
  81. package/dist/chunk-UDB4MUXI.js.map +0 -1
  82. package/dist/chunk-YG7W4CDT.js.map +0 -1
  83. /package/dist/{chunk-TKXU7ZXP.mjs.map → chunk-2L2ATCIK.mjs.map} +0 -0
  84. /package/dist/{chunk-3W4SMZFD.mjs.map → chunk-3XL562LA.mjs.map} +0 -0
  85. /package/dist/{chunk-AOWUGDER.js.map → chunk-E27BGHCR.js.map} +0 -0
  86. /package/dist/{chunk-INB4AX37.js.map → chunk-F3VP6B2X.js.map} +0 -0
  87. /package/dist/{chunk-Y4LNTDZ2.mjs.map → chunk-FR26QD3N.mjs.map} +0 -0
  88. /package/dist/{chunk-PG32JMWC.mjs.map → chunk-I3QG3QZL.mjs.map} +0 -0
  89. /package/dist/{chunk-S7AR3ROH.js.map → chunk-IE6EHYEG.js.map} +0 -0
  90. /package/dist/{chunk-Q5W3YGEB.js.map → chunk-IVD2ORDS.js.map} +0 -0
  91. /package/dist/{chunk-IBV23QOX.mjs.map → chunk-KIXPIIY5.mjs.map} +0 -0
  92. /package/dist/{chunk-AYJK7MSH.js.map → chunk-LLH2T5NT.js.map} +0 -0
  93. /package/dist/{chunk-TNRH2LRU.mjs.map → chunk-LXJBBRQ4.mjs.map} +0 -0
  94. /package/dist/{chunk-R2M4YLJ7.js.map → chunk-M2JQCKR7.js.map} +0 -0
  95. /package/dist/{chunk-RIALLTR7.js.map → chunk-O2VSIMDY.js.map} +0 -0
  96. /package/dist/{chunk-RX7WZZ32.js.map → chunk-QAKSH24Z.js.map} +0 -0
  97. /package/dist/{chunk-GP6TDVNT.js.map → chunk-QSVAU6X4.js.map} +0 -0
  98. /package/dist/{chunk-VNH2GKLV.mjs.map → chunk-T3O2PFSR.mjs.map} +0 -0
  99. /package/dist/{chunk-NESDQ4PF.mjs.map → chunk-TE4W25CA.mjs.map} +0 -0
  100. /package/dist/{chunk-L675SYPP.mjs.map → chunk-TUIJOZXZ.mjs.map} +0 -0
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkRIALLTR7js = require('./chunk-RIALLTR7.js');
3
+ var _chunkO2VSIMDYjs = require('./chunk-O2VSIMDY.js');
4
4
 
5
5
 
6
- var _chunkAYJK7MSHjs = require('./chunk-AYJK7MSH.js');
6
+ var _chunkLLH2T5NTjs = require('./chunk-LLH2T5NT.js');
7
7
 
8
8
 
9
- var _chunkYG7W4CDTjs = require('./chunk-YG7W4CDT.js');
9
+ var _chunk33MTKZ4Hjs = require('./chunk-33MTKZ4H.js');
10
10
 
11
11
 
12
12
 
@@ -17,8 +17,8 @@ var _utils = require('@metamask/utils');
17
17
  function processSnapPermissions(initialPermissions) {
18
18
  return Object.fromEntries(
19
19
  Object.entries(initialPermissions).map(([initialPermission, value]) => {
20
- if (_utils.hasProperty.call(void 0, _chunkAYJK7MSHjs.caveatMappers, initialPermission)) {
21
- return [initialPermission, _chunkAYJK7MSHjs.caveatMappers[initialPermission](value)];
20
+ if (_utils.hasProperty.call(void 0, _chunkLLH2T5NTjs.caveatMappers, initialPermission)) {
21
+ return [initialPermission, _chunkLLH2T5NTjs.caveatMappers[initialPermission](value)];
22
22
  } else if (_utils.hasProperty.call(void 0, _chunkJRSPKOFGjs.endowmentCaveatMappers, initialPermission)) {
23
23
  return [
24
24
  initialPermission,
@@ -38,11 +38,11 @@ var buildSnapEndowmentSpecifications = (excludedEndowments) => Object.values(_ch
38
38
  }
39
39
  return allSpecifications;
40
40
  }, {});
41
- var buildSnapRestrictedMethodSpecifications = (excludedPermissions, hooks) => Object.values(_chunkRIALLTR7js.restrictedMethodPermissionBuilders).reduce((specifications, { targetName, specificationBuilder, methodHooks }) => {
41
+ var buildSnapRestrictedMethodSpecifications = (excludedPermissions, hooks) => Object.values(_chunkO2VSIMDYjs.restrictedMethodPermissionBuilders).reduce((specifications, { targetName, specificationBuilder, methodHooks }) => {
42
42
  if (!excludedPermissions.includes(targetName)) {
43
43
  specifications[targetName] = specificationBuilder({
44
44
  // @ts-expect-error The selectHooks type is wonky
45
- methodHooks: _chunkYG7W4CDTjs.selectHooks.call(void 0,
45
+ methodHooks: _chunk33MTKZ4Hjs.selectHooks.call(void 0,
46
46
  hooks,
47
47
  methodHooks
48
48
  )
@@ -56,4 +56,4 @@ var buildSnapRestrictedMethodSpecifications = (excludedPermissions, hooks) => Ob
56
56
 
57
57
 
58
58
  exports.processSnapPermissions = processSnapPermissions; exports.buildSnapEndowmentSpecifications = buildSnapEndowmentSpecifications; exports.buildSnapRestrictedMethodSpecifications = buildSnapRestrictedMethodSpecifications;
59
- //# sourceMappingURL=chunk-RX7WZZ32.js.map
59
+ //# sourceMappingURL=chunk-QAKSH24Z.js.map
@@ -1,16 +1,16 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkINB4AX37js = require('./chunk-INB4AX37.js');
3
+ var _chunkF3VP6B2Xjs = require('./chunk-F3VP6B2X.js');
4
4
 
5
5
 
6
- var _chunkYG7W4CDTjs = require('./chunk-YG7W4CDT.js');
6
+ var _chunk33MTKZ4Hjs = require('./chunk-33MTKZ4H.js');
7
7
 
8
8
  // src/permitted/middleware.ts
9
9
  var _rpcerrors = require('@metamask/rpc-errors');
10
10
  var _snapsutils = require('@metamask/snaps-utils');
11
11
  function createSnapsMethodMiddleware(isSnap, hooks) {
12
12
  return async function methodMiddleware(request, response, next, end) {
13
- const handler = _chunkINB4AX37js.methodHandlers[request.method];
13
+ const handler = _chunkF3VP6B2Xjs.methodHandlers[request.method];
14
14
  if (handler) {
15
15
  if (String.prototype.startsWith.call(request.method, "snap_") && !isSnap) {
16
16
  return end(_rpcerrors.rpcErrors.methodNotFound());
@@ -22,7 +22,7 @@ function createSnapsMethodMiddleware(isSnap, hooks) {
22
22
  response,
23
23
  next,
24
24
  end,
25
- _chunkYG7W4CDTjs.selectHooks.call(void 0, hooks, hookNames)
25
+ _chunk33MTKZ4Hjs.selectHooks.call(void 0, hooks, hookNames)
26
26
  );
27
27
  } catch (error) {
28
28
  _snapsutils.logError.call(void 0, error);
@@ -36,4 +36,4 @@ function createSnapsMethodMiddleware(isSnap, hooks) {
36
36
 
37
37
 
38
38
  exports.createSnapsMethodMiddleware = createSnapsMethodMiddleware;
39
- //# sourceMappingURL=chunk-GP6TDVNT.js.map
39
+ //# sourceMappingURL=chunk-QSVAU6X4.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getNode
3
- } from "./chunk-SGQXD5K7.mjs";
3
+ } from "./chunk-W33UWNA2.mjs";
4
4
 
5
5
  // src/restricted/getBip32PublicKey.ts
6
6
  import { PermissionType, SubjectType } from "@metamask/permission-controller";
@@ -8,15 +8,16 @@ import { rpcErrors } from "@metamask/rpc-errors";
8
8
  import {
9
9
  bip32entropy,
10
10
  Bip32PathStruct,
11
+ CurveStruct,
11
12
  SnapCaveatType
12
13
  } from "@metamask/snaps-utils";
13
14
  import { assertStruct } from "@metamask/utils";
14
- import { boolean, enums, object, optional } from "superstruct";
15
+ import { boolean, object, optional } from "superstruct";
15
16
  var targetName = "snap_getBip32PublicKey";
16
17
  var Bip32PublicKeyArgsStruct = bip32entropy(
17
18
  object({
18
19
  path: Bip32PathStruct,
19
- curve: enums(["ed25519", "secp256k1"]),
20
+ curve: CurveStruct,
20
21
  compressed: optional(boolean())
21
22
  })
22
23
  );
@@ -75,4 +76,4 @@ export {
75
76
  getBip32PublicKeyBuilder,
76
77
  getBip32PublicKeyImplementation
77
78
  };
78
- //# sourceMappingURL=chunk-6WUIFFMQ.mjs.map
79
+ //# sourceMappingURL=chunk-R3DRYUNH.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/restricted/getBip32PublicKey.ts"],"sourcesContent":["import type {\n PermissionSpecificationBuilder,\n PermissionValidatorConstraint,\n RestrictedMethodOptions,\n ValidPermissionSpecification,\n} from '@metamask/permission-controller';\nimport { PermissionType, SubjectType } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type {\n GetBip32PublicKeyParams,\n GetBip32PublicKeyResult,\n} from '@metamask/snaps-sdk';\nimport {\n bip32entropy,\n Bip32PathStruct,\n CurveStruct,\n SnapCaveatType,\n} from '@metamask/snaps-utils';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assertStruct } from '@metamask/utils';\nimport { boolean, object, optional } from 'superstruct';\n\nimport type { MethodHooksObject } from '../utils';\nimport { getNode } from '../utils';\n\nconst targetName = 'snap_getBip32PublicKey';\n\nexport type GetBip32PublicKeyMethodHooks = {\n /**\n * @returns The mnemonic of the user's primary keyring.\n */\n getMnemonic: () => Promise<Uint8Array>;\n\n /**\n * Waits for the extension to be unlocked.\n *\n * @returns A promise that resolves once the extension is unlocked.\n */\n getUnlockPromise: (shouldShowUnlockRequest: boolean) => Promise<void>;\n};\n\ntype GetBip32PublicKeySpecificationBuilderOptions = {\n methodHooks: GetBip32PublicKeyMethodHooks;\n};\n\ntype GetBip32PublicKeySpecification = ValidPermissionSpecification<{\n permissionType: PermissionType.RestrictedMethod;\n targetName: typeof targetName;\n methodImplementation: ReturnType<typeof getBip32PublicKeyImplementation>;\n allowedCaveats: Readonly<NonEmptyArray<string>> | null;\n validator: PermissionValidatorConstraint;\n}>;\n\nexport const Bip32PublicKeyArgsStruct = bip32entropy(\n object({\n path: Bip32PathStruct,\n curve: CurveStruct,\n compressed: optional(boolean()),\n }),\n);\n\n/**\n * The specification builder for the `snap_getBip32PublicKey` permission.\n * `snap_getBip32PublicKey` lets the Snap retrieve public keys for a particular\n * BIP-32 node.\n *\n * @param options - The specification builder options.\n * @param options.methodHooks - The RPC method hooks needed by the method implementation.\n * @returns The specification for the `snap_getBip32PublicKey` permission.\n */\nconst specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.RestrictedMethod,\n GetBip32PublicKeySpecificationBuilderOptions,\n GetBip32PublicKeySpecification\n> = ({ methodHooks }: GetBip32PublicKeySpecificationBuilderOptions) => {\n return {\n permissionType: PermissionType.RestrictedMethod,\n targetName,\n allowedCaveats: [SnapCaveatType.PermittedDerivationPaths],\n methodImplementation: getBip32PublicKeyImplementation(methodHooks),\n validator: ({ caveats }) => {\n if (\n caveats?.length !== 1 ||\n caveats[0].type !== SnapCaveatType.PermittedDerivationPaths\n ) {\n throw rpcErrors.invalidParams({\n message: `Expected a single \"${SnapCaveatType.PermittedDerivationPaths}\" caveat.`,\n });\n }\n },\n subjectTypes: [SubjectType.Snap],\n };\n};\n\nconst methodHooks: MethodHooksObject<GetBip32PublicKeyMethodHooks> = {\n getMnemonic: true,\n getUnlockPromise: true,\n};\n\nexport const getBip32PublicKeyBuilder = Object.freeze({\n targetName,\n specificationBuilder,\n methodHooks,\n} as const);\n\n/**\n * Builds the method implementation for `snap_getBip32PublicKey`.\n *\n * @param hooks - The RPC method hooks.\n * @param hooks.getMnemonic - A function to retrieve the Secret Recovery Phrase of the user.\n * @param hooks.getUnlockPromise - A function that resolves once the MetaMask extension is unlocked\n * and prompts the user to unlock their MetaMask if it is locked.\n * @returns The method implementation which returns a public key.\n * @throws If the params are invalid.\n */\nexport function getBip32PublicKeyImplementation({\n getMnemonic,\n getUnlockPromise,\n}: GetBip32PublicKeyMethodHooks) {\n return async function getBip32PublicKey(\n args: RestrictedMethodOptions<GetBip32PublicKeyParams>,\n ): Promise<GetBip32PublicKeyResult> {\n await getUnlockPromise(true);\n\n assertStruct(\n args.params,\n Bip32PublicKeyArgsStruct,\n 'Invalid BIP-32 public key params',\n rpcErrors.invalidParams,\n );\n\n const { params } = args;\n const node = await getNode({\n curve: params.curve,\n path: params.path,\n secretRecoveryPhrase: await getMnemonic(),\n });\n\n if (params.compressed) {\n return node.compressedPublicKey;\n }\n\n return node.publicKey;\n };\n}\n"],"mappings":";;;;;AAMA,SAAS,gBAAgB,mBAAmB;AAC5C,SAAS,iBAAiB;AAK1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,oBAAoB;AAC7B,SAAS,SAAS,QAAQ,gBAAgB;AAK1C,IAAM,aAAa;AA4BZ,IAAM,2BAA2B;AAAA,EACtC,OAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,YAAY,SAAS,QAAQ,CAAC;AAAA,EAChC,CAAC;AACH;AAWA,IAAM,uBAIF,CAAC,EAAE,aAAAA,aAAY,MAAoD;AACrE,SAAO;AAAA,IACL,gBAAgB,eAAe;AAAA,IAC/B;AAAA,IACA,gBAAgB,CAAC,eAAe,wBAAwB;AAAA,IACxD,sBAAsB,gCAAgCA,YAAW;AAAA,IACjE,WAAW,CAAC,EAAE,QAAQ,MAAM;AAC1B,UACE,SAAS,WAAW,KACpB,QAAQ,CAAC,EAAE,SAAS,eAAe,0BACnC;AACA,cAAM,UAAU,cAAc;AAAA,UAC5B,SAAS,sBAAsB,eAAe,wBAAwB;AAAA,QACxE,CAAC;AAAA,MACH;AAAA,IACF;AAAA,IACA,cAAc,CAAC,YAAY,IAAI;AAAA,EACjC;AACF;AAEA,IAAM,cAA+D;AAAA,EACnE,aAAa;AAAA,EACb,kBAAkB;AACpB;AAEO,IAAM,2BAA2B,OAAO,OAAO;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AACF,CAAU;AAYH,SAAS,gCAAgC;AAAA,EAC9C;AAAA,EACA;AACF,GAAiC;AAC/B,SAAO,eAAe,kBACpB,MACkC;AAClC,UAAM,iBAAiB,IAAI;AAE3B;AAAA,MACE,KAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,UAAU;AAAA,IACZ;AAEA,UAAM,EAAE,OAAO,IAAI;AACnB,UAAM,OAAO,MAAM,QAAQ;AAAA,MACzB,OAAO,OAAO;AAAA,MACd,MAAM,OAAO;AAAA,MACb,sBAAsB,MAAM,YAAY;AAAA,IAC1C,CAAC;AAED,QAAI,OAAO,YAAY;AACrB,aAAO,KAAK;AAAA,IACd;AAEA,WAAO,KAAK;AAAA,EACd;AACF;","names":["methodHooks"]}
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  methodHandlers
3
- } from "./chunk-3W4SMZFD.mjs";
3
+ } from "./chunk-3XL562LA.mjs";
4
4
  import {
5
5
  selectHooks
6
- } from "./chunk-SGQXD5K7.mjs";
6
+ } from "./chunk-W33UWNA2.mjs";
7
7
 
8
8
  // src/permitted/middleware.ts
9
9
  import { rpcErrors } from "@metamask/rpc-errors";
@@ -36,4 +36,4 @@ function createSnapsMethodMiddleware(isSnap, hooks) {
36
36
  export {
37
37
  createSnapsMethodMiddleware
38
38
  };
39
- //# sourceMappingURL=chunk-VNH2GKLV.mjs.map
39
+ //# sourceMappingURL=chunk-T3O2PFSR.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  deriveEntropy
3
- } from "./chunk-SGQXD5K7.mjs";
3
+ } from "./chunk-W33UWNA2.mjs";
4
4
 
5
5
  // src/restricted/manageState.ts
6
6
  import { PermissionType, SubjectType } from "@metamask/permission-controller";
@@ -140,4 +140,4 @@ export {
140
140
  getManageStateImplementation,
141
141
  getValidatedParams
142
142
  };
143
- //# sourceMappingURL=chunk-NESDQ4PF.mjs.map
143
+ //# sourceMappingURL=chunk-TE4W25CA.mjs.map
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  restrictedMethodPermissionBuilders
3
- } from "./chunk-PG32JMWC.mjs";
3
+ } from "./chunk-I3QG3QZL.mjs";
4
4
  import {
5
5
  caveatMappers
6
- } from "./chunk-Y4LNTDZ2.mjs";
6
+ } from "./chunk-FR26QD3N.mjs";
7
7
  import {
8
8
  selectHooks
9
- } from "./chunk-SGQXD5K7.mjs";
9
+ } from "./chunk-W33UWNA2.mjs";
10
10
  import {
11
11
  endowmentCaveatMappers,
12
12
  endowmentPermissionBuilders
@@ -56,4 +56,4 @@ export {
56
56
  buildSnapEndowmentSpecifications,
57
57
  buildSnapRestrictedMethodSpecifications
58
58
  };
59
- //# sourceMappingURL=chunk-L675SYPP.mjs.map
59
+ //# sourceMappingURL=chunk-TUIJOZXZ.mjs.map
@@ -1,6 +1,7 @@
1
1
  // src/utils.ts
2
2
  import { SLIP10Node } from "@metamask/key-tree";
3
3
  import {
4
+ assertExhaustive,
4
5
  add0x,
5
6
  assert,
6
7
  concatBytes,
@@ -54,10 +55,16 @@ async function deriveEntropy({
54
55
  return add0x(privateKey);
55
56
  }
56
57
  function getPathPrefix(curve) {
57
- if (curve === "secp256k1") {
58
- return "bip32";
58
+ switch (curve) {
59
+ case "secp256k1":
60
+ return "bip32";
61
+ case "ed25519":
62
+ return "slip10";
63
+ case "ed25519Bip32":
64
+ return "cip3";
65
+ default:
66
+ return assertExhaustive(curve);
59
67
  }
60
- return "slip10";
61
68
  }
62
69
  async function getNode({
63
70
  curve,
@@ -80,4 +87,4 @@ export {
80
87
  getPathPrefix,
81
88
  getNode
82
89
  };
83
- //# sourceMappingURL=chunk-SGQXD5K7.mjs.map
90
+ //# sourceMappingURL=chunk-W33UWNA2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils.ts"],"sourcesContent":["import type {\n HardenedBIP32Node,\n BIP32Node,\n SLIP10PathNode,\n SupportedCurve,\n} from '@metamask/key-tree';\nimport { SLIP10Node } from '@metamask/key-tree';\nimport type { MagicValue } from '@metamask/snaps-utils';\nimport type { Hex } from '@metamask/utils';\nimport {\n assertExhaustive,\n add0x,\n assert,\n concatBytes,\n createDataView,\n stringToBytes,\n} from '@metamask/utils';\nimport { keccak_256 as keccak256 } from '@noble/hashes/sha3';\n\nconst HARDENED_VALUE = 0x80000000;\n\n/**\n * Maps an interface with method hooks to an object, using the keys of the\n * interface, and `true` as value. This ensures that the `methodHooks` object\n * has the same values as the interface.\n */\nexport type MethodHooksObject<HooksType extends Record<string, unknown>> = {\n [Key in keyof HooksType]: true;\n};\n\n/**\n * Returns the subset of the specified `hooks` that are included in the\n * `hookNames` object. This is a Principle of Least Authority (POLA) measure\n * to ensure that each RPC method implementation only has access to the\n * API \"hooks\" it needs to do its job.\n *\n * @param hooks - The hooks to select from.\n * @param hookNames - The names of the hooks to select.\n * @returns The selected hooks.\n * @template Hooks - The hooks to select from.\n * @template HookName - The names of the hooks to select.\n */\nexport function selectHooks<\n Hooks extends Record<string, unknown>,\n HookName extends keyof Hooks,\n>(\n hooks: Hooks,\n hookNames?: Record<HookName, boolean>,\n): Pick<Hooks, HookName> | undefined {\n if (hookNames) {\n return Object.keys(hookNames).reduce<Partial<Pick<Hooks, HookName>>>(\n (hookSubset, _hookName) => {\n const hookName = _hookName as HookName;\n hookSubset[hookName] = hooks[hookName];\n return hookSubset;\n },\n {},\n ) as Pick<Hooks, HookName>;\n }\n return undefined;\n}\n\n/**\n * Get a BIP-32 derivation path array from a hash, which is compatible with\n * `@metamask/key-tree`. The hash is assumed to be 32 bytes long.\n *\n * @param hash - The hash to derive indices from.\n * @returns The derived indices as a {@link HardenedBIP32Node} array.\n */\nfunction getDerivationPathArray(hash: Uint8Array): HardenedBIP32Node[] {\n const array: HardenedBIP32Node[] = [];\n const view = createDataView(hash);\n\n for (let index = 0; index < 8; index++) {\n const uint32 = view.getUint32(index * 4);\n\n // This is essentially `index | 0x80000000`. Because JavaScript numbers are\n // signed, we use the bitwise unsigned right shift operator to ensure that\n // the result is a positive number.\n // eslint-disable-next-line no-bitwise\n const pathIndex = (uint32 | HARDENED_VALUE) >>> 0;\n array.push(`bip32:${pathIndex - HARDENED_VALUE}'` as const);\n }\n\n return array;\n}\n\ntype DeriveEntropyOptions = {\n /**\n * The input value to derive entropy from.\n */\n input: string;\n\n /**\n * An optional salt to use when deriving entropy.\n */\n salt?: string;\n\n /**\n * The mnemonic phrase to use for entropy derivation.\n */\n mnemonicPhrase: Uint8Array;\n\n /**\n * A hardened BIP-32 index, which is used to derive the root key from the\n * mnemonic phrase.\n */\n magic: MagicValue;\n};\n\n/**\n * Derive entropy from the given mnemonic phrase and salt.\n *\n * This is based on the reference implementation of\n * [SIP-6](https://metamask.github.io/SIPs/SIPS/sip-6).\n *\n * @param options - The options for entropy derivation.\n * @param options.input - The input value to derive entropy from.\n * @param options.salt - An optional salt to use when deriving entropy.\n * @param options.mnemonicPhrase - The mnemonic phrase to use for entropy\n * derivation.\n * @param options.magic - A hardened BIP-32 index, which is used to derive the\n * root key from the mnemonic phrase.\n * @returns The derived entropy.\n */\nexport async function deriveEntropy({\n input,\n salt = '',\n mnemonicPhrase,\n magic,\n}: DeriveEntropyOptions): Promise<Hex> {\n const inputBytes = stringToBytes(input);\n const saltBytes = stringToBytes(salt);\n\n // Get the derivation path from the snap ID.\n const hash = keccak256(concatBytes([inputBytes, keccak256(saltBytes)]));\n const computedDerivationPath = getDerivationPathArray(hash);\n\n // Derive the private key using BIP-32.\n const { privateKey } = await SLIP10Node.fromDerivationPath({\n derivationPath: [\n mnemonicPhrase,\n `bip32:${magic}`,\n ...computedDerivationPath,\n ],\n curve: 'secp256k1',\n });\n\n // This should never happen, but this keeps TypeScript happy.\n assert(privateKey, 'Failed to derive the entropy.');\n\n return add0x(privateKey);\n}\n\n/**\n * Get the path prefix to use for key derivation in `key-tree`. This assumes the\n * following:\n *\n * - The Secp256k1 curve always uses the BIP-32 specification.\n * - The Ed25519 curve always uses the SLIP-10 specification.\n * - The BIP-32-Ed25519 curve always uses the CIP-3 specification.\n *\n * While this does not matter in most situations (no known case at the time of\n * writing), `key-tree` requires a specific specification to be used.\n *\n * @param curve - The curve to get the path prefix for. The curve is NOT\n * validated by this function.\n * @returns The path prefix, i.e., `bip32` or `slip10`.\n */\nexport function getPathPrefix(\n curve: SupportedCurve,\n): 'bip32' | 'slip10' | 'cip3' {\n switch (curve) {\n case 'secp256k1':\n return 'bip32';\n case 'ed25519':\n return 'slip10';\n case 'ed25519Bip32':\n return 'cip3';\n default:\n return assertExhaustive(curve);\n }\n}\n\ntype GetNodeArgs = {\n curve: SupportedCurve;\n secretRecoveryPhrase: Uint8Array;\n path: string[];\n};\n\n/**\n * Get a `key-tree`-compatible node.\n *\n * Note: This function assumes that all the parameters have been validated\n * beforehand.\n *\n * @param options - The derivation options.\n * @param options.curve - The curve to use for derivation.\n * @param options.secretRecoveryPhrase - The secret recovery phrase to use for\n * derivation.\n * @param options.path - The derivation path to use as array, starting with an\n * \"m\" as the first item.\n */\nexport async function getNode({\n curve,\n secretRecoveryPhrase,\n path,\n}: GetNodeArgs) {\n const prefix = getPathPrefix(curve);\n\n return await SLIP10Node.fromDerivationPath({\n curve,\n derivationPath: [\n secretRecoveryPhrase,\n ...(path.slice(1).map((index) => `${prefix}:${index}`) as\n | BIP32Node[]\n | SLIP10PathNode[]),\n ],\n });\n}\n"],"mappings":";AAMA,SAAS,kBAAkB;AAG3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc,iBAAiB;AAExC,IAAM,iBAAiB;AAuBhB,SAAS,YAId,OACA,WACmC;AACnC,MAAI,WAAW;AACb,WAAO,OAAO,KAAK,SAAS,EAAE;AAAA,MAC5B,CAAC,YAAY,cAAc;AACzB,cAAM,WAAW;AACjB,mBAAW,QAAQ,IAAI,MAAM,QAAQ;AACrC,eAAO;AAAA,MACT;AAAA,MACA,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO;AACT;AASA,SAAS,uBAAuB,MAAuC;AACrE,QAAM,QAA6B,CAAC;AACpC,QAAM,OAAO,eAAe,IAAI;AAEhC,WAAS,QAAQ,GAAG,QAAQ,GAAG,SAAS;AACtC,UAAM,SAAS,KAAK,UAAU,QAAQ,CAAC;AAMvC,UAAM,aAAa,SAAS,oBAAoB;AAChD,UAAM,KAAK,SAAS,YAAY,cAAc,GAAY;AAAA,EAC5D;AAEA,SAAO;AACT;AAwCA,eAAsB,cAAc;AAAA,EAClC;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AACF,GAAuC;AACrC,QAAM,aAAa,cAAc,KAAK;AACtC,QAAM,YAAY,cAAc,IAAI;AAGpC,QAAM,OAAO,UAAU,YAAY,CAAC,YAAY,UAAU,SAAS,CAAC,CAAC,CAAC;AACtE,QAAM,yBAAyB,uBAAuB,IAAI;AAG1D,QAAM,EAAE,WAAW,IAAI,MAAM,WAAW,mBAAmB;AAAA,IACzD,gBAAgB;AAAA,MACd;AAAA,MACA,SAAS,KAAK;AAAA,MACd,GAAG;AAAA,IACL;AAAA,IACA,OAAO;AAAA,EACT,CAAC;AAGD,SAAO,YAAY,+BAA+B;AAElD,SAAO,MAAM,UAAU;AACzB;AAiBO,SAAS,cACd,OAC6B;AAC7B,UAAQ,OAAO;AAAA,IACb,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO,iBAAiB,KAAK;AAAA,EACjC;AACF;AAqBA,eAAsB,QAAQ;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AACF,GAAgB;AACd,QAAM,SAAS,cAAc,KAAK;AAElC,SAAO,MAAM,WAAW,mBAAmB;AAAA,IACzC;AAAA,IACA,gBAAgB;AAAA,MACd;AAAA,MACA,GAAI,KAAK,MAAM,CAAC,EAAE,IAAI,CAAC,UAAU,GAAG,MAAM,IAAI,KAAK,EAAE;AAAA,IAGvD;AAAA,EACF,CAAC;AACH;","names":[]}
@@ -1,7 +1,10 @@
1
1
  // src/permitted/createInterface.ts
2
2
  import { rpcErrors } from "@metamask/rpc-errors";
3
- import { ComponentOrElementStruct } from "@metamask/snaps-sdk";
4
- import { StructError, create, object } from "superstruct";
3
+ import {
4
+ ComponentOrElementStruct,
5
+ InterfaceContextStruct
6
+ } from "@metamask/snaps-sdk";
7
+ import { StructError, create, object, optional } from "superstruct";
5
8
  var hookNames = {
6
9
  createInterface: true
7
10
  };
@@ -11,14 +14,15 @@ var createInterfaceHandler = {
11
14
  hookNames
12
15
  };
13
16
  var CreateInterfaceParametersStruct = object({
14
- ui: ComponentOrElementStruct
17
+ ui: ComponentOrElementStruct,
18
+ context: optional(InterfaceContextStruct)
15
19
  });
16
20
  async function getCreateInterfaceImplementation(req, res, _next, end, { createInterface }) {
17
21
  const { params } = req;
18
22
  try {
19
23
  const validatedParams = getValidatedParams(params);
20
- const { ui } = validatedParams;
21
- res.result = await createInterface(ui);
24
+ const { ui, context } = validatedParams;
25
+ res.result = await createInterface(ui, context);
22
26
  } catch (error) {
23
27
  return end(error);
24
28
  }
@@ -40,4 +44,4 @@ function getValidatedParams(params) {
40
44
  export {
41
45
  createInterfaceHandler
42
46
  };
43
- //# sourceMappingURL=chunk-634BK2VP.mjs.map
47
+ //# sourceMappingURL=chunk-WEUKWKAQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/permitted/createInterface.ts"],"sourcesContent":["import type { JsonRpcEngineEndCallback } from '@metamask/json-rpc-engine';\nimport type { PermittedHandlerExport } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type {\n CreateInterfaceParams,\n CreateInterfaceResult,\n JsonRpcRequest,\n ComponentOrElement,\n InterfaceContext,\n} from '@metamask/snaps-sdk';\nimport {\n ComponentOrElementStruct,\n InterfaceContextStruct,\n} from '@metamask/snaps-sdk';\nimport { type InferMatching } from '@metamask/snaps-utils';\nimport type { PendingJsonRpcResponse } from '@metamask/utils';\nimport { StructError, create, object, optional } from 'superstruct';\n\nimport type { MethodHooksObject } from '../utils';\n\nconst hookNames: MethodHooksObject<CreateInterfaceMethodHooks> = {\n createInterface: true,\n};\n\nexport type CreateInterfaceMethodHooks = {\n /**\n * @param ui - The UI components.\n * @returns The unique identifier of the interface.\n */\n createInterface: (\n ui: ComponentOrElement,\n context?: InterfaceContext,\n ) => Promise<string>;\n};\n\nexport const createInterfaceHandler: PermittedHandlerExport<\n CreateInterfaceMethodHooks,\n CreateInterfaceParameters,\n CreateInterfaceResult\n> = {\n methodNames: ['snap_createInterface'],\n implementation: getCreateInterfaceImplementation,\n hookNames,\n};\n\nconst CreateInterfaceParametersStruct = object({\n ui: ComponentOrElementStruct,\n context: optional(InterfaceContextStruct),\n});\n\nexport type CreateInterfaceParameters = InferMatching<\n typeof CreateInterfaceParametersStruct,\n CreateInterfaceParams\n>;\n\n/**\n * The `snap_createInterface` method implementation.\n *\n * @param req - The JSON-RPC request object.\n * @param res - The JSON-RPC response object.\n * @param _next - The `json-rpc-engine` \"next\" callback. Not used by this\n * function.\n * @param end - The `json-rpc-engine` \"end\" callback.\n * @param hooks - The RPC method hooks.\n * @param hooks.createInterface - The function to create the interface.\n * @returns Nothing.\n */\nasync function getCreateInterfaceImplementation(\n req: JsonRpcRequest<CreateInterfaceParameters>,\n res: PendingJsonRpcResponse<CreateInterfaceResult>,\n _next: unknown,\n end: JsonRpcEngineEndCallback,\n { createInterface }: CreateInterfaceMethodHooks,\n): Promise<void> {\n const { params } = req;\n\n try {\n const validatedParams = getValidatedParams(params);\n\n const { ui, context } = validatedParams;\n\n res.result = await createInterface(ui, context);\n } catch (error) {\n return end(error);\n }\n\n return end();\n}\n\n/**\n * Validate the createInterface method `params` and returns them cast to the correct\n * type. Throws if validation fails.\n *\n * @param params - The unvalidated params object from the method request.\n * @returns The validated createInterface method parameter object.\n */\nfunction getValidatedParams(params: unknown): CreateInterfaceParameters {\n try {\n return create(params, CreateInterfaceParametersStruct);\n } catch (error) {\n if (error instanceof StructError) {\n throw rpcErrors.invalidParams({\n message: `Invalid params: ${error.message}.`,\n });\n }\n /* istanbul ignore next */\n throw rpcErrors.internal();\n }\n}\n"],"mappings":";AAEA,SAAS,iBAAiB;AAQ1B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAGP,SAAS,aAAa,QAAQ,QAAQ,gBAAgB;AAItD,IAAM,YAA2D;AAAA,EAC/D,iBAAiB;AACnB;AAaO,IAAM,yBAIT;AAAA,EACF,aAAa,CAAC,sBAAsB;AAAA,EACpC,gBAAgB;AAAA,EAChB;AACF;AAEA,IAAM,kCAAkC,OAAO;AAAA,EAC7C,IAAI;AAAA,EACJ,SAAS,SAAS,sBAAsB;AAC1C,CAAC;AAmBD,eAAe,iCACb,KACA,KACA,OACA,KACA,EAAE,gBAAgB,GACH;AACf,QAAM,EAAE,OAAO,IAAI;AAEnB,MAAI;AACF,UAAM,kBAAkB,mBAAmB,MAAM;AAEjD,UAAM,EAAE,IAAI,QAAQ,IAAI;AAExB,QAAI,SAAS,MAAM,gBAAgB,IAAI,OAAO;AAAA,EAChD,SAAS,OAAO;AACd,WAAO,IAAI,KAAK;AAAA,EAClB;AAEA,SAAO,IAAI;AACb;AASA,SAAS,mBAAmB,QAA4C;AACtE,MAAI;AACF,WAAO,OAAO,QAAQ,+BAA+B;AAAA,EACvD,SAAS,OAAO;AACd,QAAI,iBAAiB,aAAa;AAChC,YAAM,UAAU,cAAc;AAAA,QAC5B,SAAS,mBAAmB,MAAM,OAAO;AAAA,MAC3C,CAAC;AAAA,IACH;AAEA,UAAM,UAAU,SAAS;AAAA,EAC3B;AACF;","names":[]}
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-7TVJV425.js');
2
2
 
3
3
 
4
- var _chunkGP6TDVNTjs = require('./chunk-GP6TDVNT.js');
4
+ var _chunkQSVAU6X4js = require('./chunk-QSVAU6X4.js');
5
5
 
6
6
 
7
- var _chunkINB4AX37js = require('./chunk-INB4AX37.js');
8
- require('./chunk-AOWUGDER.js');
9
- require('./chunk-IDZGMGIB.js');
7
+ var _chunkF3VP6B2Xjs = require('./chunk-F3VP6B2X.js');
8
+ require('./chunk-E27BGHCR.js');
9
+ require('./chunk-DLVPMPRZ.js');
10
10
  require('./chunk-PS6OEQXL.js');
11
11
  require('./chunk-D5WQBUZB.js');
12
- require('./chunk-UDB4MUXI.js');
12
+ require('./chunk-PPR53SPJ.js');
13
13
  require('./chunk-4LSOS7SM.js');
14
14
  require('./chunk-3UAWEHMF.js');
15
15
  require('./chunk-NP3KGMVC.js');
@@ -19,34 +19,34 @@ require('./chunk-NWT2EXFD.js');
19
19
 
20
20
 
21
21
 
22
- var _chunkRX7WZZ32js = require('./chunk-RX7WZZ32.js');
22
+ var _chunkQAKSH24Zjs = require('./chunk-QAKSH24Z.js');
23
23
 
24
24
 
25
- var _chunkRIALLTR7js = require('./chunk-RIALLTR7.js');
25
+ var _chunkO2VSIMDYjs = require('./chunk-O2VSIMDY.js');
26
26
 
27
27
 
28
28
 
29
- var _chunkAYJK7MSHjs = require('./chunk-AYJK7MSH.js');
29
+ var _chunkLLH2T5NTjs = require('./chunk-LLH2T5NT.js');
30
30
  require('./chunk-2KTJCF3C.js');
31
31
  require('./chunk-VHY3NATP.js');
32
32
  require('./chunk-ZPK4THX4.js');
33
33
  require('./chunk-VUA6ICJO.js');
34
- require('./chunk-Q5W3YGEB.js');
34
+ require('./chunk-IVD2ORDS.js');
35
35
  require('./chunk-SYUGPLEP.js');
36
36
  require('./chunk-P74WXDY4.js');
37
37
 
38
38
 
39
- var _chunkR2M4YLJ7js = require('./chunk-R2M4YLJ7.js');
39
+ var _chunkM2JQCKR7js = require('./chunk-M2JQCKR7.js');
40
40
  require('./chunk-QDZAWH6F.js');
41
41
  require('./chunk-I7DR6BFO.js');
42
- require('./chunk-S7AR3ROH.js');
43
- require('./chunk-LGUJMQC7.js');
42
+ require('./chunk-IE6EHYEG.js');
43
+ require('./chunk-4BPNRCZJ.js');
44
44
 
45
45
 
46
46
  var _chunkFFHVA6PPjs = require('./chunk-FFHVA6PP.js');
47
47
 
48
48
 
49
- var _chunkYG7W4CDTjs = require('./chunk-YG7W4CDT.js');
49
+ var _chunk33MTKZ4Hjs = require('./chunk-33MTKZ4H.js');
50
50
 
51
51
 
52
52
 
@@ -114,5 +114,5 @@ var _snapsutils = require('@metamask/snaps-utils');
114
114
 
115
115
 
116
116
 
117
- exports.SnapCaveatType = _snapsutils.SnapCaveatType; exports.SnapEndowments = _chunkYGKFOOWIjs.SnapEndowments; exports.WALLET_SNAP_PERMISSION_KEY = _chunkFFHVA6PPjs.WALLET_SNAP_PERMISSION_KEY; exports.buildSnapEndowmentSpecifications = _chunkRX7WZZ32js.buildSnapEndowmentSpecifications; exports.buildSnapRestrictedMethodSpecifications = _chunkRX7WZZ32js.buildSnapRestrictedMethodSpecifications; exports.caveatMappers = _chunkAYJK7MSHjs.caveatMappers; exports.caveatSpecifications = _chunkAYJK7MSHjs.caveatSpecifications; exports.createSnapsMethodMiddleware = _chunkGP6TDVNTjs.createSnapsMethodMiddleware; exports.endowmentCaveatMappers = _chunkJRSPKOFGjs.endowmentCaveatMappers; exports.endowmentCaveatSpecifications = _chunkJRSPKOFGjs.endowmentCaveatSpecifications; exports.endowmentPermissionBuilders = _chunkJRSPKOFGjs.endowmentPermissionBuilders; exports.getChainIdsCaveat = _chunkIEUCBULUjs.getChainIdsCaveat; exports.getCronjobCaveatJobs = _chunkOQOTJFFVjs.getCronjobCaveatJobs; exports.getEncryptionEntropy = _chunkR2M4YLJ7js.getEncryptionEntropy; exports.getKeyringCaveatOrigins = _chunkPWUEAR4Hjs.getKeyringCaveatOrigins; exports.getLookupMatchersCaveat = _chunkIEUCBULUjs.getLookupMatchersCaveat; exports.getMaxRequestTimeCaveat = _chunkFCVWU5XHjs.getMaxRequestTimeCaveat; exports.getRpcCaveatOrigins = _chunkLIWV3FMYjs.getRpcCaveatOrigins; exports.getSignatureOriginCaveat = _chunkTEXEQGNZjs.getSignatureOriginCaveat; exports.getTransactionOriginCaveat = _chunk6TKD32TSjs.getTransactionOriginCaveat; exports.handlerEndowments = _chunkJRSPKOFGjs.handlerEndowments; exports.permittedMethods = _chunkINB4AX37js.handlers; exports.processSnapPermissions = _chunkRX7WZZ32js.processSnapPermissions; exports.restrictedMethodPermissionBuilders = _chunkRIALLTR7js.restrictedMethodPermissionBuilders; exports.selectHooks = _chunkYG7W4CDTjs.selectHooks;
117
+ exports.SnapCaveatType = _snapsutils.SnapCaveatType; exports.SnapEndowments = _chunkYGKFOOWIjs.SnapEndowments; exports.WALLET_SNAP_PERMISSION_KEY = _chunkFFHVA6PPjs.WALLET_SNAP_PERMISSION_KEY; exports.buildSnapEndowmentSpecifications = _chunkQAKSH24Zjs.buildSnapEndowmentSpecifications; exports.buildSnapRestrictedMethodSpecifications = _chunkQAKSH24Zjs.buildSnapRestrictedMethodSpecifications; exports.caveatMappers = _chunkLLH2T5NTjs.caveatMappers; exports.caveatSpecifications = _chunkLLH2T5NTjs.caveatSpecifications; exports.createSnapsMethodMiddleware = _chunkQSVAU6X4js.createSnapsMethodMiddleware; exports.endowmentCaveatMappers = _chunkJRSPKOFGjs.endowmentCaveatMappers; exports.endowmentCaveatSpecifications = _chunkJRSPKOFGjs.endowmentCaveatSpecifications; exports.endowmentPermissionBuilders = _chunkJRSPKOFGjs.endowmentPermissionBuilders; exports.getChainIdsCaveat = _chunkIEUCBULUjs.getChainIdsCaveat; exports.getCronjobCaveatJobs = _chunkOQOTJFFVjs.getCronjobCaveatJobs; exports.getEncryptionEntropy = _chunkM2JQCKR7js.getEncryptionEntropy; exports.getKeyringCaveatOrigins = _chunkPWUEAR4Hjs.getKeyringCaveatOrigins; exports.getLookupMatchersCaveat = _chunkIEUCBULUjs.getLookupMatchersCaveat; exports.getMaxRequestTimeCaveat = _chunkFCVWU5XHjs.getMaxRequestTimeCaveat; exports.getRpcCaveatOrigins = _chunkLIWV3FMYjs.getRpcCaveatOrigins; exports.getSignatureOriginCaveat = _chunkTEXEQGNZjs.getSignatureOriginCaveat; exports.getTransactionOriginCaveat = _chunk6TKD32TSjs.getTransactionOriginCaveat; exports.handlerEndowments = _chunkJRSPKOFGjs.handlerEndowments; exports.permittedMethods = _chunkF3VP6B2Xjs.handlers; exports.processSnapPermissions = _chunkQAKSH24Zjs.processSnapPermissions; exports.restrictedMethodPermissionBuilders = _chunkO2VSIMDYjs.restrictedMethodPermissionBuilders; exports.selectHooks = _chunk33MTKZ4Hjs.selectHooks;
118
118
  //# sourceMappingURL=index.js.map
package/dist/index.mjs CHANGED
@@ -1,15 +1,15 @@
1
1
  import "./chunk-TNENASGX.mjs";
2
2
  import {
3
3
  createSnapsMethodMiddleware
4
- } from "./chunk-VNH2GKLV.mjs";
4
+ } from "./chunk-T3O2PFSR.mjs";
5
5
  import {
6
6
  handlers
7
- } from "./chunk-3W4SMZFD.mjs";
8
- import "./chunk-TKXU7ZXP.mjs";
9
- import "./chunk-MXCJWR45.mjs";
7
+ } from "./chunk-3XL562LA.mjs";
8
+ import "./chunk-2L2ATCIK.mjs";
9
+ import "./chunk-2CTOCP34.mjs";
10
10
  import "./chunk-MXPVC2XP.mjs";
11
11
  import "./chunk-GVJLWGSI.mjs";
12
- import "./chunk-634BK2VP.mjs";
12
+ import "./chunk-WEUKWKAQ.mjs";
13
13
  import "./chunk-UB3733UY.mjs";
14
14
  import "./chunk-62URQ5VS.mjs";
15
15
  import "./chunk-I6FU5MGE.mjs";
@@ -19,34 +19,34 @@ import {
19
19
  buildSnapEndowmentSpecifications,
20
20
  buildSnapRestrictedMethodSpecifications,
21
21
  processSnapPermissions
22
- } from "./chunk-L675SYPP.mjs";
22
+ } from "./chunk-TUIJOZXZ.mjs";
23
23
  import {
24
24
  restrictedMethodPermissionBuilders
25
- } from "./chunk-PG32JMWC.mjs";
25
+ } from "./chunk-I3QG3QZL.mjs";
26
26
  import {
27
27
  caveatMappers,
28
28
  caveatSpecifications
29
- } from "./chunk-Y4LNTDZ2.mjs";
29
+ } from "./chunk-FR26QD3N.mjs";
30
30
  import "./chunk-EKXDFYIX.mjs";
31
31
  import "./chunk-WFAY5FPP.mjs";
32
32
  import "./chunk-CVK2TYJX.mjs";
33
33
  import "./chunk-LR7UR4YU.mjs";
34
- import "./chunk-IBV23QOX.mjs";
34
+ import "./chunk-KIXPIIY5.mjs";
35
35
  import "./chunk-IZYMBIBD.mjs";
36
36
  import "./chunk-E6WUMFQT.mjs";
37
37
  import {
38
38
  getEncryptionEntropy
39
- } from "./chunk-NESDQ4PF.mjs";
39
+ } from "./chunk-TE4W25CA.mjs";
40
40
  import "./chunk-JWDQUKKU.mjs";
41
41
  import "./chunk-X247BMMW.mjs";
42
- import "./chunk-TNRH2LRU.mjs";
43
- import "./chunk-6WUIFFMQ.mjs";
42
+ import "./chunk-LXJBBRQ4.mjs";
43
+ import "./chunk-R3DRYUNH.mjs";
44
44
  import {
45
45
  WALLET_SNAP_PERMISSION_KEY
46
46
  } from "./chunk-VVBTXSID.mjs";
47
47
  import {
48
48
  selectHooks
49
- } from "./chunk-SGQXD5K7.mjs";
49
+ } from "./chunk-W33UWNA2.mjs";
50
50
  import {
51
51
  endowmentCaveatMappers,
52
52
  endowmentCaveatSpecifications,
@@ -2,23 +2,23 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkRX7WZZ32js = require('./chunk-RX7WZZ32.js');
6
- require('./chunk-RIALLTR7.js');
7
- require('./chunk-AYJK7MSH.js');
5
+ var _chunkQAKSH24Zjs = require('./chunk-QAKSH24Z.js');
6
+ require('./chunk-O2VSIMDY.js');
7
+ require('./chunk-LLH2T5NT.js');
8
8
  require('./chunk-2KTJCF3C.js');
9
9
  require('./chunk-VHY3NATP.js');
10
10
  require('./chunk-ZPK4THX4.js');
11
11
  require('./chunk-VUA6ICJO.js');
12
- require('./chunk-Q5W3YGEB.js');
12
+ require('./chunk-IVD2ORDS.js');
13
13
  require('./chunk-SYUGPLEP.js');
14
14
  require('./chunk-P74WXDY4.js');
15
- require('./chunk-R2M4YLJ7.js');
15
+ require('./chunk-M2JQCKR7.js');
16
16
  require('./chunk-QDZAWH6F.js');
17
17
  require('./chunk-I7DR6BFO.js');
18
- require('./chunk-S7AR3ROH.js');
19
- require('./chunk-LGUJMQC7.js');
18
+ require('./chunk-IE6EHYEG.js');
19
+ require('./chunk-4BPNRCZJ.js');
20
20
  require('./chunk-FFHVA6PP.js');
21
- require('./chunk-YG7W4CDT.js');
21
+ require('./chunk-33MTKZ4H.js');
22
22
  require('./chunk-JRSPKOFG.js');
23
23
  require('./chunk-PWUEAR4H.js');
24
24
  require('./chunk-3DHVA2FY.js');
@@ -39,5 +39,5 @@ require('./chunk-YGKFOOWI.js');
39
39
 
40
40
 
41
41
 
42
- exports.buildSnapEndowmentSpecifications = _chunkRX7WZZ32js.buildSnapEndowmentSpecifications; exports.buildSnapRestrictedMethodSpecifications = _chunkRX7WZZ32js.buildSnapRestrictedMethodSpecifications; exports.processSnapPermissions = _chunkRX7WZZ32js.processSnapPermissions;
42
+ exports.buildSnapEndowmentSpecifications = _chunkQAKSH24Zjs.buildSnapEndowmentSpecifications; exports.buildSnapRestrictedMethodSpecifications = _chunkQAKSH24Zjs.buildSnapRestrictedMethodSpecifications; exports.processSnapPermissions = _chunkQAKSH24Zjs.processSnapPermissions;
43
43
  //# sourceMappingURL=permissions.js.map
@@ -2,23 +2,23 @@ import {
2
2
  buildSnapEndowmentSpecifications,
3
3
  buildSnapRestrictedMethodSpecifications,
4
4
  processSnapPermissions
5
- } from "./chunk-L675SYPP.mjs";
6
- import "./chunk-PG32JMWC.mjs";
7
- import "./chunk-Y4LNTDZ2.mjs";
5
+ } from "./chunk-TUIJOZXZ.mjs";
6
+ import "./chunk-I3QG3QZL.mjs";
7
+ import "./chunk-FR26QD3N.mjs";
8
8
  import "./chunk-EKXDFYIX.mjs";
9
9
  import "./chunk-WFAY5FPP.mjs";
10
10
  import "./chunk-CVK2TYJX.mjs";
11
11
  import "./chunk-LR7UR4YU.mjs";
12
- import "./chunk-IBV23QOX.mjs";
12
+ import "./chunk-KIXPIIY5.mjs";
13
13
  import "./chunk-IZYMBIBD.mjs";
14
14
  import "./chunk-E6WUMFQT.mjs";
15
- import "./chunk-NESDQ4PF.mjs";
15
+ import "./chunk-TE4W25CA.mjs";
16
16
  import "./chunk-JWDQUKKU.mjs";
17
17
  import "./chunk-X247BMMW.mjs";
18
- import "./chunk-TNRH2LRU.mjs";
19
- import "./chunk-6WUIFFMQ.mjs";
18
+ import "./chunk-LXJBBRQ4.mjs";
19
+ import "./chunk-R3DRYUNH.mjs";
20
20
  import "./chunk-VVBTXSID.mjs";
21
- import "./chunk-SGQXD5K7.mjs";
21
+ import "./chunk-W33UWNA2.mjs";
22
22
  import "./chunk-C6E6DI4I.mjs";
23
23
  import "./chunk-TOYWHUAS.mjs";
24
24
  import "./chunk-PCB6QOHL.mjs";
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkUDB4MUXIjs = require('../chunk-UDB4MUXI.js');
3
+ var _chunkPPR53SPJjs = require('../chunk-PPR53SPJ.js');
4
4
 
5
5
 
6
- exports.createInterfaceHandler = _chunkUDB4MUXIjs.createInterfaceHandler;
6
+ exports.createInterfaceHandler = _chunkPPR53SPJjs.createInterfaceHandler;
7
7
  //# sourceMappingURL=createInterface.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createInterfaceHandler
3
- } from "../chunk-634BK2VP.mjs";
3
+ } from "../chunk-WEUKWKAQ.mjs";
4
4
  export {
5
5
  createInterfaceHandler
6
6
  };
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkINB4AX37js = require('../chunk-INB4AX37.js');
5
- require('../chunk-AOWUGDER.js');
6
- require('../chunk-IDZGMGIB.js');
4
+ var _chunkF3VP6B2Xjs = require('../chunk-F3VP6B2X.js');
5
+ require('../chunk-E27BGHCR.js');
6
+ require('../chunk-DLVPMPRZ.js');
7
7
  require('../chunk-PS6OEQXL.js');
8
8
  require('../chunk-D5WQBUZB.js');
9
- require('../chunk-UDB4MUXI.js');
9
+ require('../chunk-PPR53SPJ.js');
10
10
  require('../chunk-4LSOS7SM.js');
11
11
  require('../chunk-3UAWEHMF.js');
12
12
  require('../chunk-NP3KGMVC.js');
@@ -16,5 +16,5 @@ require('../chunk-FFHVA6PP.js');
16
16
 
17
17
 
18
18
 
19
- exports.handlers = _chunkINB4AX37js.handlers; exports.methodHandlers = _chunkINB4AX37js.methodHandlers;
19
+ exports.handlers = _chunkF3VP6B2Xjs.handlers; exports.methodHandlers = _chunkF3VP6B2Xjs.methodHandlers;
20
20
  //# sourceMappingURL=handlers.js.map
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  handlers,
3
3
  methodHandlers
4
- } from "../chunk-3W4SMZFD.mjs";
5
- import "../chunk-TKXU7ZXP.mjs";
6
- import "../chunk-MXCJWR45.mjs";
4
+ } from "../chunk-3XL562LA.mjs";
5
+ import "../chunk-2L2ATCIK.mjs";
6
+ import "../chunk-2CTOCP34.mjs";
7
7
  import "../chunk-MXPVC2XP.mjs";
8
8
  import "../chunk-GVJLWGSI.mjs";
9
- import "../chunk-634BK2VP.mjs";
9
+ import "../chunk-WEUKWKAQ.mjs";
10
10
  import "../chunk-UB3733UY.mjs";
11
11
  import "../chunk-62URQ5VS.mjs";
12
12
  import "../chunk-I6FU5MGE.mjs";
@@ -1,26 +1,26 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-7TVJV425.js');
2
2
 
3
3
 
4
- var _chunkGP6TDVNTjs = require('../chunk-GP6TDVNT.js');
4
+ var _chunkQSVAU6X4js = require('../chunk-QSVAU6X4.js');
5
5
 
6
6
 
7
7
 
8
- var _chunkINB4AX37js = require('../chunk-INB4AX37.js');
9
- require('../chunk-AOWUGDER.js');
10
- require('../chunk-IDZGMGIB.js');
8
+ var _chunkF3VP6B2Xjs = require('../chunk-F3VP6B2X.js');
9
+ require('../chunk-E27BGHCR.js');
10
+ require('../chunk-DLVPMPRZ.js');
11
11
  require('../chunk-PS6OEQXL.js');
12
12
  require('../chunk-D5WQBUZB.js');
13
- require('../chunk-UDB4MUXI.js');
13
+ require('../chunk-PPR53SPJ.js');
14
14
  require('../chunk-4LSOS7SM.js');
15
15
  require('../chunk-3UAWEHMF.js');
16
16
  require('../chunk-NP3KGMVC.js');
17
17
  require('../chunk-4W7U4OH6.js');
18
18
  require('../chunk-NWT2EXFD.js');
19
19
  require('../chunk-FFHVA6PP.js');
20
- require('../chunk-YG7W4CDT.js');
20
+ require('../chunk-33MTKZ4H.js');
21
21
 
22
22
 
23
23
 
24
24
 
25
- exports.createSnapsMethodMiddleware = _chunkGP6TDVNTjs.createSnapsMethodMiddleware; exports.handlers = _chunkINB4AX37js.handlers; exports.methodHandlers = _chunkINB4AX37js.methodHandlers;
25
+ exports.createSnapsMethodMiddleware = _chunkQSVAU6X4js.createSnapsMethodMiddleware; exports.handlers = _chunkF3VP6B2Xjs.handlers; exports.methodHandlers = _chunkF3VP6B2Xjs.methodHandlers;
26
26
  //# sourceMappingURL=index.js.map
@@ -1,23 +1,23 @@
1
1
  import "../chunk-TNENASGX.mjs";
2
2
  import {
3
3
  createSnapsMethodMiddleware
4
- } from "../chunk-VNH2GKLV.mjs";
4
+ } from "../chunk-T3O2PFSR.mjs";
5
5
  import {
6
6
  handlers,
7
7
  methodHandlers
8
- } from "../chunk-3W4SMZFD.mjs";
9
- import "../chunk-TKXU7ZXP.mjs";
10
- import "../chunk-MXCJWR45.mjs";
8
+ } from "../chunk-3XL562LA.mjs";
9
+ import "../chunk-2L2ATCIK.mjs";
10
+ import "../chunk-2CTOCP34.mjs";
11
11
  import "../chunk-MXPVC2XP.mjs";
12
12
  import "../chunk-GVJLWGSI.mjs";
13
- import "../chunk-634BK2VP.mjs";
13
+ import "../chunk-WEUKWKAQ.mjs";
14
14
  import "../chunk-UB3733UY.mjs";
15
15
  import "../chunk-62URQ5VS.mjs";
16
16
  import "../chunk-I6FU5MGE.mjs";
17
17
  import "../chunk-TJYMYQAB.mjs";
18
18
  import "../chunk-CH5O2YCX.mjs";
19
19
  import "../chunk-VVBTXSID.mjs";
20
- import "../chunk-SGQXD5K7.mjs";
20
+ import "../chunk-W33UWNA2.mjs";
21
21
  export {
22
22
  createSnapsMethodMiddleware,
23
23
  handlers,