source: trip-planner-front/node_modules/tweetnacl/nacl.d.ts@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

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