Skip to content

Commit

Permalink
Update signer deps (#1727)
Browse files Browse the repository at this point in the history
* update signer dependencies to support new signers

* update type definition

* update parcel

* update browserslist

* bump version

* update zod

* update babel

* update trezor

* npm audit fix

* fix compilation issues

* more ledger updates

* update restore

* update restore

* update gridplus, electron builder

* more audit fixes

* update workflow versions

* fix Lattice signing

* fix parse import
mholtzman authored Jan 16, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent cb8a8f3 commit 24382d6
Showing 9 changed files with 12,376 additions and 13,618 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: read version from package.json
id: package-version
uses: martinbeentjes/npm-get-version-action@master
@@ -56,8 +56,8 @@ jobs:
APPLE_ID_PASSWORD: ${{ secrets[matrix.apple_app_specific_password_key] }}

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.12.1
cache: 'npm'
4 changes: 2 additions & 2 deletions .github/workflows/compile-and-test.yml
Original file line number Diff line number Diff line change
@@ -13,8 +13,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.12.1
- name: Electronegativity
4 changes: 2 additions & 2 deletions main/dapps/server/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import http from 'http'
import { parse } from 'cookie'
import { URL } from 'url'
import cookie from 'cookie'
import { hash } from 'eth-ens-namehash'

import store from '../../store'
@@ -12,7 +12,7 @@ const server = http.createServer((req, res) => {
const url = new URL(req.url || '', `http://${req.headers.host}`)
const ens = url.hostname.replace('.localhost', '')
const namehash = hash(ens)
const session = req.headers.cookie ? cookie.parse(req.headers.cookie).__frameSession : ''
const session = (req.headers.cookie && parse(req.headers.cookie).__frameSession) || ''

// check if dapp is added before progressing
if (!store('main.dapps', namehash)) {
2 changes: 1 addition & 1 deletion main/signatures/index.ts
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import signatureTypes from './types'
import { SignTypedDataVersion, MessageTypeProperty } from '@metamask/eth-sig-util'

import type { TypedMessage, TypedSignatureRequestType } from '../accounts/types'
import type { EIP712MessageDomain } from '@ledgerhq/hw-app-eth/lib/modules/EIP712/EIP712.types'
import type { EIP712MessageDomain } from '@ledgerhq/types-live'

const matchesMsgType = (properties: MessageTypeProperty[], required: MessageTypeProperty[]) =>
properties.length === required.length &&
13 changes: 9 additions & 4 deletions main/signers/lattice/Lattice/index.ts
Original file line number Diff line number Diff line change
@@ -33,6 +33,9 @@ type LatticeResponseError = {
errorMessage: string
}

type SigningPayload = Parameters<InstanceType<typeof Client>['sign']>[0]['data']
type SignProtocol = 'eip712' | 'signPersonal'

export const Status = {
OK: 'ok',
CONNECTING: 'connecting',
@@ -324,17 +327,19 @@ export default class Lattice extends Signer {
}
}

private async sign(index: number, protocol: string, payload: string | TypedData) {
private async sign(index: number, protocol: SignProtocol, payload: string | TypedData) {
const connection = this.connection as Client

const data = {
protocol,
payload,
curveType: Constants.SIGNING.CURVES.SECP256K1,
hashType: Constants.SIGNING.HASHES.KECCAK256,
signerPath: this.getPath(index)
}
} as SigningPayload

const signOpts = {
currency: 'ETH_MSG',
currency: 'ETH_MSG' as const,
data: data
}

@@ -401,7 +406,7 @@ export default class Lattice extends Signer {
return { data, currency: unsignedTx.currency }
}

return { currency: 'ETH', data: unsignedTx }
return { currency: 'ETH' as const, data: unsignedTx }
}

private getPath(index: number) {
4 changes: 2 additions & 2 deletions main/signers/trezor/adapter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import log from 'electron-log'

import type { Device as TrezorDevice } from '@trezor/connect'
import type { DeviceUniquePath, Device as TrezorDevice } from '@trezor/connect'

import { SignerAdapter } from '../adapters'
import Trezor, { Status } from './Trezor'
@@ -221,7 +221,7 @@ export default class TrezorSignerAdapter extends SignerAdapter {
} else {
// this Trezor is not open because it was never connected,
// attempt to force a reload by calling this method
TrezorBridge.getFeatures({ device: { path: trezor.path } })
TrezorBridge.getFeatures({ device: { path: trezor.path as DeviceUniquePath } })
}
}

Loading

0 comments on commit 24382d6

Please sign in to comment.