Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

An example Metamask Snap that manages user passwords

Notifications You must be signed in to change notification settings

ritave/snap-passwordManager

Repository files navigation

Password Manager snap

This is an example Metamask Snap that allows the user to manage their passwords for websites and store them securely in Metamask.

Example.mov

How This Works

This Snap uses the entropy for Garlicoin to encrypt the user's passwords. It requests the following permissions:

"initialPermissions": {
  "snap_confirm": {},
  "snap_manageState": {},
  "snap_getBip44Entropy_69420": {}
},

* 69420 is the chain ID for Garlicoin.

It then uses @MetaMask/browser-passworder to encrypt the full state with the encryption key being the Bip44 entropy derived by MetaMask.

import * as passworder from '@metamask/browser-passworder';

const entropy = await wallet.request({
  method: 'snap_getBip44Entropy_69420',
});

const newState = {
  [website]: { username, password },
};

const encryptedState = {
  passwords: await passworder.encrypt(entropy.key, newState),
};

wallet.request({
  method: 'snap_manageState',
  params: ['update', encryptedState],
});

It also has some extra features like using async-mutex for async-safe state management and fuzzy searching for retrieving specific passwords. Follow the steps below to run this snap locally and see how it works.

Setup

yarn install
yarn build
yarn serve

Testing and Linting

Run yarn test to run the tests once.

Run yarn lint to run the linter, or run yarn lint:fix to run the linter and fix any automatically fixable issues.

About

An example Metamask Snap that manages user passwords

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published