scrypt.d.ts 1.1 KB

123456789101112131415161718192021222324252627282930
  1. import { Input } from './utils.js';
  2. export type ScryptOpts = {
  3. N: number;
  4. r: number;
  5. p: number;
  6. dkLen?: number;
  7. asyncTick?: number;
  8. maxmem?: number;
  9. onProgress?: (progress: number) => void;
  10. };
  11. /**
  12. * Scrypt KDF from RFC 7914.
  13. * @param password - pass
  14. * @param salt - salt
  15. * @param opts - parameters
  16. * - `N` is cpu/mem work factor (power of 2 e.g. 2**18)
  17. * - `r` is block size (8 is common), fine-tunes sequential memory read size and performance
  18. * - `p` is parallelization factor (1 is common)
  19. * - `dkLen` is output key length in bytes e.g. 32.
  20. * - `asyncTick` - (default: 10) max time in ms for which async function can block execution
  21. * - `maxmem` - (default: `1024 ** 3 + 1024` aka 1GB+1KB). A limit that the app could use for scrypt
  22. * - `onProgress` - callback function that would be executed for progress report
  23. * @returns Derived key
  24. */
  25. export declare function scrypt(password: Input, salt: Input, opts: ScryptOpts): Uint8Array;
  26. /**
  27. * Scrypt KDF from RFC 7914.
  28. */
  29. export declare function scryptAsync(password: Input, salt: Input, opts: ScryptOpts): Promise<Uint8Array>;
  30. //# sourceMappingURL=scrypt.d.ts.map