Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@metamask/bip32-example-snap

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metamask/bip32-example-snap

MetaMask example snap demonstrating the use of `snap_getBip32Entropy`.

  • 2.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
26K
increased by46.54%
Maintainers
0
Weekly downloads
 
Created
Source

@metamask/bip32-example-snap

This snap demonstrates the use of snap_getBip32Entropy and snap_getBip32PublicKey to derive a BIP-32 public key and private key from the user's secret recovery phrase.

Snap manifest

Note: Using snap_getBip32Entropy and snap_getBip32PublicKey requires their respective snap_getBip32Entropy and snap_getBip32PublicKey permissions. Refer to the documentation for more information.

Along with other permissions, the manifest of this snap includes the snap_getBip32Entropy and snap_getBip32PublicKey permissions:

{
  "initialPermissions": {
    "snap_getBip32Entropy": [
      {
        "path": ["m", "44'", "0'"],
        "curve": "secp256k1"
      },
      {
        "path": ["m", "44'", "0'"],
        "curve": "ed25519"
      }
    ],
    "snap_getBip32PublicKey": [
      {
        "path": ["m", "44'", "0'"],
        "curve": "secp256k1"
      }
    ]
  }
}

Each of the items in the snap_getBip32Entropy and snap_getBip32PublicKey permissions is an object with the following properties:

  • path: The BIP-32 derivation path to use.
  • curve: The elliptic curve to use. These methods support secp256k1 and ed25519.

Snap usage

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

  • getPublicKey: Get the public key for the given path and curve.
  • signMessage: Sign a message with the private key for the given path and curve. The message is signed with the chosen curve's signing algorithm (ECDSA for secp256k1 and EdDSA for ed25519).

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

FAQs

Package last updated on 11 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc