Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

nacl.d.ts 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // Type definitions for TweetNaCl.js
  2. export as namespace nacl;
  3. declare var nacl: nacl;
  4. export = nacl;
  5. declare namespace nacl {
  6. export interface BoxKeyPair {
  7. publicKey: Uint8Array;
  8. secretKey: Uint8Array;
  9. }
  10. export interface SignKeyPair {
  11. publicKey: Uint8Array;
  12. secretKey: Uint8Array;
  13. }
  14. export interface secretbox {
  15. (msg: Uint8Array, nonce: Uint8Array, key: Uint8Array): Uint8Array;
  16. open(box: Uint8Array, nonce: Uint8Array, key: Uint8Array): Uint8Array | false;
  17. readonly keyLength: number;
  18. readonly nonceLength: number;
  19. readonly overheadLength: number;
  20. }
  21. export interface scalarMult {
  22. (n: Uint8Array, p: Uint8Array): Uint8Array;
  23. base(n: Uint8Array): Uint8Array;
  24. readonly scalarLength: number;
  25. readonly groupElementLength: number;
  26. }
  27. namespace box {
  28. export interface open {
  29. (msg: Uint8Array, nonce: Uint8Array, publicKey: Uint8Array, secretKey: Uint8Array): Uint8Array | false;
  30. after(box: Uint8Array, nonce: Uint8Array, key: Uint8Array): Uint8Array | false;
  31. }
  32. export interface keyPair {
  33. (): BoxKeyPair;
  34. fromSecretKey(secretKey: Uint8Array): BoxKeyPair;
  35. }
  36. }
  37. export interface box {
  38. (msg: Uint8Array, nonce: Uint8Array, publicKey: Uint8Array, secretKey: Uint8Array): Uint8Array;
  39. before(publicKey: Uint8Array, secretKey: Uint8Array): Uint8Array;
  40. after(msg: Uint8Array, nonce: Uint8Array, key: Uint8Array): Uint8Array;
  41. open: box.open;
  42. keyPair: box.keyPair;
  43. readonly publicKeyLength: number;
  44. readonly secretKeyLength: number;
  45. readonly sharedKeyLength: number;
  46. readonly nonceLength: number;
  47. readonly overheadLength: number;
  48. }
  49. namespace sign {
  50. export interface detached {
  51. (msg: Uint8Array, secretKey: Uint8Array): Uint8Array;
  52. verify(msg: Uint8Array, sig: Uint8Array, publicKey: Uint8Array): boolean;
  53. }
  54. export interface keyPair {
  55. (): SignKeyPair;
  56. fromSecretKey(secretKey: Uint8Array): SignKeyPair;
  57. fromSeed(secretKey: Uint8Array): SignKeyPair;
  58. }
  59. }
  60. export interface sign {
  61. (msg: Uint8Array, secretKey: Uint8Array): Uint8Array;
  62. open(signedMsg: Uint8Array, publicKey: Uint8Array): Uint8Array | null;
  63. detached: sign.detached;
  64. keyPair: sign.keyPair;
  65. readonly publicKeyLength: number;
  66. readonly secretKeyLength: number;
  67. readonly seedLength: number;
  68. readonly signatureLength: number;
  69. }
  70. export interface hash {
  71. (msg: Uint8Array): Uint8Array;
  72. readonly hashLength: number;
  73. }
  74. }
  75. declare interface nacl {
  76. randomBytes(n: number): Uint8Array;
  77. secretbox: nacl.secretbox;
  78. scalarMult: nacl.scalarMult;
  79. box: nacl.box;
  80. sign: nacl.sign;
  81. hash: nacl.hash;
  82. verify(x: Uint8Array, y: Uint8Array): boolean;
  83. setPRNG(fn: (x: Uint8Array, n: number) => void): void;
  84. }