How to use the libsodium-wrappers-sumo.memzero 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 wireapp / wire-web-packages / packages / proteus / src / main / util / MemoryUtil.ts View on Github external
function zeroize(object: Uint8Array | ArrayBuffer | Record | undefined): void {
  if (object instanceof Uint8Array) {
    sodium.memzero(object);
  } else if (object instanceof ArrayBuffer) {
    sodium.memzero(new Uint8Array(object));
  } else if (typeof object === 'object') {
    Object.keys(object)
      .map(key => object[key])
      .forEach(val => zeroize(val));
  } else {
    return;
  }
}
github wireapp / wire-web-packages / packages / proteus / src / main / util / MemoryUtil.ts View on Github external
function zeroize(object: Uint8Array | ArrayBuffer | Record | undefined): void {
  if (object instanceof Uint8Array) {
    sodium.memzero(object);
  } else if (object instanceof ArrayBuffer) {
    sodium.memzero(new Uint8Array(object));
  } else if (typeof object === 'object') {
    Object.keys(object)
      .map(key => object[key])
      .forEach(val => zeroize(val));
  } else {
    return;
  }
}