/// export declare function packEncryptedMessage(encryptedMessage: any): string; export declare function unpackEncryptedMessage(encryptedMessage: any): { ciphertext: string; ephemPublicKey: string; nonce: string; version: string; }; /** * A Keypair is an object that can group relevant keys for a user in the webb system. * The keys managed by a keypair are as follows: * - pubkey: Required * - used in commitments of circuits, to indicate ownership of a UTXO. * The value can be derived from `pubkey = poseidon(privkey)` * - encryptionKey: Optional * - used to encrypting data for private communication. It is a pubkey of the privkey * in a different cryptography scheme. * - privkey: Optional * - used for proving knowledge of a value and thus ability to spend UTXOs (creating nullifier). * - used for decrypting data that has been encrypted with the encryptionKey. */ export declare class Keypair { privkey: string | undefined; private pubkey; private encryptionKey; /** * Initialize a new keypair from a passed hex string. Generates a random private key if not defined. * * @param privkey - hex string of a field element for the * @returns - A 'Keypair' object with pubkey and encryptionKey values derived from the private key. */ constructor(privkey?: string); /** * @returns a string of public parts of this keypair object: pubkey and encryption key. */ toString(): string; /** * Initialize new keypair from string data. * * @param str - A string which contains public keydata. * (0, 66), the slice for the pubKey value, 0x-prefixed, which is required. * (66, 130), the slice for the encryptionKey value, which is optional to enable * encrypt and decrypt functionality. It should be hex encoded. * @returns The keypair object configured with appropriate public values. * @throws If the string object is not 66 chars or 130 chars. */ static fromString(str: string): Keypair; static encryptWithKey(encryptionKey: string, data: string): string; /** * Encrypt data using keypair encryption key * * @param bytes - A buffer to encrypt * @returns a hex string encoding of encrypted data with this encryption key */ encrypt(bytes: Buffer): string; /** * Decrypt data using keypair private key * * @param data - a hex string with data * @returns A Buffer of the decrypted data */ decrypt(data: string): Buffer; /** * @returns a 0x-prefixed, 32 fixed byte hex-string representation of the public key */ getPubKey(): string; /** * @returns a 0x-prefixed, 32 fixed byte hex-string representation of the encryption key */ getEncryptionKey(): string; }