Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
Remove remaining Trezor references
Browse files Browse the repository at this point in the history
  • Loading branch information
abandeali1 committed Aug 24, 2018
1 parent a27112c commit 0629a7d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 23 deletions.
13 changes: 1 addition & 12 deletions packages/order-utils/src/signature_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export const signatureUtils = {
/**
* Combines the signature proof and the Signature Type.
* @param signature The hex encoded signature proof
* @param signatureType The signature type, i.e EthSign, Trezor, Wallet etc.
* @param signatureType The signature type, i.e EthSign, Wallet etc.
* @return Hex encoded string of signature proof with Signature Type
*/
convertToSignatureWithType(signature: string, signatureType: SignatureType): string {
Expand All @@ -318,12 +318,6 @@ export const signatureUtils = {
const prefixedMsgHex = ethUtil.bufferToHex(prefixedMsgBuff);
return prefixedMsgHex;
}
case SignerType.Trezor: {
const msgBuff = ethUtil.toBuffer(message);
const prefixedMsgBuff = hashTrezorPersonalMessage(msgBuff);
const prefixedMsgHex = ethUtil.bufferToHex(prefixedMsgBuff);
return prefixedMsgHex;
}
default:
throw new Error(`Unrecognized SignerType: ${signerType}`);
}
Expand All @@ -346,11 +340,6 @@ export const signatureUtils = {
},
};

function hashTrezorPersonalMessage(message: Buffer): Buffer {
const prefix = ethUtil.toBuffer(`\x19Ethereum Signed Message:\n${message.byteLength}`);
return ethUtil.sha3(Buffer.concat([prefix, message]));
}

function parseValidatorSignature(signature: string): ValidatorSignature {
assert.isOneOfExpectedSignatureTypes(signature, [SignatureType.Validator]);
// tslint:disable:custom-no-magic-numbers
Expand Down
9 changes: 0 additions & 9 deletions packages/order-utils/test/signature_utils_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,6 @@ describe('Signature utils', () => {
r: '0xaca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d64393',
s: '0x46b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf2',
};
it('should concatenate v,r,s and append the Trezor signature type', async () => {
const expectedSignatureWithSignatureType =
'0x1baca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf208';
const signatureWithSignatureType = signatureUtils.convertECSignatureToSignatureHex(
ecSignature,
SignerType.Trezor,
);
expect(signatureWithSignatureType).to.equal(expectedSignatureWithSignatureType);
});
it('should concatenate v,r,s and append the EthSign signature type when SignerType is Default', async () => {
const expectedSignatureWithSignatureType =
'0x1baca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf203';
Expand Down
3 changes: 1 addition & 2 deletions packages/types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,13 @@ export enum SignatureType {
}

/**
* The type of the Signer implementation. Some signer implementations use different message prefixes (e.g Trezor) or implement different
* The type of the Signer implementation. Some signer implementations use different message prefixes or implement different
* eth_sign behaviour (e.g Metamask). Default assumes a spec compliant `eth_sign`.
*/
export enum SignerType {
Default = 'DEFAULT',
Ledger = 'LEDGER',
Metamask = 'METAMASK',
Trezor = 'TREZOR',
}

export enum AssetProxyId {
Expand Down

0 comments on commit 0629a7d

Please sign in to comment.