cafe-utility 35.0.1 → 36.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.d.ts +22 -3
  2. package/index.js +1607 -1478
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -661,7 +661,19 @@ declare function compressPublicKey(publicKey: [bigint, bigint]): Uint8Array
661
661
  declare function publicKeyFromCompressed(compressed: Uint8Array): [bigint, bigint]
662
662
  declare function publicKeyToAddress(publicKey: [bigint, bigint]): Uint8Array
663
663
  declare function checksumEncode(addressBytes: Uint8Array): string
664
+ /**
665
+ * @deprecated Use a constant-time signing implementation instead.
666
+ * The underlying scalar multiplication is variable-time and leaks private key
667
+ * bits through timing. Safe only in environments where the caller has no
668
+ * exposure to timing side channels.
669
+ */
664
670
  declare function signMessage(message: Uint8Array, privateKey: bigint, nonce?: bigint): [bigint, bigint, 27n | 28n]
671
+ /**
672
+ * @deprecated Use a constant-time signing implementation instead.
673
+ * The underlying scalar multiplication is variable-time and leaks private key
674
+ * bits through timing. Safe only in environments where the caller has no
675
+ * exposure to timing side channels.
676
+ */
665
677
  declare function signHash(hash: bigint, privateKey: bigint, nonce?: bigint): [bigint, bigint, 27n | 28n]
666
678
  declare function recoverPublicKey(message: Uint8Array, r: bigint, s: bigint, v: 27n | 28n): [bigint, bigint]
667
679
  declare function verifySignature(message: Uint8Array, publicKey: [bigint, bigint], r: bigint, s: bigint): boolean
@@ -700,14 +712,20 @@ export declare class Chunk {
700
712
  data: Uint8Array
701
713
  }
702
714
  }
715
+ export type ChunkEntry = {
716
+ chunk: Chunk
717
+ key?: Uint8Array
718
+ }
703
719
  export declare class ChunkSplitter {
704
- static readonly NOOP: (_: Chunk, _key?: Uint8Array) => Promise<void>
720
+ static readonly NOOP: (_: ChunkEntry[]) => Promise<ChunkEntry[]>
705
721
  private refSize
706
722
  private encrypted
723
+ private maxShards
707
724
  private chunks
708
725
  private counters
709
- private onChunk
710
- constructor(onChunk: (chunk: Chunk, key?: Uint8Array) => Promise<void>, encrypted?: boolean)
726
+ private pending
727
+ private onBatch
728
+ constructor(onBatch: (batch: ChunkEntry[]) => Promise<ChunkEntry[]>, maxShards?: number, encrypted?: boolean)
711
729
  static root(data: Uint8Array): Promise<Chunk>
712
730
  static encryptedRoot(data: Uint8Array): Promise<{
713
731
  address: Uint8Array
@@ -715,6 +733,7 @@ export declare class ChunkSplitter {
715
733
  }>
716
734
  append(data: Uint8Array, level?: number, spanIncrement?: bigint): Promise<void>
717
735
  private elevate
736
+ private flushBatch
718
737
  finalize(level?: number): Promise<Chunk>
719
738
  }
720
739
  export declare class ChunkJoiner {