index.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * A fundamental building block of Ethereum is the underlying
  3. * cryptographic primitives.
  4. *
  5. * @_section: api/crypto:Cryptographic Functions [about-crypto]
  6. */
  7. null
  8. // We import all these so we can export lock()
  9. import { computeHmac } from "./hmac.js";
  10. import { keccak256 } from "./keccak.js";
  11. import { ripemd160 } from "./ripemd160.js";
  12. import { pbkdf2 } from "./pbkdf2.js";
  13. import { randomBytes } from "./random.js";
  14. import { scrypt, scryptSync } from "./scrypt.js";
  15. import { sha256, sha512 } from "./sha2.js";
  16. export {
  17. computeHmac,
  18. randomBytes,
  19. keccak256,
  20. ripemd160,
  21. sha256, sha512,
  22. pbkdf2,
  23. scrypt, scryptSync
  24. };
  25. export { SigningKey } from "./signing-key.js";
  26. export { Signature } from "./signature.js";
  27. /**
  28. * Once called, prevents any future change to the underlying cryptographic
  29. * primitives using the ``.register`` feature for hooks.
  30. */
  31. function lock(): void {
  32. computeHmac.lock();
  33. keccak256.lock();
  34. pbkdf2.lock();
  35. randomBytes.lock();
  36. ripemd160.lock();
  37. scrypt.lock();
  38. scryptSync.lock();
  39. sha256.lock();
  40. sha512.lock();
  41. randomBytes.lock();
  42. }
  43. export { lock };
  44. /////////////////////////////
  45. // Types
  46. export type { ProgressCallback } from "./scrypt.js";
  47. export type { SignatureLike } from "./signature.js";