Skip to content
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

feat: Enable Ledger clear signing feature #28909

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
14 changes: 8 additions & 6 deletions app/scripts/lib/offscreen-bridge/ledger-offscreen-bridge.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { LedgerBridge } from '@metamask/eth-ledger-bridge-keyring';
import {
LedgerBridge,
LedgerSignTypedDataParams,
LedgerSignTypedDataResponse,
} from '@metamask/eth-ledger-bridge-keyring';
import {
LedgerAction,
OffscreenCommunicationEvents,
Expand Down Expand Up @@ -161,11 +165,9 @@ export class LedgerOffscreenBridge
});
}

deviceSignTypedData(params: {
hdPath: string;
domainSeparatorHex: string;
hashStructMessageHex: string;
}) {
deviceSignTypedData(
params: LedgerSignTypedDataParams,
): Promise<LedgerSignTypedDataResponse> {
return new Promise<{
v: number;
s: string;
Expand Down
29 changes: 28 additions & 1 deletion lavamoat/browserify/beta/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,8 @@
"@ethereumjs/tx>@ethereumjs/util": true,
"@metamask/eth-ledger-bridge-keyring>@ethereumjs/rlp": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth": true,
"@metamask/eth-sig-util": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>@ledgerhq/types-live": true,
"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util": true,
"@metamask/eth-trezor-keyring>hdkey": true,
"browserify>buffer": true,
"webpack>events": true
Expand Down Expand Up @@ -1001,6 +1002,32 @@
"define": true
}
},
"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util": {
"packages": {
"@ethereumjs/tx>@ethereumjs/util": true,
"@ethereumjs/tx>ethereum-cryptography": true,
"@metamask/abi-utils": true,
"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/utils": true,
"@metamask/eth-sig-util>tweetnacl": true,
"@metamask/utils>@scure/base": true,
"browserify>buffer": true
}
},
"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/utils>@metamask/superstruct": true,
"@metamask/utils>@scure/base": true,
"@metamask/utils>pony-cause": true,
"@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
}
},
"@metamask/eth-query": {
"packages": {
"@metamask/eth-query>json-rpc-random-id": true,
Expand Down
29 changes: 28 additions & 1 deletion lavamoat/browserify/flask/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,8 @@
"@ethereumjs/tx>@ethereumjs/util": true,
"@metamask/eth-ledger-bridge-keyring>@ethereumjs/rlp": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth": true,
"@metamask/eth-sig-util": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>@ledgerhq/types-live": true,
"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util": true,
"@metamask/eth-trezor-keyring>hdkey": true,
"browserify>buffer": true,
"webpack>events": true
Expand Down Expand Up @@ -1001,6 +1002,32 @@
"define": true
}
},
"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util": {
"packages": {
"@ethereumjs/tx>@ethereumjs/util": true,
"@ethereumjs/tx>ethereum-cryptography": true,
"@metamask/abi-utils": true,
"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/utils": true,
"@metamask/eth-sig-util>tweetnacl": true,
"@metamask/utils>@scure/base": true,
"browserify>buffer": true
}
},
"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/utils>@metamask/superstruct": true,
"@metamask/utils>@scure/base": true,
"@metamask/utils>pony-cause": true,
"@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
}
},
"@metamask/eth-query": {
"packages": {
"@metamask/eth-query>json-rpc-random-id": true,
Expand Down
29 changes: 28 additions & 1 deletion lavamoat/browserify/main/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,8 @@
"@ethereumjs/tx>@ethereumjs/util": true,
"@metamask/eth-ledger-bridge-keyring>@ethereumjs/rlp": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth": true,
"@metamask/eth-sig-util": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>@ledgerhq/types-live": true,
"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util": true,
"@metamask/eth-trezor-keyring>hdkey": true,
"browserify>buffer": true,
"webpack>events": true
Expand Down Expand Up @@ -1001,6 +1002,32 @@
"define": true
}
},
"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util": {
"packages": {
"@ethereumjs/tx>@ethereumjs/util": true,
"@ethereumjs/tx>ethereum-cryptography": true,
"@metamask/abi-utils": true,
"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/utils": true,
"@metamask/eth-sig-util>tweetnacl": true,
"@metamask/utils>@scure/base": true,
"browserify>buffer": true
}
},
"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/utils>@metamask/superstruct": true,
"@metamask/utils>@scure/base": true,
"@metamask/utils>pony-cause": true,
"@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
}
},
"@metamask/eth-query": {
"packages": {
"@metamask/eth-query>json-rpc-random-id": true,
Expand Down
29 changes: 28 additions & 1 deletion lavamoat/browserify/mmi/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,8 @@
"@ethereumjs/tx>@ethereumjs/util": true,
"@metamask/eth-ledger-bridge-keyring>@ethereumjs/rlp": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth": true,
"@metamask/eth-sig-util": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>@ledgerhq/types-live": true,
"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util": true,
"@metamask/eth-trezor-keyring>hdkey": true,
"browserify>buffer": true,
"webpack>events": true
Expand Down Expand Up @@ -1093,6 +1094,32 @@
"define": true
}
},
"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util": {
"packages": {
"@ethereumjs/tx>@ethereumjs/util": true,
"@ethereumjs/tx>ethereum-cryptography": true,
"@metamask/abi-utils": true,
"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/utils": true,
"@metamask/eth-sig-util>tweetnacl": true,
"@metamask/utils>@scure/base": true,
"browserify>buffer": true
}
},
"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/utils>@metamask/superstruct": true,
"@metamask/utils>@scure/base": true,
"@metamask/utils>pony-cause": true,
"@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
}
},
"@metamask/eth-query": {
"packages": {
"@metamask/eth-query>json-rpc-random-id": true,
Expand Down
2 changes: 1 addition & 1 deletion offscreen/scripts/ledger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function setupMessageListeners(iframe: HTMLIFrameElement) {
export default async function init() {
return new Promise<void>((resolve) => {
const iframe = document.createElement('iframe');
iframe.src = 'https://metamask.github.io/eth-ledger-bridge-keyring';
iframe.src = 'https://metamask.github.io/ledger-iframe-bridge/8.0.0/';
iframe.allow = 'hid';
iframe.onload = () => {
setupMessageListeners(iframe);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@
"@metamask/ens-resolver-snap": "^0.1.2",
"@metamask/eth-json-rpc-filters": "^9.0.0",
"@metamask/eth-json-rpc-middleware": "^15.0.0",
"@metamask/eth-ledger-bridge-keyring": "^5.0.1",
"@metamask/eth-ledger-bridge-keyring": "^8.0.0",
"@metamask/eth-query": "^4.0.0",
"@metamask/eth-sig-util": "^7.0.1",
"@metamask/eth-snap-keyring": "^5.0.1",
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5298,17 +5298,17 @@ __metadata:
languageName: node
linkType: hard

"@metamask/eth-ledger-bridge-keyring@npm:^5.0.1":
version: 5.0.1
resolution: "@metamask/eth-ledger-bridge-keyring@npm:5.0.1"
"@metamask/eth-ledger-bridge-keyring@npm:^8.0.0":
version: 8.0.1
resolution: "@metamask/eth-ledger-bridge-keyring@npm:8.0.1"
dependencies:
"@ethereumjs/rlp": "npm:^5.0.2"
"@ethereumjs/tx": "npm:^4.2.0"
"@ethereumjs/util": "npm:^8.1.0"
"@ledgerhq/hw-app-eth": "npm:^6.39.0"
"@metamask/eth-sig-util": "npm:^7.0.3"
"@metamask/eth-sig-util": "npm:^8.0.0"
hdkey: "npm:^2.1.0"
checksum: 10/5ac967d7c88c2f1f2853118cfe65ee081a90c2633fb468eae8049c3a78a4985f03130bff3071e9fb893e4c97bc55aeb2196e2b6e9e363ac6235379b80e7cfc7e
checksum: 10/1fe3782ab224cd55e825c41226451ec52141b12387e23a49f9786b4d1edbb1e16be02e13ec07ed26547c8d9651a9951060b72432d8adefd7975d3a313d701f2f
languageName: node
linkType: hard

Expand Down Expand Up @@ -26546,7 +26546,7 @@ __metadata:
"@metamask/eth-json-rpc-filters": "npm:^9.0.0"
"@metamask/eth-json-rpc-middleware": "npm:^15.0.0"
"@metamask/eth-json-rpc-provider": "npm:^4.1.6"
"@metamask/eth-ledger-bridge-keyring": "npm:^5.0.1"
"@metamask/eth-ledger-bridge-keyring": "npm:^8.0.0"
"@metamask/eth-query": "npm:^4.0.0"
"@metamask/eth-sig-util": "npm:^7.0.1"
"@metamask/eth-snap-keyring": "npm:^5.0.1"
Expand Down
Loading