Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ritave/snap-passwordManager
An example Metamask Snap that manages user passwords
https://github.com/ritave/snap-passwordManager
Last synced: about 2 months ago
JSON representation
An example Metamask Snap that manages user passwords
- Host: GitHub
- URL: https://github.com/ritave/snap-passwordManager
- Owner: ritave
- Archived: true
- Created: 2022-04-19T11:53:26.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-01T11:12:49.000Z (almost 2 years ago)
- Last Synced: 2024-08-02T15:04:03.889Z (5 months ago)
- Language: HTML
- Size: 1.16 MB
- Stars: 33
- Watchers: 3
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
- awesome-metamask-snaps - ritave/snap-passwordManager - A secure password manager using encrypted data storage available to Snaps (Snaps)
README
# 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.
https://user-images.githubusercontent.com/1614945/164003634-69949fd6-9946-4550-9aa3-edbbb8b5fb4c.mov
### How This Works
This Snap uses the entropy for [Garlicoin](https://garlicoin.io/) to encrypt the user's passwords. It requests the following permissions:
```JSON
"initialPermissions": {
"snap_confirm": {},
"snap_manageState": {},
"snap_getBip44Entropy_69420": {}
},
```_* 69420 is the chain ID for Garlicoin._
It then uses [@MetaMask/browser-passworder](https://github.com/metamask/browser-passworder) to encrypt the full state with the encryption key being the Bip44 entropy derived by MetaMask.
```Javascript
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](https://www.npmjs.com/package/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
```shell
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.