Skip to content

feat: add qr keyring package #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
ccd708e
wip: qr implementation
mikesposito Sep 25, 2024
c6e0836
Merge branch 'main' into add-qr-keyring
mikesposito Feb 12, 2025
922042c
fix account init
mikesposito Mar 19, 2025
810ddbd
Merge branch 'main' into add-qr-keyring
mikesposito Mar 19, 2025
4dcf294
test: add tests for serialize and deserialize
mikesposito Mar 19, 2025
2af99a2
test: add crypto-hd account derivation tests
mikesposito Jun 24, 2025
42e2d44
fix: set `#accountToUnlock` to next index after adding accounts
mikesposito Jun 24, 2025
47add0b
fix: make it compatible with keystone-keyring serialized state
mikesposito Jun 24, 2025
6378b23
fix lint
mikesposito Jun 24, 2025
f1c94c1
fix tests
mikesposito Jun 24, 2025
46df5a1
feat: add `removeAccount`
mikesposito Jun 24, 2025
5782759
fix tsconfig build
mikesposito Jun 24, 2025
5c7227b
fix: accounts and cached indexes are treated separately
mikesposito Jun 25, 2025
a390759
fix: package export config
mikesposito Jun 25, 2025
2217aa2
rename account-deriver to airgapped-signer
mikesposito Jun 25, 2025
065a890
add bridge and missing methods for pairing
mikesposito Jun 25, 2025
18060dc
accept decoded URs as input
mikesposito Jun 25, 2025
6fa15f9
Merge branch 'main' into add-qr-keyring
mikesposito Jun 25, 2025
8a027ff
align dependencies to monorepo and remove unused
mikesposito Jun 25, 2025
bb9b6ba
fix unit tests
mikesposito Jun 25, 2025
ae6ca94
add scan request type argument
mikesposito Jun 26, 2025
33294fd
implement `signTransaction` and `signTypedData`
mikesposito Jun 26, 2025
4de83c0
fix ci
mikesposito Jun 26, 2025
e4f6caa
fix lint
mikesposito Jun 26, 2025
a63b603
add `signPersonalMessage`
mikesposito Jun 26, 2025
56b5f54
fix `sendTransaction`
mikesposito Jun 27, 2025
b36b2f6
move signing logic to `device.ts`
mikesposito Jun 27, 2025
307c0d3
update `yarn.lock`
mikesposito Jun 27, 2025
3eee499
test: add coverage for signing methods
mikesposito Jul 2, 2025
0b3231e
test: add coverage for `CryptoAccount` mode
mikesposito Jul 2, 2025
08b6fa0
test: move fixtures to separate file
mikesposito Jul 2, 2025
2078f0d
refactor: move `Device` initialization to constructor
mikesposito Jul 3, 2025
261268a
remove unused devDependency
mikesposito Jul 3, 2025
f88fa39
refactor: simplify `serialize()`
mikesposito Jul 3, 2025
0e5165f
refactor: `indexFromAddress` and `pathFromAddress`
mikesposito Jul 3, 2025
5ab4c61
set package version to `0.0.0`
mikesposito Jul 3, 2025
2cdc46b
Merge branch 'main' into add-qr-keyring
mikesposito Jul 8, 2025
423f79c
refactor: remove `indexFromAccount`
mikesposito Jul 8, 2025
ebd35b4
fix: compare to `normalizedAddress` in `pathFromAddress`
mikesposito Jul 8, 2025
a9b0f29
fix changelog validate script
mikesposito Jul 8, 2025
36c61e7
feat: add `QrKeyringDeferredPromiseBridge`
mikesposito Jul 15, 2025
b39e51b
fix: add missing export
mikesposito Jul 15, 2025
d2e6996
fix: setAccountToUnlock incremented also if account exists
mikesposito Jul 15, 2025
8e585a0
Merge branch 'main' into add-qr-keyring
mikesposito Jul 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This repository contains the following packages [^fn1]:

- [`@metamask/eth-hd-keyring`](packages/keyring-eth-hd)
- [`@metamask/eth-ledger-bridge-keyring`](packages/keyring-eth-ledger-bridge)
- [`@metamask/eth-qr-keyring`](packages/keyring-eth-qr)
- [`@metamask/eth-simple-keyring`](packages/keyring-eth-simple)
- [`@metamask/eth-snap-keyring`](packages/keyring-snap-bridge)
- [`@metamask/eth-trezor-keyring`](packages/keyring-eth-trezor)
Expand All @@ -37,6 +38,7 @@ linkStyle default opacity:0.5
keyring_api(["@metamask/keyring-api"]);
eth_hd_keyring(["@metamask/eth-hd-keyring"]);
eth_ledger_bridge_keyring(["@metamask/eth-ledger-bridge-keyring"]);
eth_qr_keyring(["@metamask/eth-qr-keyring"]);
eth_simple_keyring(["@metamask/eth-simple-keyring"]);
eth_trezor_keyring(["@metamask/eth-trezor-keyring"]);
keyring_internal_api(["@metamask/keyring-internal-api"]);
Expand All @@ -48,6 +50,7 @@ linkStyle default opacity:0.5
keyring_api --> keyring_utils;
eth_hd_keyring --> keyring_utils;
eth_ledger_bridge_keyring --> keyring_utils;
eth_qr_keyring --> keyring_utils;
eth_simple_keyring --> keyring_utils;
eth_trezor_keyring --> keyring_utils;
keyring_internal_api --> keyring_api;
Expand Down
10 changes: 10 additions & 0 deletions packages/keyring-eth-qr/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

[Unreleased]: https://github.com/MetaMask/accounts/
15 changes: 15 additions & 0 deletions packages/keyring-eth-qr/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ISC License

Copyright (c) 2020 MetaMask

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1 change: 1 addition & 0 deletions packages/keyring-eth-qr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# QR Keyring
29 changes: 29 additions & 0 deletions packages/keyring-eth-qr/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* For a detailed explanation regarding each configuration property and type check, visit:
* https://jestjs.io/docs/configuration
*/

const merge = require('deepmerge');
const path = require('path');

const baseConfig = require('../../jest.config.packages');

const displayName = path.basename(__dirname);

module.exports = merge(baseConfig, {
// The display name when running multiple projects
displayName,

// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: [],

// An object that configures minimum threshold enforcement for coverage results
coverageThreshold: {
global: {
branches: 96.66,
functions: 100,
lines: 98.99,
statements: 99.01,
},
},
});
96 changes: 96 additions & 0 deletions packages/keyring-eth-qr/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"name": "@metamask/eth-qr-keyring",
"version": "0.0.0",
"description": "A simple standard interface for a series of Ethereum private keys.",
"keywords": [
"ethereum",
"keyring",
"qr",
"metamask"
],
"homepage": "https://github.com/MetaMask/accounts/packages/keyring-eth-qr#readme",
"bugs": {
"url": "https://github.com/MetaMask/accounts/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/MetaMask/accounts.git"
},
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
}
},
"main": "./dist/index.cjs",
"types": "./dist/index.d.cts",
"files": [
"dist/"
],
"scripts": {
"build": "tsc --build tsconfig.build.json",
"build:clean": "rimraf dist && yarn build",
"build:docs": "typedoc",
"build:force": "tsc --build tsconfig.build.json --force",
"changelog:update": "../../scripts/update-changelog.sh @metamask/eth-simple-keyring",
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/eth-simple-keyring",
"publish:preview": "yarn npm publish --tag preview",
"sample": "ts-node src/sample.ts",
"test": "jest",
"test:clean": "jest --clearCache",
"test:verbose": "jest --verbose",
"test:watch": "jest --watch"
},
"dependencies": {
"@ethereumjs/rlp": "^5.0.2",
"@ethereumjs/tx": "^5.4.0",
"@ethereumjs/util": "^9.1.0",
"@keystonehq/bc-ur-registry-eth": "^0.19.1",
"@metamask/eth-sig-util": "^8.2.0",
"@metamask/keyring-utils": "workspace:^",
"@metamask/utils": "^11.1.0",
"hdkey": "^2.1.0",
"uuid": "^9.0.1"
},
"devDependencies": {
"@ethereumjs/common": "^4.4.0",
"@keystonehq/metamask-airgapped-keyring": "^0.15.2",
"@lavamoat/allow-scripts": "^3.2.1",
"@metamask/auto-changelog": "^3.4.4",
"@types/hdkey": "^2.0.1",
"@types/jest": "^29.5.12",
"@types/node": "^20.12.12",
"deepmerge": "^4.2.2",
"depcheck": "^1.4.7",
"jest": "^29.5.0",
"ts-jest": "^29.0.5",
"ts-node": "^10.9.2",
"typedoc": "^0.25.13",
"typescript": "~5.6.3"
},
"engines": {
"node": "^18.18 || >=20"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"lavamoat": {
"allowScripts": {
"keccak": true,
"secp256k1": true,
"@lavamoat/preinstall-always-fail": false,
"ethereumjs-tx>ethereumjs-util>ethereum-cryptography>keccak": false,
"ethereumjs-tx>ethereumjs-util>ethereum-cryptography>secp256k1": false,
"@keystonehq/ur-decoder>@keystonehq/bc-ur-registry-eth>ethereumjs-util>ethereum-cryptography>keccak": false,
"@lavamoat/allow-scripts>@lavamoat/preinstall-always-fail": false,
"hdkey>secp256k1": false
}
}
}
Loading
Loading