@metamask/snaps-rpc-methods 15.1.1 → 16.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -4
- package/dist/index.cjs +1 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -2
- package/dist/index.mjs.map +1 -1
- package/dist/permissions.cjs +18 -8
- package/dist/permissions.cjs.map +1 -1
- package/dist/permissions.d.cts +3 -2
- package/dist/permissions.d.cts.map +1 -1
- package/dist/permissions.d.mts +3 -2
- package/dist/permissions.d.mts.map +1 -1
- package/dist/permissions.mjs +17 -7
- package/dist/permissions.mjs.map +1 -1
- package/dist/permitted/cancelBackgroundEvent.cjs +10 -14
- package/dist/permitted/cancelBackgroundEvent.cjs.map +1 -1
- package/dist/permitted/cancelBackgroundEvent.d.cts +9 -12
- package/dist/permitted/cancelBackgroundEvent.d.cts.map +1 -1
- package/dist/permitted/cancelBackgroundEvent.d.mts +9 -12
- package/dist/permitted/cancelBackgroundEvent.d.mts.map +1 -1
- package/dist/permitted/cancelBackgroundEvent.mjs +10 -14
- package/dist/permitted/cancelBackgroundEvent.mjs.map +1 -1
- package/dist/permitted/clearState.cjs +10 -16
- package/dist/permitted/clearState.cjs.map +1 -1
- package/dist/permitted/clearState.d.cts +9 -23
- package/dist/permitted/clearState.d.cts.map +1 -1
- package/dist/permitted/clearState.d.mts +9 -23
- package/dist/permitted/clearState.d.mts.map +1 -1
- package/dist/permitted/clearState.mjs +10 -16
- package/dist/permitted/clearState.mjs.map +1 -1
- package/dist/permitted/closeWebSocket.cjs +7 -14
- package/dist/permitted/closeWebSocket.cjs.map +1 -1
- package/dist/permitted/closeWebSocket.d.cts +9 -12
- package/dist/permitted/closeWebSocket.d.cts.map +1 -1
- package/dist/permitted/closeWebSocket.d.mts +9 -12
- package/dist/permitted/closeWebSocket.d.mts.map +1 -1
- package/dist/permitted/closeWebSocket.mjs +7 -14
- package/dist/permitted/closeWebSocket.mjs.map +1 -1
- package/dist/permitted/createInterface.cjs +11 -15
- package/dist/permitted/createInterface.cjs.map +1 -1
- package/dist/permitted/createInterface.d.cts +23 -37
- package/dist/permitted/createInterface.d.cts.map +1 -1
- package/dist/permitted/createInterface.d.mts +23 -37
- package/dist/permitted/createInterface.d.mts.map +1 -1
- package/dist/permitted/createInterface.mjs +11 -15
- package/dist/permitted/createInterface.mjs.map +1 -1
- package/dist/permitted/endTrace.cjs +4 -6
- package/dist/permitted/endTrace.cjs.map +1 -1
- package/dist/permitted/endTrace.d.cts +8 -11
- package/dist/permitted/endTrace.d.cts.map +1 -1
- package/dist/permitted/endTrace.d.mts +8 -11
- package/dist/permitted/endTrace.d.mts.map +1 -1
- package/dist/permitted/endTrace.mjs +4 -6
- package/dist/permitted/endTrace.mjs.map +1 -1
- package/dist/permitted/getAllSnaps.cjs +5 -11
- package/dist/permitted/getAllSnaps.cjs.map +1 -1
- package/dist/permitted/getAllSnaps.d.cts +10 -14
- package/dist/permitted/getAllSnaps.d.cts.map +1 -1
- package/dist/permitted/getAllSnaps.d.mts +10 -14
- package/dist/permitted/getAllSnaps.d.mts.map +1 -1
- package/dist/permitted/getAllSnaps.mjs +5 -11
- package/dist/permitted/getAllSnaps.mjs.map +1 -1
- package/dist/permitted/getBackgroundEvents.cjs +8 -15
- package/dist/permitted/getBackgroundEvents.cjs.map +1 -1
- package/dist/permitted/getBackgroundEvents.d.cts +10 -13
- package/dist/permitted/getBackgroundEvents.d.cts.map +1 -1
- package/dist/permitted/getBackgroundEvents.d.mts +10 -13
- package/dist/permitted/getBackgroundEvents.d.mts.map +1 -1
- package/dist/permitted/getBackgroundEvents.mjs +8 -15
- package/dist/permitted/getBackgroundEvents.mjs.map +1 -1
- package/dist/permitted/getClientStatus.cjs +5 -6
- package/dist/permitted/getClientStatus.cjs.map +1 -1
- package/dist/permitted/getClientStatus.d.cts +17 -18
- package/dist/permitted/getClientStatus.d.cts.map +1 -1
- package/dist/permitted/getClientStatus.d.mts +17 -18
- package/dist/permitted/getClientStatus.d.mts.map +1 -1
- package/dist/permitted/getClientStatus.mjs +5 -6
- package/dist/permitted/getClientStatus.mjs.map +1 -1
- package/dist/permitted/getFile.cjs +7 -11
- package/dist/permitted/getFile.cjs.map +1 -1
- package/dist/permitted/getFile.d.cts +8 -10
- package/dist/permitted/getFile.d.cts.map +1 -1
- package/dist/permitted/getFile.d.mts +8 -10
- package/dist/permitted/getFile.d.mts.map +1 -1
- package/dist/permitted/getFile.mjs +7 -11
- package/dist/permitted/getFile.mjs.map +1 -1
- package/dist/permitted/getInterfaceContext.cjs +12 -15
- package/dist/permitted/getInterfaceContext.cjs.map +1 -1
- package/dist/permitted/getInterfaceContext.d.cts +9 -21
- package/dist/permitted/getInterfaceContext.d.cts.map +1 -1
- package/dist/permitted/getInterfaceContext.d.mts +9 -21
- package/dist/permitted/getInterfaceContext.d.mts.map +1 -1
- package/dist/permitted/getInterfaceContext.mjs +12 -15
- package/dist/permitted/getInterfaceContext.mjs.map +1 -1
- package/dist/permitted/getInterfaceState.cjs +11 -15
- package/dist/permitted/getInterfaceState.cjs.map +1 -1
- package/dist/permitted/getInterfaceState.d.cts +9 -21
- package/dist/permitted/getInterfaceState.d.cts.map +1 -1
- package/dist/permitted/getInterfaceState.d.mts +9 -21
- package/dist/permitted/getInterfaceState.d.mts.map +1 -1
- package/dist/permitted/getInterfaceState.mjs +11 -15
- package/dist/permitted/getInterfaceState.mjs.map +1 -1
- package/dist/permitted/getSnaps.cjs +6 -12
- package/dist/permitted/getSnaps.cjs.map +1 -1
- package/dist/permitted/getSnaps.d.cts +11 -14
- package/dist/permitted/getSnaps.d.cts.map +1 -1
- package/dist/permitted/getSnaps.d.mts +11 -14
- package/dist/permitted/getSnaps.d.mts.map +1 -1
- package/dist/permitted/getSnaps.mjs +6 -12
- package/dist/permitted/getSnaps.mjs.map +1 -1
- package/dist/permitted/getState.cjs +9 -11
- package/dist/permitted/getState.cjs.map +1 -1
- package/dist/permitted/getState.d.cts +17 -28
- package/dist/permitted/getState.d.cts.map +1 -1
- package/dist/permitted/getState.d.mts +17 -28
- package/dist/permitted/getState.d.mts.map +1 -1
- package/dist/permitted/getState.mjs +9 -11
- package/dist/permitted/getState.mjs.map +1 -1
- package/dist/permitted/getWebSockets.cjs +11 -14
- package/dist/permitted/getWebSockets.cjs.map +1 -1
- package/dist/permitted/getWebSockets.d.cts +10 -13
- package/dist/permitted/getWebSockets.d.cts.map +1 -1
- package/dist/permitted/getWebSockets.d.mts +10 -13
- package/dist/permitted/getWebSockets.d.mts.map +1 -1
- package/dist/permitted/getWebSockets.mjs +11 -14
- package/dist/permitted/getWebSockets.mjs.map +1 -1
- package/dist/permitted/index.cjs +0 -1
- package/dist/permitted/index.cjs.map +1 -1
- package/dist/permitted/index.d.cts +29 -25
- package/dist/permitted/index.d.cts.map +1 -1
- package/dist/permitted/index.d.mts +29 -25
- package/dist/permitted/index.d.mts.map +1 -1
- package/dist/permitted/index.mjs +0 -1
- package/dist/permitted/index.mjs.map +1 -1
- package/dist/permitted/invokeKeyring.cjs +12 -13
- package/dist/permitted/invokeKeyring.cjs.map +1 -1
- package/dist/permitted/invokeKeyring.d.cts +17 -16
- package/dist/permitted/invokeKeyring.d.cts.map +1 -1
- package/dist/permitted/invokeKeyring.d.mts +17 -16
- package/dist/permitted/invokeKeyring.d.mts.map +1 -1
- package/dist/permitted/invokeKeyring.mjs +12 -13
- package/dist/permitted/invokeKeyring.mjs.map +1 -1
- package/dist/permitted/invokeSnapSugar.cjs +6 -10
- package/dist/permitted/invokeSnapSugar.cjs.map +1 -1
- package/dist/permitted/invokeSnapSugar.d.cts +9 -12
- package/dist/permitted/invokeSnapSugar.d.cts.map +1 -1
- package/dist/permitted/invokeSnapSugar.d.mts +9 -12
- package/dist/permitted/invokeSnapSugar.d.mts.map +1 -1
- package/dist/permitted/invokeSnapSugar.mjs +6 -10
- package/dist/permitted/invokeSnapSugar.mjs.map +1 -1
- package/dist/permitted/listEntropySources.cjs +28 -12
- package/dist/permitted/listEntropySources.cjs.map +1 -1
- package/dist/permitted/listEntropySources.d.cts +12 -23
- package/dist/permitted/listEntropySources.d.cts.map +1 -1
- package/dist/permitted/listEntropySources.d.mts +12 -23
- package/dist/permitted/listEntropySources.d.mts.map +1 -1
- package/dist/permitted/listEntropySources.mjs +28 -12
- package/dist/permitted/listEntropySources.mjs.map +1 -1
- package/dist/permitted/middleware.cjs +70 -20
- package/dist/permitted/middleware.cjs.map +1 -1
- package/dist/permitted/middleware.d.cts +5 -2
- package/dist/permitted/middleware.d.cts.map +1 -1
- package/dist/permitted/middleware.d.mts +5 -2
- package/dist/permitted/middleware.d.mts.map +1 -1
- package/dist/permitted/middleware.mjs +70 -20
- package/dist/permitted/middleware.mjs.map +1 -1
- package/dist/permitted/openWebSocket.cjs +7 -14
- package/dist/permitted/openWebSocket.cjs.map +1 -1
- package/dist/permitted/openWebSocket.d.cts +9 -12
- package/dist/permitted/openWebSocket.d.cts.map +1 -1
- package/dist/permitted/openWebSocket.d.mts +9 -12
- package/dist/permitted/openWebSocket.d.mts.map +1 -1
- package/dist/permitted/openWebSocket.mjs +7 -14
- package/dist/permitted/openWebSocket.mjs.map +1 -1
- package/dist/permitted/requestSnaps.cjs +14 -19
- package/dist/permitted/requestSnaps.cjs.map +1 -1
- package/dist/permitted/requestSnaps.d.cts +9 -36
- package/dist/permitted/requestSnaps.d.cts.map +1 -1
- package/dist/permitted/requestSnaps.d.mts +9 -36
- package/dist/permitted/requestSnaps.d.mts.map +1 -1
- package/dist/permitted/requestSnaps.mjs +15 -20
- package/dist/permitted/requestSnaps.mjs.map +1 -1
- package/dist/permitted/resolveInterface.cjs +11 -15
- package/dist/permitted/resolveInterface.cjs.map +1 -1
- package/dist/permitted/resolveInterface.d.cts +12 -24
- package/dist/permitted/resolveInterface.d.cts.map +1 -1
- package/dist/permitted/resolveInterface.d.mts +12 -24
- package/dist/permitted/resolveInterface.d.mts.map +1 -1
- package/dist/permitted/resolveInterface.mjs +11 -15
- package/dist/permitted/resolveInterface.mjs.map +1 -1
- package/dist/permitted/scheduleBackgroundEvent.cjs +11 -14
- package/dist/permitted/scheduleBackgroundEvent.cjs.map +1 -1
- package/dist/permitted/scheduleBackgroundEvent.d.cts +10 -17
- package/dist/permitted/scheduleBackgroundEvent.d.cts.map +1 -1
- package/dist/permitted/scheduleBackgroundEvent.d.mts +10 -17
- package/dist/permitted/scheduleBackgroundEvent.d.mts.map +1 -1
- package/dist/permitted/scheduleBackgroundEvent.mjs +11 -14
- package/dist/permitted/scheduleBackgroundEvent.mjs.map +1 -1
- package/dist/permitted/sendWebSocketMessage.cjs +10 -14
- package/dist/permitted/sendWebSocketMessage.cjs.map +1 -1
- package/dist/permitted/sendWebSocketMessage.d.cts +9 -12
- package/dist/permitted/sendWebSocketMessage.d.cts.map +1 -1
- package/dist/permitted/sendWebSocketMessage.d.mts +9 -12
- package/dist/permitted/sendWebSocketMessage.d.mts.map +1 -1
- package/dist/permitted/sendWebSocketMessage.mjs +10 -14
- package/dist/permitted/sendWebSocketMessage.mjs.map +1 -1
- package/dist/permitted/setState.cjs +18 -21
- package/dist/permitted/setState.cjs.map +1 -1
- package/dist/permitted/setState.d.cts +18 -45
- package/dist/permitted/setState.d.cts.map +1 -1
- package/dist/permitted/setState.d.mts +18 -45
- package/dist/permitted/setState.d.mts.map +1 -1
- package/dist/permitted/setState.mjs +18 -21
- package/dist/permitted/setState.mjs.map +1 -1
- package/dist/permitted/startTrace.cjs +4 -6
- package/dist/permitted/startTrace.cjs.map +1 -1
- package/dist/permitted/startTrace.d.cts +8 -11
- package/dist/permitted/startTrace.d.cts.map +1 -1
- package/dist/permitted/startTrace.d.mts +8 -11
- package/dist/permitted/startTrace.d.mts.map +1 -1
- package/dist/permitted/startTrace.mjs +4 -6
- package/dist/permitted/startTrace.mjs.map +1 -1
- package/dist/permitted/trackError.cjs +4 -6
- package/dist/permitted/trackError.cjs.map +1 -1
- package/dist/permitted/trackError.d.cts +8 -11
- package/dist/permitted/trackError.d.cts.map +1 -1
- package/dist/permitted/trackError.d.mts +8 -11
- package/dist/permitted/trackError.d.mts.map +1 -1
- package/dist/permitted/trackError.mjs +4 -6
- package/dist/permitted/trackError.mjs.map +1 -1
- package/dist/permitted/trackEvent.cjs +4 -6
- package/dist/permitted/trackEvent.cjs.map +1 -1
- package/dist/permitted/trackEvent.d.cts +8 -11
- package/dist/permitted/trackEvent.d.cts.map +1 -1
- package/dist/permitted/trackEvent.d.mts +8 -11
- package/dist/permitted/trackEvent.d.mts.map +1 -1
- package/dist/permitted/trackEvent.mjs +4 -6
- package/dist/permitted/trackEvent.mjs.map +1 -1
- package/dist/permitted/updateInterface.cjs +11 -15
- package/dist/permitted/updateInterface.cjs.map +1 -1
- package/dist/permitted/updateInterface.d.cts +9 -22
- package/dist/permitted/updateInterface.d.cts.map +1 -1
- package/dist/permitted/updateInterface.d.mts +9 -22
- package/dist/permitted/updateInterface.d.mts.map +1 -1
- package/dist/permitted/updateInterface.mjs +11 -15
- package/dist/permitted/updateInterface.mjs.map +1 -1
- package/dist/restricted/dialog.cjs +23 -30
- package/dist/restricted/dialog.cjs.map +1 -1
- package/dist/restricted/dialog.d.cts +10 -58
- package/dist/restricted/dialog.d.cts.map +1 -1
- package/dist/restricted/dialog.d.mts +10 -58
- package/dist/restricted/dialog.d.mts.map +1 -1
- package/dist/restricted/dialog.mjs +23 -30
- package/dist/restricted/dialog.mjs.map +1 -1
- package/dist/restricted/getBip32Entropy.cjs +15 -12
- package/dist/restricted/getBip32Entropy.cjs.map +1 -1
- package/dist/restricted/getBip32Entropy.d.cts +11 -24
- package/dist/restricted/getBip32Entropy.d.cts.map +1 -1
- package/dist/restricted/getBip32Entropy.d.mts +11 -24
- package/dist/restricted/getBip32Entropy.d.mts.map +1 -1
- package/dist/restricted/getBip32Entropy.mjs +16 -13
- package/dist/restricted/getBip32Entropy.mjs.map +1 -1
- package/dist/restricted/getBip32PublicKey.cjs +15 -12
- package/dist/restricted/getBip32PublicKey.cjs.map +1 -1
- package/dist/restricted/getBip32PublicKey.d.cts +11 -24
- package/dist/restricted/getBip32PublicKey.d.cts.map +1 -1
- package/dist/restricted/getBip32PublicKey.d.mts +11 -24
- package/dist/restricted/getBip32PublicKey.d.mts.map +1 -1
- package/dist/restricted/getBip32PublicKey.mjs +16 -13
- package/dist/restricted/getBip32PublicKey.mjs.map +1 -1
- package/dist/restricted/getBip44Entropy.cjs +14 -10
- package/dist/restricted/getBip44Entropy.cjs.map +1 -1
- package/dist/restricted/getBip44Entropy.d.cts +11 -15
- package/dist/restricted/getBip44Entropy.d.cts.map +1 -1
- package/dist/restricted/getBip44Entropy.d.mts +11 -15
- package/dist/restricted/getBip44Entropy.d.mts.map +1 -1
- package/dist/restricted/getBip44Entropy.mjs +15 -11
- package/dist/restricted/getBip44Entropy.mjs.map +1 -1
- package/dist/restricted/getEntropy.cjs +10 -10
- package/dist/restricted/getEntropy.cjs.map +1 -1
- package/dist/restricted/getEntropy.d.cts +11 -15
- package/dist/restricted/getEntropy.d.cts.map +1 -1
- package/dist/restricted/getEntropy.d.mts +11 -15
- package/dist/restricted/getEntropy.d.mts.map +1 -1
- package/dist/restricted/getEntropy.mjs +11 -11
- package/dist/restricted/getEntropy.mjs.map +1 -1
- package/dist/restricted/index.cjs.map +1 -1
- package/dist/restricted/index.d.cts +20 -160
- package/dist/restricted/index.d.cts.map +1 -1
- package/dist/restricted/index.d.mts +20 -160
- package/dist/restricted/index.d.mts.map +1 -1
- package/dist/restricted/index.mjs.map +1 -1
- package/dist/restricted/invokeSnap.cjs +11 -12
- package/dist/restricted/invokeSnap.cjs.map +1 -1
- package/dist/restricted/invokeSnap.d.cts +9 -13
- package/dist/restricted/invokeSnap.d.cts.map +1 -1
- package/dist/restricted/invokeSnap.d.mts +9 -13
- package/dist/restricted/invokeSnap.d.mts.map +1 -1
- package/dist/restricted/invokeSnap.mjs +11 -12
- package/dist/restricted/invokeSnap.mjs.map +1 -1
- package/dist/restricted/manageState.cjs +21 -20
- package/dist/restricted/manageState.cjs.map +1 -1
- package/dist/restricted/manageState.d.cts +12 -34
- package/dist/restricted/manageState.d.cts.map +1 -1
- package/dist/restricted/manageState.d.mts +12 -34
- package/dist/restricted/manageState.d.mts.map +1 -1
- package/dist/restricted/manageState.mjs +21 -20
- package/dist/restricted/manageState.mjs.map +1 -1
- package/dist/restricted/notify.cjs +31 -24
- package/dist/restricted/notify.cjs.map +1 -1
- package/dist/restricted/notify.d.cts +16 -25
- package/dist/restricted/notify.d.cts.map +1 -1
- package/dist/restricted/notify.d.mts +16 -25
- package/dist/restricted/notify.d.mts.map +1 -1
- package/dist/restricted/notify.mjs +32 -25
- package/dist/restricted/notify.mjs.map +1 -1
- package/dist/types.cjs +3 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +155 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +155 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +2 -0
- package/dist/types.mjs.map +1 -0
- package/dist/utils.cjs +78 -24
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +21 -13
- package/dist/utils.d.cts.map +1 -1
- package/dist/utils.d.mts +21 -13
- package/dist/utils.d.mts.map +1 -1
- package/dist/utils.mjs +75 -22
- package/dist/utils.mjs.map +1 -1
- package/package.json +6 -6
- package/dist/permitted/handlers.cjs +0 -63
- package/dist/permitted/handlers.cjs.map +0 -1
- package/dist/permitted/handlers.d.cts +0 -299
- package/dist/permitted/handlers.d.cts.map +0 -1
- package/dist/permitted/handlers.d.mts +0 -299
- package/dist/permitted/handlers.d.mts.map +0 -1
- package/dist/permitted/handlers.mjs +0 -60
- package/dist/permitted/handlers.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getEntropy.cjs","sourceRoot":"","sources":["../../src/restricted/getEntropy.ts"],"names":[],"mapp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,UAAU,CAC9B,OAAkD;QAElD,MAAM,EACJ,MAAM,EACN,OAAO,EAAE,EAAE,MAAM,EAAE,GACpB,GAAG,OAAO,CAAC;QAEZ,IAAA,oBAAY,EACV,MAAM,EACN,4BAAoB,EACpB,sCAAsC,EACtC,sBAAS,CAAC,aAAa,CACxB,CAAC;QAEF,MAAM,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAE7B,MAAM,IAAI,GAAG,MAAM,IAAA,iCAAyB,EAC1C,uBAAe,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,EACrC,MAAM,CAAC,MAAM,CACd,CAAC;QAEF,OAAO,IAAA,6BAAqB,EAAC;YAC3B,KAAK,EAAE,MAAM;YACb,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,IAAI;YACJ,KAAK,EAAE,+BAAiB;YACxB,sBAAsB,EAAE,qBAAqB,EAAE;SAChD,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { CryptographicFunctions } from '@metamask/key-tree';\nimport type { Messenger } from '@metamask/messenger';\nimport type {\n PermissionSpecificationBuilder,\n RestrictedMethodOptions,\n ValidPermissionSpecification,\n} from '@metamask/permission-controller';\nimport { PermissionType, SubjectType } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type { GetEntropyParams, GetEntropyResult } from '@metamask/snaps-sdk';\nimport { SIP_6_MAGIC_VALUE } from '@metamask/snaps-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { literal, object, optional, string } from '@metamask/superstruct';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assertStruct } from '@metamask/utils';\n\nimport type { KeyringControllerWithKeyringAction } from '../types';\nimport type { MethodHooksObject } from '../utils';\nimport {\n deriveEntropyFromSeed,\n getMnemonicSeed,\n getValueFromEntropySource,\n} from '../utils';\n\nconst targetName = 'snap_getEntropy';\n\nexport type GetEntropyMessengerActions = KeyringControllerWithKeyringAction;\n\ntype GetEntropySpecificationBuilderOptions = {\n allowedCaveats?: Readonly<NonEmptyArray<string>> | null;\n methodHooks: GetEntropyHooks;\n messenger: Messenger<string, GetEntropyMessengerActions>;\n};\n\ntype GetEntropySpecification = ValidPermissionSpecification<{\n permissionType: PermissionType.RestrictedMethod;\n targetName: typeof targetName;\n methodImplementation: ReturnType<typeof getEntropyImplementation>;\n allowedCaveats: Readonly<NonEmptyArray<string>> | null;\n}>;\n\nexport const GetEntropyArgsStruct = object({\n version: literal(1),\n salt: optional(string()),\n source: optional(string()),\n});\n\n/**\n * @property version - The version of the `snap_getEntropy` method. This must be\n * the numeric literal `1`.\n * @property salt - A string to use as the salt when deriving the entropy. If\n * omitted, the salt will be an empty string.\n */\nexport type GetEntropyArgs = Infer<typeof GetEntropyArgsStruct>;\n\nconst specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.RestrictedMethod,\n GetEntropySpecificationBuilderOptions,\n GetEntropySpecification\n> = ({\n allowedCaveats = null,\n methodHooks,\n messenger,\n}: GetEntropySpecificationBuilderOptions) => {\n return {\n permissionType: PermissionType.RestrictedMethod,\n targetName,\n allowedCaveats,\n methodImplementation: getEntropyImplementation({ methodHooks, messenger }),\n subjectTypes: [SubjectType.Snap],\n };\n};\n\nconst methodHooks: MethodHooksObject<GetEntropyHooks> = {\n getUnlockPromise: true,\n getClientCryptography: true,\n};\n\n/**\n * Get a deterministic 256-bit entropy value, specific to the Snap and the\n * user's account. You can use this entropy to generate a private key, or any\n * other value that requires a high level of randomness. Other Snaps can't\n * access this entropy, and it changes if the user's secret recovery phrase\n * changes.\n *\n * You can optionally specify a salt to generate different entropy for different\n * purposes. Using a salt results in entropy unrelated to the entropy generated\n * without a salt.\n *\n * This value is deterministic: it's always the same for the same Snap, user\n * account, and salt.\n *\n * @example\n * ```json name=\"Manifest\"\n * {\n * \"initialPermissions\": {\n * \"snap_getEntropy\": {}\n * }\n * }\n * ```\n * ```ts name=\"Usage\"\n * const entropy = await snap.request({\n * method: 'snap_getEntropy',\n * params: {\n * version: 1,\n * salt: 'foo', // Optional.\n * },\n * })\n *\n * // '0x...'\n * console.log(entropy)\n * ```\n */\nexport const getEntropyBuilder = Object.freeze({\n targetName,\n specificationBuilder,\n methodHooks,\n actionNames: ['KeyringController:withKeyring'],\n} as const);\n\nexport type GetEntropyHooks = {\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 /**\n * Get the cryptographic functions to use for the client. This may return an\n * empty object or `undefined` to fall back to the default cryptographic\n * functions.\n *\n * @returns The cryptographic functions to use for the client.\n */\n getClientCryptography: () => CryptographicFunctions | undefined;\n};\n\n/**\n * Builds the method implementation for `snap_getEntropy`. The implementation\n * is based on the reference implementation of\n * [SIP-6](https://metamask.github.io/SIPs/SIPS/sip-6).\n *\n * @param options - The options.\n * @param options.messenger - The messenger.\n * @param options.methodHooks - The RPC method hooks.\n * @param options.methodHooks.getUnlockPromise - The method to get a promise that resolves\n * once the extension is unlocked.\n * @param options.methodHooks.getClientCryptography - A function to retrieve the cryptographic\n * functions to use for the client.\n * @returns The method implementation.\n */\nfunction getEntropyImplementation({\n methodHooks: { getUnlockPromise, getClientCryptography },\n messenger,\n}: GetEntropySpecificationBuilderOptions) {\n return async function getEntropy(\n options: RestrictedMethodOptions<GetEntropyParams>,\n ): Promise<GetEntropyResult> {\n const {\n params,\n context: { origin },\n } = options;\n\n assertStruct(\n params,\n GetEntropyArgsStruct,\n 'Invalid \"snap_getEntropy\" parameters',\n rpcErrors.invalidParams,\n );\n\n await getUnlockPromise(true);\n\n const seed = await getValueFromEntropySource(\n getMnemonicSeed.bind(null, messenger),\n params.source,\n );\n\n return deriveEntropyFromSeed({\n input: origin,\n salt: params.salt,\n seed,\n magic: SIP_6_MAGIC_VALUE,\n cryptographicFunctions: getClientCryptography(),\n });\n };\n}\n"]}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import type { CryptographicFunctions } from "@metamask/key-tree";
|
|
2
|
+
import type { Messenger } from "@metamask/messenger";
|
|
2
3
|
import type { PermissionSpecificationBuilder, RestrictedMethodOptions } from "@metamask/permission-controller";
|
|
3
4
|
import { PermissionType } from "@metamask/permission-controller";
|
|
4
5
|
import type { GetEntropyParams, GetEntropyResult } from "@metamask/snaps-sdk";
|
|
5
6
|
import type { Infer } from "@metamask/superstruct";
|
|
6
7
|
import type { NonEmptyArray } from "@metamask/utils";
|
|
8
|
+
import type { KeyringControllerWithKeyringAction } from "../types.cjs";
|
|
7
9
|
import type { MethodHooksObject } from "../utils.cjs";
|
|
8
10
|
declare const targetName = "snap_getEntropy";
|
|
11
|
+
export type GetEntropyMessengerActions = KeyringControllerWithKeyringAction;
|
|
9
12
|
type GetEntropySpecificationBuilderOptions = {
|
|
10
13
|
allowedCaveats?: Readonly<NonEmptyArray<string>> | null;
|
|
11
14
|
methodHooks: GetEntropyHooks;
|
|
15
|
+
messenger: Messenger<string, GetEntropyMessengerActions>;
|
|
12
16
|
};
|
|
13
17
|
export declare const GetEntropyArgsStruct: import("@metamask/superstruct").Struct<{
|
|
14
18
|
version: 1;
|
|
@@ -70,17 +74,9 @@ export declare const getEntropyBuilder: Readonly<{
|
|
|
70
74
|
allowedCaveats: Readonly<NonEmptyArray<string>> | null;
|
|
71
75
|
}>;
|
|
72
76
|
readonly methodHooks: MethodHooksObject<GetEntropyHooks>;
|
|
77
|
+
readonly actionNames: readonly ["KeyringController:withKeyring"];
|
|
73
78
|
}>;
|
|
74
79
|
export type GetEntropyHooks = {
|
|
75
|
-
/**
|
|
76
|
-
* Get the mnemonic seed of the provided source. If no source is provided, the
|
|
77
|
-
* mnemonic seed of the primary keyring will be returned.
|
|
78
|
-
*
|
|
79
|
-
* @param source - The optional ID of the source to get the mnemonic of.
|
|
80
|
-
* @returns The mnemonic seed of the provided source, or the default source if no
|
|
81
|
-
* source is provided.
|
|
82
|
-
*/
|
|
83
|
-
getMnemonicSeed: (source?: string | undefined) => Promise<Uint8Array>;
|
|
84
80
|
/**
|
|
85
81
|
* Waits for the extension to be unlocked.
|
|
86
82
|
*
|
|
@@ -101,15 +97,15 @@ export type GetEntropyHooks = {
|
|
|
101
97
|
* is based on the reference implementation of
|
|
102
98
|
* [SIP-6](https://metamask.github.io/SIPs/SIPS/sip-6).
|
|
103
99
|
*
|
|
104
|
-
* @param
|
|
105
|
-
* @param
|
|
106
|
-
*
|
|
107
|
-
* @param
|
|
100
|
+
* @param options - The options.
|
|
101
|
+
* @param options.messenger - The messenger.
|
|
102
|
+
* @param options.methodHooks - The RPC method hooks.
|
|
103
|
+
* @param options.methodHooks.getUnlockPromise - The method to get a promise that resolves
|
|
108
104
|
* once the extension is unlocked.
|
|
109
|
-
* @param
|
|
105
|
+
* @param options.methodHooks.getClientCryptography - A function to retrieve the cryptographic
|
|
110
106
|
* functions to use for the client.
|
|
111
107
|
* @returns The method implementation.
|
|
112
108
|
*/
|
|
113
|
-
declare function getEntropyImplementation({
|
|
109
|
+
declare function getEntropyImplementation({ methodHooks: { getUnlockPromise, getClientCryptography }, messenger, }: GetEntropySpecificationBuilderOptions): (options: RestrictedMethodOptions<GetEntropyParams>) => Promise<GetEntropyResult>;
|
|
114
110
|
export {};
|
|
115
111
|
//# sourceMappingURL=getEntropy.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getEntropy.d.cts","sourceRoot":"","sources":["../../src/restricted/getEntropy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,2BAA2B;AACjE,OAAO,KAAK,EACV,8BAA8B,EAC9B,uBAAuB,EAExB,wCAAwC;AACzC,OAAO,EAAE,cAAc,EAAe,wCAAwC;AAE9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,4BAA4B;AAE9E,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB;AAGrD,OAAO,KAAK,EAAE,iBAAiB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IAC5B;;;;OAIG;IACH,gBAAgB,EAAE,CAAC,uBAAuB,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtE;;;;;;OAMG;IACH,qBAAqB,EAAE,MAAM,sBAAsB,GAAG,SAAS,CAAC;CACjE,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,iBAAS,wBAAwB,CAAC,EAChC,WAAW,EAAE,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,EACxD,SAAS,GACV,EAAE,qCAAqC,aAE3B,wBAAwB,gBAAgB,CAAC,KACjD,QAAQ,gBAAgB,CAAC,CA4B7B"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import type { CryptographicFunctions } from "@metamask/key-tree";
|
|
2
|
+
import type { Messenger } from "@metamask/messenger";
|
|
2
3
|
import type { PermissionSpecificationBuilder, RestrictedMethodOptions } from "@metamask/permission-controller";
|
|
3
4
|
import { PermissionType } from "@metamask/permission-controller";
|
|
4
5
|
import type { GetEntropyParams, GetEntropyResult } from "@metamask/snaps-sdk";
|
|
5
6
|
import type { Infer } from "@metamask/superstruct";
|
|
6
7
|
import type { NonEmptyArray } from "@metamask/utils";
|
|
8
|
+
import type { KeyringControllerWithKeyringAction } from "../types.mjs";
|
|
7
9
|
import type { MethodHooksObject } from "../utils.mjs";
|
|
8
10
|
declare const targetName = "snap_getEntropy";
|
|
11
|
+
export type GetEntropyMessengerActions = KeyringControllerWithKeyringAction;
|
|
9
12
|
type GetEntropySpecificationBuilderOptions = {
|
|
10
13
|
allowedCaveats?: Readonly<NonEmptyArray<string>> | null;
|
|
11
14
|
methodHooks: GetEntropyHooks;
|
|
15
|
+
messenger: Messenger<string, GetEntropyMessengerActions>;
|
|
12
16
|
};
|
|
13
17
|
export declare const GetEntropyArgsStruct: import("@metamask/superstruct").Struct<{
|
|
14
18
|
version: 1;
|
|
@@ -70,17 +74,9 @@ export declare const getEntropyBuilder: Readonly<{
|
|
|
70
74
|
allowedCaveats: Readonly<NonEmptyArray<string>> | null;
|
|
71
75
|
}>;
|
|
72
76
|
readonly methodHooks: MethodHooksObject<GetEntropyHooks>;
|
|
77
|
+
readonly actionNames: readonly ["KeyringController:withKeyring"];
|
|
73
78
|
}>;
|
|
74
79
|
export type GetEntropyHooks = {
|
|
75
|
-
/**
|
|
76
|
-
* Get the mnemonic seed of the provided source. If no source is provided, the
|
|
77
|
-
* mnemonic seed of the primary keyring will be returned.
|
|
78
|
-
*
|
|
79
|
-
* @param source - The optional ID of the source to get the mnemonic of.
|
|
80
|
-
* @returns The mnemonic seed of the provided source, or the default source if no
|
|
81
|
-
* source is provided.
|
|
82
|
-
*/
|
|
83
|
-
getMnemonicSeed: (source?: string | undefined) => Promise<Uint8Array>;
|
|
84
80
|
/**
|
|
85
81
|
* Waits for the extension to be unlocked.
|
|
86
82
|
*
|
|
@@ -101,15 +97,15 @@ export type GetEntropyHooks = {
|
|
|
101
97
|
* is based on the reference implementation of
|
|
102
98
|
* [SIP-6](https://metamask.github.io/SIPs/SIPS/sip-6).
|
|
103
99
|
*
|
|
104
|
-
* @param
|
|
105
|
-
* @param
|
|
106
|
-
*
|
|
107
|
-
* @param
|
|
100
|
+
* @param options - The options.
|
|
101
|
+
* @param options.messenger - The messenger.
|
|
102
|
+
* @param options.methodHooks - The RPC method hooks.
|
|
103
|
+
* @param options.methodHooks.getUnlockPromise - The method to get a promise that resolves
|
|
108
104
|
* once the extension is unlocked.
|
|
109
|
-
* @param
|
|
105
|
+
* @param options.methodHooks.getClientCryptography - A function to retrieve the cryptographic
|
|
110
106
|
* functions to use for the client.
|
|
111
107
|
* @returns The method implementation.
|
|
112
108
|
*/
|
|
113
|
-
declare function getEntropyImplementation({
|
|
109
|
+
declare function getEntropyImplementation({ methodHooks: { getUnlockPromise, getClientCryptography }, messenger, }: GetEntropySpecificationBuilderOptions): (options: RestrictedMethodOptions<GetEntropyParams>) => Promise<GetEntropyResult>;
|
|
114
110
|
export {};
|
|
115
111
|
//# sourceMappingURL=getEntropy.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getEntropy.d.mts","sourceRoot":"","sources":["../../src/restricted/getEntropy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,2BAA2B;AACjE,OAAO,KAAK,EACV,8BAA8B,EAC9B,uBAAuB,EAExB,wCAAwC;AACzC,OAAO,EAAE,cAAc,EAAe,wCAAwC;AAE9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,4BAA4B;AAE9E,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB;AAGrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAiB;
|
|
1
|
+
{"version":3,"file":"getEntropy.d.mts","sourceRoot":"","sources":["../../src/restricted/getEntropy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,2BAA2B;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AACrD,OAAO,KAAK,EACV,8BAA8B,EAC9B,uBAAuB,EAExB,wCAAwC;AACzC,OAAO,EAAE,cAAc,EAAe,wCAAwC;AAE9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,4BAA4B;AAE9E,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB;AAGrD,OAAO,KAAK,EAAE,kCAAkC,EAAE,qBAAiB;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAiB;AAOlD,QAAA,MAAM,UAAU,oBAAoB,CAAC;AAErC,MAAM,MAAM,0BAA0B,GAAG,kCAAkC,CAAC;AAE5E,KAAK,qCAAqC,GAAG;IAC3C,cAAc,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC;IACxD,WAAW,EAAE,eAAe,CAAC;IAC7B,SAAS,EAAE,SAAS,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAC;CAC1D,CAAC;AASF,eAAO,MAAM,oBAAoB;;;;;;;;EAI/B,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAyBhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,iBAAiB;;;wBA9EZ,eAAe,gBAAgB;oBACnC,iBAAiB;8BACP,WAAW,+BAA+B,CAAC;wBACjD,SAAS,cAAc,MAAM,CAAC,CAAC,GAAG,IAAI;;;;EAgF7C,CAAC;AAEZ,MAAM,MAAM,eAAe,GAAG;IAC5B;;;;OAIG;IACH,gBAAgB,EAAE,CAAC,uBAAuB,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtE;;;;;;OAMG;IACH,qBAAqB,EAAE,MAAM,sBAAsB,GAAG,SAAS,CAAC;CACjE,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,iBAAS,wBAAwB,CAAC,EAChC,WAAW,EAAE,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,EACxD,SAAS,GACV,EAAE,qCAAqC,aAE3B,wBAAwB,gBAAgB,CAAC,KACjD,QAAQ,gBAAgB,CAAC,CA4B7B"}
|
|
@@ -3,24 +3,23 @@ import { rpcErrors } from "@metamask/rpc-errors";
|
|
|
3
3
|
import { SIP_6_MAGIC_VALUE } from "@metamask/snaps-utils";
|
|
4
4
|
import { literal, object, optional, string } from "@metamask/superstruct";
|
|
5
5
|
import { assertStruct } from "@metamask/utils";
|
|
6
|
-
import {
|
|
6
|
+
import { deriveEntropyFromSeed, getMnemonicSeed, getValueFromEntropySource } from "../utils.mjs";
|
|
7
7
|
const targetName = 'snap_getEntropy';
|
|
8
8
|
export const GetEntropyArgsStruct = object({
|
|
9
9
|
version: literal(1),
|
|
10
10
|
salt: optional(string()),
|
|
11
11
|
source: optional(string()),
|
|
12
12
|
});
|
|
13
|
-
const specificationBuilder = ({ allowedCaveats = null, methodHooks, }) => {
|
|
13
|
+
const specificationBuilder = ({ allowedCaveats = null, methodHooks, messenger, }) => {
|
|
14
14
|
return {
|
|
15
15
|
permissionType: PermissionType.RestrictedMethod,
|
|
16
16
|
targetName,
|
|
17
17
|
allowedCaveats,
|
|
18
|
-
methodImplementation: getEntropyImplementation(methodHooks),
|
|
18
|
+
methodImplementation: getEntropyImplementation({ methodHooks, messenger }),
|
|
19
19
|
subjectTypes: [SubjectType.Snap],
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
const methodHooks = {
|
|
23
|
-
getMnemonicSeed: true,
|
|
24
23
|
getUnlockPromise: true,
|
|
25
24
|
getClientCryptography: true,
|
|
26
25
|
};
|
|
@@ -63,27 +62,28 @@ export const getEntropyBuilder = Object.freeze({
|
|
|
63
62
|
targetName,
|
|
64
63
|
specificationBuilder,
|
|
65
64
|
methodHooks,
|
|
65
|
+
actionNames: ['KeyringController:withKeyring'],
|
|
66
66
|
});
|
|
67
67
|
/**
|
|
68
68
|
* Builds the method implementation for `snap_getEntropy`. The implementation
|
|
69
69
|
* is based on the reference implementation of
|
|
70
70
|
* [SIP-6](https://metamask.github.io/SIPs/SIPS/sip-6).
|
|
71
71
|
*
|
|
72
|
-
* @param
|
|
73
|
-
* @param
|
|
74
|
-
*
|
|
75
|
-
* @param
|
|
72
|
+
* @param options - The options.
|
|
73
|
+
* @param options.messenger - The messenger.
|
|
74
|
+
* @param options.methodHooks - The RPC method hooks.
|
|
75
|
+
* @param options.methodHooks.getUnlockPromise - The method to get a promise that resolves
|
|
76
76
|
* once the extension is unlocked.
|
|
77
|
-
* @param
|
|
77
|
+
* @param options.methodHooks.getClientCryptography - A function to retrieve the cryptographic
|
|
78
78
|
* functions to use for the client.
|
|
79
79
|
* @returns The method implementation.
|
|
80
80
|
*/
|
|
81
|
-
function getEntropyImplementation({
|
|
81
|
+
function getEntropyImplementation({ methodHooks: { getUnlockPromise, getClientCryptography }, messenger, }) {
|
|
82
82
|
return async function getEntropy(options) {
|
|
83
83
|
const { params, context: { origin }, } = options;
|
|
84
84
|
assertStruct(params, GetEntropyArgsStruct, 'Invalid "snap_getEntropy" parameters', rpcErrors.invalidParams);
|
|
85
85
|
await getUnlockPromise(true);
|
|
86
|
-
const seed = await getValueFromEntropySource(getMnemonicSeed, params.source);
|
|
86
|
+
const seed = await getValueFromEntropySource(getMnemonicSeed.bind(null, messenger), params.source);
|
|
87
87
|
return deriveEntropyFromSeed({
|
|
88
88
|
input: origin,
|
|
89
89
|
salt: params.salt,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getEntropy.mjs","sourceRoot":"","sources":["../../src/restricted/getEntropy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getEntropy.mjs","sourceRoot":"","sources":["../../src/restricted/getEntropy.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,wCAAwC;AAC9E,OAAO,EAAE,SAAS,EAAE,6BAA6B;AAEjD,OAAO,EAAE,iBAAiB,EAAE,8BAA8B;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,8BAA8B;AAE1E,OAAO,EAAE,YAAY,EAAE,wBAAwB;AAI/C,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,yBAAyB,EAC1B,qBAAiB;AAElB,MAAM,UAAU,GAAG,iBAAiB,CAAC;AAiBrC,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;IACzC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACnB,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IACxB,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;CAC3B,CAAC,CAAC;AAUH,MAAM,oBAAoB,GAItB,CAAC,EACH,cAAc,GAAG,IAAI,EACrB,WAAW,EACX,SAAS,GAC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;IACL,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { CryptographicFunctions } from '@metamask/key-tree';\nimport type { Messenger } from '@metamask/messenger';\nimport type {\n PermissionSpecificationBuilder,\n RestrictedMethodOptions,\n ValidPermissionSpecification,\n} from '@metamask/permission-controller';\nimport { PermissionType, SubjectType } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type { GetEntropyParams, GetEntropyResult } from '@metamask/snaps-sdk';\nimport { SIP_6_MAGIC_VALUE } from '@metamask/snaps-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { literal, object, optional, string } from '@metamask/superstruct';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assertStruct } from '@metamask/utils';\n\nimport type { KeyringControllerWithKeyringAction } from '../types';\nimport type { MethodHooksObject } from '../utils';\nimport {\n deriveEntropyFromSeed,\n getMnemonicSeed,\n getValueFromEntropySource,\n} from '../utils';\n\nconst targetName = 'snap_getEntropy';\n\nexport type GetEntropyMessengerActions = KeyringControllerWithKeyringAction;\n\ntype GetEntropySpecificationBuilderOptions = {\n allowedCaveats?: Readonly<NonEmptyArray<string>> | null;\n methodHooks: GetEntropyHooks;\n messenger: Messenger<string, GetEntropyMessengerActions>;\n};\n\ntype GetEntropySpecification = ValidPermissionSpecification<{\n permissionType: PermissionType.RestrictedMethod;\n targetName: typeof targetName;\n methodImplementation: ReturnType<typeof getEntropyImplementation>;\n allowedCaveats: Readonly<NonEmptyArray<string>> | null;\n}>;\n\nexport const GetEntropyArgsStruct = object({\n version: literal(1),\n salt: optional(string()),\n source: optional(string()),\n});\n\n/**\n * @property version - The version of the `snap_getEntropy` method. This must be\n * the numeric literal `1`.\n * @property salt - A string to use as the salt when deriving the entropy. If\n * omitted, the salt will be an empty string.\n */\nexport type GetEntropyArgs = Infer<typeof GetEntropyArgsStruct>;\n\nconst specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.RestrictedMethod,\n GetEntropySpecificationBuilderOptions,\n GetEntropySpecification\n> = ({\n allowedCaveats = null,\n methodHooks,\n messenger,\n}: GetEntropySpecificationBuilderOptions) => {\n return {\n permissionType: PermissionType.RestrictedMethod,\n targetName,\n allowedCaveats,\n methodImplementation: getEntropyImplementation({ methodHooks, messenger }),\n subjectTypes: [SubjectType.Snap],\n };\n};\n\nconst methodHooks: MethodHooksObject<GetEntropyHooks> = {\n getUnlockPromise: true,\n getClientCryptography: true,\n};\n\n/**\n * Get a deterministic 256-bit entropy value, specific to the Snap and the\n * user's account. You can use this entropy to generate a private key, or any\n * other value that requires a high level of randomness. Other Snaps can't\n * access this entropy, and it changes if the user's secret recovery phrase\n * changes.\n *\n * You can optionally specify a salt to generate different entropy for different\n * purposes. Using a salt results in entropy unrelated to the entropy generated\n * without a salt.\n *\n * This value is deterministic: it's always the same for the same Snap, user\n * account, and salt.\n *\n * @example\n * ```json name=\"Manifest\"\n * {\n * \"initialPermissions\": {\n * \"snap_getEntropy\": {}\n * }\n * }\n * ```\n * ```ts name=\"Usage\"\n * const entropy = await snap.request({\n * method: 'snap_getEntropy',\n * params: {\n * version: 1,\n * salt: 'foo', // Optional.\n * },\n * })\n *\n * // '0x...'\n * console.log(entropy)\n * ```\n */\nexport const getEntropyBuilder = Object.freeze({\n targetName,\n specificationBuilder,\n methodHooks,\n actionNames: ['KeyringController:withKeyring'],\n} as const);\n\nexport type GetEntropyHooks = {\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 /**\n * Get the cryptographic functions to use for the client. This may return an\n * empty object or `undefined` to fall back to the default cryptographic\n * functions.\n *\n * @returns The cryptographic functions to use for the client.\n */\n getClientCryptography: () => CryptographicFunctions | undefined;\n};\n\n/**\n * Builds the method implementation for `snap_getEntropy`. The implementation\n * is based on the reference implementation of\n * [SIP-6](https://metamask.github.io/SIPs/SIPS/sip-6).\n *\n * @param options - The options.\n * @param options.messenger - The messenger.\n * @param options.methodHooks - The RPC method hooks.\n * @param options.methodHooks.getUnlockPromise - The method to get a promise that resolves\n * once the extension is unlocked.\n * @param options.methodHooks.getClientCryptography - A function to retrieve the cryptographic\n * functions to use for the client.\n * @returns The method implementation.\n */\nfunction getEntropyImplementation({\n methodHooks: { getUnlockPromise, getClientCryptography },\n messenger,\n}: GetEntropySpecificationBuilderOptions) {\n return async function getEntropy(\n options: RestrictedMethodOptions<GetEntropyParams>,\n ): Promise<GetEntropyResult> {\n const {\n params,\n context: { origin },\n } = options;\n\n assertStruct(\n params,\n GetEntropyArgsStruct,\n 'Invalid \"snap_getEntropy\" parameters',\n rpcErrors.invalidParams,\n );\n\n await getUnlockPromise(true);\n\n const seed = await getValueFromEntropySource(\n getMnemonicSeed.bind(null, messenger),\n params.source,\n );\n\n return deriveEntropyFromSeed({\n input: origin,\n salt: params.salt,\n seed,\n magic: SIP_6_MAGIC_VALUE,\n cryptographicFunctions: getClientCryptography(),\n });\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/restricted/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/restricted/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAQA,yCAAyC;AAKzC,2DAA2D;AAK3D,+DAA+D;AAK/D,2DAA2D;AAE3D,iDAAiD;AAEjD,+CAA+C;AAE/C,yDAAyD;AAEzD,iDAAiD;AAEjD,yDAAyD;AAKzD,mDAAmD;AAEnD,yCAAyC;AAGzC,+CAA0D;AAAjD,wHAAA,0BAA0B,OAAA;AACnC,iDAAqD;AAA5C,mHAAA,oBAAoB,OAAA;AAsChB,QAAA,kCAAkC,GAG3C;IACF,CAAC,sBAAa,CAAC,UAAU,CAAC,EAAE,sBAAa;IACzC,CAAC,wCAAsB,CAAC,UAAU,CAAC,EAAE,wCAAsB;IAC3D,CAAC,4CAAwB,CAAC,UAAU,CAAC,EAAE,4CAAwB;IAC/D,CAAC,wCAAsB,CAAC,UAAU,CAAC,EAAE,wCAAsB;IAC3D,CAAC,8BAAiB,CAAC,UAAU,CAAC,EAAE,8BAAiB;IACjD,CAAC,8BAAiB,CAAC,UAAU,CAAC,EAAE,8BAAiB;IACjD,CAAC,gCAAkB,CAAC,UAAU,CAAC,EAAE,gCAAkB;IACnD,CAAC,sBAAa,CAAC,UAAU,CAAC,EAAE,sBAAa;IACzC,CAAC,sCAAqB,CAAC,UAAU,CAAC,EAAE,sCAAqB;IACzD,CAAC,4BAAgB,CAAC,UAAU,CAAC,EAAE,4BAAgB;IAC/C,CAAC,sCAAqB,CAAC,UAAU,CAAC,EAAE,sCAAqB;CACjD,CAAC;AAEX,sDAA0B;AAE1B,uCAAiD;AAAxC,+GAAA,qBAAqB,OAAA","sourcesContent":["import type { Messenger } from '@metamask/messenger';\nimport type {\n PermissionSpecificationBuilder,\n PermissionType,\n RestrictedMethodSpecificationConstraint,\n} from '@metamask/permission-controller';\n\nimport type { DialogMessengerActions } from './dialog';\nimport { dialogBuilder } from './dialog';\nimport type {\n GetBip32EntropyMessengerActions,\n GetBip32EntropyMethodHooks,\n} from './getBip32Entropy';\nimport { getBip32EntropyBuilder } from './getBip32Entropy';\nimport type {\n GetBip32PublicKeyMessengerActions,\n GetBip32PublicKeyMethodHooks,\n} from './getBip32PublicKey';\nimport { getBip32PublicKeyBuilder } from './getBip32PublicKey';\nimport type {\n GetBip44EntropyMessengerActions,\n GetBip44EntropyMethodHooks,\n} from './getBip44Entropy';\nimport { getBip44EntropyBuilder } from './getBip44Entropy';\nimport type { GetEntropyHooks, GetEntropyMessengerActions } from './getEntropy';\nimport { getEntropyBuilder } from './getEntropy';\nimport type { GetLocaleMethodHooks } from './getLocale';\nimport { getLocaleBuilder } from './getLocale';\nimport type { GetPreferencesMethodHooks } from './getPreferences';\nimport { getPreferencesBuilder } from './getPreferences';\nimport type { InvokeSnapMessengerActions } from './invokeSnap';\nimport { invokeSnapBuilder } from './invokeSnap';\nimport type { ManageAccountsMethodHooks } from './manageAccounts';\nimport { manageAccountsBuilder } from './manageAccounts';\nimport type {\n ManageStateMessengerActions,\n ManageStateMethodHooks,\n} from './manageState';\nimport { manageStateBuilder } from './manageState';\nimport type { NotifyMessengerActions, NotifyMethodHooks } from './notify';\nimport { notifyBuilder } from './notify';\nimport type { MethodHooksObject } from '../utils';\n\nexport { WALLET_SNAP_PERMISSION_KEY } from './invokeSnap';\nexport { getEncryptionEntropy } from './manageState';\n\nexport type RestrictedMethodActions =\n | DialogMessengerActions\n | GetBip32EntropyMessengerActions\n | GetBip32PublicKeyMessengerActions\n | GetBip44EntropyMessengerActions\n | GetEntropyMessengerActions\n | InvokeSnapMessengerActions\n | ManageStateMessengerActions\n | NotifyMessengerActions;\n\nexport type RestrictedMethodMessenger = Messenger<\n string,\n RestrictedMethodActions\n>;\n\nexport type RestrictedMethodHooks = GetBip32EntropyMethodHooks &\n GetBip32PublicKeyMethodHooks &\n GetBip44EntropyMethodHooks &\n GetEntropyHooks &\n ManageStateMethodHooks &\n NotifyMethodHooks &\n ManageAccountsMethodHooks &\n GetLocaleMethodHooks &\n GetPreferencesMethodHooks;\n\ntype RestrictedMethodPermissionBuilder = {\n targetName: string;\n specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.RestrictedMethod,\n any,\n RestrictedMethodSpecificationConstraint\n >;\n actionNames?: readonly RestrictedMethodActions['type'][];\n methodHooks?: MethodHooksObject<Record<string, unknown>>;\n};\n\nexport const restrictedMethodPermissionBuilders: Record<\n string,\n RestrictedMethodPermissionBuilder\n> = {\n [dialogBuilder.targetName]: dialogBuilder,\n [getBip32EntropyBuilder.targetName]: getBip32EntropyBuilder,\n [getBip32PublicKeyBuilder.targetName]: getBip32PublicKeyBuilder,\n [getBip44EntropyBuilder.targetName]: getBip44EntropyBuilder,\n [getEntropyBuilder.targetName]: getEntropyBuilder,\n [invokeSnapBuilder.targetName]: invokeSnapBuilder,\n [manageStateBuilder.targetName]: manageStateBuilder,\n [notifyBuilder.targetName]: notifyBuilder,\n [manageAccountsBuilder.targetName]: manageAccountsBuilder,\n [getLocaleBuilder.targetName]: getLocaleBuilder,\n [getPreferencesBuilder.targetName]: getPreferencesBuilder,\n} as const;\n\nexport * from './caveats';\nexport type { DialogApprovalTypes } from './dialog';\nexport { DIALOG_APPROVAL_TYPES } from './dialog';\n"]}
|
|
@@ -1,169 +1,29 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
1
|
+
import type { Messenger } from "@metamask/messenger";
|
|
2
|
+
import type { PermissionSpecificationBuilder, PermissionType, RestrictedMethodSpecificationConstraint } from "@metamask/permission-controller";
|
|
3
|
+
import type { DialogMessengerActions } from "./dialog.cjs";
|
|
4
|
+
import type { GetBip32EntropyMessengerActions, GetBip32EntropyMethodHooks } from "./getBip32Entropy.cjs";
|
|
5
|
+
import type { GetBip32PublicKeyMessengerActions, GetBip32PublicKeyMethodHooks } from "./getBip32PublicKey.cjs";
|
|
6
|
+
import type { GetBip44EntropyMessengerActions, GetBip44EntropyMethodHooks } from "./getBip44Entropy.cjs";
|
|
7
|
+
import type { GetEntropyHooks, GetEntropyMessengerActions } from "./getEntropy.cjs";
|
|
6
8
|
import type { GetLocaleMethodHooks } from "./getLocale.cjs";
|
|
7
9
|
import type { GetPreferencesMethodHooks } from "./getPreferences.cjs";
|
|
8
|
-
import type {
|
|
10
|
+
import type { InvokeSnapMessengerActions } from "./invokeSnap.cjs";
|
|
9
11
|
import type { ManageAccountsMethodHooks } from "./manageAccounts.cjs";
|
|
10
|
-
import type { ManageStateMethodHooks } from "./manageState.cjs";
|
|
11
|
-
import type { NotifyMethodHooks } from "./notify.cjs";
|
|
12
|
+
import type { ManageStateMessengerActions, ManageStateMethodHooks } from "./manageState.cjs";
|
|
13
|
+
import type { NotifyMessengerActions, NotifyMethodHooks } from "./notify.cjs";
|
|
14
|
+
import type { MethodHooksObject } from "../utils.cjs";
|
|
12
15
|
export { WALLET_SNAP_PERMISSION_KEY } from "./invokeSnap.cjs";
|
|
13
16
|
export { getEncryptionEntropy } from "./manageState.cjs";
|
|
14
|
-
export type
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
|
|
23
|
-
targetName: "snap_dialog";
|
|
24
|
-
methodImplementation: (args: import("@metamask/permission-controller").RestrictedMethodOptions<import("@metamask/snaps-sdk").DialogParams>) => Promise<import("@metamask/utils").Json>;
|
|
25
|
-
allowedCaveats: readonly [string, ...string[]] | null;
|
|
26
|
-
}>;
|
|
27
|
-
readonly methodHooks: import("../utils.cjs").MethodHooksObject<DialogMethodHooks>;
|
|
28
|
-
}>;
|
|
29
|
-
readonly snap_getBip32Entropy: Readonly<{
|
|
30
|
-
readonly targetName: "snap_getBip32Entropy";
|
|
31
|
-
readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.RestrictedMethod, {
|
|
32
|
-
methodHooks: GetBip32EntropyMethodHooks;
|
|
33
|
-
}, {
|
|
34
|
-
permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
|
|
35
|
-
targetName: "snap_getBip32Entropy";
|
|
36
|
-
methodImplementation: (args: import("@metamask/permission-controller").RestrictedMethodOptions<import("@metamask/snaps-sdk").GetBip32EntropyParams>) => Promise<import("@metamask/key-tree").JsonSLIP10Node>;
|
|
37
|
-
allowedCaveats: readonly [string, ...string[]] | null;
|
|
38
|
-
validator: import("@metamask/permission-controller").PermissionValidatorConstraint;
|
|
39
|
-
}>;
|
|
40
|
-
readonly methodHooks: import("../utils.cjs").MethodHooksObject<GetBip32EntropyMethodHooks>;
|
|
41
|
-
}>;
|
|
42
|
-
readonly snap_getBip32PublicKey: Readonly<{
|
|
43
|
-
readonly targetName: "snap_getBip32PublicKey";
|
|
44
|
-
readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.RestrictedMethod, {
|
|
45
|
-
methodHooks: GetBip32PublicKeyMethodHooks;
|
|
46
|
-
}, {
|
|
47
|
-
permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
|
|
48
|
-
targetName: "snap_getBip32PublicKey";
|
|
49
|
-
methodImplementation: (args: import("@metamask/permission-controller").RestrictedMethodOptions<import("@metamask/snaps-sdk").GetBip32PublicKeyParams>) => Promise<string>;
|
|
50
|
-
allowedCaveats: readonly [string, ...string[]] | null;
|
|
51
|
-
validator: import("@metamask/permission-controller").PermissionValidatorConstraint;
|
|
52
|
-
}>;
|
|
53
|
-
readonly methodHooks: import("../utils.cjs").MethodHooksObject<GetBip32PublicKeyMethodHooks>;
|
|
54
|
-
}>;
|
|
55
|
-
readonly snap_getBip44Entropy: Readonly<{
|
|
56
|
-
readonly targetName: "snap_getBip44Entropy";
|
|
57
|
-
readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.RestrictedMethod, {
|
|
58
|
-
methodHooks: GetBip44EntropyMethodHooks;
|
|
59
|
-
}, {
|
|
60
|
-
permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
|
|
61
|
-
targetName: "snap_getBip44Entropy";
|
|
62
|
-
methodImplementation: (args: import("@metamask/permission-controller").RestrictedMethodOptions<import("@metamask/snaps-sdk").GetBip44EntropyParams>) => Promise<import("@metamask/key-tree").JsonBIP44CoinTypeNode>;
|
|
63
|
-
allowedCaveats: readonly [string, ...string[]] | null;
|
|
64
|
-
validator: import("@metamask/permission-controller").PermissionValidatorConstraint;
|
|
65
|
-
}>;
|
|
66
|
-
readonly methodHooks: import("../utils.cjs").MethodHooksObject<GetBip44EntropyMethodHooks>;
|
|
67
|
-
}>;
|
|
68
|
-
readonly snap_getEntropy: Readonly<{
|
|
69
|
-
readonly targetName: "snap_getEntropy";
|
|
70
|
-
readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.RestrictedMethod, {
|
|
71
|
-
allowedCaveats?: readonly [string, ...string[]] | null | undefined;
|
|
72
|
-
methodHooks: GetEntropyHooks;
|
|
73
|
-
}, {
|
|
74
|
-
permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
|
|
75
|
-
targetName: "snap_getEntropy";
|
|
76
|
-
methodImplementation: (options: import("@metamask/permission-controller").RestrictedMethodOptions<import("@metamask/snaps-sdk").GetEntropyParams>) => Promise<`0x${string}`>;
|
|
77
|
-
allowedCaveats: readonly [string, ...string[]] | null;
|
|
78
|
-
}>;
|
|
79
|
-
readonly methodHooks: import("../utils.cjs").MethodHooksObject<GetEntropyHooks>;
|
|
80
|
-
}>;
|
|
81
|
-
readonly wallet_snap: Readonly<{
|
|
82
|
-
readonly targetName: "wallet_snap";
|
|
83
|
-
readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.RestrictedMethod, {
|
|
84
|
-
allowedCaveats?: readonly [string, ...string[]] | null | undefined;
|
|
85
|
-
methodHooks: InvokeSnapMethodHooks;
|
|
86
|
-
}, {
|
|
87
|
-
permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
|
|
88
|
-
targetName: "wallet_snap";
|
|
89
|
-
methodImplementation: (options: import("@metamask/permission-controller").RestrictedMethodOptions<import("@metamask/snaps-sdk").InvokeSnapParams>) => Promise<import("@metamask/utils").Json>;
|
|
90
|
-
allowedCaveats: readonly [string, ...string[]] | null;
|
|
91
|
-
validator: import("@metamask/permission-controller").PermissionValidatorConstraint;
|
|
92
|
-
sideEffect: {
|
|
93
|
-
onPermitted: import("@metamask/permission-controller").SideEffectHandler<import("./invokeSnap.cjs").SnapControllerInstallSnapsAction | import("./invokeSnap.cjs").SnapControllerGetPermittedSnapsAction, never>;
|
|
94
|
-
};
|
|
95
|
-
}>;
|
|
96
|
-
readonly methodHooks: import("../utils.cjs").MethodHooksObject<InvokeSnapMethodHooks>;
|
|
97
|
-
}>;
|
|
98
|
-
readonly snap_manageState: Readonly<{
|
|
99
|
-
readonly targetName: "snap_manageState";
|
|
100
|
-
readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.RestrictedMethod, {
|
|
101
|
-
allowedCaveats?: readonly [string, ...string[]] | null | undefined;
|
|
102
|
-
methodHooks: ManageStateMethodHooks;
|
|
103
|
-
}, {
|
|
104
|
-
permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
|
|
105
|
-
targetName: "snap_manageState";
|
|
106
|
-
methodImplementation: (options: import("@metamask/permission-controller").RestrictedMethodOptions<import("@metamask/snaps-sdk").ManageStateParams>) => Promise<import("@metamask/snaps-sdk").ManageStateResult>;
|
|
107
|
-
allowedCaveats: readonly [string, ...string[]] | null;
|
|
108
|
-
}>;
|
|
109
|
-
readonly methodHooks: import("../utils.cjs").MethodHooksObject<ManageStateMethodHooks>;
|
|
110
|
-
}>;
|
|
111
|
-
readonly snap_notify: Readonly<{
|
|
112
|
-
readonly targetName: "snap_notify";
|
|
113
|
-
readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.RestrictedMethod, {
|
|
114
|
-
allowedCaveats?: readonly [string, ...string[]] | null | undefined;
|
|
115
|
-
methodHooks: NotifyMethodHooks;
|
|
116
|
-
}, {
|
|
117
|
-
permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
|
|
118
|
-
targetName: "snap_notify";
|
|
119
|
-
methodImplementation: (args: import("@metamask/permission-controller").RestrictedMethodOptions<import("@metamask/snaps-sdk").NotifyParams>) => Promise<null>;
|
|
120
|
-
allowedCaveats: readonly [string, ...string[]] | null;
|
|
121
|
-
}>;
|
|
122
|
-
readonly methodHooks: import("../utils.cjs").MethodHooksObject<NotifyMethodHooks>;
|
|
123
|
-
}>;
|
|
124
|
-
readonly snap_manageAccounts: Readonly<{
|
|
125
|
-
readonly targetName: "snap_manageAccounts";
|
|
126
|
-
readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.RestrictedMethod, {
|
|
127
|
-
allowedCaveats?: readonly [string, ...string[]] | null | undefined;
|
|
128
|
-
methodHooks: ManageAccountsMethodHooks;
|
|
129
|
-
}, {
|
|
130
|
-
permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
|
|
131
|
-
targetName: "snap_manageAccounts";
|
|
132
|
-
methodImplementation: (options: import("@metamask/permission-controller").RestrictedMethodOptions<import("@metamask/snaps-sdk").ManageAccountsParams>) => Promise<import("@metamask/utils").Json>;
|
|
133
|
-
allowedCaveats: readonly [string, ...string[]] | null;
|
|
134
|
-
}>;
|
|
135
|
-
readonly methodHooks: {
|
|
136
|
-
readonly getSnapKeyring: true;
|
|
137
|
-
readonly getUnlockPromise: true;
|
|
138
|
-
};
|
|
139
|
-
}>;
|
|
140
|
-
readonly snap_getLocale: Readonly<{
|
|
141
|
-
readonly targetName: "snap_getLocale";
|
|
142
|
-
readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.RestrictedMethod, {
|
|
143
|
-
allowedCaveats?: readonly [string, ...string[]] | null | undefined;
|
|
144
|
-
methodHooks: GetLocaleMethodHooks;
|
|
145
|
-
}, {
|
|
146
|
-
permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
|
|
147
|
-
targetName: "snap_getLocale";
|
|
148
|
-
methodImplementation: (_args: import("@metamask/permission-controller").RestrictedMethodOptions<import("@metamask/permission-controller").RestrictedMethodParameters>) => Promise<string>;
|
|
149
|
-
allowedCaveats: readonly [string, ...string[]] | null;
|
|
150
|
-
}>;
|
|
151
|
-
readonly methodHooks: import("../utils.cjs").MethodHooksObject<GetLocaleMethodHooks>;
|
|
152
|
-
}>;
|
|
153
|
-
readonly snap_getPreferences: Readonly<{
|
|
154
|
-
readonly targetName: "snap_getPreferences";
|
|
155
|
-
readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.RestrictedMethod, {
|
|
156
|
-
allowedCaveats?: readonly [string, ...string[]] | null | undefined;
|
|
157
|
-
methodHooks: GetPreferencesMethodHooks;
|
|
158
|
-
}, {
|
|
159
|
-
permissionType: import("@metamask/permission-controller").PermissionType.RestrictedMethod;
|
|
160
|
-
targetName: "snap_getPreferences";
|
|
161
|
-
methodImplementation: (_args: import("@metamask/permission-controller").RestrictedMethodOptions<import("@metamask/permission-controller").RestrictedMethodParameters>) => Promise<import("@metamask/snaps-sdk").GetPreferencesResult>;
|
|
162
|
-
allowedCaveats: readonly [string, ...string[]] | null;
|
|
163
|
-
}>;
|
|
164
|
-
readonly methodHooks: import("../utils.cjs").MethodHooksObject<GetPreferencesMethodHooks>;
|
|
165
|
-
}>;
|
|
17
|
+
export type RestrictedMethodActions = DialogMessengerActions | GetBip32EntropyMessengerActions | GetBip32PublicKeyMessengerActions | GetBip44EntropyMessengerActions | GetEntropyMessengerActions | InvokeSnapMessengerActions | ManageStateMessengerActions | NotifyMessengerActions;
|
|
18
|
+
export type RestrictedMethodMessenger = Messenger<string, RestrictedMethodActions>;
|
|
19
|
+
export type RestrictedMethodHooks = GetBip32EntropyMethodHooks & GetBip32PublicKeyMethodHooks & GetBip44EntropyMethodHooks & GetEntropyHooks & ManageStateMethodHooks & NotifyMethodHooks & ManageAccountsMethodHooks & GetLocaleMethodHooks & GetPreferencesMethodHooks;
|
|
20
|
+
type RestrictedMethodPermissionBuilder = {
|
|
21
|
+
targetName: string;
|
|
22
|
+
specificationBuilder: PermissionSpecificationBuilder<PermissionType.RestrictedMethod, any, RestrictedMethodSpecificationConstraint>;
|
|
23
|
+
actionNames?: readonly RestrictedMethodActions['type'][];
|
|
24
|
+
methodHooks?: MethodHooksObject<Record<string, unknown>>;
|
|
166
25
|
};
|
|
26
|
+
export declare const restrictedMethodPermissionBuilders: Record<string, RestrictedMethodPermissionBuilder>;
|
|
167
27
|
export * from "./caveats/index.cjs";
|
|
168
28
|
export type { DialogApprovalTypes } from "./dialog.cjs";
|
|
169
29
|
export { DIALOG_APPROVAL_TYPES } from "./dialog.cjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/restricted/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/restricted/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AACrD,OAAO,KAAK,EACV,8BAA8B,EAC9B,cAAc,EACd,uCAAuC,EACxC,wCAAwC;AAEzC,OAAO,KAAK,EAAE,sBAAsB,EAAE,qBAAiB;AAEvD,OAAO,KAAK,EACV,+BAA+B,EAC/B,0BAA0B,EAC3B,8BAA0B;AAE3B,OAAO,KAAK,EACV,iCAAiC,EACjC,4BAA4B,EAC7B,gCAA4B;AAE7B,OAAO,KAAK,EACV,+BAA+B,EAC/B,0BAA0B,EAC3B,8BAA0B;AAE3B,OAAO,KAAK,EAAE,eAAe,EAAE,0BAA0B,EAAE,yBAAqB;AAEhF,OAAO,KAAK,EAAE,oBAAoB,EAAE,wBAAoB;AAExD,OAAO,KAAK,EAAE,yBAAyB,EAAE,6BAAyB;AAElE,OAAO,KAAK,EAAE,0BAA0B,EAAE,yBAAqB;AAE/D,OAAO,KAAK,EAAE,yBAAyB,EAAE,6BAAyB;AAElE,OAAO,KAAK,EACV,2BAA2B,EAC3B,sBAAsB,EACvB,0BAAsB;AAEvB,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,qBAAiB;AAE1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAiB;AAElD,OAAO,EAAE,0BAA0B,EAAE,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