JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 30476
  • Score
    100M100P100Q154107F
  • License (MIT-0 OR Apache-2.0)

MetaMask example snap demonstrating the use of `snap_getBip44Entropy`

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@metamask/bip44-example-snap) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    @metamask/bip44-example-snap

    This snap demonstrates the use of snap_getBip44Entropy to derive a BIP-44 private key from the user's secret recovery phrase.

    Snap manifest

    Note: Using snap_getBip44Entropy requires the snap_getBip44Entropy permissions. Refer to the documentation for more information.

    Along with other permissions, the manifest of this snap includes the snap_getBip44Entropy permission:

    {
      "initialPermissions": {
        "snap_getBip44Entropy": [
          {
            "coinType": 1
          },
          {
            "coinType": 3
          }
        ]
      }
    }

    Each of the coin types in the initialPermissions.snap_getBip44Entropy array represents a BIP-44 coin type. The coin types in the array above represent Bitcoin and Dogecoin, respectively. All coin types can be found in the SLIP-44 registry here.

    Snap usage

    This snap exposes an onRpcRequest handler, which supports the following JSON-RPC methods:

    • getPublicKey: Get the public key for the given coinType and addressIndex.
    • signMessage: Sign a message with the private key for the given coinType and addressIndex. For this particular example, we use the BLS12-381 elliptic curve to sign the message.

    For more information, you can refer to the end-to-end tests.