This snap demonstrates how to use snap_getEntropy
JSON-RPC method to get
entropy from the MetaMask extension, and use it to sign a message.
Note: Using
snap_getEntropy
requires thesnap_getEntropy
permissions. Refer to the documentation for more information.
Along with other permissions, the manifest of this snap includes the
snap_getEntropy
permission:
{
"initialPermissions": {
"snap_getEntropy": {}
}
}
This permission does not require any additional configuration.
This snap exposes an onRpcRequest
handler, which supports the following
JSON-RPC methods:
-
signMessage
: Derives a private key using thesnap_getEntropy
method, and uses it to sign amessage
. For this particular example, we use theBLS12-381
elliptic curve to sign the message.
For more information, you can refer to the end-to-end tests.