@kya-os/contracts 1.3.3 → 1.3.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/package.json +3 -2
- package/README.md +0 -130
- package/dist/agentshield-api/endpoints.d.ts +0 -21
- package/dist/agentshield-api/endpoints.js +0 -20
- package/dist/agentshield-api/index.d.ts +0 -5
- package/dist/agentshield-api/index.js +0 -27
- package/dist/agentshield-api/schemas.d.ts +0 -9846
- package/dist/agentshield-api/schemas.js +0 -92
- package/dist/agentshield-api/types.d.ts +0 -92
- package/dist/agentshield-api/types.js +0 -12
- package/dist/cli.d.ts +0 -375
- package/dist/cli.js +0 -109
- package/dist/config/base.d.ts +0 -19
- package/dist/config/base.js +0 -2
- package/dist/config/delegation.d.ts +0 -46
- package/dist/config/delegation.js +0 -2
- package/dist/config/identity.d.ts +0 -22
- package/dist/config/identity.js +0 -2
- package/dist/config/index.d.ts +0 -17
- package/dist/config/index.js +0 -2
- package/dist/config/proofing.d.ts +0 -26
- package/dist/config/proofing.js +0 -2
- package/dist/config/tool-protection.d.ts +0 -36
- package/dist/config/tool-protection.js +0 -2
- package/dist/delegation/constraints.d.ts +0 -726
- package/dist/delegation/constraints.js +0 -103
- package/dist/delegation/index.d.ts +0 -2
- package/dist/delegation/index.js +0 -18
- package/dist/delegation/schemas.d.ts +0 -8042
- package/dist/delegation/schemas.js +0 -232
- package/dist/did/index.d.ts +0 -3
- package/dist/did/index.js +0 -19
- package/dist/did/resolve-contract.d.ts +0 -53
- package/dist/did/resolve-contract.js +0 -12
- package/dist/did/schemas.d.ts +0 -33
- package/dist/did/schemas.js +0 -80
- package/dist/did/types.d.ts +0 -38
- package/dist/did/types.js +0 -37
- package/dist/env/constants.d.ts +0 -13
- package/dist/env/constants.js +0 -15
- package/dist/env/index.d.ts +0 -1
- package/dist/env/index.js +0 -17
- package/dist/handshake.d.ts +0 -138
- package/dist/handshake.js +0 -50
- package/dist/index.d.ts +0 -11
- package/dist/index.js +0 -28
- package/dist/proof/index.d.ts +0 -2
- package/dist/proof/index.js +0 -18
- package/dist/proof/proof-record.d.ts +0 -728
- package/dist/proof/proof-record.js +0 -60
- package/dist/proof/signing-spec.d.ts +0 -73
- package/dist/proof/signing-spec.js +0 -52
- package/dist/proof.d.ts +0 -378
- package/dist/proof.js +0 -59
- package/dist/registry.d.ts +0 -326
- package/dist/registry.js +0 -98
- package/dist/runtime/errors.d.ts +0 -179
- package/dist/runtime/errors.js +0 -51
- package/dist/runtime/headers.d.ts +0 -34
- package/dist/runtime/headers.js +0 -52
- package/dist/runtime/index.d.ts +0 -2
- package/dist/runtime/index.js +0 -18
- package/dist/test.d.ts +0 -215
- package/dist/test.js +0 -83
- package/dist/tlkrc/index.d.ts +0 -1
- package/dist/tlkrc/index.js +0 -17
- package/dist/tlkrc/rotation.d.ts +0 -168
- package/dist/tlkrc/rotation.js +0 -55
- package/dist/tool-protection/index.d.ts +0 -129
- package/dist/tool-protection/index.js +0 -80
- package/dist/utils/validation.d.ts +0 -14
- package/dist/utils/validation.js +0 -56
- package/dist/vc/index.d.ts +0 -2
- package/dist/vc/index.js +0 -18
- package/dist/vc/schemas.d.ts +0 -1888
- package/dist/vc/schemas.js +0 -116
- package/dist/vc/statuslist.d.ts +0 -292
- package/dist/vc/statuslist.js +0 -61
- package/dist/verifier.d.ts +0 -202
- package/dist/verifier.js +0 -76
- package/dist/well-known/index.d.ts +0 -248
- package/dist/well-known/index.js +0 -104
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MAX_WINDOW_DURATION_SEC = exports.MAX_BUDGET_CAP = exports.SUPPORTED_MATCHERS = exports.SUPPORTED_CURRENCIES = exports.DelegationConstraintsSchema = exports.CrispScopeSchema = exports.ScopeMatcherSchema = exports.CrispBudgetSchema = exports.BudgetWindowSchema = exports.WindowKindSchema = exports.CurrencySchema = void 0;
|
|
4
|
-
exports.validateDelegationConstraints = validateDelegationConstraints;
|
|
5
|
-
exports.hasValidTimeRange = hasValidTimeRange;
|
|
6
|
-
exports.areChildConstraintsValid = areChildConstraintsValid;
|
|
7
|
-
exports.doesResourceMatchScope = doesResourceMatchScope;
|
|
8
|
-
const zod_1 = require("zod");
|
|
9
|
-
exports.CurrencySchema = zod_1.z.enum(['USD', 'ops', 'points']);
|
|
10
|
-
exports.WindowKindSchema = zod_1.z.enum(['rolling', 'fixed']);
|
|
11
|
-
exports.BudgetWindowSchema = zod_1.z.object({
|
|
12
|
-
kind: exports.WindowKindSchema,
|
|
13
|
-
durationSec: zod_1.z.number().int().positive(),
|
|
14
|
-
});
|
|
15
|
-
exports.CrispBudgetSchema = zod_1.z.object({
|
|
16
|
-
unit: exports.CurrencySchema,
|
|
17
|
-
cap: zod_1.z.number().nonnegative(),
|
|
18
|
-
window: exports.BudgetWindowSchema.optional(),
|
|
19
|
-
});
|
|
20
|
-
exports.ScopeMatcherSchema = zod_1.z.enum(['exact', 'prefix', 'regex']);
|
|
21
|
-
exports.CrispScopeSchema = zod_1.z.object({
|
|
22
|
-
resource: zod_1.z.string().min(1),
|
|
23
|
-
matcher: exports.ScopeMatcherSchema,
|
|
24
|
-
constraints: zod_1.z.record(zod_1.z.any()).optional(),
|
|
25
|
-
});
|
|
26
|
-
exports.DelegationConstraintsSchema = zod_1.z.object({
|
|
27
|
-
notBefore: zod_1.z.number().int().optional(),
|
|
28
|
-
notAfter: zod_1.z.number().int().optional(),
|
|
29
|
-
scopes: zod_1.z.array(zod_1.z.string()).optional(),
|
|
30
|
-
crisp: zod_1.z.object({
|
|
31
|
-
budget: exports.CrispBudgetSchema.optional(),
|
|
32
|
-
scopes: zod_1.z.array(exports.CrispScopeSchema).min(1),
|
|
33
|
-
}).passthrough().optional(),
|
|
34
|
-
}).passthrough();
|
|
35
|
-
function validateDelegationConstraints(constraints) {
|
|
36
|
-
return exports.DelegationConstraintsSchema.safeParse(constraints);
|
|
37
|
-
}
|
|
38
|
-
function hasValidTimeRange(constraints) {
|
|
39
|
-
if (constraints.notBefore === undefined && constraints.notAfter === undefined) {
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
if (constraints.notBefore !== undefined && constraints.notAfter !== undefined) {
|
|
43
|
-
return constraints.notBefore < constraints.notAfter;
|
|
44
|
-
}
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
function areChildConstraintsValid(parent, child) {
|
|
48
|
-
if (parent.notBefore !== undefined && child.notBefore !== undefined) {
|
|
49
|
-
if (child.notBefore < parent.notBefore) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
if (parent.notAfter !== undefined && child.notAfter !== undefined) {
|
|
54
|
-
if (child.notAfter > parent.notAfter) {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (parent.crisp?.budget &&
|
|
59
|
-
child.crisp?.budget &&
|
|
60
|
-
parent.crisp.budget.unit === child.crisp.budget.unit) {
|
|
61
|
-
if (child.crisp.budget.cap > parent.crisp.budget.cap) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
if (parent.crisp && child.crisp) {
|
|
66
|
-
const parentResources = new Set(parent.crisp.scopes.map((s) => s.resource));
|
|
67
|
-
const allChildResourcesInParent = child.crisp.scopes.every((childScope) => {
|
|
68
|
-
return parent.crisp.scopes.some((parentScope) => {
|
|
69
|
-
if (parentScope.matcher === 'exact') {
|
|
70
|
-
return parentScope.resource === childScope.resource;
|
|
71
|
-
}
|
|
72
|
-
if (parentScope.matcher === 'prefix') {
|
|
73
|
-
return childScope.resource.startsWith(parentScope.resource);
|
|
74
|
-
}
|
|
75
|
-
return true;
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
return allChildResourcesInParent;
|
|
79
|
-
}
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
function doesResourceMatchScope(resource, scope) {
|
|
83
|
-
switch (scope.matcher) {
|
|
84
|
-
case 'exact':
|
|
85
|
-
return resource === scope.resource;
|
|
86
|
-
case 'prefix':
|
|
87
|
-
return resource.startsWith(scope.resource);
|
|
88
|
-
case 'regex':
|
|
89
|
-
try {
|
|
90
|
-
const regex = new RegExp(scope.resource);
|
|
91
|
-
return regex.test(resource);
|
|
92
|
-
}
|
|
93
|
-
catch {
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
default:
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
exports.SUPPORTED_CURRENCIES = ['USD', 'ops', 'points'];
|
|
101
|
-
exports.SUPPORTED_MATCHERS = ['exact', 'prefix', 'regex'];
|
|
102
|
-
exports.MAX_BUDGET_CAP = Number.MAX_SAFE_INTEGER;
|
|
103
|
-
exports.MAX_WINDOW_DURATION_SEC = 10 * 365 * 24 * 60 * 60;
|
package/dist/delegation/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./schemas.js"), exports);
|
|
18
|
-
__exportStar(require("./constraints.js"), exports);
|