mirror of
https://github.com/pezkuwichain/pezkuwi-wasm.git
synced 2026-04-22 03:18:06 +00:00
64 lines
2.5 KiB
TypeScript
64 lines
2.5 KiB
TypeScript
import { RistrettoPoint } from '@noble/curves/ed25519.js';
|
|
type Point = typeof RistrettoPoint.BASE;
|
|
type Data = string | Uint8Array;
|
|
export type RNG = (bytes: number) => Uint8Array;
|
|
declare class Strobe128 {
|
|
state: Uint8Array;
|
|
state32: Uint32Array;
|
|
pos: number;
|
|
posBegin: number;
|
|
curFlags: number;
|
|
constructor(protocolLabel: Data);
|
|
private keccakF1600;
|
|
private runF;
|
|
private absorb;
|
|
private squeeze;
|
|
private overwrite;
|
|
private beginOp;
|
|
metaAD(data: Data, more: boolean): void;
|
|
AD(data: Data, more: boolean): void;
|
|
PRF(len: number, more: boolean): Uint8Array;
|
|
KEY(data: Data, more: boolean): void;
|
|
clone(): Strobe128;
|
|
clean(): void;
|
|
}
|
|
declare class Merlin {
|
|
strobe: Strobe128;
|
|
constructor(label: Data);
|
|
appendMessage(label: Data, message: Data): void;
|
|
challengeBytes(label: Data, len: number): Uint8Array;
|
|
clean(): void;
|
|
}
|
|
declare class SigningContext extends Merlin {
|
|
private rng;
|
|
constructor(name: string, rng?: RNG);
|
|
label(label: Data): void;
|
|
bytes(bytes: Uint8Array): this;
|
|
protoName(label: Data): void;
|
|
commitPoint(label: Data, point: Point): void;
|
|
challengeScalar(label: Data): bigint;
|
|
witnessScalar(label: Data, nonceSeeds?: Uint8Array[]): bigint;
|
|
witnessBytes(label: Data, len: number, nonceSeeds?: Uint8Array[]): Uint8Array;
|
|
}
|
|
export declare function getPublicKey(secretKey: Uint8Array): Uint8Array;
|
|
export declare function secretFromSeed(seed: Uint8Array): Uint8Array;
|
|
export declare function fromKeypair(pair: Uint8Array): Uint8Array;
|
|
export declare function sign(secretKey: Uint8Array, message: Uint8Array, rng?: RNG): Uint8Array;
|
|
export declare function verify(message: Uint8Array, signature: Uint8Array, publicKey: Uint8Array): boolean;
|
|
export declare function getSharedSecret(secretKey: Uint8Array, publicKey: Uint8Array): Uint8Array;
|
|
export declare const HDKD: {
|
|
secretSoft(secretKey: Uint8Array, chainCode: Uint8Array, rng?: RNG): Uint8Array;
|
|
publicSoft(publicKey: Uint8Array, chainCode: Uint8Array): Uint8Array;
|
|
secretHard(secretKey: Uint8Array, chainCode: Uint8Array): Uint8Array;
|
|
};
|
|
export declare const vrf: {
|
|
sign(msg: Uint8Array, secretKey: Uint8Array, ctx: Uint8Array, extra: Uint8Array, rng: RNG): Uint8Array;
|
|
verify(msg: Uint8Array, signature: Uint8Array, publicKey: Uint8Array, ctx?: Uint8Array, extra?: Uint8Array, rng?: RNG): boolean;
|
|
};
|
|
export declare const __tests: {
|
|
Strobe128: typeof Strobe128;
|
|
Merlin: typeof Merlin;
|
|
SigningContext: typeof SigningContext;
|
|
};
|
|
export {};
|
|
//# sourceMappingURL=index.d.ts.map
|