add jsdoc linting, address issues
[squeep-mystery-box] / lib / version-parameters.js
1 'use strict';
2
3 /**
4 * Supported packings/cipher types.
5 * To be useful, any cipher included here must be Authenticated Encryption with Additional Data (AEAD).
6 * More preferable versions are numbered higher.
7 */
8 const allVersions = {
9 1: {
10 version: 1,
11 algorithm: 'aes-256-gcm',
12 algOptions: {},
13 versionBytes: 1,
14 flagsBytes: 1,
15 ivBytes: 12,
16 saltBytes: 16,
17 tagBytes: 16,
18 keyDeriver: 'scrypt',
19 keyBytes: 32,
20 },
21 2: {
22 version: 2,
23 algorithm: 'chacha20-poly1305', // Prefer this over NIST because we stan djb
24 algOptions: {
25 authTagLength: 16,
26 },
27 versionBytes: 1,
28 flagsBytes: 1,
29 ivBytes: 12,
30 saltBytes: 16,
31 tagBytes: 16,
32 keyDeriver: 'scrypt',
33 keyBytes: 32,
34 },
35 3: {
36 version: 3,
37 algorithm: 'xchacha20-poly1305', // Not yet available, but would prefer even more...
38 algOptions: {
39 authTagLength: 16,
40 },
41 versionBytes: 1,
42 flagsBytes: 1,
43 ivBytes: 24,
44 saltBytes: 16,
45 tagBytes: 16,
46 keyDeriver: 'scrypt',
47 keyBytes: 32,
48 },
49 4: {
50 version: 4,
51 algorithm: 'aes-256-gcm',
52 algOptions: {},
53 versionBytes: 1,
54 flagsBytes: 1,
55 ivBytes: 12,
56 saltBytes: 16,
57 tagBytes: 16,
58 keyDeriver: 'shake256',
59 keyBytes: 32,
60 },
61 5: {
62 version: 5,
63 algorithm: 'chacha20-poly1305',
64 algOptions: {
65 authTagLength: 16,
66 },
67 versionBytes: 1,
68 flagsBytes: 1,
69 ivBytes: 12,
70 saltBytes: 16,
71 tagBytes: 16,
72 keyDeriver: 'shake256',
73 keyBytes: 32,
74 },
75 6: {
76 version: 6,
77 algorithm: 'xchacha20-poly1305', // Not yet available, but would prefer even more...
78 algOptions: {
79 authTagLength: 16,
80 },
81 versionBytes: 1,
82 flagsBytes: 1,
83 ivBytes: 24,
84 saltBytes: 16,
85 tagBytes: 16,
86 keyDeriver: 'shake256',
87 keyBytes: 32,
88 },
89 7: {
90 version: 7,
91 algorithm: 'aes-256-gcm',
92 algOptions: {},
93 versionBytes: 1,
94 flagsBytes: 1,
95 ivBytes: 12,
96 saltBytes: 16,
97 tagBytes: 16,
98 keyDeriver: 'blake2b512',
99 keyBytes: 32,
100 },
101 8: {
102 version: 8,
103 algorithm: 'chacha20-poly1305',
104 algOptions: {
105 authTagLength: 16,
106 },
107 versionBytes: 1,
108 flagsBytes: 1,
109 ivBytes: 12,
110 saltBytes: 16,
111 tagBytes: 16,
112 keyDeriver: 'blake2b512',
113 keyBytes: 32,
114 },
115 9: {
116 version: 9,
117 algorithm: 'xchacha20-poly1305', // Not yet available, but would prefer even more...
118 algOptions: {
119 authTagLength: 16,
120 },
121 versionBytes: 1,
122 flagsBytes: 1,
123 ivBytes: 24,
124 saltBytes: 16,
125 tagBytes: 16,
126 keyDeriver: 'blake2b512',
127 keyBytes: 32,
128 },
129 };
130
131 module.exports = allVersions;