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