Variable polykeyWorkerConst

polykeyWorker: {
    checkPassword(password, hash, salt, opsLimit?, memLimit?) => boolean;
    decrypt(key, cipherText) => undefined | TransferDescriptor<ArrayBuffer>;
    encrypt(key, plainText) => TransferDescriptor<ArrayBuffer>;
    generateCertificate(__namedParameters) => Promise<TransferDescriptor<ArrayBuffer>>;
    generateDeterministicKeyPair(recoveryCode) => Promise<TransferDescriptor<{
        privateKey: ArrayBuffer;
        publicKey: ArrayBuffer;
        secretKey: ArrayBuffer;
    }>>;
    hashPassword(password, salt?, opsLimit?, memLimit?) => TransferDescriptor<[ArrayBuffer, ArrayBuffer]>;
    isRunningInWorker() => boolean;
    sleep(ms) => void;
} = ...

Worker object that contains all functions that will be executed in parallel. Functions should be using CPU-parallelism not IO-parallelism. Most functions should be synchronous, not asynchronous. Making them asynchronous does not make a difference to the caller. The caller must always await because the fucntions will run on the pool.

When passing in Buffer, it is coerced into an Uint8Array. To avoid confusion, do not pass in Buffer and instead use ArrayBuffer.

If you are passing the underlying ArrayBuffer, ensure that the containing Buffer is unpooled, or make a slice copy of the underlying ArrayBuffer with the Buffer.byteOffset and Buffer.byteLength.

Remember the subtyping relationship of buffers: Buffers < Uint8Array < ArrayBuffer < BufferSource

Only the ArrayBuffer is "transferrable" which means they can be zero-copy transferred. When transferring a structure that contains ArrayBuffer, you must pass the array of transferrable objects as the second parameter to Transfer.

Only transfer things that you don't expect to be using in the sending thread.

Note that Buffer.from(ArrayBuffer) is a zero-copy wrapper.

Type declaration

  • checkPassword:function
  • decrypt:function
    • Parameters

      • key: ArrayBuffer
      • cipherText: ArrayBuffer

      Returns undefined | TransferDescriptor<ArrayBuffer>

  • encrypt:function
    • Parameters

      • key: ArrayBuffer
      • plainText: ArrayBuffer

      Returns TransferDescriptor<ArrayBuffer>

  • generateCertificate:function
    • Parameters

      • __namedParameters: {
            certId: ArrayBuffer;
            duration: number;
            issuerAttrsExtra?: {
                [key: string]: string[];
            }[];
            issuerPrivateKey: ArrayBuffer;
            now?: Date;
            subjectAttrsExtra?: {
                [key: string]: string[];
            }[];
            subjectKeyPair: {
                privateKey: ArrayBuffer;
                publicKey: ArrayBuffer;
            };
        }
        • certId: ArrayBuffer
        • duration: number
        • Optional issuerAttrsExtra?: {
              [key: string]: string[];
          }[]
        • issuerPrivateKey: ArrayBuffer
        • Optional now?: Date
        • Optional subjectAttrsExtra?: {
              [key: string]: string[];
          }[]
        • subjectKeyPair: {
              privateKey: ArrayBuffer;
              publicKey: ArrayBuffer;
          }
          • privateKey: ArrayBuffer
          • publicKey: ArrayBuffer

      Returns Promise<TransferDescriptor<ArrayBuffer>>

  • generateDeterministicKeyPair:function
    • Parameters

      Returns Promise<TransferDescriptor<{
          privateKey: ArrayBuffer;
          publicKey: ArrayBuffer;
          secretKey: ArrayBuffer;
      }>>

  • hashPassword:function
  • isRunningInWorker:function
  • sleep:function

Generated using TypeDoc