Document default value of optional params

This commit is contained in:
dapplion 2021-04-05 19:47:25 +02:00
parent 3bf2d48e2e
commit 1236f7a2cc
3 changed files with 9 additions and 16 deletions

View File

@ -8,6 +8,7 @@ export class PublicKey extends blst.PublicKey implements IPublicKey {
super(value);
}
/** @param type Defaults to `CoordType.jacobian` */
static fromBytes(bytes: Uint8Array, type?: blst.CoordType): PublicKey {
const pk = blst.PublicKey.fromBytes(bytes, type);
if (pk.value.is_inf()) {

View File

@ -9,6 +9,7 @@ export class Signature extends blst.Signature implements ISignature {
super(value);
}
/** @param type Defaults to `CoordType.affine` */
static fromBytes(bytes: Uint8Array, type?: blst.CoordType, validate?: boolean): Signature {
const sig = blst.Signature.fromBytes(bytes, type);
if (validate) sig.sigValidate();

View File

@ -1,21 +1,8 @@
export interface IBls {
implementation: Implementation;
SecretKey: {
fromBytes(bytes: Uint8Array): SecretKey;
fromHex(hex: string): SecretKey;
fromKeygen(ikm?: Uint8Array): SecretKey;
};
PublicKey: {
fromBytes(bytes: Uint8Array, type?: CoordType): PublicKey;
fromHex(hex: string): PublicKey;
aggregate(publicKeys: PublicKey[]): PublicKey;
};
Signature: {
fromBytes(bytes: Uint8Array, type?: CoordType, validate?: boolean): Signature;
fromHex(hex: string): Signature;
aggregate(signatures: Signature[]): Signature;
verifyMultipleSignatures(sets: {publicKey: PublicKey; message: Uint8Array; signature: Signature}[]): boolean;
};
SecretKey: typeof SecretKey;
PublicKey: typeof PublicKey;
Signature: typeof Signature;
sign(secretKey: Uint8Array, message: Uint8Array): Uint8Array;
aggregatePublicKeys(publicKeys: Uint8Array[]): Uint8Array;
@ -41,14 +28,17 @@ export declare class SecretKey {
}
export declare class PublicKey {
/** @param type Only for impl `blst-native`. Defaults to `CoordType.jacobian` */
static fromBytes(bytes: Uint8Array, type?: CoordType): PublicKey;
static fromHex(hex: string): PublicKey;
static aggregate(publicKeys: PublicKey[]): PublicKey;
/** @param format Defaults to `PointFormat.compressed` */
toBytes(format?: PointFormat): Uint8Array;
toHex(format?: PointFormat): string;
}
export declare class Signature {
/** @param type Only for impl `blst-native`. Defaults to `CoordType.affine` */
static fromBytes(bytes: Uint8Array, type?: CoordType, validate?: boolean): Signature;
static fromHex(hex: string): Signature;
static aggregate(signatures: Signature[]): Signature;
@ -56,6 +46,7 @@ export declare class Signature {
verify(publicKey: PublicKey, message: Uint8Array): boolean;
verifyAggregate(publicKeys: PublicKey[], message: Uint8Array): boolean;
verifyMultiple(publicKeys: PublicKey[], messages: Uint8Array[]): boolean;
/** @param format Defaults to `PointFormat.compressed` */
toBytes(format?: PointFormat): Uint8Array;
toHex(format?: PointFormat): string;
}