@getmyenv/crypto 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/backup.js CHANGED
@@ -1,4 +1,4 @@
1
- import { BACKUP_FORMAT_VERSION, READABLE_BACKUP_VERSIONS } from "./types.js";
1
+ import { BACKUP_FORMAT_VERSION } from "./types.js";
2
2
  import { decryptSecret, openSealedKey, parseSealedKey, parseWrappedKey, publicKeyFromPrivate, unwrapPrivateKey, wipe, } from "./envelope.js";
3
3
  import { looksLikeRecoveryCode, parseRecoveryCode, unwrapWithRecoveryCode } from "./recovery.js";
4
4
  export function createBackupEnvelope(input) {
@@ -25,7 +25,7 @@ export function parseBackup(raw) {
25
25
  if (parsed.format !== "getmyenv-backup") {
26
26
  throw new Error("Not a getmyenv backup file");
27
27
  }
28
- if (!READABLE_BACKUP_VERSIONS.includes(parsed.version)) {
28
+ if (parsed.version !== BACKUP_FORMAT_VERSION) {
29
29
  throw new Error(`Unsupported backup version: ${String(parsed.version)}`);
30
30
  }
31
31
  if (typeof parsed.projectName !== "string" ||
@@ -74,9 +74,7 @@ async function openBackupPrivateKey(secret, envelope) {
74
74
  }
75
75
  catch (err) {
76
76
  if (code) {
77
- throw new Error(envelope.version === 3
78
- ? "This backup was made before recovery codes. Use the Vault password it was made with."
79
- : "This backup has no recovery code. Use the Vault password it was made with.");
77
+ throw new Error("This backup has no recovery code. Use the Vault password it was made with.");
80
78
  }
81
79
  throw err;
82
80
  }
package/dist/types.d.ts CHANGED
@@ -60,8 +60,6 @@ export type EncryptedSecretPayload = {
60
60
  ciphertext: string;
61
61
  };
62
62
  export declare const BACKUP_FORMAT_VERSION: 4;
63
- /** Versions parseBackup reads. v3 has no recovery wrap and opens with its Vault password only. */
64
- export declare const READABLE_BACKUP_VERSIONS: readonly [3, 4];
65
63
  export type BackupContext = {
66
64
  /** Context id when the backup was made. Part of the sealed key's binding. */
67
65
  id: number;
@@ -85,12 +83,12 @@ export type BackupValue = {
85
83
  */
86
84
  export type EncryptedBackupEnvelope = {
87
85
  format: "getmyenv-backup";
88
- version: (typeof READABLE_BACKUP_VERSIONS)[number];
86
+ version: typeof BACKUP_FORMAT_VERSION;
89
87
  createdAt: string;
90
88
  projectName: string;
91
89
  publicKey: string;
92
90
  wrappedPrivateKey: WrappedPrivateKey;
93
- /** The private key wrapped with the recovery code. Absent in v3, null for guests and vaults without a code. */
91
+ /** The private key wrapped with the recovery code. Null for guests and vaults without a code. */
94
92
  recoveryWrappedKey?: WrappedPrivateKey | null;
95
93
  contexts: BackupContext[];
96
94
  /** Every variable name in the project, including ones with no values. */
package/dist/types.js CHANGED
@@ -18,5 +18,3 @@ export const KDF_BOUNDS = {
18
18
  hashLength: 32,
19
19
  };
20
20
  export const BACKUP_FORMAT_VERSION = 4;
21
- /** Versions parseBackup reads. v3 has no recovery wrap and opens with its Vault password only. */
22
- export const READABLE_BACKUP_VERSIONS = [3, 4];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getmyenv/crypto",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Encryption for getmyenv: Argon2id-wrapped X25519 keys, sealed per-context keys, AES-256-GCM values",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",