UNPKG

did-sdk-js

Version:

js sdk for did and vc according to mcps did spec

48 lines (47 loc) 2.15 kB
/// <reference types="node" /> import { Crypto } from "./crypto"; import * as eccryptoJS from "eccrypto-js"; export declare class Secp256k1 extends Crypto { static PRIVKEY_LEN: number; static KEY_TYPE: string; /** * Calculates the public key from a given private key. * @param privateKeyHex The private key hexstring * @param mode Pubkey Type 'compress' or '' * @returns Public key {type:type, value:hexstring} */ static getPublicKeyFromPrivateKey(privateKeyHex: string, mode?: string): string; static generateMnemonicAndKey(): { mnemonic: string; privateKey: string; publicKey: string; }; static generateKey(): { privateKey: string; publicKey: string; }; static kdf(): void; /** * Generates a signature (base64 string) for a signDocSerialize based on given private key. * @param signMsg from protobuf and tx. * @param privateKeyHex The private key. * @returns Signature. Does not include tx. */ static sign(signMsg: string, privateKeyHex: string): Promise<any>; /** * Verifies a signature (64 byte <r,s>) given the sign bytes and public key. * @param sigValue The signature base64 string. * @param signMsg Unsigned transaction sign msg string. * @param publicKeyHex The public key. * @returns Signature. Does not include tx. */ static signVerify(signMsg: string, sigValue: string, publicKeyHex: string): Promise<any>; static encrypt(msg: string, publicKeyHex: string): Promise<string>; static encryptv2(msg: string, publicKeyHex: string): Promise<string>; static encryptv1(msg: string, publicKeyHex: string): Promise<string>; static decrypt(encryptDataHex: string, privateKeyHex: string): Promise<string>; static decryptv2(encryptDataHex: string, privateKeyHex: string): Promise<string>; static decryptv1(encryptDataHex: string, privateKeyHex: string): Promise<string>; static encSerialize(encInfo: eccryptoJS.Encrypted): Buffer; static encDeserialize(cipherData: Buffer): eccryptoJS.Encrypted; }