herumi fromBytes explicit signature
This commit is contained in:
parent
5731f49454
commit
40fc4b33a2
|
@ -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} from "../interface";
|
import {PointFormat, Signature as ISignature, CoordType} 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,7 +17,11 @@ export class Signature implements ISignature {
|
||||||
this.value = value;
|
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 context = getContext();
|
||||||
const signature = new context.Signature();
|
const signature = new context.Signature();
|
||||||
if (!isZeroUint8Array(bytes)) {
|
if (!isZeroUint8Array(bytes)) {
|
||||||
|
|
Reference in New Issue