/// import { Models, Crypto, CryptoAsymmetricModels } from '@open-rights-exchange/chain-js'; import { EosAccountKeys, EosSignature, EosPublicKey, EosPrivateKey, EosKeyPair } from './models'; export declare const defaultIter = 1000000; export declare const defaultMode = Models.ModelsCryptoAes.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; /** 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: EosPublicKey, 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: EosPrivateKey, 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: EosPublicKey[], 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: EosPublicKey[], options?: any): Promise<{ decrypted: string; remaining: CryptoAsymmetricModels.AsymmetricEncryptedData[]; }>; /** Signs data with private key */ export declare function sign(data: string | Buffer, privateKey: EosPrivateKey | string): EosSignature; /** Generates and returns a new public/private key pair */ export declare function generateKeyPair(): Promise; /** Returns public key from signature */ export declare function getPublicKeyFromSignature(signature: Models.Signature | EosSignature | string | Buffer, data: string | Buffer, encoding?: string): EosPublicKey; /** 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: EosPublicKey, signature: EosSignature): boolean; /** Generates new owner and active key pairs (public and private) * Encrypts private keys with provided password and optional salt * Returns: { publicKeys:{owner, active}, privateKeys:{owner, active}, privateKeysEncrypted:{owner, active} } */ export declare function generateNewAccountKeysAndEncryptPrivateKeys(password: string, overrideKeys: any, encryptionOptions: Crypto.AesCrypto.AesEncryptionOptions): Promise; /** Generate a random private/public key pair and encrypt using provided password and optional salt */ export declare function generateKeyPairAndEncryptPrivateKeys(password: string, encryptionOptions: Crypto.AesCrypto.AesEncryptionOptions): Promise; export declare function removeEosPublicKeyPrefix(publickey: EosPublicKey): string; /** Convert an EOS public key format to a 'raw' ECC public key usable with ECC libraries */ export declare function eosPublicKeyToEccPublicKey(eosPublicKey: EosPublicKey): string; /** Convert an EOS private key format to a 'raw' ECC private key usable with ECC libraries */ export declare function eosPrivateKeyToEccPrivateKey(eosPrivateKey: EosPrivateKey): string; /** Signs data as a message using private key (Eos does not append additional fields for a message) */ export declare function signMessage(data: string, privateKey: EosPrivateKey | string): EosSignature; /** Verify that a 'personal message' was signed using the given key (Eos does not append additional fields for a message) */ export declare function verifySignedMessage(data: string, publicKey: EosPublicKey, signature: EosSignature): boolean; export declare function getPublicKeyFromPrivateKey(privateKey: EosPrivateKey): any;