support new key derivations, add new preferred versions using such
[squeep-mystery-box] / lib / version-parameters.js
index 80a09356c28c3a3bb7cc1afbeb2b570d68e133a2..9af7d49d61eee45b8ee4922abc7f6f66ab30100f 100644 (file)
@@ -15,6 +15,7 @@ const allVersions = {
     ivBytes: 12,
     saltBytes: 16,
     tagBytes: 16,
+    keyDeriver: 'scrypt',
     keyBytes: 32,
   },
   2: {
@@ -28,11 +29,12 @@ const allVersions = {
     ivBytes: 12,
     saltBytes: 16,
     tagBytes: 16,
+    keyDeriver: 'scrypt',
     keyBytes: 32,
   },
   3: {
     version: 3,
-    algorithm: 'xchacha20-poly1305', // Not yet available...
+    algorithm: 'xchacha20-poly1305', // Not yet available, but would prefer even more...
     algOptions: {
       authTagLength: 16,
     },
@@ -41,6 +43,87 @@ const allVersions = {
     ivBytes: 24,
     saltBytes: 16,
     tagBytes: 16,
+    keyDeriver: 'scrypt',
+    keyBytes: 32,
+  },
+  4: {
+    version: 4,
+    algorithm: 'aes-256-gcm',
+    algOptions: {},
+    versionBytes: 1,
+    flagsBytes: 1,
+    ivBytes: 12,
+    saltBytes: 16,
+    tagBytes: 16,
+    keyDeriver: 'shake256',
+    keyBytes: 32,
+  },
+  5: {
+    version: 5,
+    algorithm: 'chacha20-poly1305',
+    algOptions: {
+      authTagLength: 16,
+    },
+    versionBytes: 1,
+    flagsBytes: 1,
+    ivBytes: 12,
+    saltBytes: 16,
+    tagBytes: 16,
+    keyDeriver: 'shake256',
+    keyBytes: 32,
+  },
+  6: {
+    version: 6,
+    algorithm: 'xchacha20-poly1305', // Not yet available, but would prefer even more...
+    algOptions: {
+      authTagLength: 16,
+    },
+    versionBytes: 1,
+    flagsBytes: 1,
+    ivBytes: 24,
+    saltBytes: 16,
+    tagBytes: 16,
+    keyDeriver: 'shake256',
+    keyBytes: 32,
+  },
+  7: {
+    version: 7,
+    algorithm: 'aes-256-gcm',
+    algOptions: {},
+    versionBytes: 1,
+    flagsBytes: 1,
+    ivBytes: 12,
+    saltBytes: 16,
+    tagBytes: 16,
+    keyDeriver: 'blake2b512',
+    keyBytes: 32,
+  },
+  8: {
+    version: 8,
+    algorithm: 'chacha20-poly1305',
+    algOptions: {
+      authTagLength: 16,
+    },
+    versionBytes: 1,
+    flagsBytes: 1,
+    ivBytes: 12,
+    saltBytes: 16,
+    tagBytes: 16,
+    keyDeriver: 'blake2b512',
+    keyBytes: 32,
+  },
+  9: {
+    version: 9,
+    algorithm: 'xchacha20-poly1305', // Not yet available, but would prefer even more...
+    algOptions: {
+      authTagLength: 16,
+    },
+    versionBytes: 1,
+    flagsBytes: 1,
+    ivBytes: 24,
+    saltBytes: 16,
+    tagBytes: 16,
+    keyDeriver: 'blake2b512',
     keyBytes: 32,
   },
 };