default

--- NOT PRODUCTION READY. WOULD NEED INTEROPERABILITY TESTS---

f
cryptoToMultikey

Convert a Crypto Key pair to Multikeys. This function exports the cryptokeys into a JWK Key pair, and uses the JWKToMultikey function.

I
JWKKeyPair

Public/secret pair of JWK instances

f
JWKToMultikey

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.

T
Multibase

Type for a Multibase

I
Multikey

Pair of keys in Multibase encoding. Using the field names as defined in the Multikey specification.

f
multikeyToCrypto

Convert a multikey pair to Web Crypto. This function decodes the multikey data into JWK using the multikeyToJWK function, and imports the resulting keys into Web Crypto.

f
multikeyToJWK

Convert a multikey pair to JWK. This function decodes the multikey data into a binary buffer, checks the preambles and invokes the crypto specific converter functions (depending on the preamble values) that do the final conversion from the binary data to JWK.

lib/common.ts

Common types, conversion functions and Multikey conversion utilities for the rest of the code.

T
ClassToDecoder

Type definition for the table mapping curves to their decoder functions (i.e., mapping the Multikey to JWK).

v
classToDecoder

What coder function must be used to convert from Multikey to JWK (data)?

T
ClassToEncoder

Type definition for the table mapping curves to their encoder functions (i.e., mapping the JWK to Multikey).

v
classToEncoder

What coder function must be used to convert from JWK to Multikey?

T
ClassToPreamble

Type definition for the table mapping preambles to a specific curve.

v
classToPreamble

What preambles must be used for a Curve?

E
CryptoCurves

Names for the various crypto curves

I
CryptoKeyData

This is an internal type, used for the implementation: return the crypto curve and type from a multikey preamble.

E
CryptoKeyTypes

Names for the key types

v
Ecdsa256Preambles

Preamble for ECDSA P-256, a.k.a. secp256r1 curve

v
Ecdsa384Preambles

Preamble for ECDSA P-384, a.k.a. secp384r1 curve

v
ECDSACurves

List of possible ECDSA Curves. Having this here declaratively may make it easier if in the future, a new curve is added to the family (P-512)?

v
EddsaPreambles

Preamble value for EDDSA, a.k.a. ed25519 curve

I
JWKKeyPair

Public/secret pair of JWK instances

T
Multibase

Type for a Multibase

I
Multikey

Pair of keys in Multibase encoding. Using the field names as defined in the Multikey specification.

I
MultikeyBinary

Same as the Multikey, but decoded and without the preambles. I.e., just the bare key values.

T
Preamble

Type used for preambles, which are, so far, a single pair of numbers.

f
preambleToCryptoData

Classify the crypto key based on the multikey preamble characters that are at the start of the code. These are two binary numbers, signalling the crypto category (ecdsa or eddsa) and, in the former case, the additional reference to the exact curve.

lib/convert.ts

The real work for the whole library are done in the main functions in this module.

f
JWKToMultikey

Convert 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.

f
multikeyToJWK

Generic function to convert a multikey pair to JWK. This function decodes the multikey data into a binary buffer, checks the preambles and invokes the crypto curve specific converter functions (depending on the preamble values) that do the final conversion from the binary data to JWK.

lib/ecdsa.ts

Base conversion functions for ECDSA. The Multikey definition requires the usage of a compressed public key which must be compressed when creating the Multikey representation, and decompressed for the JWK conversion.

f
JWKToMultikeyBinary

Convert the Crypto values from JWK to the equivalent Multikey Pairs' binary data. The final encoding, with preambles, are done in the general level.

f
multikeyBinaryToJWK

Convert the multikey values to their JWK equivalents. The final x and d values are encoded in base64 and then the relevant JWK structure are created

lib/eddsa.ts

Base conversion functions for EDDSA. The functions are straightforward, but the interfaces are made so that they coincide with the companion functions in ECDSA.

f
JWKToMultikeyBinary

Convert the Crypto values from JWK to the equivalent Multikey Pairs' binary data. The final encoding, with preambles, are done in the general level.

f
multikeyBinaryToJWK

Convert the multikey values to their JWK equivalents. The final x and d values are encoded in base64 and then the relevant JWK structure are created