/**
 * This file is for using native crypto in the browser.
 *
 * @private
 */
import { Binary } from '../binary.js';
import { DecryptResult, EncryptResult, PemKeyPair } from './declarations.js';
export declare const isSupported: boolean;
export declare const method = "http://www.w3.org/2001/04/xmlenc#aes256-cbc";
export declare const name = "BrowserNativeCryptoService";
/**
 * Get a DOMString representing the algorithm to use for an
 * asymmetric key generation.
 */
export declare function rsaOaepSha1(modulusLength?: number): RsaHashedKeyGenParams;
export declare function rsaPkcs1Sha256(modulusLength?: number): RsaHashedKeyGenParams;
/**
 * Generate a random hex key
 * @return New key as a hex string
 */
export declare function generateKey(length?: number): string;
/**
 * Generate an RSA key pair
 * @see    {@link https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/generateKey}
 * @param  size in bits
 */
export declare function generateKeyPair(size?: number): Promise<CryptoKeyPair>;
export declare function cryptoToPemPair(keys: CryptoKeyPair): Promise<PemKeyPair>;
/**
 * Encrypt using a public key
 * @param payload Payload to encrypt
 * @param publicKey PEM formatted public key
 * @return Encrypted payload
 */
export declare function encryptWithPublicKey(payload: Binary, publicKey: string): Promise<Binary>;
/**
 * Generate a 16-byte initialization vector
 */
export declare function generateInitializationVector(length?: number): string;
export declare function randomBytes(length: number): Uint8Array;
/**
 * Returns a promise to the encryption key as a binary string.
 *
 * Note: This function should almost never fail as it includes a fallback
 * if for some reason the native generate key fails.
 *
 * @param length The key length, defaults to 256
 *
 * @returns The hex string.
 */
export declare function randomBytesAsHex(length: number): string;
/**
 * Decrypt a public-key encrypted payload with a private key
 * @param  encryptedPayload  Payload to decrypt
 * @param  privateKey        PEM formatted private keynpmv
 * @return Decrypted payload
 */
export declare function decryptWithPrivateKey(encryptedPayload: Binary, privateKey: string): Promise<Binary>;
/**
 * Decrypt content synchronously
 * @param payload The payload to decrypt
 * @param key     The encryption key
 * @param iv      The initialization vector
 * @param algorithm The algorithm to use for encryption
 * @param authTag The authentication tag for authenticated crypto.
 */
export declare function decrypt(payload: Binary, key: Binary, iv: Binary, algorithm?: string, authTag?: Binary): Promise<DecryptResult>;
/**
 * Encrypt content synchronously
 * @param payload   The payload to encrypt
 * @param key       The encryption key
 * @param iv        The initialization vector
 * @param algorithm The algorithm to use for encryption
 */
export declare function encrypt(payload: Binary, key: Binary, iv: Binary, algorithm?: string): Promise<EncryptResult>;
/**
 * Create a SHA256 hash. Code refrenced from MDN:
 * https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest
 * @param  content  String content
 * @return Hex hash
 */
export declare function sha256(content: string): Promise<string>;
/**
 * Create an HMAC SHA256 hash
 * @param  key     Key string
 * @param  content Content string
 * @return Hex hash
 */
export declare function hmac(key: string, content: string): Promise<string>;
/**
 * Create an ArrayBuffer from a hex string.
 * https://developers.google.com/web/updates/2012/06/How-to-convert-ArrayBuffer-to-and-from-String?hl=en
 * @param  hex - Hex string
 */
export declare function hex2Ab(hex: string): ArrayBuffer;
//# sourceMappingURL=index.d.ts.map