@calimero-network/mero-js 26.7.0 → 26.8.0
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/agent-gate/policy.d.ts +7 -1
- package/dist/agent-gate/policy.js +4 -3
- package/dist/index.browser.mjs +1 -1
- package/dist/index.browser.mjs.map +3 -3
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +3 -3
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +3 -3
- package/package.json +1 -1
|
@@ -36,11 +36,17 @@ export interface VerifySignedAgentPolicyOptions {
|
|
|
36
36
|
identity?: string;
|
|
37
37
|
/** The OIDC issuer required. Defaults to {@link KMS_RELEASE_SIGNER}'s. */
|
|
38
38
|
issuer?: string;
|
|
39
|
+
/**
|
|
40
|
+
* The image role the allowlist must be for: `agent` (the default), or
|
|
41
|
+
* `inference`, the release's `kms-inference-attestation-policy.<profile>.json`
|
|
42
|
+
* for its private inference image. Both have the same shape and signer.
|
|
43
|
+
*/
|
|
44
|
+
role?: 'agent' | 'inference';
|
|
39
45
|
}
|
|
40
46
|
/**
|
|
41
47
|
* Verify an agent allowlist against its cosign bundle, as `cosign verify-blob`
|
|
42
48
|
* would, and return it parsed. Rejects unless it was signed by the KMS release
|
|
43
|
-
* workflow, it is an
|
|
49
|
+
* workflow, it is an allowlist for `options.role` (default `agent`) and the profile asked
|
|
44
50
|
* for, every list in it is non-empty, and `expectedVersion`, when given, is its
|
|
45
51
|
* `version`.
|
|
46
52
|
*/
|
|
@@ -27,7 +27,7 @@ const LISTS = [
|
|
|
27
27
|
/**
|
|
28
28
|
* Verify an agent allowlist against its cosign bundle, as `cosign verify-blob`
|
|
29
29
|
* would, and return it parsed. Rejects unless it was signed by the KMS release
|
|
30
|
-
* workflow, it is an
|
|
30
|
+
* workflow, it is an allowlist for `options.role` (default `agent`) and the profile asked
|
|
31
31
|
* for, every list in it is non-empty, and `expectedVersion`, when given, is its
|
|
32
32
|
* `version`.
|
|
33
33
|
*/
|
|
@@ -44,8 +44,9 @@ export async function verifySignedAgentPolicy(policy, bundle, options = {}) {
|
|
|
44
44
|
catch {
|
|
45
45
|
throw new Error('The signed agent policy is not JSON');
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
const role = options.role ?? 'agent';
|
|
48
|
+
if (parsed?.role !== role) {
|
|
49
|
+
throw new Error(`The signed file is a ${JSON.stringify(parsed?.role)} policy, not an ${role} one`);
|
|
49
50
|
}
|
|
50
51
|
const profile = options.profile ?? PRODUCTION_PROFILE;
|
|
51
52
|
if (parsed.profile !== profile) {
|