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/
Names for the various crypto curves
Names for the key types
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.
This is an internal type, used for the implementation: return the crypto curve and type from a multikey preamble.
Pair of keys in Multibase encoding. Using the field names as defined in the Multikey specification.
Same as the Multikey, but decoded and without the preambles. I.e., just the bare key values.
Type definition for the table mapping curves to their decoder functions (i.e., mapping the Multikey to JWK).
Type definition for the table mapping curves to their encoder functions (i.e., mapping the JWK to Multikey).
Type definition for the table mapping preambles to a specific curve.
Type for a Multibase
Type used for preambles, which are, so far, a single pair of numbers.
What coder function must be used to convert from Multikey to JWK (data)?
What coder function must be used to convert from JWK to Multikey?
What preambles must be used for a Curve?
Preamble for ECDSA P-256
, a.k.a. secp256r1
curve
Preamble for ECDSA P-384
, a.k.a. secp384r1
curve
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)?
Preamble value for EDDSA, a.k.a. ed25519
curve
Usage
import * as mod from "lib/common.ts";