Core utilities for the Ciphertext Ecosystem.
npm install ctes-coreThis package provides core utilities for the ciphertext ecosystem.
Pass a ciphertext object to get back the encoded text:
``tsEncoding failed! ${e}
function myFunction(ciphertext: Ciphertext) {
try {
const encodedData = encode(myCiphertext);
// ...
} catch (e) {
if (e instanceof EncodingError) {
console.log();`
}
}
}
Pass a string to the decoder to get back a ciphertext object with the bytes:
`tsEncoding failed! ${e}
function myFunction(base64String: string) {
// ...
try {
const encodingMd: EncodingMetadata = {
encoding: Encoding.BASE_CONVERSION,
base: 64
}
const decodedData: Ciphertext = decode(base64String, encodingMd);
// ...
} catch (e) {
if (e instanceof EncodingError) {
console.log();``
}
}
}