default
NOT FINAL, DO NOT USE IT FOR CRITICAL APPLICATIONS
Utility function: get a JWK representation from a binary crypto key/key pair.
Convert a Crypto Key pair to Multikeys. This function exports the cryptokeys into a JWK Key pair,
and uses the JWKToMultikey function.
Generate a new public/private key pair in one of the ecdsa/eddsa/RSA crypto algorithms (the term Ed25519 can also be used for eddsa). The result is a pair or JWK format for keys.
Generate a new public/private key pair in one of the ecdsa or eddsa crypto algorithms (the term Ed25519 can also be used for eddsa). The result is a pair or Multibase formatted keys, i.e., in Multikey.
Utility function: get a binary crypto representation from a JWK encoded key/key pair.
Type for a Multibase
Pair of keys in Multibase encoding. Using the field names as defined in the Multikey specification.
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.
lib/crypto.ts
The main crypto operations: encrypt/decrypt and sign/verify. These functions are exported (via index.ts) to the external world.
lib/hash.ts
Hashing function; useful for crypto users, though not used by the rest of the package.
Calculate Hash of a string
lib/keys.ts
Key management operations: creation in binary Crypto, JWK, or Multikey formats. Note that Multikeys are only defined for ecdsa and eddsa; it cannot be used for rsa algorithms.
Crypto identifier values that are relevant for this package. "rsa" is an alias for "rsa-pss"; "ed25519" is an alias for "eddsa".
Generate a private/public key pair in one of the ecdsa/eddsa/RSA crypto algorithms (the term Ed25519 can also be used for eddsa). The result is the WebCrypto format for keys.
Convert a public/private key pair in JWK to WebCrypto's binary representation.
Convert a JWK key representation of a Key to WebCrypto's representation.
lib/types.ts
Common types for the package
Base encoding alternatives
Elliptic curves that are used for this package.
Used to overload the key argument for verify and encrypt operations
Used to overload the key argument for sign and decrypt operations. Note that a plain Multibase is not an option; the multikey secret key alone may not contain all necessary information.
Crypto hash values that are used for this package. "SHA-256" is the usual default.
Options to specify details for keys, i.e., the underlying algorithms.
Options for the output of signing/verifying and for encryption/decryption.
lib/utils.ts
Various utility functions; not meant to be exported to the external world...
Mapping of the CryptoKey instance and the corresponding terms for the WebCrypto API like sign or verify.
Array buffer to text, needed for crypto operations. The text is decoded from UTF-8, which is the default for the WebCrypto API.
Decode a string from encoded form. If the text is recognized as Multibase, the encoding format is there, otherwise
the options argument rules.
Encode the result in base58 or base64, possibly in Multibase. The options argument dictates.
Default is base64 encoding and plain output.
Type guard for a CryptoKey object.
Type guard for a CryptoKeyPair object.
Type guard for a JWK Key Pair
Type guard for a Multibase value.
Type guard for a Multikey object.
Text to array buffer, needed for crypto operations. The text is encoded in UTF-8, which is the default for the WebCrypto API.
Additional structure needed for operations such as sign or verify in the WebCrypto API. Can be extracted from the WebCrypto representation of the crypto keys, see algorithmDataCR.