ignoring the validate flag on herumi signature impl

This commit is contained in:
g11tech 2021-09-22 15:19:58 +05:30
parent 6854661b29
commit 5731f49454
2 changed files with 4 additions and 4 deletions

View File

@ -2,7 +2,7 @@ import {SignatureType, multiVerify} from "bls-eth-wasm";
import {getContext} from "./context"; import {getContext} from "./context";
import {PublicKey} from "./publicKey"; import {PublicKey} from "./publicKey";
import {bytesToHex, concatUint8Arrays, hexToBytes, isZeroUint8Array} from "../helpers"; import {bytesToHex, concatUint8Arrays, hexToBytes, isZeroUint8Array} from "../helpers";
import {PointFormat, Signature as ISignature, CoordType} from "../interface"; import {PointFormat, Signature as ISignature} from "../interface";
import {EmptyAggregateError, InvalidLengthError, InvalidOrderError} from "../errors"; import {EmptyAggregateError, InvalidLengthError, InvalidOrderError} from "../errors";
import {SIGNATURE_LENGTH_COMPRESSED, SIGNATURE_LENGTH_UNCOMPRESSED} from "../constants"; import {SIGNATURE_LENGTH_COMPRESSED, SIGNATURE_LENGTH_UNCOMPRESSED} from "../constants";
@ -17,8 +17,7 @@ export class Signature implements ISignature {
this.value = value; this.value = value;
} }
static fromBytes(bytes: Uint8Array, _type?: CoordType, validate = true): Signature { static fromBytes(bytes: Uint8Array): Signature {
if (validate === false) throw new Error("ValidationSkipNotSupported");
const context = getContext(); const context = getContext();
const signature = new context.Signature(); const signature = new context.Signature();
if (!isZeroUint8Array(bytes)) { if (!isZeroUint8Array(bytes)) {

View File

@ -38,7 +38,8 @@ export declare class PublicKey {
} }
export declare class Signature { export declare class Signature {
/** @param type Only for impl `blst-native`. Defaults to `CoordType.affine` */ /** @param type Only for impl `blst-native`. Defaults to `CoordType.affine`
* @param validate When using `herumi` implementation, signature validation is always on regardless of this flag. */
static fromBytes(bytes: Uint8Array, type?: CoordType, validate?: boolean): Signature; static fromBytes(bytes: Uint8Array, type?: CoordType, validate?: boolean): Signature;
static fromHex(hex: string): Signature; static fromHex(hex: string): Signature;
static aggregate(signatures: Signature[]): Signature; static aggregate(signatures: Signature[]): Signature;