import type { PublicKey, PrivateKey, KeyPair } from '../types.js'; import * as peculiarWebcrypto from '@peculiar/webcrypto'; /** * WebCrypto polyfill from @peculiar/webcrypto * This behaves differently with respect to Ed25519 keys * See: https://github.com/PeculiarVentures/webcrypto/issues/55 * Note that the types don't exactly match but it is compatible. */ declare const webcrypto: peculiarWebcrypto.Crypto; /** * Imports Ed25519 public `CryptoKey` from key buffer. * If `publicKey` is already `CryptoKey`, then this just returns it. */ declare function importPublicKey(publicKey: BufferSource): Promise; /** * Imports Ed25519 private `CryptoKey` from key buffer. * If `privateKey` is already `CryptoKey`, then this just returns it. */ declare function importPrivateKey(privateKey: BufferSource): Promise; /** * Imports Ed25519 `CryptoKeyPair` from key pair buffer. * If any of the keys are already `CryptoKey`, then this will return them. */ declare function importKeyPair({ publicKey, privateKey, }: { publicKey: BufferSource; privateKey: BufferSource; }): Promise; /** * Exports Ed25519 public `CryptoKey` to `PublicKey`. * If `publicKey` is already `Buffer`, then this just returns it. * The returned buffers is guaranteed to unpooled. * This means the underlying `ArrayBuffer` is safely transferrable. */ declare function exportPublicKey(publicCryptoKey: CryptoKey): Promise; /** * Exports Ed25519 private `CryptoKey` to `PrivateKey` * If `privateKey` is already `Buffer`, then this just returns it. * The returned buffers is guaranteed to unpooled. * This means the underlying `ArrayBuffer` is safely transferrable. */ declare function exportPrivateKey(privateCryptoKey: CryptoKey): Promise; /** * Exports Ed25519 `CryptoKeyPair` to `KeyPair` * If any of the keys are already `Buffer`, then this will return them. * The returned buffers is guaranteed to unpooled. * This means the underlying `ArrayBuffer` is safely transferrable. */ declare function exportKeyPair(keyPair: { publicKey: CryptoKey; privateKey: CryptoKey; }): Promise; export default webcrypto; export { importPublicKey, importPrivateKey, importKeyPair, exportPublicKey, exportPrivateKey, exportKeyPair, };