necjs
Version:
NECJS SDK for NCOG Earth Chain RPC
54 lines (53 loc) • 1.76 kB
TypeScript
export declare class WasmError extends Error {
readonly context?: any;
constructor(message: string, context?: any);
}
export interface MlKem {
/**
* Generate a new keypair.
* Resolves to an object: { pubKey: base64-string; privKey: base64-string }.
*/
keyGen(): Promise<{
pubKey: string;
privKey: string;
}>;
/**
* Asymmetric encrypt with the given public key.
*/
encrypt(pubKey: string, message: string): Promise<{
encryptedData: string;
version: string;
}>;
/**
* Asymmetric decrypt with the given private key.
*/
decrypt(privKey: string, encryptedData: string, version: string): Promise<string>;
/**
* Symmetric encrypt with the shared-secret key.
*/
symEncrypt(ssKey: string, message: string): Promise<{
encryptedData: string;
version: string;
}>;
/**
* Symmetric decrypt with the shared-secret key.
*/
symDecrypt(ssKey: string, encryptedData: string, version: string): Promise<string>;
/**
* Derive an EVM-style address (hex) from a raw private-key string.
*/
privateKeyToAddress(privateKey: string): string;
signTransactionMLDSA87: (TxObject: any, privateKeyHex: string) => any;
decodeRLPTransaction: (txHex: string) => any;
}
/**
* Load and initialize the MLKEM Go WebAssembly module.
* Automatically detects environment and uses appropriate loader.
*/
export declare function loadWasm(): Promise<MlKem>;
/**
* Load WASM from buffer (useful for bundlers that inline WASM)
*/
export declare function loadWasmFromBuffer(wasmBuffer: ArrayBuffer): Promise<MlKem>;
export type { MlKemNode } from './mlkem-node';
export type { MlKemBrowser } from './mlkem-browser';