@kya-os/contracts 1.3.3 → 1.3.5
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/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/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/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/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/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/well-known/index.d.ts +0 -248
- package/dist/well-known/index.js +0 -104
package/dist/tlkrc/rotation.d.ts
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const RotationEventSchema: z.ZodEffects<z.ZodObject<{
|
|
3
|
-
issuerDid: z.ZodString;
|
|
4
|
-
prevKeyId: z.ZodString;
|
|
5
|
-
nextKeyId: z.ZodString;
|
|
6
|
-
effectiveAt: z.ZodNumber;
|
|
7
|
-
issuedAt: z.ZodNumber;
|
|
8
|
-
seq: z.ZodNumber;
|
|
9
|
-
prevEventHash: z.ZodOptional<z.ZodString>;
|
|
10
|
-
signature: z.ZodString;
|
|
11
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
12
|
-
}, "strip", z.ZodTypeAny, {
|
|
13
|
-
signature: string;
|
|
14
|
-
issuerDid: string;
|
|
15
|
-
prevKeyId: string;
|
|
16
|
-
nextKeyId: string;
|
|
17
|
-
effectiveAt: number;
|
|
18
|
-
issuedAt: number;
|
|
19
|
-
seq: number;
|
|
20
|
-
metadata?: Record<string, any> | undefined;
|
|
21
|
-
prevEventHash?: string | undefined;
|
|
22
|
-
}, {
|
|
23
|
-
signature: string;
|
|
24
|
-
issuerDid: string;
|
|
25
|
-
prevKeyId: string;
|
|
26
|
-
nextKeyId: string;
|
|
27
|
-
effectiveAt: number;
|
|
28
|
-
issuedAt: number;
|
|
29
|
-
seq: number;
|
|
30
|
-
metadata?: Record<string, any> | undefined;
|
|
31
|
-
prevEventHash?: string | undefined;
|
|
32
|
-
}>, {
|
|
33
|
-
signature: string;
|
|
34
|
-
issuerDid: string;
|
|
35
|
-
prevKeyId: string;
|
|
36
|
-
nextKeyId: string;
|
|
37
|
-
effectiveAt: number;
|
|
38
|
-
issuedAt: number;
|
|
39
|
-
seq: number;
|
|
40
|
-
metadata?: Record<string, any> | undefined;
|
|
41
|
-
prevEventHash?: string | undefined;
|
|
42
|
-
}, {
|
|
43
|
-
signature: string;
|
|
44
|
-
issuerDid: string;
|
|
45
|
-
prevKeyId: string;
|
|
46
|
-
nextKeyId: string;
|
|
47
|
-
effectiveAt: number;
|
|
48
|
-
issuedAt: number;
|
|
49
|
-
seq: number;
|
|
50
|
-
metadata?: Record<string, any> | undefined;
|
|
51
|
-
prevEventHash?: string | undefined;
|
|
52
|
-
}>;
|
|
53
|
-
export type RotationEvent = z.infer<typeof RotationEventSchema>;
|
|
54
|
-
export declare const RotationChainSchema: z.ZodObject<{
|
|
55
|
-
issuerDid: z.ZodString;
|
|
56
|
-
events: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
57
|
-
issuerDid: z.ZodString;
|
|
58
|
-
prevKeyId: z.ZodString;
|
|
59
|
-
nextKeyId: z.ZodString;
|
|
60
|
-
effectiveAt: z.ZodNumber;
|
|
61
|
-
issuedAt: z.ZodNumber;
|
|
62
|
-
seq: z.ZodNumber;
|
|
63
|
-
prevEventHash: z.ZodOptional<z.ZodString>;
|
|
64
|
-
signature: z.ZodString;
|
|
65
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
66
|
-
}, "strip", z.ZodTypeAny, {
|
|
67
|
-
signature: string;
|
|
68
|
-
issuerDid: string;
|
|
69
|
-
prevKeyId: string;
|
|
70
|
-
nextKeyId: string;
|
|
71
|
-
effectiveAt: number;
|
|
72
|
-
issuedAt: number;
|
|
73
|
-
seq: number;
|
|
74
|
-
metadata?: Record<string, any> | undefined;
|
|
75
|
-
prevEventHash?: string | undefined;
|
|
76
|
-
}, {
|
|
77
|
-
signature: string;
|
|
78
|
-
issuerDid: string;
|
|
79
|
-
prevKeyId: string;
|
|
80
|
-
nextKeyId: string;
|
|
81
|
-
effectiveAt: number;
|
|
82
|
-
issuedAt: number;
|
|
83
|
-
seq: number;
|
|
84
|
-
metadata?: Record<string, any> | undefined;
|
|
85
|
-
prevEventHash?: string | undefined;
|
|
86
|
-
}>, {
|
|
87
|
-
signature: string;
|
|
88
|
-
issuerDid: string;
|
|
89
|
-
prevKeyId: string;
|
|
90
|
-
nextKeyId: string;
|
|
91
|
-
effectiveAt: number;
|
|
92
|
-
issuedAt: number;
|
|
93
|
-
seq: number;
|
|
94
|
-
metadata?: Record<string, any> | undefined;
|
|
95
|
-
prevEventHash?: string | undefined;
|
|
96
|
-
}, {
|
|
97
|
-
signature: string;
|
|
98
|
-
issuerDid: string;
|
|
99
|
-
prevKeyId: string;
|
|
100
|
-
nextKeyId: string;
|
|
101
|
-
effectiveAt: number;
|
|
102
|
-
issuedAt: number;
|
|
103
|
-
seq: number;
|
|
104
|
-
metadata?: Record<string, any> | undefined;
|
|
105
|
-
prevEventHash?: string | undefined;
|
|
106
|
-
}>, "many">;
|
|
107
|
-
currentKeyId: z.ZodString;
|
|
108
|
-
valid: z.ZodBoolean;
|
|
109
|
-
errors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
110
|
-
}, "strip", z.ZodTypeAny, {
|
|
111
|
-
valid: boolean;
|
|
112
|
-
issuerDid: string;
|
|
113
|
-
events: {
|
|
114
|
-
signature: string;
|
|
115
|
-
issuerDid: string;
|
|
116
|
-
prevKeyId: string;
|
|
117
|
-
nextKeyId: string;
|
|
118
|
-
effectiveAt: number;
|
|
119
|
-
issuedAt: number;
|
|
120
|
-
seq: number;
|
|
121
|
-
metadata?: Record<string, any> | undefined;
|
|
122
|
-
prevEventHash?: string | undefined;
|
|
123
|
-
}[];
|
|
124
|
-
currentKeyId: string;
|
|
125
|
-
errors?: string[] | undefined;
|
|
126
|
-
}, {
|
|
127
|
-
valid: boolean;
|
|
128
|
-
issuerDid: string;
|
|
129
|
-
events: {
|
|
130
|
-
signature: string;
|
|
131
|
-
issuerDid: string;
|
|
132
|
-
prevKeyId: string;
|
|
133
|
-
nextKeyId: string;
|
|
134
|
-
effectiveAt: number;
|
|
135
|
-
issuedAt: number;
|
|
136
|
-
seq: number;
|
|
137
|
-
metadata?: Record<string, any> | undefined;
|
|
138
|
-
prevEventHash?: string | undefined;
|
|
139
|
-
}[];
|
|
140
|
-
currentKeyId: string;
|
|
141
|
-
errors?: string[] | undefined;
|
|
142
|
-
}>;
|
|
143
|
-
export type RotationChain = z.infer<typeof RotationChainSchema>;
|
|
144
|
-
export declare function validateRotationEvent(event: unknown): z.SafeParseReturnType<{
|
|
145
|
-
signature: string;
|
|
146
|
-
issuerDid: string;
|
|
147
|
-
prevKeyId: string;
|
|
148
|
-
nextKeyId: string;
|
|
149
|
-
effectiveAt: number;
|
|
150
|
-
issuedAt: number;
|
|
151
|
-
seq: number;
|
|
152
|
-
metadata?: Record<string, any> | undefined;
|
|
153
|
-
prevEventHash?: string | undefined;
|
|
154
|
-
}, {
|
|
155
|
-
signature: string;
|
|
156
|
-
issuerDid: string;
|
|
157
|
-
prevKeyId: string;
|
|
158
|
-
nextKeyId: string;
|
|
159
|
-
effectiveAt: number;
|
|
160
|
-
issuedAt: number;
|
|
161
|
-
seq: number;
|
|
162
|
-
metadata?: Record<string, any> | undefined;
|
|
163
|
-
prevEventHash?: string | undefined;
|
|
164
|
-
}>;
|
|
165
|
-
export declare function isRotationChainValid(chain: RotationChain): boolean;
|
|
166
|
-
export declare function getActiveKeyAt(chain: RotationChain, timestamp: number): string | null;
|
|
167
|
-
export declare const DEFAULT_GRACE_PERIOD_SEC: number;
|
|
168
|
-
export declare const MAX_GRACE_PERIOD_SEC: number;
|
package/dist/tlkrc/rotation.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MAX_GRACE_PERIOD_SEC = exports.DEFAULT_GRACE_PERIOD_SEC = exports.RotationChainSchema = exports.RotationEventSchema = void 0;
|
|
4
|
-
exports.validateRotationEvent = validateRotationEvent;
|
|
5
|
-
exports.isRotationChainValid = isRotationChainValid;
|
|
6
|
-
exports.getActiveKeyAt = getActiveKeyAt;
|
|
7
|
-
const zod_1 = require("zod");
|
|
8
|
-
exports.RotationEventSchema = zod_1.z.object({
|
|
9
|
-
issuerDid: zod_1.z.string().min(1),
|
|
10
|
-
prevKeyId: zod_1.z.string().min(1),
|
|
11
|
-
nextKeyId: zod_1.z.string().min(1),
|
|
12
|
-
effectiveAt: zod_1.z.number().int().positive(),
|
|
13
|
-
issuedAt: zod_1.z.number().int().positive(),
|
|
14
|
-
seq: zod_1.z.number().int().nonnegative(),
|
|
15
|
-
prevEventHash: zod_1.z.string().optional(),
|
|
16
|
-
signature: zod_1.z.string().min(1),
|
|
17
|
-
metadata: zod_1.z.record(zod_1.z.any()).optional(),
|
|
18
|
-
}).refine((event) => event.effectiveAt >= event.issuedAt, {
|
|
19
|
-
message: 'effectiveAt must be >= issuedAt',
|
|
20
|
-
});
|
|
21
|
-
exports.RotationChainSchema = zod_1.z.object({
|
|
22
|
-
issuerDid: zod_1.z.string().min(1),
|
|
23
|
-
events: zod_1.z.array(exports.RotationEventSchema).min(1),
|
|
24
|
-
currentKeyId: zod_1.z.string().min(1),
|
|
25
|
-
valid: zod_1.z.boolean(),
|
|
26
|
-
errors: zod_1.z.array(zod_1.z.string()).optional(),
|
|
27
|
-
});
|
|
28
|
-
function validateRotationEvent(event) {
|
|
29
|
-
return exports.RotationEventSchema.safeParse(event);
|
|
30
|
-
}
|
|
31
|
-
function isRotationChainValid(chain) {
|
|
32
|
-
if (chain.events.length === 0) {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
for (let i = 1; i < chain.events.length; i++) {
|
|
36
|
-
if (chain.events[i].seq <= chain.events[i - 1].seq) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return chain.valid;
|
|
41
|
-
}
|
|
42
|
-
function getActiveKeyAt(chain, timestamp) {
|
|
43
|
-
if (chain.events.length === 0) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
for (let i = chain.events.length - 1; i >= 0; i--) {
|
|
47
|
-
const event = chain.events[i];
|
|
48
|
-
if (event.effectiveAt <= timestamp) {
|
|
49
|
-
return event.nextKeyId;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return chain.events[0].prevKeyId;
|
|
53
|
-
}
|
|
54
|
-
exports.DEFAULT_GRACE_PERIOD_SEC = 24 * 60 * 60;
|
|
55
|
-
exports.MAX_GRACE_PERIOD_SEC = 30 * 24 * 60 * 60;
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export interface ToolProtection {
|
|
3
|
-
requiresDelegation: boolean;
|
|
4
|
-
requiredScopes: string[];
|
|
5
|
-
riskLevel?: 'low' | 'medium' | 'high' | 'critical';
|
|
6
|
-
}
|
|
7
|
-
export type ToolProtectionMap = Record<string, ToolProtection>;
|
|
8
|
-
export interface ToolProtectionResponse {
|
|
9
|
-
toolProtections: ToolProtectionMap;
|
|
10
|
-
metadata?: {
|
|
11
|
-
lastUpdated?: string;
|
|
12
|
-
version?: string;
|
|
13
|
-
source?: string;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export interface DelegationRequiredErrorData {
|
|
17
|
-
toolName: string;
|
|
18
|
-
requiredScopes: string[];
|
|
19
|
-
consentUrl?: string;
|
|
20
|
-
authorizationUrl?: string;
|
|
21
|
-
reason?: string;
|
|
22
|
-
}
|
|
23
|
-
export declare const ToolProtectionSchema: z.ZodObject<{
|
|
24
|
-
requiresDelegation: z.ZodBoolean;
|
|
25
|
-
requiredScopes: z.ZodArray<z.ZodString, "many">;
|
|
26
|
-
riskLevel: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
|
|
27
|
-
}, "strip", z.ZodTypeAny, {
|
|
28
|
-
requiresDelegation: boolean;
|
|
29
|
-
requiredScopes: string[];
|
|
30
|
-
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
31
|
-
}, {
|
|
32
|
-
requiresDelegation: boolean;
|
|
33
|
-
requiredScopes: string[];
|
|
34
|
-
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
35
|
-
}>;
|
|
36
|
-
export declare const ToolProtectionMapSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
37
|
-
requiresDelegation: z.ZodBoolean;
|
|
38
|
-
requiredScopes: z.ZodArray<z.ZodString, "many">;
|
|
39
|
-
riskLevel: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
|
|
40
|
-
}, "strip", z.ZodTypeAny, {
|
|
41
|
-
requiresDelegation: boolean;
|
|
42
|
-
requiredScopes: string[];
|
|
43
|
-
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
44
|
-
}, {
|
|
45
|
-
requiresDelegation: boolean;
|
|
46
|
-
requiredScopes: string[];
|
|
47
|
-
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
48
|
-
}>>;
|
|
49
|
-
export declare const ToolProtectionResponseSchema: z.ZodObject<{
|
|
50
|
-
toolProtections: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
51
|
-
requiresDelegation: z.ZodBoolean;
|
|
52
|
-
requiredScopes: z.ZodArray<z.ZodString, "many">;
|
|
53
|
-
riskLevel: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
|
|
54
|
-
}, "strip", z.ZodTypeAny, {
|
|
55
|
-
requiresDelegation: boolean;
|
|
56
|
-
requiredScopes: string[];
|
|
57
|
-
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
58
|
-
}, {
|
|
59
|
-
requiresDelegation: boolean;
|
|
60
|
-
requiredScopes: string[];
|
|
61
|
-
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
62
|
-
}>>;
|
|
63
|
-
metadata: z.ZodOptional<z.ZodObject<{
|
|
64
|
-
lastUpdated: z.ZodOptional<z.ZodString>;
|
|
65
|
-
version: z.ZodOptional<z.ZodString>;
|
|
66
|
-
source: z.ZodOptional<z.ZodString>;
|
|
67
|
-
}, "strip", z.ZodTypeAny, {
|
|
68
|
-
version?: string | undefined;
|
|
69
|
-
lastUpdated?: string | undefined;
|
|
70
|
-
source?: string | undefined;
|
|
71
|
-
}, {
|
|
72
|
-
version?: string | undefined;
|
|
73
|
-
lastUpdated?: string | undefined;
|
|
74
|
-
source?: string | undefined;
|
|
75
|
-
}>>;
|
|
76
|
-
}, "strip", z.ZodTypeAny, {
|
|
77
|
-
toolProtections: Record<string, {
|
|
78
|
-
requiresDelegation: boolean;
|
|
79
|
-
requiredScopes: string[];
|
|
80
|
-
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
81
|
-
}>;
|
|
82
|
-
metadata?: {
|
|
83
|
-
version?: string | undefined;
|
|
84
|
-
lastUpdated?: string | undefined;
|
|
85
|
-
source?: string | undefined;
|
|
86
|
-
} | undefined;
|
|
87
|
-
}, {
|
|
88
|
-
toolProtections: Record<string, {
|
|
89
|
-
requiresDelegation: boolean;
|
|
90
|
-
requiredScopes: string[];
|
|
91
|
-
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
92
|
-
}>;
|
|
93
|
-
metadata?: {
|
|
94
|
-
version?: string | undefined;
|
|
95
|
-
lastUpdated?: string | undefined;
|
|
96
|
-
source?: string | undefined;
|
|
97
|
-
} | undefined;
|
|
98
|
-
}>;
|
|
99
|
-
export declare const DelegationRequiredErrorDataSchema: z.ZodObject<{
|
|
100
|
-
toolName: z.ZodString;
|
|
101
|
-
requiredScopes: z.ZodArray<z.ZodString, "many">;
|
|
102
|
-
consentUrl: z.ZodOptional<z.ZodString>;
|
|
103
|
-
authorizationUrl: z.ZodOptional<z.ZodString>;
|
|
104
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
105
|
-
}, "strip", z.ZodTypeAny, {
|
|
106
|
-
requiredScopes: string[];
|
|
107
|
-
toolName: string;
|
|
108
|
-
reason?: string | undefined;
|
|
109
|
-
consentUrl?: string | undefined;
|
|
110
|
-
authorizationUrl?: string | undefined;
|
|
111
|
-
}, {
|
|
112
|
-
requiredScopes: string[];
|
|
113
|
-
toolName: string;
|
|
114
|
-
reason?: string | undefined;
|
|
115
|
-
consentUrl?: string | undefined;
|
|
116
|
-
authorizationUrl?: string | undefined;
|
|
117
|
-
}>;
|
|
118
|
-
export declare function isToolProtection(obj: any): obj is ToolProtection;
|
|
119
|
-
export declare function isToolProtectionMap(obj: any): obj is ToolProtectionMap;
|
|
120
|
-
export declare function isToolProtectionResponse(obj: any): obj is ToolProtectionResponse;
|
|
121
|
-
export declare function isDelegationRequiredErrorData(obj: any): obj is DelegationRequiredErrorData;
|
|
122
|
-
export declare function validateToolProtection(obj: any): ToolProtection;
|
|
123
|
-
export declare function validateToolProtectionMap(obj: any): ToolProtectionMap;
|
|
124
|
-
export declare function validateToolProtectionResponse(obj: any): ToolProtectionResponse;
|
|
125
|
-
export declare function validateDelegationRequiredErrorData(obj: any): DelegationRequiredErrorData;
|
|
126
|
-
export declare function toolRequiresDelegation(toolName: string, protections: ToolProtectionMap): boolean;
|
|
127
|
-
export declare function getToolRequiredScopes(toolName: string, protections: ToolProtectionMap): string[];
|
|
128
|
-
export declare function getToolRiskLevel(toolName: string, protections: ToolProtectionMap): ToolProtection['riskLevel'] | undefined;
|
|
129
|
-
export declare function createDelegationRequiredError(toolName: string, requiredScopes: string[], consentUrl?: string): DelegationRequiredErrorData;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DelegationRequiredErrorDataSchema = exports.ToolProtectionResponseSchema = exports.ToolProtectionMapSchema = exports.ToolProtectionSchema = void 0;
|
|
4
|
-
exports.isToolProtection = isToolProtection;
|
|
5
|
-
exports.isToolProtectionMap = isToolProtectionMap;
|
|
6
|
-
exports.isToolProtectionResponse = isToolProtectionResponse;
|
|
7
|
-
exports.isDelegationRequiredErrorData = isDelegationRequiredErrorData;
|
|
8
|
-
exports.validateToolProtection = validateToolProtection;
|
|
9
|
-
exports.validateToolProtectionMap = validateToolProtectionMap;
|
|
10
|
-
exports.validateToolProtectionResponse = validateToolProtectionResponse;
|
|
11
|
-
exports.validateDelegationRequiredErrorData = validateDelegationRequiredErrorData;
|
|
12
|
-
exports.toolRequiresDelegation = toolRequiresDelegation;
|
|
13
|
-
exports.getToolRequiredScopes = getToolRequiredScopes;
|
|
14
|
-
exports.getToolRiskLevel = getToolRiskLevel;
|
|
15
|
-
exports.createDelegationRequiredError = createDelegationRequiredError;
|
|
16
|
-
const zod_1 = require("zod");
|
|
17
|
-
exports.ToolProtectionSchema = zod_1.z.object({
|
|
18
|
-
requiresDelegation: zod_1.z.boolean(),
|
|
19
|
-
requiredScopes: zod_1.z.array(zod_1.z.string()),
|
|
20
|
-
riskLevel: zod_1.z.enum(['low', 'medium', 'high', 'critical']).optional()
|
|
21
|
-
});
|
|
22
|
-
exports.ToolProtectionMapSchema = zod_1.z.record(zod_1.z.string(), exports.ToolProtectionSchema);
|
|
23
|
-
exports.ToolProtectionResponseSchema = zod_1.z.object({
|
|
24
|
-
toolProtections: exports.ToolProtectionMapSchema,
|
|
25
|
-
metadata: zod_1.z.object({
|
|
26
|
-
lastUpdated: zod_1.z.string().optional(),
|
|
27
|
-
version: zod_1.z.string().optional(),
|
|
28
|
-
source: zod_1.z.string().optional()
|
|
29
|
-
}).optional()
|
|
30
|
-
});
|
|
31
|
-
exports.DelegationRequiredErrorDataSchema = zod_1.z.object({
|
|
32
|
-
toolName: zod_1.z.string(),
|
|
33
|
-
requiredScopes: zod_1.z.array(zod_1.z.string()),
|
|
34
|
-
consentUrl: zod_1.z.string().optional(),
|
|
35
|
-
authorizationUrl: zod_1.z.string().optional(),
|
|
36
|
-
reason: zod_1.z.string().optional()
|
|
37
|
-
});
|
|
38
|
-
function isToolProtection(obj) {
|
|
39
|
-
return exports.ToolProtectionSchema.safeParse(obj).success;
|
|
40
|
-
}
|
|
41
|
-
function isToolProtectionMap(obj) {
|
|
42
|
-
return exports.ToolProtectionMapSchema.safeParse(obj).success;
|
|
43
|
-
}
|
|
44
|
-
function isToolProtectionResponse(obj) {
|
|
45
|
-
return exports.ToolProtectionResponseSchema.safeParse(obj).success;
|
|
46
|
-
}
|
|
47
|
-
function isDelegationRequiredErrorData(obj) {
|
|
48
|
-
return exports.DelegationRequiredErrorDataSchema.safeParse(obj).success;
|
|
49
|
-
}
|
|
50
|
-
function validateToolProtection(obj) {
|
|
51
|
-
return exports.ToolProtectionSchema.parse(obj);
|
|
52
|
-
}
|
|
53
|
-
function validateToolProtectionMap(obj) {
|
|
54
|
-
return exports.ToolProtectionMapSchema.parse(obj);
|
|
55
|
-
}
|
|
56
|
-
function validateToolProtectionResponse(obj) {
|
|
57
|
-
return exports.ToolProtectionResponseSchema.parse(obj);
|
|
58
|
-
}
|
|
59
|
-
function validateDelegationRequiredErrorData(obj) {
|
|
60
|
-
return exports.DelegationRequiredErrorDataSchema.parse(obj);
|
|
61
|
-
}
|
|
62
|
-
function toolRequiresDelegation(toolName, protections) {
|
|
63
|
-
const protection = protections[toolName];
|
|
64
|
-
return protection?.requiresDelegation ?? false;
|
|
65
|
-
}
|
|
66
|
-
function getToolRequiredScopes(toolName, protections) {
|
|
67
|
-
const protection = protections[toolName];
|
|
68
|
-
return protection?.requiredScopes ?? [];
|
|
69
|
-
}
|
|
70
|
-
function getToolRiskLevel(toolName, protections) {
|
|
71
|
-
return protections[toolName]?.riskLevel;
|
|
72
|
-
}
|
|
73
|
-
function createDelegationRequiredError(toolName, requiredScopes, consentUrl) {
|
|
74
|
-
return {
|
|
75
|
-
toolName,
|
|
76
|
-
requiredScopes,
|
|
77
|
-
consentUrl,
|
|
78
|
-
authorizationUrl: consentUrl
|
|
79
|
-
};
|
|
80
|
-
}
|
package/dist/vc/index.d.ts
DELETED
package/dist/vc/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("./statuslist.js"), exports);
|