UNPKG

js-crypto-key-utils

Version:

Universal Module for Cryptographic Key Utilities in JavaScript, including PEM-JWK converters

21 lines (20 loc) 903 B
/** * asn1ec.js */ import { DecodedAsn1Key, PublicOrPrivate } from './typedef'; /** * Convert JWK to parsed ASN.1 EC key object * @param {JsonWebKey} jwk - A key object in JWK format. * @param {PublicOrPrivate} type - 'public' or 'private' * @param {boolean} [compact=false] - *Only for EC public keys*, the compact form of public key is given as ASN.1 object if true. * @return {Object} - Parsed ASN.1 object. */ export declare const fromJWK: (jwk: JsonWebKey, type: PublicOrPrivate, compact?: boolean) => DecodedAsn1Key; /** * Convert parsed ASN.1 EC key object to JWK. * @param {Object} decoded - Parsed ASN.1 EC key object. * @param {PublicOrPrivate} type - 'public' or 'private' * @return {JsonWebKey} - Converted key objects in JWK format. * @throws {Error} - Throws if UnsupportedCurve. */ export declare const toJWK: (decoded: DecodedAsn1Key, type: PublicOrPrivate) => JsonWebKey;