diff --git a/README.md b/README.md index a37f5ee..d841f17 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ --- NOT PRODUCTION READY --- -# Multikey ↔︎ WebCrypto and JWK conversions +# Multikey ↔︎ WebCrypto and JWK conversions (Node.js version) Conversion of cryptographic keys in [Multikey format](https://www.w3.org/TR/controller-document/#multikey) to and @@ -11,7 +11,7 @@ from [WebCrypto](https://www.w3.org/TR/WebCryptoAPI/) and [JWK](https://datatrac This is really a proof-of-concept implementation. It shows that such conversion _can indeed be done_, which is an important in proving the practical usability of multikeys. -The package has been written in TypeScript+Node.js. (There is also a Deno version.) +The package has been written in TypeScript+Node.js. (There is also a [Typescript+Deno version](https://github.com/iherman/multikey-webcrypto-d).) For a more detailed documentation, see the [code documentation](https://iherman.github.io/multikey-webcrypto/), generated by typedoc. A short set of examples may help. diff --git a/docs/enums/lib_common.CryptoCurves.html b/docs/enums/lib_common.CryptoCurves.html index 1706a0e..c204c9a 100644 --- a/docs/enums/lib_common.CryptoCurves.html +++ b/docs/enums/lib_common.CryptoCurves.html @@ -1,5 +1,5 @@ CryptoCurves | Conversions to and from multikeys and WebCrypto - v0.0.1

Names for the various crypto curve

-

Enumeration Members

Enumeration Members

Enumeration Members

ECDSA_384: "secp384r1"
ECDSA_256: "secp256r1"
EDDSA: "ed25519"
+

Enumeration Members

ECDSA_384: "secp384r1"
ECDSA_256: "secp256r1"
EDDSA: "ed25519"
diff --git a/docs/enums/lib_common.CryptoKeyTypes.html b/docs/enums/lib_common.CryptoKeyTypes.html index bf6fa2e..9341828 100644 --- a/docs/enums/lib_common.CryptoKeyTypes.html +++ b/docs/enums/lib_common.CryptoKeyTypes.html @@ -1,4 +1,4 @@ CryptoKeyTypes | Conversions to and from multikeys and WebCrypto - v0.0.1

Names for the key types

-

Enumeration Members

Enumeration Members

Enumeration Members

PUBLIC: "public"
SECRET: "secret"
+

Enumeration Members

PUBLIC: "public"
SECRET: "secret"
diff --git a/docs/functions/index.JWKToMultikey.html b/docs/functions/index.JWKToMultikey.html index 76c2fb7..4587f93 100644 --- a/docs/functions/index.JWKToMultikey.html +++ b/docs/functions/index.JWKToMultikey.html @@ -7,8 +7,8 @@

Parameters

Returns Multikey

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

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

    Parameters

    Returns Multibase

    -
  • +
    diff --git a/docs/functions/index.cryptoToMultikey.html b/docs/functions/index.cryptoToMultikey.html index 663d7eb..c3d16c6 100644 --- a/docs/functions/index.cryptoToMultikey.html +++ b/docs/functions/index.cryptoToMultikey.html @@ -5,8 +5,8 @@

    Parameters

    Returns Promise<Multikey>

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

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

    Parameters

    Returns Promise<Multibase>

    -
  • +
    diff --git a/docs/functions/index.multikeyToCrypto.html b/docs/functions/index.multikeyToCrypto.html index 6dee36c..1a0062d 100644 --- a/docs/functions/index.multikeyToCrypto.html +++ b/docs/functions/index.multikeyToCrypto.html @@ -5,8 +5,8 @@

    Parameters

    Returns Promise<CryptoKeyPair>

    -
  • Overloaded version of the conversion function for a single (public) key in Multikey, returning the generated Crypto Key.

    +
  • Overloaded version of the conversion function for a single (public) key in Multikey, returning the generated Crypto Key.

    Parameters

    Returns Promise<CryptoKey>

    -
  • +
    diff --git a/docs/functions/index.multikeyToJWK.html b/docs/functions/index.multikeyToJWK.html index 30648fb..fae2570 100644 --- a/docs/functions/index.multikeyToJWK.html +++ b/docs/functions/index.multikeyToJWK.html @@ -5,8 +5,8 @@

    Parameters

    Returns JWKKeyPair

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

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

    Parameters

    Returns JsonWebKey

    -
  • +
    diff --git a/docs/functions/lib_common.preambleToCryptoData.html b/docs/functions/lib_common.preambleToCryptoData.html index b5ac4fc..7ed9b9c 100644 --- a/docs/functions/lib_common.preambleToCryptoData.html +++ b/docs/functions/lib_common.preambleToCryptoData.html @@ -1,4 +1,4 @@ preambleToCryptoData | Conversions to and from multikeys and WebCrypto - v0.0.1
    • 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.

      -

      Parameters

      Returns CryptoKeyData

    +

    Parameters

    Returns CryptoKeyData

    diff --git a/docs/functions/lib_convert.JWKToMultikey.html b/docs/functions/lib_convert.JWKToMultikey.html index dac62ac..ec0d050 100644 --- a/docs/functions/lib_convert.JWKToMultikey.html +++ b/docs/functions/lib_convert.JWKToMultikey.html @@ -4,4 +4,4 @@ those that would lead to error in this cose. 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

    Returns Multikey

    +

    Parameters

    Returns Multikey

    diff --git a/docs/functions/lib_convert.multikeyToJWK.html b/docs/functions/lib_convert.multikeyToJWK.html index 6e42970..a586e5a 100644 --- a/docs/functions/lib_convert.multikeyToJWK.html +++ b/docs/functions/lib_convert.multikeyToJWK.html @@ -5,4 +5,4 @@

    Parameters

    Returns JWKKeyPair

    -
    +
    diff --git a/docs/functions/lib_ecdsa.JWKToMultikeyBinary.html b/docs/functions/lib_ecdsa.JWKToMultikeyBinary.html index a4fa283..6e3a594 100644 --- a/docs/functions/lib_ecdsa.JWKToMultikeyBinary.html +++ b/docs/functions/lib_ecdsa.JWKToMultikeyBinary.html @@ -8,4 +8,4 @@
  • x: Uint8Array

    x value for the elliptical curve

  • d: Uint8Array

    d (private) value for the elliptical curve

  • Optionaly: Uint8Array

    y value for the elliptical curve

    -
  • Returns MultikeyBinary

    +

    Returns MultikeyBinary

    diff --git a/docs/functions/lib_ecdsa.multikeyBinaryToJWK.html b/docs/functions/lib_ecdsa.multikeyBinaryToJWK.html index fcb333d..370d6e5 100644 --- a/docs/functions/lib_ecdsa.multikeyBinaryToJWK.html +++ b/docs/functions/lib_ecdsa.multikeyBinaryToJWK.html @@ -6,4 +6,4 @@

    Parameters

    Returns JWKKeyPair

    +

    Returns JWKKeyPair

    diff --git a/docs/functions/lib_eddsa.JWKToMultikeyBinary.html b/docs/functions/lib_eddsa.JWKToMultikeyBinary.html index 8452a71..1cbd267 100644 --- a/docs/functions/lib_eddsa.JWKToMultikeyBinary.html +++ b/docs/functions/lib_eddsa.JWKToMultikeyBinary.html @@ -6,4 +6,4 @@
  • x: Uint8Array

    x value for the elliptical curve, as extracted from JWK

  • d: Uint8Array

    d (private) value for the elliptical curve, as extracted from JWK

  • Optional_y: Uint8Array

    unused in this function, just a placeholder

    -
  • Returns MultikeyBinary

    +

    Returns MultikeyBinary

    diff --git a/docs/functions/lib_eddsa.multikeyBinaryToJWK.html b/docs/functions/lib_eddsa.multikeyBinaryToJWK.html index a6f6647..2ef0cb6 100644 --- a/docs/functions/lib_eddsa.multikeyBinaryToJWK.html +++ b/docs/functions/lib_eddsa.multikeyBinaryToJWK.html @@ -6,4 +6,4 @@

    Parameters

    Returns JWKKeyPair

    +

    Returns JWKKeyPair

    diff --git a/docs/index.html b/docs/index.html index d956b22..0de504e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,10 +1,10 @@ Conversions to and from multikeys and WebCrypto - v0.0.1

    Conversions to and from multikeys and WebCrypto - v0.0.1

    --- NOT PRODUCTION READY ---

    -

    Multikey ↔︎ WebCrypto and JWK conversions

    Conversion of cryptographic keys in Multikey format to and +

    Multikey ↔︎ WebCrypto and JWK conversions (Node.js version)

    Conversion of cryptographic keys in Multikey format to and from WebCrypto and JWK. The conversions are available for the three EC curves that are defined for Verifiable Credentials: ECDSA with P-256 and P-384 and EDDSA.

    This is really a proof-of-concept implementation. It shows that such conversion can indeed be done, which is an important in proving the practical usability of multikeys.

    -

    The package has been written in TypeScript+Node.js. (There is also a Deno version.)

    +

    The package has been written in TypeScript+Node.js. (There is also a Typescript+Deno version.)

    For a more detailed documentation, see the code documentation, generated by typedoc. A short set of examples may help.

    The interface makes use of the JsonWebKey, CryptoKeyPair, and CryptoKey types, which are global types in Node.js (or Deno), defined by WebCrypto.

    export interface JWKKeyPair {
    public: JsonWebKey;
    secret?: JsonWebKey;
    }

    export type Multibase = string;

    export interface Multikey {
    publicKeyMultibase: Multibase;
    secretKeyMultibase?: Multibase;
    } @@ -27,4 +27,4 @@
    import * as mkc from "multikey-webcrypto";

    const mk: Multikey = mkc.cryptoToMultikey(your_web_crypto_public_key);
    // mk the encoded value

    // Convert the multikey back to jwk
    const generated_crypto_key: JWKKeyPair = mkc.multikeyToJWK(mk);
    -
    +
    diff --git a/docs/interfaces/lib_common.CryptoKeyData.html b/docs/interfaces/lib_common.CryptoKeyData.html index c895f21..3a976ea 100644 --- a/docs/interfaces/lib_common.CryptoKeyData.html +++ b/docs/interfaces/lib_common.CryptoKeyData.html @@ -1,5 +1,5 @@ CryptoKeyData | Conversions to and from multikeys and WebCrypto - v0.0.1

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

    So far, I have not yet found a way to encode that in a simple table, hence the separate function.

    -
    interface CryptoKeyData {
        crCurve: CryptoCurves;
        crType: CryptoKeyTypes;
    }

    Properties

    interface CryptoKeyData {
        crCurve: CryptoCurves;
        crType: CryptoKeyTypes;
    }

    Properties

    Properties

    crCurve: CryptoCurves
    +

    Properties

    crCurve: CryptoCurves
    diff --git a/docs/interfaces/lib_common.JWKKeyPair.html b/docs/interfaces/lib_common.JWKKeyPair.html index c58c2d8..7fa02c2 100644 --- a/docs/interfaces/lib_common.JWKKeyPair.html +++ b/docs/interfaces/lib_common.JWKKeyPair.html @@ -1,4 +1,4 @@ JWKKeyPair | Conversions to and from multikeys and WebCrypto - v0.0.1
    +

    Properties

    public: JsonWebKey
    secret?: JsonWebKey
    diff --git a/docs/interfaces/lib_common.Multikey.html b/docs/interfaces/lib_common.Multikey.html index cacc7e1..a12201a 100644 --- a/docs/interfaces/lib_common.Multikey.html +++ b/docs/interfaces/lib_common.Multikey.html @@ -1,5 +1,5 @@ Multikey | Conversions to and from multikeys and WebCrypto - v0.0.1
    +

    Properties

    publicKeyMultibase: string
    secretKeyMultibase?: string
    diff --git a/docs/interfaces/lib_common.MultikeyBinary.html b/docs/interfaces/lib_common.MultikeyBinary.html index b448228..db9d036 100644 --- a/docs/interfaces/lib_common.MultikeyBinary.html +++ b/docs/interfaces/lib_common.MultikeyBinary.html @@ -1,4 +1,4 @@ MultikeyBinary | Conversions to and from multikeys and WebCrypto - v0.0.1

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

    -
    interface MultikeyBinary {
        public: Uint8Array;
        secret?: Uint8Array;
    }

    Properties

    interface MultikeyBinary {
        public: Uint8Array;
        secret?: Uint8Array;
    }

    Properties

    Properties

    public: Uint8Array
    secret?: Uint8Array
    +

    Properties

    public: Uint8Array
    secret?: Uint8Array
    diff --git a/docs/modules/index.html b/docs/modules/index.html index f2f8f9b..ef93799 100644 --- a/docs/modules/index.html +++ b/docs/modules/index.html @@ -1,4 +1,4 @@ -index | Conversions to and from multikeys and WebCrypto - v0.0.1

    References

    JWKKeyPair +index | Conversions to and from multikeys and WebCrypto - v0.0.1

    References

    Functions

    multikeyToJWK diff --git a/docs/modules/lib_common.html b/docs/modules/lib_common.html index 6ccd447..64916a5 100644 --- a/docs/modules/lib_common.html +++ b/docs/modules/lib_common.html @@ -1,5 +1,5 @@ lib/common | Conversions to and from multikeys and WebCrypto - v0.0.1

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

    -

    Index

    Enumerations

    Index

    Enumerations

    Interfaces

    JWKKeyPair Multikey diff --git a/docs/modules/lib_convert.html b/docs/modules/lib_convert.html index f13f591..b06c35b 100644 --- a/docs/modules/lib_convert.html +++ b/docs/modules/lib_convert.html @@ -1,4 +1,4 @@ lib/convert | Conversions to and from multikeys and WebCrypto - v0.0.1
    diff --git a/docs/modules/lib_ecdsa.html b/docs/modules/lib_ecdsa.html index fbf1717..3791c66 100644 --- a/docs/modules/lib_ecdsa.html +++ b/docs/modules/lib_ecdsa.html @@ -2,6 +2,6 @@ which must be compressed when creating the Multikey representation, and decompressed for the JWK conversion.

    The two exported functions, used by the rest of the package, just branch out to the internal functions that do the key (de)compression itself.

    -

    Index

    Functions

    Index

    Functions

    diff --git a/docs/modules/lib_eddsa.html b/docs/modules/lib_eddsa.html index 7faf233..27a0f98 100644 --- a/docs/modules/lib_eddsa.html +++ b/docs/modules/lib_eddsa.html @@ -1,5 +1,5 @@ lib/eddsa | Conversions to and from multikeys and WebCrypto - v0.0.1
    diff --git a/docs/types/lib_common.ClassToDecoder.html b/docs/types/lib_common.ClassToDecoder.html index 63846c8..e8c4c01 100644 --- a/docs/types/lib_common.ClassToDecoder.html +++ b/docs/types/lib_common.ClassToDecoder.html @@ -1,2 +1,2 @@ ClassToDecoder | Conversions to and from multikeys and WebCrypto - v0.0.1
    +
    diff --git a/docs/types/lib_common.ClassToEncoder.html b/docs/types/lib_common.ClassToEncoder.html index 7756a53..37e08b6 100644 --- a/docs/types/lib_common.ClassToEncoder.html +++ b/docs/types/lib_common.ClassToEncoder.html @@ -1,2 +1,2 @@ ClassToEncoder | Conversions to and from multikeys and WebCrypto - v0.0.1
    +
    diff --git a/docs/types/lib_common.ClassToPreamble.html b/docs/types/lib_common.ClassToPreamble.html index 9bf2b37..82a8348 100644 --- a/docs/types/lib_common.ClassToPreamble.html +++ b/docs/types/lib_common.ClassToPreamble.html @@ -1,2 +1,2 @@ ClassToPreamble | Conversions to and from multikeys and WebCrypto - v0.0.1
    +
    diff --git a/docs/types/lib_common.Multibase.html b/docs/types/lib_common.Multibase.html index 3c5c383..a8233a0 100644 --- a/docs/types/lib_common.Multibase.html +++ b/docs/types/lib_common.Multibase.html @@ -1,3 +1,3 @@ Multibase | Conversions to and from multikeys and WebCrypto - v0.0.1
    Multibase: string

    Type for a Multibase

    One day this could become a string with a fixed regexp...

    -
    +
    diff --git a/docs/types/lib_common.Preamble.html b/docs/types/lib_common.Preamble.html index 15e3dab..325c25b 100644 --- a/docs/types/lib_common.Preamble.html +++ b/docs/types/lib_common.Preamble.html @@ -1,2 +1,2 @@ Preamble | Conversions to and from multikeys and WebCrypto - v0.0.1
    Preamble<T>: [T, T]

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

    -

    Type Parameters

    • T
    +

    Type Parameters

    diff --git a/docs/variables/lib_common.ECDSACurves.html b/docs/variables/lib_common.ECDSACurves.html index 652ab5a..b8c443e 100644 --- a/docs/variables/lib_common.ECDSACurves.html +++ b/docs/variables/lib_common.ECDSACurves.html @@ -1,3 +1,3 @@ ECDSACurves | Conversions to and from multikeys and WebCrypto - v0.0.1
    ECDSACurves: CryptoCurves[] = ...

    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)?

    -
    +
    diff --git a/docs/variables/lib_common.Ecdsa256Preambles.html b/docs/variables/lib_common.Ecdsa256Preambles.html index f3a525b..dd90ef5 100644 --- a/docs/variables/lib_common.Ecdsa256Preambles.html +++ b/docs/variables/lib_common.Ecdsa256Preambles.html @@ -1,2 +1,2 @@ Ecdsa256Preambles | Conversions to and from multikeys and WebCrypto - v0.0.1
    Ecdsa256Preambles: MultikeyPreambles = ...

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

    -
    +
    diff --git a/docs/variables/lib_common.Ecdsa384Preambles.html b/docs/variables/lib_common.Ecdsa384Preambles.html index acc4c3c..883292e 100644 --- a/docs/variables/lib_common.Ecdsa384Preambles.html +++ b/docs/variables/lib_common.Ecdsa384Preambles.html @@ -1,2 +1,2 @@ Ecdsa384Preambles | Conversions to and from multikeys and WebCrypto - v0.0.1
    Ecdsa384Preambles: MultikeyPreambles = ...

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

    -
    +
    diff --git a/docs/variables/lib_common.EddsaPreambles.html b/docs/variables/lib_common.EddsaPreambles.html index 5bfb5c5..b9cd56b 100644 --- a/docs/variables/lib_common.EddsaPreambles.html +++ b/docs/variables/lib_common.EddsaPreambles.html @@ -1,2 +1,2 @@ EddsaPreambles | Conversions to and from multikeys and WebCrypto - v0.0.1
    EddsaPreambles: MultikeyPreambles = ...

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

    -
    +
    diff --git a/docs/variables/lib_common.classToDecoder-1.html b/docs/variables/lib_common.classToDecoder-1.html index 764d142..405c6d7 100644 --- a/docs/variables/lib_common.classToDecoder-1.html +++ b/docs/variables/lib_common.classToDecoder-1.html @@ -1,2 +1,2 @@ classToDecoder | Conversions to and from multikeys and WebCrypto - v0.0.1
    classToDecoder: ClassToDecoder = ...

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

    -
    +
    diff --git a/docs/variables/lib_common.classToEncoder-1.html b/docs/variables/lib_common.classToEncoder-1.html index 3614473..1db48f3 100644 --- a/docs/variables/lib_common.classToEncoder-1.html +++ b/docs/variables/lib_common.classToEncoder-1.html @@ -1,2 +1,2 @@ classToEncoder | Conversions to and from multikeys and WebCrypto - v0.0.1
    classToEncoder: ClassToEncoder = ...

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

    -
    +
    diff --git a/docs/variables/lib_common.classToPreamble-1.html b/docs/variables/lib_common.classToPreamble-1.html index fe418ad..c696508 100644 --- a/docs/variables/lib_common.classToPreamble-1.html +++ b/docs/variables/lib_common.classToPreamble-1.html @@ -1,2 +1,2 @@ classToPreamble | Conversions to and from multikeys and WebCrypto - v0.0.1
    classToPreamble: ClassToPreamble = ...

    What preambles must be used for a Curve?

    -
    +