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

Licensed by under the W3C Software and Document License, https://www.w3.org/Consortium/Legal/copyright-software. Copyright ©2024 World Wide Web Consortium. https://www.w3.org/copyright/software-license-2023/

Enums

E
CryptoCurves

Names for the various crypto curves

E
CryptoKeyTypes

Names for the key types

Functions

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.

Interfaces

I
CryptoKeyData

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

I
JWKKeyPair

Public/secret pair of JWK instances

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.

Type Aliases

T
ClassToDecoder

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

T
ClassToEncoder

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

T
ClassToPreamble

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

T
Multibase

Type for a Multibase

T
Preamble

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

Variables

v
classToDecoder

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

v
classToEncoder

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

v
classToPreamble

What preambles must be used for a Curve?

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