function JWKToMultikey
JWKToMultikey(keys: JWKKeyPair): Multikey

Convert a JWK Key pair to Multikeys. This function decodes the JWK keys, finds out which binary key it encodes and, converts the key to the multikey versions depending on the exact curve.

Note that the code does not check (yet?) all combination of JWK pairs and fields for possible errors, only those that would lead to error in this package. E.g., it does not check whether the x (and possibly y) values are identical in the secret and private JWK keys.

Works for ecdsa (both P-384 and P-256), and eddsa.

Parameters

Return Type

Throws

  • exceptions if something is incorrect in the incoming data
JWKToMultikey(keys: JsonWebKey): Multibase

Overloaded version of the conversion function for a single (public) key in JWK, returning the generated Multikey.

Parameters

Return Type

Throws

  • exceptions if something is incorrect in the incoming data

Usage

import { JWKToMultikey } from ".";