initial commit
[squeep-mystery-box] / lib / version-parameters.js
diff --git a/lib/version-parameters.js b/lib/version-parameters.js
new file mode 100644 (file)
index 0000000..80a0935
--- /dev/null
@@ -0,0 +1,48 @@
+'use strict';
+
+/**
+ * Supported packings/cipher types.
+ * To be useful, any cipher included here must be Authenticated Encryption with Additional Data (AEAD).
+ * More preferable versions are numbered higher.
+ */
+const allVersions = {
+  1: {
+    version: 1,
+    algorithm: 'aes-256-gcm',
+    algOptions: {},
+    versionBytes: 1,
+    flagsBytes: 1,
+    ivBytes: 12,
+    saltBytes: 16,
+    tagBytes: 16,
+    keyBytes: 32,
+  },
+  2: {
+    version: 2,
+    algorithm: 'chacha20-poly1305', // Prefer this over NIST because we stan djb
+    algOptions: {
+      authTagLength: 16,
+    },
+    versionBytes: 1,
+    flagsBytes: 1,
+    ivBytes: 12,
+    saltBytes: 16,
+    tagBytes: 16,
+    keyBytes: 32,
+  },
+  3: {
+    version: 3,
+    algorithm: 'xchacha20-poly1305', // Not yet available...
+    algOptions: {
+      authTagLength: 16,
+    },
+    versionBytes: 1,
+    flagsBytes: 1,
+    ivBytes: 24,
+    saltBytes: 16,
+    tagBytes: 16,
+    keyBytes: 32,
+  },
+};
+
+module.exports = allVersions;
\ No newline at end of file