INNER CODE UNIT · JavaScript

toUint8Array

codedogQBY/ReadAny · packages/app-expo/index.js:44

function toUint8Array(data) {
  if (data instanceof Uint8Array) {
    return data;
  }
  if (ArrayBuffer.isView(data)) {
    return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
  }
  if (data instanceof ArrayBuffer) {
    return new Uint8Array(data);
  }
  throw new TypeError("subtle.digest expects an ArrayBuffer or TypedArray");
}

const cryptoObject = globalThis.crypto ?? {};
if (!globalThis.crypto) {
  globalThis.crypto = cryptoObject;
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…