@coffre/core 0.1.2 → 0.1.4
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/kek.js +3 -3
- package/dist/schemas.d.ts +1 -1
- package/package.json +2 -2
- package/src/kek/local.ts +1 -1
- package/src/kek/registry.ts +2 -2
package/dist/kek.js
CHANGED
|
@@ -67,7 +67,7 @@ var LocalKekProvider = class LocalKekProvider {
|
|
|
67
67
|
keyVersion;
|
|
68
68
|
#kek;
|
|
69
69
|
constructor(kek, keyId, keyVersion = "1") {
|
|
70
|
-
if (kek.length !== KEK_BYTES) throw new Error(`local
|
|
70
|
+
if (kek.length !== KEK_BYTES) throw new Error(`a local vault key must be ${KEK_BYTES} bytes, got ${kek.length}`);
|
|
71
71
|
this.#kek = kek;
|
|
72
72
|
this.keyId = keyId;
|
|
73
73
|
this.keyVersion = keyVersion;
|
|
@@ -159,7 +159,7 @@ var KekRegistry = class {
|
|
|
159
159
|
this.#primary = primary;
|
|
160
160
|
for (const provider of [primary, ...additional]) {
|
|
161
161
|
const ref = refOf(provider.provider, provider.keyId);
|
|
162
|
-
if (this.#byRef.has(ref)) throw new Error(`duplicate
|
|
162
|
+
if (this.#byRef.has(ref)) throw new Error(`duplicate vault key in registry: ${ref}`);
|
|
163
163
|
this.#byRef.set(ref, provider);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
@@ -182,7 +182,7 @@ var KekRegistry = class {
|
|
|
182
182
|
unwrap(wrapped, ctx, operation) {
|
|
183
183
|
const ref = refOf(wrapped.kekProvider, wrapped.kekId);
|
|
184
184
|
const provider = this.#byRef.get(ref);
|
|
185
|
-
if (!provider) throw new Error(`no
|
|
185
|
+
if (!provider) throw new Error(`no vault key configured for ${ref} (kek or previousKeks in the vault's config); cannot unwrap`);
|
|
186
186
|
return provider.unwrap(wrapped, ctx, operation);
|
|
187
187
|
}
|
|
188
188
|
};
|
package/dist/schemas.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ export declare const principalType: z.ZodEnum<{
|
|
|
9
9
|
}>;
|
|
10
10
|
export declare const principalId: z.ZodString;
|
|
11
11
|
export declare const instanceRole: z.ZodEnum<{
|
|
12
|
-
user: "user";
|
|
13
12
|
owner: "owner";
|
|
13
|
+
user: "user";
|
|
14
14
|
}>;
|
|
15
15
|
export declare const grantId: z.ZodString;
|
|
16
16
|
export declare const emailAddress: z.ZodString;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coffre/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "What coffre's packages share: roles, envelopes, identity, the audit chain and the vault's contract.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@types/node": "26.1.1",
|
|
69
69
|
"tsdown": "0.23.0",
|
|
70
70
|
"typescript": "5.9.3",
|
|
71
|
-
"@coffre/conformance": "0.1.
|
|
71
|
+
"@coffre/conformance": "0.1.4"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
74
|
"build": "tsdown",
|
package/src/kek/local.ts
CHANGED
|
@@ -25,7 +25,7 @@ export class LocalKekProvider implements KekProvider {
|
|
|
25
25
|
|
|
26
26
|
constructor(kek: Buffer, keyId: string, keyVersion: string = '1') {
|
|
27
27
|
if (kek.length !== KEK_BYTES) {
|
|
28
|
-
throw new Error(`local
|
|
28
|
+
throw new Error(`a local vault key must be ${KEK_BYTES} bytes, got ${kek.length}`);
|
|
29
29
|
}
|
|
30
30
|
this.#kek = kek;
|
|
31
31
|
this.keyId = keyId;
|
package/src/kek/registry.ts
CHANGED
|
@@ -23,7 +23,7 @@ export class KekRegistry {
|
|
|
23
23
|
for (const provider of [primary, ...additional]) {
|
|
24
24
|
const ref = refOf(provider.provider, provider.keyId);
|
|
25
25
|
if (this.#byRef.has(ref)) {
|
|
26
|
-
throw new Error(`duplicate
|
|
26
|
+
throw new Error(`duplicate vault key in registry: ${ref}`);
|
|
27
27
|
}
|
|
28
28
|
this.#byRef.set(ref, provider);
|
|
29
29
|
}
|
|
@@ -56,7 +56,7 @@ export class KekRegistry {
|
|
|
56
56
|
// Operationally this means a KEK was removed from configuration while
|
|
57
57
|
// rows still reference it. Fail loudly rather than returning a decrypt
|
|
58
58
|
// error that looks like corruption.
|
|
59
|
-
throw new Error(`no
|
|
59
|
+
throw new Error(`no vault key configured for ${ref} (kek or previousKeks in the vault's config); cannot unwrap`);
|
|
60
60
|
}
|
|
61
61
|
return provider.unwrap(wrapped, ctx, operation);
|
|
62
62
|
}
|