Skip to main content
  • Snap
  • Restricted

snap_getBip32PublicKey

Description

Gets the BIP-32 public key for the derivation path specified by the path parameter. Note that this returns the public key, not the extended public key (xpub), or Ethereum address.

Parameters

curve

"ed25519" | "ed25519Bip32" | "secp256k1"required

The curve to use for the derived key. This must be a curve supported by @metamask/key-tree.

path

string[]required

The derivation path to use for the derived key, represented as an array of path segments. For example, the path m/44'/1'/0'/0/0 would be represented as ['m', "44'", "1'", "0'", '0', '0'].

compressed

boolean | null

Whether to return the compressed public key. Defaults to false.

source

string | null

The ID of the entropy source to use. If not specified, the primary entropy source will be used. For a list of available entropy sources, see the snap_listEntropySources method.

Returns

string

The public key as hexadecimal string. May be compressed or uncompressed depending on the compressed parameter provided in the request parameters.

Example

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