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.
Usage
import * as mod from "lib/utils.ts";