@metamask/signature-insights-example-snap

1.0.3 • Public • Published

@metamask/signature-insights-example-snap

This snap demonstrates how to use the endowment:signature-insight permission to provide signature insights to the user. This snap uses the onSignature handler to provide insights for signature requests presented to the user.

Signature insights are displayed in the signature confirmation screen, and can show any Snaps-based UI components.

Snap manifest

Note: Using onSignature requires the endowment:signature-insight permissions. Refer to the documentation for more information.

Along with other permissions, the manifest of this snap includes the endowment:signature-insight permission:

{
  "initialPermissions": {
    "endowment:signature-insight": {}
  }
}

By default, the onSignature handler does not receive the signature origin. If you want to receive the origin, you can add the allowSignatureOrigin property to the permission definition:

{
  "initialPermissions": {
    "endowment:signature-insight": {
      "allowSignatureOrigin": true
    }
  }
}

Snap usage

This snap exposes an onSignature handler, which is called when a signature is presented to the user. The handler receives the signature payload and the signature origin (if the allowSignatureOrigin property is set to true).

The snap decodes the signature data and returns the decoded data as the signature insight.

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

Readme

Keywords

none

Package Sidebar

Install

npm i @metamask/signature-insights-example-snap

Weekly Downloads

4,214

Version

1.0.3

License

(MIT-0 OR Apache-2.0)

Unpacked Size

29.8 kB

Total Files

7

Last publish

Collaborators

  • mcmire
  • nicholasellul
  • naugtur
  • ritave
  • danfinlay
  • kumavis
  • rekmarks
  • metamaskbot
  • gudahtt
  • sethkfman