/// <reference types="node" />
/// <reference types="node" />
import base64 from '@root/encoding/base64.js';
import hex from '@root/encoding/hex.js';
import { TxOut } from '@ts-bitcoin/core';
import * as jose from 'jose';
import crypto from '../runtime/crypto.js';
import { AdditionalKeys, Keys, OutputType, UserKeyAttributes } from './types.js';
export { crypto };
export { jose };
export { hex };
export { base64 };
export * from './cbor-jose.js';
export declare function deriveKey(password: string, salt: string, iterations?: number, keyLength?: number): Promise<{
    salt: string;
    cryptoKey: CryptoKey;
    rawKey: ArrayBuffer;
}>;
export declare function serializeKeys(keys: Keys): Promise<string>;
export declare function deserializeKeys(str: string): Promise<Keys>;
export declare function saveKeysInStorage(keys: Keys, storage: Storage): Promise<void>;
export declare function loadKeysFromStorage(storage: Storage): Promise<Keys | null>;
export declare function getRecoveryKey(keys: Keys, userKeyAttributes: UserKeyAttributes): Promise<Uint8Array>;
export declare function generateSaltToDeriveKey(saltLength?: number): string;
export declare function generateUserKeyAttributes(password: string, keys?: Keys): Promise<{
    userKeyAttributes: UserKeyAttributes;
    masterKey: CryptoKey;
}>;
/**
 * Regenerates a userKeyAttributes from a recovery key and a new password, keeping the same recovery key
 *
 * @param userKeyAttributes
 * @param newPassword
 * @param recoveryKeyHex
 * @returns
 */
export declare function recoverUserKeyAttributes(userKeyAttributes: UserKeyAttributes, newPassword: string, recoveryKeyHex: string): Promise<{
    userKeyAttributes: UserKeyAttributes;
    masterKey: CryptoKey;
}>;
/**
 * Either give password or recoveryKeyHex
 * userKeyAttributes is required
 *
 * @param password
 * @param userKeyAttributes
 * @param recoveryKeyHex
 * @returns
 */
export declare function getKeysFromUserKeyAttributes(password: string | null, // pass null when you give recoveryKeyHex
userKeyAttributes: UserKeyAttributes, recoveryKeyHex?: string): Promise<Keys>;
export declare function generateP256Key(rawMasterKey: ArrayBuffer, name: string): Promise<{
    secret: Buffer;
    xs: Uint8Array;
    ys: Uint8Array;
}>;
export declare function generateAdditionalKeys(masterKey: CryptoKey): Promise<AdditionalKeys>;
export declare function importSymmetricKey(key: string | Uint8Array | object, format?: 'raw' | 'base64' | 'hex'): Promise<CryptoKey>;
export declare function generateSymmetricKey(): Promise<CryptoKey>;
export declare function exportKey(key: CryptoKey): Promise<Uint8Array>;
export declare function exportKey(key: CryptoKey, format: 'hex' | 'base64'): Promise<string>;
export declare function exportKey(key: CryptoKey, format: 'jwk'): Promise<jose.JWK>;
export declare function encrypt(data: Uint8Array, key?: BufferSource): Promise<{
    encryptedData: Uint8Array;
    iv: Uint8Array;
    key: Uint8Array;
}>;
export declare function decrypt(data: Uint8Array, iv: Uint8Array, key: CryptoKey): Promise<Uint8Array>;
export declare function encryptToB64String(data: Buffer | Uint8Array, key: Uint8Array | CryptoKey): Promise<string>;
export declare function decryptFromB64String(data: string, key: CryptoKey): Promise<Uint8Array>;
export declare function toUint8Array(data: Uint8Array | string): Uint8Array;
/**
 * Returns a Uint8Array string
 * @param data
 * @returns Uint8Array
 */
export declare function sha1(data: Uint8Array | string): Promise<Uint8Array>;
/**
 * Returns a hex string
 * @param data
 * @returns hex string
 */
export declare function sha1s(data: Uint8Array | string): Promise<string>;
/**
 * Returns a Uint8Array string
 * @param data
 * @returns Uint8Array
 */
export declare function sha256(data: Uint8Array | string): Promise<Uint8Array>;
/**
 * Returns a hex string
 * @param data
 * @returns hex string
 */
export declare function sha256s(data: Uint8Array | string): Promise<string>;
/**
 * Returns a Uint8Array
 * @param data
 * @returns hex string
 */
export declare function sha512(data: Uint8Array | string): Promise<Uint8Array>;
/**
 * Returns a hex string
 * @param data
 * @returns hex string
 */
export declare function sha512s(data: Uint8Array | string): Promise<string>;
/**
 * Returns a buffer
 * @param data
 * @returns buffer
 */
export declare function sha256hmac(data: Uint8Array | string, message: Uint8Array | string): Promise<Uint8Array>;
/**
 * Returns a hex string
 * @param data
 * @returns hex string
 */
export declare function sha256hmacs(data: Uint8Array | string, message: Uint8Array | string): Promise<string>;
/**
 * Identifies an output type
 */
export declare function identifyOutput(output: TxOut): OutputType;
export declare function JWKToUncompressedHex(jwk: any): string;
/**
 * Compress a uncompressed public key (hex)
 * @param key uncompressed key 04...
 * @returns compressed key
 */
export declare function compressPublicKey(key: string): string;
interface HexKeyInfo {
    xh: string;
    xb: string;
    yh?: string;
    yb?: string;
    isYOdd: boolean;
    isCompressedKey: boolean;
    publicKey?: string;
    compactPublicKey: string;
    jwk: jose.JWK;
}
/**
 * Get information about a hex compressed or uncompressed public key
 * Is able to decompress a compressed key if curve is provided
 *
 * @param key hex string of compressed or uncompressed public key
 * @param curve
 * @returns HexKeyInfo - Y coordinate is only available if uncompressed or compressed and curve is provided
 */
export declare function getHexKeyInfo(key: string, curve?: 'p256' | 'secp256k1'): HexKeyInfo;
export declare function getSHA1Fingerprint(jwk: jose.JWK): Promise<string>;
export declare function validateHexKey(key: string): void;
export declare function JWKOrHexKeyToCryptoKeyAndJWK(key: jose.JWK | string, type: 'ECDH' | 'ECDSA', crv: 'p256' | 'secp256k1'): Promise<{
    cryptoKey: crypto.CryptoKey;
    jwk: jose.JWK;
}>;
export declare function pbkdf2(buf: Uint8Array, salt: Uint8Array, keyLengthBits: number, iterations: number): Promise<Uint8Array>;
export declare function concat(arr1: Uint8Array, arr2: Uint8Array): Uint8Array;
export declare function parseSDKToken(token: string, SDKTokenPrefix: string, APITokenPrefix: string): Promise<{
    tokenId: string;
    tokenSecret: string;
    bearerToken: string;
}>;
export declare function createFakeTxFromOutputScript(hex: string): {
    txid: () => Buffer;
    rawtx: string;
};
