/** * Key management operations: creation in binary Crypto, JWK, or Multikey formats. Note that Multikeys are only * defined for ecdsa and eddsa; it cannot be used for rsa algorithms. * * The module also includes functions to convert JWK to and from binary crypto. See the separate * `multikey-webcrypto` for similar operations with Multikey formats. * * @module */ import type { KeyOptions, JWKeyPair } from './types.js'; /** * Crypto identifier values that are relevant for this package. "rsa" is an alias for "rsa-pss"; * "ed25519" is an alias for "eddsa". * * Only "rsa-oaep" can be used for encryption/decryption, but it cannot be used for signatures. All the * others can only be used for signature and verification. */ export type CryptoAlgorithm = "ecdsa" | "eddsa" | "ed25519" | "rsa-pss" | "rsa" | "rsa-oaep"; /** * Generate a private/public key pair in one of the ecdsa/eddsa/RSA crypto algorithms (the term Ed25519 can also be used * for eddsa). The result is the WebCrypto format for keys. * * Some of the algorithms can be (optionally) parametrized through the key options: * * * For ecdsa: the `nameCurve` field can be set to `"P-256"` or `"P-384"` to change the EC curve. Default is `"P-256"` * * For RSA: * * can be set to the modulus length of the key can be set with `modulusLength`. Value can be 1024, 2048, or 4096; * default is 2048 * * the `hash` value can be set to `"SHA-256"` or `"SHA-384"`; default is "SHA-256"` * * * @param algorithm - can be ecdsa, eddsa, Ed25519, or RSA * @param options - depends on the algorithm chosen * @async */ export declare function generateKeys(algorithm: CryptoAlgorithm, options?: KeyOptions): Promise; /** * Convert a JWK key representation of a Key to WebCrypto's representation. * * @param key * @param usage - can be `["verify"]/["encrypt"]` or `["sign"]/["decrypt"]` for a public or private key, respectively * @constructor * @async * */ export declare function JWKeyToCrypto(key: JsonWebKey, usage?: KeyUsage[]): Promise; /** * Convert a public/private key pair in JWK to WebCrypto's binary representation. * * @param keys * @constructor * @async */ export declare function JWKeyPairToCrypto(keys: JWKeyPair): Promise; //# sourceMappingURL=keys.d.ts.map