herumi fromBytes explicit signature

This commit is contained in:
g11tech 2021-09-22 20:51:31 +05:30
parent 5731f49454
commit 40fc4b33a2
1 changed files with 6 additions and 2 deletions

View File

@ -2,7 +2,7 @@ import {SignatureType, multiVerify} from "bls-eth-wasm";
import {getContext} from "./context";
import {PublicKey} from "./publicKey";
import {bytesToHex, concatUint8Arrays, hexToBytes, isZeroUint8Array} from "../helpers";
import {PointFormat, Signature as ISignature} from "../interface";
import {PointFormat, Signature as ISignature, CoordType} from "../interface";
import {EmptyAggregateError, InvalidLengthError, InvalidOrderError} from "../errors";
import {SIGNATURE_LENGTH_COMPRESSED, SIGNATURE_LENGTH_UNCOMPRESSED} from "../constants";
@ -17,7 +17,11 @@ export class Signature implements ISignature {
this.value = value;
}
static fromBytes(bytes: Uint8Array): Signature {
/**
* @param type Does not affect `herumi` implementation, always de-serializes to `jacobian`
* @param validate With `herumi` implementation signature validation is always on regardless of this flag.
*/
static fromBytes(bytes: Uint8Array, _type?: CoordType, _validate = true): Signature {
const context = getContext();
const signature = new context.Signature();
if (!isZeroUint8Array(bytes)) {