LogoLogo
  • Basics
    • Introduction
    • Decentralized Identifiers
    • Veramo
    • Roadmap
    • FAQs
  • Identify Snap
    • Snap Architecture
    • Snap Account
    • Snap RPC APIs
      • Basic APIs
        • hello
      • Snap APIs
        • togglePopups
      • Account APIs
        • getAccountInfo
      • DID APIs
        • getAvailableDIDMethods
        • getCurrentDIDMethod
        • switchMethod
        • resolveDID
      • Verifiable Credentials APIs
        • createVC
        • saveVC
        • getVCs
        • syncGoogleVCs
        • verifyVC
        • removeVC
        • deleteAllVCs
        • createVP
        • verifyVP
      • Google Drive APIs
        • configureGoogleAccount
    • Snap Plugins
    • Snap Permissions
  • Getting Started
    • Introduction
    • Application Setup
    • Hello World
Powered by GitBook
On this page
  • Overview
  • How Identify Snap connects to a Metamask account
  • How Identify Snap connects to a Non-Metamask account

Was this helpful?

Export as PDF
  1. Identify Snap

Snap Account

PreviousSnap ArchitectureNextSnap RPC APIs

Last updated 3 months ago

Was this helpful?

Overview

While MetaMask Snaps can access the currently connected Metamask accounts, they cannot access the private key of these accounts directly. Rather, Identify Snap gets a , specific to the Snap and the currently connected Metamask account and uses it to generate a new private key. Other snaps cannot access this entropy and it changes if the user's secret recovery phrase changes, which means even if the snap creates a new wallet for each Metamask account, users will always be able to access their snap wallet as long as they are connected to that same Metamask account on another browser/device.

In addition, Identify Snap also enables developers and users to access both non-MetaMask accounts (imported using private keys directly) via which is a secure way of transferring data from Metamask to the snap.

In summary, users can connect to Identify Snap using their currently connected MetaMask account or importing the private key directly.

How Identify Snap connects to a Metamask account

The architecture diagram below demonstrates how a new Snap wallet is created for Metamask accounts.

  1. User connects to the Identify Snap using their Metamask account

  2. Snap imports the private key to this Snap wallet to the Snap storage for later use

  3. For example, if your Metamask account is 0x35a0....9898, your Snap account address may be 0xda17....2792. The point is you are not accessing your Metamask account but rather you're accessing a Snap specific account that is associated with your Metamask account

How Identify Snap connects to a Non-Metamask account

The architecture diagram below demonstrates how a new Snap wallet is created for Non-Metamask(External) accounts.

  1. User passes their Account id(eg. 0.0.633893) or EVM address(0xe75e....6B0D) as parameters to the externalAccount params. For example: externalAccount: { accountIdOrEvmAddress: '0.0.633893', curve?: 'ED25519' }

  2. Snap knows that this is a non-metamask account due to the externalAccount params being passed. So, it tries to import the account directly onto Metamask

  3. If this is the first time importing the account, Snap prompts the user to enter the private key to this account via Metamask dialog box. If the account was previously imported, it skips this step.

  4. Once the user enters the private key, Snap imports the private key to this Snap wallet to the Snap storage for later use

  5. For example, if your Non-Metamask account's EVM address is 0xe75e....6B0D, your Snap account address will also be 0xe75e....6B0D. Note that unlike a Metamask account whereby a new Snap wallet is created for each account, if you connect to a non-metamask account, Snap will not generate a new wallet and instead use the same account that was imported.

  6. This feature lets users import their existing wallets such as Hashpack, Blade Wallet, etc directly onto the Snap

Snap gets a , specific to the Snap and the currently connected Metamask account and uses it to generate a Snap wallet

deterministic 256-bit entropy value
deterministic 256-bit entropy value
Snap dialog box