New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@keystonehq/metamask-airgapped-keyring

Package Overview
Dependencies
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@keystonehq/metamask-airgapped-keyring - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9-alpha.0

7

dist/metamask-airgapped-keyring.cjs.development.js

@@ -123,3 +123,2 @@ 'use strict';

super(opts);
this.indexedAccounts = {};

@@ -158,3 +157,2 @@ this.getInteraction = () => {

this.unlockedAccount = 0;
this.indexedAccounts = {};
};

@@ -180,2 +178,3 @@

const to = from + n;
const newAccounts = [];

@@ -185,8 +184,8 @@ for (let i = from; i < to; i++) {

newAccounts.push(address);
this.page = 0;
this.latestAccount++;
this.indexedAccounts[i] = address;
}
this.accounts = Object.values(this.indexedAccounts);
this.accounts = this.accounts.concat(newAccounts);
resolve(this.accounts);

@@ -193,0 +192,0 @@ } catch (e) {

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@keystonehq/base-eth-keyring"),s=require("events"),n=require("@metamask/obs-store"),i=require("@keystonehq/bc-ur-registry-eth"),r=require("uuid"),c=require("@ethereumjs/tx"),o=(e=require("rlp"))&&"object"==typeof e&&"default"in e?e.default:e;class a extends s.EventEmitter{constructor(){if(super(),this.readCryptoHDKey=()=>new Promise((e,t)=>{this.memStore.updateState({sync:{reading:!0}}),this.on("keystone-sync_success",t=>{const s=i.CryptoHDKey.fromCBOR(Buffer.from(t,"hex"));this.resetState(),e(s)}),this.on("keystone-sync_cancel",()=>{this.resetState(),t(new Error("KeystoneError#sync_cancel. Sync process canceled, please retry"))})}),this.submitCryptoHDKey=e=>{this.emit("keystone-sync_success",e)},this.cancelReadCryptoHDKey=()=>{this.emit("keystone-sync_cancel")},this.requestSignature=(e,t,s)=>new Promise((n,c)=>{const o=e.toUR(),a=e.getRequestId(),h=r.stringify(a),u={requestId:h,payload:{type:o.type,cbor:o.cbor.toString("hex")},title:t,description:s};this.memStore.updateState({sign:{request:u}}),this.once(h+"-signed",e=>{const t=i.ETHSignature.fromCBOR(Buffer.from(e,"hex"));this.resetState(),n(t)}),this.once(h+"-canceled",()=>{this.resetState(),c(new Error("KeystoneError#Tx_canceled. Signing canceled, please retry"))})}),this.submitSignature=(e,t)=>{this.emit(e+"-signed",t)},this.cancelRequestSignature=()=>{const e=this.memStore.getState().sign.request;if(e){const{requestId:t}=e;this.memStore.updateState({sign:{}}),this.emit(t+"-canceled")}},this.resetState=()=>{this.memStore.updateState({sync:{reading:!1},sign:{}})},a.instance)return a.instance;this.memStore=new n.ObservableStore({sync:{reading:!1},sign:{},_version:1}),a.instance=this}}class h extends t.BaseKeyring{constructor(e){if(super(e),this.indexedAccounts={},this.getInteraction=()=>new a,this.getMemStore=()=>this.getInteraction().memStore,this.setAccountToUnlock=e=>{this.unlockedAccount=parseInt(e,10)},this.removeAccount=e=>{if(!this.accounts.map(e=>e.toLowerCase()).includes(e.toLowerCase()))throw new Error(`Address ${e} not found in this keyring`);this.accounts=this.accounts.filter(t=>t.toLowerCase()!==e.toLowerCase())},this.forgetDevice=()=>{this.xfp="",this.xpub="",this.hdPath="",this.page=0,this.perPage=5,this.accounts=[],this.currentAccount=0,this.paths={},this.latestAccount=0,this.hdk=void 0,this.unlockedAccount=0,this.indexedAccounts={}},this.submitCryptoHDKey=this.getInteraction().submitCryptoHDKey,this.submitSignature=this.getInteraction().submitSignature,this.cancelReadCryptoHDKey=this.getInteraction().cancelReadCryptoHDKey,this.cancelSignRequest=this.getInteraction().cancelRequestSignature,h.instance)return h.instance.deserialize(e),h.instance;h.instance=this}addAccounts(e=1){return new Promise((t,s)=>{try{const s=this.unlockedAccount,n=s+e;for(let e=s;e<n;e++){const t=this._addressFromIndex("m",e);this.page=0,this.latestAccount++,this.indexedAccounts[e]=t}this.accounts=Object.values(this.indexedAccounts),t(this.accounts)}catch(e){s(e)}})}async signTransaction(e,t){const s=0===t.type?i.DataType.transaction:i.DataType.typedTransaction;let n;n=0===t.type?o.encode(t.getMessageToSign(!1)):t.getMessageToSign(!1);const a=this._pathFromAddress(e),h=t.common.chainId(),u=r.v4(),y=i.EthSignRequest.constructETHRequest(n,s,a,this.xfp,u,h),{r:d,s:g,v:m}=await this.requestSignature(u,y,"Scan with your Keystone",'After your Keystone has signed the transaction, click on "Scan Keystone" to receive the signature'),p=t.toJSON();return p.v=m,p.s=g,p.r=d,p.type=t.type,c.TransactionFactory.fromTxData(p,{common:t.common})}}h.type=t.BaseKeyring.type,exports.MetaMaskKeyring=h;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@keystonehq/base-eth-keyring"),s=require("events"),n=require("@metamask/obs-store"),i=require("@keystonehq/bc-ur-registry-eth"),r=require("uuid"),c=require("@ethereumjs/tx"),o=(e=require("rlp"))&&"object"==typeof e&&"default"in e?e.default:e;class a extends s.EventEmitter{constructor(){if(super(),this.readCryptoHDKey=()=>new Promise((e,t)=>{this.memStore.updateState({sync:{reading:!0}}),this.on("keystone-sync_success",t=>{const s=i.CryptoHDKey.fromCBOR(Buffer.from(t,"hex"));this.resetState(),e(s)}),this.on("keystone-sync_cancel",()=>{this.resetState(),t(new Error("KeystoneError#sync_cancel. Sync process canceled, please retry"))})}),this.submitCryptoHDKey=e=>{this.emit("keystone-sync_success",e)},this.cancelReadCryptoHDKey=()=>{this.emit("keystone-sync_cancel")},this.requestSignature=(e,t,s)=>new Promise((n,c)=>{const o=e.toUR(),a=e.getRequestId(),h=r.stringify(a),u={requestId:h,payload:{type:o.type,cbor:o.cbor.toString("hex")},title:t,description:s};this.memStore.updateState({sign:{request:u}}),this.once(h+"-signed",e=>{const t=i.ETHSignature.fromCBOR(Buffer.from(e,"hex"));this.resetState(),n(t)}),this.once(h+"-canceled",()=>{this.resetState(),c(new Error("KeystoneError#Tx_canceled. Signing canceled, please retry"))})}),this.submitSignature=(e,t)=>{this.emit(e+"-signed",t)},this.cancelRequestSignature=()=>{const e=this.memStore.getState().sign.request;if(e){const{requestId:t}=e;this.memStore.updateState({sign:{}}),this.emit(t+"-canceled")}},this.resetState=()=>{this.memStore.updateState({sync:{reading:!1},sign:{}})},a.instance)return a.instance;this.memStore=new n.ObservableStore({sync:{reading:!1},sign:{},_version:1}),a.instance=this}}class h extends t.BaseKeyring{constructor(e){if(super(e),this.getInteraction=()=>new a,this.getMemStore=()=>this.getInteraction().memStore,this.setAccountToUnlock=e=>{this.unlockedAccount=parseInt(e,10)},this.removeAccount=e=>{if(!this.accounts.map(e=>e.toLowerCase()).includes(e.toLowerCase()))throw new Error(`Address ${e} not found in this keyring`);this.accounts=this.accounts.filter(t=>t.toLowerCase()!==e.toLowerCase())},this.forgetDevice=()=>{this.xfp="",this.xpub="",this.hdPath="",this.page=0,this.perPage=5,this.accounts=[],this.currentAccount=0,this.paths={},this.latestAccount=0,this.hdk=void 0,this.unlockedAccount=0},this.submitCryptoHDKey=this.getInteraction().submitCryptoHDKey,this.submitSignature=this.getInteraction().submitSignature,this.cancelReadCryptoHDKey=this.getInteraction().cancelReadCryptoHDKey,this.cancelSignRequest=this.getInteraction().cancelRequestSignature,h.instance)return h.instance.deserialize(e),h.instance;h.instance=this}addAccounts(e=1){return new Promise((t,s)=>{try{const s=this.unlockedAccount,n=s+e,i=[];for(let e=s;e<n;e++){const t=this._addressFromIndex("m",e);i.push(t),this.page=0,this.latestAccount++}this.accounts=this.accounts.concat(i),t(this.accounts)}catch(e){s(e)}})}async signTransaction(e,t){const s=0===t.type?i.DataType.transaction:i.DataType.typedTransaction;let n;n=0===t.type?o.encode(t.getMessageToSign(!1)):t.getMessageToSign(!1);const a=this._pathFromAddress(e),h=t.common.chainId(),u=r.v4(),y=i.EthSignRequest.constructETHRequest(n,s,a,this.xfp,u,h),{r:d,s:g,v:m}=await this.requestSignature(u,y,"Scan with your Keystone",'After your Keystone has signed the transaction, click on "Scan Keystone" to receive the signature'),p=t.toJSON();return p.v=m,p.s=g,p.r=d,p.type=t.type,c.TransactionFactory.fromTxData(p,{common:t.common})}}h.type=t.BaseKeyring.type,exports.MetaMaskKeyring=h;
//# sourceMappingURL=metamask-airgapped-keyring.cjs.production.min.js.map

@@ -117,3 +117,2 @@ import { BaseKeyring } from '@keystonehq/base-eth-keyring';

super(opts);
this.indexedAccounts = {};

@@ -152,3 +151,2 @@ this.getInteraction = () => {

this.unlockedAccount = 0;
this.indexedAccounts = {};
};

@@ -174,2 +172,3 @@

const to = from + n;
const newAccounts = [];

@@ -179,8 +178,8 @@ for (let i = from; i < to; i++) {

newAccounts.push(address);
this.page = 0;
this.latestAccount++;
this.indexedAccounts[i] = address;
}
this.accounts = Object.values(this.indexedAccounts);
this.accounts = this.accounts.concat(newAccounts);
resolve(this.accounts);

@@ -187,0 +186,0 @@ } catch (e) {

@@ -7,3 +7,2 @@ import { BaseKeyring, StoredKeyring } from '@keystonehq/base-eth-keyring';

private unlockedAccount;
private indexedAccounts;
constructor(opts?: StoredKeyring);

@@ -10,0 +9,0 @@ getInteraction: () => MetamaskInteractionProvider;

{
"name": "@keystonehq/metamask-airgapped-keyring",
"version": "0.0.8",
"version": "0.0.9-alpha.0",
"description": "airgapped eth keyring for metamask",

@@ -30,4 +30,4 @@ "author": "aaronisme <aarondongchen@gmail.com>",

"@ethereumjs/tx": "^3.3.0",
"@keystonehq/base-eth-keyring": "^0.0.8",
"@keystonehq/bc-ur-registry-eth": "^0.6.12",
"@keystonehq/base-eth-keyring": "^0.0.9",
"@keystonehq/bc-ur-registry-eth": "^0.6.13",
"@metamask/obs-store": "^7.0.0",

@@ -44,3 +44,3 @@ "rlp": "^2.2.6",

},
"gitHead": "cdb5ca0fe6826a973dc9c739ab443074d9f62671"
"gitHead": "bde0768b2656f208592e56a8f40120e68ebd38ca"
}
# `metamask-airgapped-keyring`
> TODO: description
## This package is still Working in Progress.
## Usage
This package is the Keystone implementation of `MetaMaskKeyring` which used in MetaMask Extension.
## Install
```bash
yarn add @keystonehq/metamask-airgapped-keyring
```
const metamaskAirgappedKeyring = require('metamask-airgapped-keyring');
// TODO: DEMONSTRATE API
```
```base
npm install --save @keystonehq/metamask-airgapped-keyring
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc