///
import { Crypto, CryptoAsymmetricModels } from '@open-rights-exchange/chain-js';
import { EthereumAddress, EthereumKeyPair, EthereumPrivateKey, EthereumPublicKey, EthereumSignature, EthereumSignatureNative } from './models';
export declare const defaultIter = 1000000;
export declare const defaultMode = Crypto.AesCrypto.EncryptionMode.Gcm;
/** Verifies that the value is a valid, stringified JSON Encrypted object */
export declare function isSymEncryptedDataString(value: string): value is Crypto.AesCrypto.AesEncryptedDataString;
/** Ensures that the value comforms to a well-formed, stringified JSON Encrypted Object */
export declare function toSymEncryptedDataString(value: any): Crypto.AesCrypto.AesEncryptedDataString;
/** get uncompressed public key from EthereumPublicKey */
export declare function uncompressPublicKey(publicKey: EthereumPublicKey): string;
/** Decrypts the encrypted value using a password, and optional salt using AES algorithm and SHA256 hash function
* The encrypted value is either a stringified JSON object or a JSON object */
export declare function decryptWithPassword(encrypted: Crypto.AesCrypto.AesEncryptedDataString | any, password: string, options: Crypto.AesCrypto.AesEncryptionOptions): string;
/** Encrypts a string using a password and optional salt */
export declare function encryptWithPassword(unencrypted: string, password: string, options: Crypto.AesCrypto.AesEncryptionOptions): Crypto.AesCrypto.AesEncryptedDataString;
/** Encrypts a string using a public key into a stringified JSON object
* The encrypted result can be decrypted with the matching private key */
export declare function encryptWithPublicKey(unencrypted: string, publicKey: EthereumPublicKey, options: Crypto.Asymmetric.EciesOptions): Promise;
/** Decrypts the encrypted value using a private key
* The encrypted value is a stringified JSON object
* ... and must have been encrypted with the public key that matches the private ley provided */
export declare function decryptWithPrivateKey(encrypted: Crypto.Asymmetric.AsymmetricEncryptedDataString | Crypto.Asymmetric.AsymmetricEncryptedData, privateKey: EthereumPrivateKey, options: Crypto.Asymmetric.EciesOptions): Promise;
/** Encrypts a string using multiple assymmetric encryptions with multiple public keys - one after the other
* calls a helper function to perform the iterative wrapping
* the first parameter of the helper is a chain-specific function (in this file) to encryptWithPublicKey
* The result is stringified JSON object including an array of encryption results with the last one including the final cipertext
* Encrypts using publicKeys in the order they appear in the array */
export declare function encryptWithPublicKeys(unencrypted: string, publicKeys: EthereumPublicKey[], options?: Crypto.Asymmetric.EciesOptions): Promise;
/** Unwraps an object produced by encryptWithPublicKeys() - resulting in the original ecrypted string
* calls a helper function to perform the iterative unwrapping
* the first parameter of the helper is a chain-specific function (in this file) to decryptWithPrivateKey
* Decrypts using privateKeys that match the publicKeys provided in encryptWithPublicKeys() - provide the privateKeys in same order
* The result is the decrypted string */
export declare function decryptWithPrivateKeys(encrypted: Crypto.Asymmetric.AsymmetricEncryptedDataString, privateKeys: EthereumPublicKey[], options?: any): Promise<{
decrypted: string;
remaining: CryptoAsymmetricModels.AsymmetricEncryptedData[];
}>;
/** Signs data with private key */
export declare function sign(data: string | Buffer, privateKey: string): EthereumSignatureNative;
/** Returns public key from ethereum signature */
export declare function getEthereumPublicKeyFromSignature(signature: EthereumSignatureNative, data: string | Buffer): EthereumPublicKey;
/** Returns public key from ethereum address */
export declare function getEthereumAddressFromPublicKey(publicKey: EthereumPublicKey): EthereumAddress;
/** Generates and returns a new public/private key pair */
export declare function generateKeyPair(): Promise;
/** Generates new public and private key pair
* Encrypts the private key using password and optional salt
*/
export declare function generateNewAccountKeysAndEncryptPrivateKeys(password: string, overrideKeys: any, options: Crypto.AesCrypto.AesEncryptionOptions): Promise;
/** Verify that the signed data was signed using the given key (signed with the private key for the provided public key) */
export declare function verifySignedWithPublicKey(data: string | Buffer, publicKey: EthereumPublicKey, signature: EthereumSignature): boolean;
/** Prepares a message body (e.g. a message/string to be signed) with the appropriate chain specific prefix or suffix
* For Eth, prepends the standard message prefix ('Ethereum Signed Message:') to the beginning of data
* Returns a HexString of the complete message (including the additions)
* Adding data to the message allows a wallet to sign an arbitrary string without risking signing an actual transaction */
export declare function prepareMessageToSign(data: string | Buffer): string;
/** Signs data as a message using private key (first prefixing additional message string) */
export declare function signMessage(data: string | Buffer, privateKey: string): EthereumSignatureNative;
/** Verify that a 'personal message' was signed using the given key (signed with the private key for the provided public key)
* A message differs than verifySignedWithPublicKey() because it might additional strings appended (Eth best-practices has a prefixed message)
* This differs from verifySignedWithPublicKey() because a message might include additional strings appended (as required by chain best-practices) */
export declare function verifySignedMessage(data: string | Buffer, publicKey: EthereumPublicKey, signature: EthereumSignature): boolean;