aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/utils/signing_utils.ts
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-06-27 10:12:43 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-06-30 09:05:40 +0800
commit2fcc36bbadcb8238ee292afc58c2cd460d1b69da (patch)
tree235d3f2b361194a2e9ba41c4981a35daa99ac863 /packages/contracts/src/utils/signing_utils.ts
parent762c0143eb10306ca70b0f206e80eb9aed925f99 (diff)
downloaddexon-0x-contracts-2fcc36bbadcb8238ee292afc58c2cd460d1b69da.tar.gz
dexon-0x-contracts-2fcc36bbadcb8238ee292afc58c2cd460d1b69da.tar.zst
dexon-0x-contracts-2fcc36bbadcb8238ee292afc58c2cd460d1b69da.zip
Update file structure
Diffstat (limited to 'packages/contracts/src/utils/signing_utils.ts')
-rw-r--r--packages/contracts/src/utils/signing_utils.ts29
1 files changed, 0 insertions, 29 deletions
diff --git a/packages/contracts/src/utils/signing_utils.ts b/packages/contracts/src/utils/signing_utils.ts
deleted file mode 100644
index 9c711c72c..000000000
--- a/packages/contracts/src/utils/signing_utils.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { SignatureType } from '@0xproject/types';
-import * as ethUtil from 'ethereumjs-util';
-
-export const signingUtils = {
- signMessage(message: Buffer, privateKey: Buffer, signatureType: SignatureType): Buffer {
- if (signatureType === SignatureType.EthSign) {
- const prefixedMessage = ethUtil.hashPersonalMessage(message);
- const ecSignature = ethUtil.ecsign(prefixedMessage, privateKey);
- const signature = Buffer.concat([
- ethUtil.toBuffer(ecSignature.v),
- ecSignature.r,
- ecSignature.s,
- ethUtil.toBuffer(signatureType),
- ]);
- return signature;
- } else if (signatureType === SignatureType.EIP712) {
- const ecSignature = ethUtil.ecsign(message, privateKey);
- const signature = Buffer.concat([
- ethUtil.toBuffer(ecSignature.v),
- ecSignature.r,
- ecSignature.s,
- ethUtil.toBuffer(signatureType),
- ]);
- return signature;
- } else {
- throw new Error(`${signatureType} is not a valid signature type`);
- }
- },
-};