@zlattice/lattice-js
Version:
Lattice blockchain TypeScript SDK with dual module support (CJS + ESM)
42 lines • 1.15 kB
TypeScript
export interface KeyPair {
privateKey: string;
publicKey: string;
}
/**
* 生成密钥对:publicKey = privateKey * G
*/
export declare function generateKeyPairHex(str?: string): KeyPair;
/**
* 生成压缩公钥
*/
export declare function compressPublicKeyHex(s: string): string;
/**
* utf8串转16进制串
*/
export declare function utf8ToHex(input: string): string;
/**
* 补全16进制字符串
*/
export declare function leftPad(input: string, num: number): string;
/**
* 转成16进制串
*/
export declare function arrayToHex(arr: number[]): string;
/**
* 转成utf8串
*/
export declare function arrayToUtf8(arr: Uint8Array): string;
/**
* 转成字节数组
*/
export declare function hexToArray(hexStr: string): Uint8Array<ArrayBuffer>;
/**
* 验证公钥是否为椭圆曲线上的点
*/
export declare function verifyPublicKey(publicKey: string): boolean;
export declare function isValidPrivateKey(privateKey: string): boolean;
/**
* 验证公钥是否等价,等价返回true
*/
export declare function comparePublicKeyHex(publicKey1: string, publicKey2: string): boolean;
//# sourceMappingURL=utils.d.ts.map