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); super(value);
} }
/** @param type Defaults to `CoordType.jacobian` */
static fromBytes(bytes: Uint8Array, type?: blst.CoordType): PublicKey { static fromBytes(bytes: Uint8Array, type?: blst.CoordType): PublicKey {
const pk = blst.PublicKey.fromBytes(bytes, type); const pk = blst.PublicKey.fromBytes(bytes, type);
if (pk.value.is_inf()) { if (pk.value.is_inf()) {

View File

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

View File

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