Made Signatures more flexible for input.

This commit is contained in:
Richard Moore 2018-07-17 15:32:06 -04:00
parent a67e3d1d65
commit a062f75d38
No known key found for this signature in database
GPG Key ID: 525F70A6FCABC295
2 changed files with 6 additions and 1 deletions

@ -248,6 +248,9 @@ export function splitSignature(signature: Arrayish | Signature): Signature {
let r = '0x', s = '0x';
if (isSignature(signature)) {
if (signature.v == null && signature.recoveryParam == null) {
errors.throwError('at least on of recoveryParam or v must be specified', errors.INVALID_ARGUMENT, { argument: 'signature', value: signature });
}
r = hexZeroPad(signature.r, 32);
s = hexZeroPad(signature.s, 32);

@ -65,7 +65,9 @@ export type SupportedAlgorithms = 'sha256' | 'sha512';
export interface Signature {
r: string;
s: string;
recoveryParam: number;
/* At least one of the following MUST be specified; the other will be derived */
recoveryParam?: number;
v?: number;
}