encodeStringifiedBlobToCbor
encodeStringifiedBlobToCbor(
blob
):Promise
<string
>
Encodes a stringified blob into CBOR format.
This function takes a string representing a serialized blob, validates its serialization, and then encodes it into the CBOR format. The resulting CBOR blob is returned as a base64-encoded string.
Parameters
• blob: string
A string representing the serialized blob that needs to be encoded.
Returns
Promise
<string
>
A promise that resolves to a base64-encoded string of the CBOR representation of the input blob.
Throws
If the input blob is not a valid serialized string.
Example
const cborBlob = await encodeStringifiedBlobToCbor('{"key": "value"}');// cborBlob will contain the base64-encoded CBOR representation of the input blob.