How to use the libsodium-wrappers-sumo.to_base64 function in libsodium-wrappers-sumo

To help you get started, we’ve selected a few libsodium-wrappers-sumo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kryptco / kr-u2f / src / crypto.ts View on Github external
export async function to_base64(d: string | Uint8Array) {
    await sodium.ready;
    return sodium.to_base64(d, sodium.base64_variants.ORIGINAL);
}
github kryptco / kr-u2f / src / crypto.ts View on Github external
export async function to_base64_url(d: string | Uint8Array) {
    await sodium.ready;
    return sodium.to_base64(d, sodium.base64_variants.URLSAFE);
}
github wireapp / wire-webapp / src / script / util / util.ts View on Github external
export const arrayToBase64 = async (array: ArrayBuffer | Uint8Array): Promise => {
  await sodium.ready;
  return sodium.to_base64(new Uint8Array(array), sodium.base64_variants.ORIGINAL);
};
github TankerHQ / quickstart-examples / server / src / auth.js View on Github external
const generatePasswordResetToken = ({ userId, secret }) => {
  const asString = JSON.stringify({ userId, secret });
  const buf = sodium.from_string(asString);
  return sodium.to_base64(buf);
};