Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
protected async signData(data: string) {
try {
switch (this.signMethod) {
case SignMethod.ETH_SIGN:
return await this.web3.eth.sign(data, this.myId);
case SignMethod.TREZOR:
return '';
case SignMethod.EIP712:
return await this.web3.eth.sign(data, this.myId);
default:
return null;
}
}
catch (error) {
throw new ConnectorError(ConnectorIssue.SIGNATURE_FAILED, error);
}
}
export async function createSignature(data: string, config: Connector) {
try {
switch (config.method) {
case SignatureMethod.ETH_SIGN:
return await this.config.web3.eth.sign(data, config.makerId);
case SignatureMethod.TREZOR:
return null;
case SignatureMethod.EIP712:
return null;
default:
throw new ConnectorError(ConnectorIssue.SIGNATURE_FAILED, `Unknown signature ${config.method}`);
}
} catch(error) {
throw parseError(error);
}
}