@kya-os/mcp-i-core 1.1.0 → 1.1.1-canary.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/__tests__/utils/mock-providers.d.ts +102 -0
- package/dist/__tests__/utils/mock-providers.d.ts.map +1 -0
- package/dist/__tests__/utils/mock-providers.js +270 -0
- package/dist/__tests__/utils/mock-providers.js.map +1 -0
- package/dist/cache/tool-protection-cache.d.ts +73 -0
- package/dist/cache/tool-protection-cache.d.ts.map +1 -0
- package/dist/cache/tool-protection-cache.js +83 -0
- package/dist/cache/tool-protection-cache.js.map +1 -0
- package/dist/compliance/index.d.ts +8 -0
- package/dist/compliance/index.d.ts.map +1 -0
- package/dist/compliance/index.js +24 -0
- package/dist/compliance/index.js.map +1 -0
- package/dist/compliance/schema-registry.d.ts +50 -0
- package/dist/compliance/schema-registry.d.ts.map +1 -0
- package/dist/compliance/schema-registry.js +438 -0
- package/dist/compliance/schema-registry.js.map +1 -0
- package/dist/compliance/schema-verifier-v2.d.ts +110 -0
- package/dist/compliance/schema-verifier-v2.d.ts.map +1 -0
- package/dist/compliance/schema-verifier-v2.js +510 -0
- package/dist/compliance/schema-verifier-v2.js.map +1 -0
- package/dist/compliance/schema-verifier.d.ts +110 -0
- package/dist/compliance/schema-verifier.d.ts.map +1 -0
- package/dist/compliance/schema-verifier.js +518 -0
- package/dist/compliance/schema-verifier.js.map +1 -0
- package/dist/delegation/bitstring.d.ts +139 -0
- package/dist/delegation/bitstring.d.ts.map +1 -0
- package/dist/delegation/bitstring.js +213 -0
- package/dist/delegation/bitstring.js.map +1 -0
- package/dist/delegation/cascading-revocation.d.ts +162 -0
- package/dist/delegation/cascading-revocation.d.ts.map +1 -0
- package/dist/delegation/cascading-revocation.js +263 -0
- package/dist/delegation/cascading-revocation.js.map +1 -0
- package/dist/delegation/delegation-graph.d.ts +178 -0
- package/dist/delegation/delegation-graph.d.ts.map +1 -0
- package/dist/delegation/delegation-graph.js +209 -0
- package/dist/delegation/delegation-graph.js.map +1 -0
- package/dist/delegation/index.d.ts +14 -0
- package/dist/delegation/index.d.ts.map +1 -0
- package/dist/delegation/index.js +30 -0
- package/dist/delegation/index.js.map +1 -0
- package/dist/delegation/statuslist-manager.d.ts +148 -0
- package/dist/delegation/statuslist-manager.d.ts.map +1 -0
- package/dist/delegation/statuslist-manager.js +221 -0
- package/dist/delegation/statuslist-manager.js.map +1 -0
- package/dist/delegation/storage/index.d.ts +9 -0
- package/dist/delegation/storage/index.d.ts.map +1 -0
- package/dist/delegation/storage/index.js +25 -0
- package/dist/delegation/storage/index.js.map +1 -0
- package/dist/delegation/storage/memory-graph-storage.d.ts +70 -0
- package/dist/delegation/storage/memory-graph-storage.d.ts.map +1 -0
- package/dist/delegation/storage/memory-graph-storage.js +149 -0
- package/dist/delegation/storage/memory-graph-storage.js.map +1 -0
- package/dist/delegation/storage/memory-statuslist-storage.d.ts +49 -0
- package/dist/delegation/storage/memory-statuslist-storage.d.ts.map +1 -0
- package/dist/delegation/storage/memory-statuslist-storage.js +67 -0
- package/dist/delegation/storage/memory-statuslist-storage.js.map +1 -0
- package/dist/delegation/utils.d.ts +19 -0
- package/dist/delegation/utils.d.ts.map +1 -0
- package/dist/delegation/utils.js +48 -0
- package/dist/delegation/utils.js.map +1 -0
- package/dist/delegation/vc-issuer.d.ts +135 -0
- package/dist/delegation/vc-issuer.d.ts.map +1 -0
- package/dist/delegation/vc-issuer.js +140 -0
- package/dist/delegation/vc-issuer.js.map +1 -0
- package/dist/delegation/vc-verifier.d.ts +213 -0
- package/dist/delegation/vc-verifier.d.ts.map +1 -0
- package/dist/delegation/vc-verifier.js +354 -0
- package/dist/delegation/vc-verifier.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +64 -1
- package/dist/index.js.map +1 -1
- package/dist/providers/base.d.ts +1 -1
- package/dist/providers/base.d.ts.map +1 -1
- package/dist/providers/memory.js +2 -2
- package/dist/providers/memory.js.map +1 -1
- package/dist/runtime/base.d.ts +12 -0
- package/dist/runtime/base.d.ts.map +1 -1
- package/dist/runtime/base.js +96 -2
- package/dist/runtime/base.js.map +1 -1
- package/dist/services/tool-protection.service.d.ts +55 -0
- package/dist/services/tool-protection.service.d.ts.map +1 -0
- package/dist/services/tool-protection.service.js +158 -0
- package/dist/services/tool-protection.service.js.map +1 -0
- package/dist/types/tool-protection.d.ts +103 -0
- package/dist/types/tool-protection.d.ts.map +1 -0
- package/dist/types/tool-protection.js +41 -0
- package/dist/types/tool-protection.js.map +1 -0
- package/dist/utils/cors.d.ts +44 -0
- package/dist/utils/cors.d.ts.map +1 -0
- package/dist/utils/cors.js +71 -0
- package/dist/utils/cors.js.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +21 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +9 -6
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delegation Graph Manager
|
|
3
|
+
*
|
|
4
|
+
* Tracks parent-child relationships between delegation credentials.
|
|
5
|
+
* Critical for cascading revocation per Delegation-Revocation.md.
|
|
6
|
+
*
|
|
7
|
+
* SOLID Principles:
|
|
8
|
+
* - Single Responsibility: Only manages delegation relationships
|
|
9
|
+
* - Open/Closed: Extensible via storage provider interface
|
|
10
|
+
* - Liskov Substitution: Any storage provider can be used
|
|
11
|
+
* - Interface Segregation: Minimal graph operations interface
|
|
12
|
+
* - Dependency Inversion: Depends on storage abstraction
|
|
13
|
+
*
|
|
14
|
+
* Related Spec: MCP-I §4.4, Delegation Chains
|
|
15
|
+
* Python Reference: Delegation-Revocation.md:45-67
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Delegation node in the graph
|
|
19
|
+
*/
|
|
20
|
+
export interface DelegationNode {
|
|
21
|
+
/** Delegation credential ID */
|
|
22
|
+
id: string;
|
|
23
|
+
/** Parent delegation ID (null for root) */
|
|
24
|
+
parentId: string | null;
|
|
25
|
+
/** Child delegation IDs */
|
|
26
|
+
children: string[];
|
|
27
|
+
/** Issuer DID */
|
|
28
|
+
issuerDid: string;
|
|
29
|
+
/** Subject DID */
|
|
30
|
+
subjectDid: string;
|
|
31
|
+
/** Credential status reference (for revocation) */
|
|
32
|
+
credentialStatusId?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Storage provider interface for delegation graphs
|
|
36
|
+
*
|
|
37
|
+
* Platform-specific implementations (CloudflareKV, DynamoDB, etc.)
|
|
38
|
+
*/
|
|
39
|
+
export interface DelegationGraphStorageProvider {
|
|
40
|
+
/**
|
|
41
|
+
* Get a delegation node by ID
|
|
42
|
+
*/
|
|
43
|
+
getNode(delegationId: string): Promise<DelegationNode | null>;
|
|
44
|
+
/**
|
|
45
|
+
* Save a delegation node
|
|
46
|
+
*/
|
|
47
|
+
setNode(node: DelegationNode): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Get all children of a delegation
|
|
50
|
+
*/
|
|
51
|
+
getChildren(delegationId: string): Promise<DelegationNode[]>;
|
|
52
|
+
/**
|
|
53
|
+
* Get the full chain from root to this delegation
|
|
54
|
+
*/
|
|
55
|
+
getChain(delegationId: string): Promise<DelegationNode[]>;
|
|
56
|
+
/**
|
|
57
|
+
* Get all descendants (children, grandchildren, etc.)
|
|
58
|
+
*/
|
|
59
|
+
getDescendants(delegationId: string): Promise<DelegationNode[]>;
|
|
60
|
+
/**
|
|
61
|
+
* Delete a node (used for cleanup)
|
|
62
|
+
*/
|
|
63
|
+
deleteNode(delegationId: string): Promise<void>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Delegation Graph Manager
|
|
67
|
+
*
|
|
68
|
+
* Manages the tree/graph structure of delegations.
|
|
69
|
+
* Per Delegation-Revocation.md:
|
|
70
|
+
* - Track parent-child relationships
|
|
71
|
+
* - Support chain validation
|
|
72
|
+
* - Enable cascading revocation
|
|
73
|
+
*/
|
|
74
|
+
export declare class DelegationGraphManager {
|
|
75
|
+
private storage;
|
|
76
|
+
constructor(storage: DelegationGraphStorageProvider);
|
|
77
|
+
/**
|
|
78
|
+
* Register a new delegation in the graph
|
|
79
|
+
*
|
|
80
|
+
* @param delegation - The delegation to register
|
|
81
|
+
* @returns The created node
|
|
82
|
+
*/
|
|
83
|
+
registerDelegation(params: {
|
|
84
|
+
id: string;
|
|
85
|
+
parentId: string | null;
|
|
86
|
+
issuerDid: string;
|
|
87
|
+
subjectDid: string;
|
|
88
|
+
credentialStatusId?: string;
|
|
89
|
+
}): Promise<DelegationNode>;
|
|
90
|
+
/**
|
|
91
|
+
* Add a child to a parent node
|
|
92
|
+
*
|
|
93
|
+
* @param parentId - Parent delegation ID
|
|
94
|
+
* @param childId - Child delegation ID
|
|
95
|
+
*/
|
|
96
|
+
private addChildToParent;
|
|
97
|
+
/**
|
|
98
|
+
* Get a delegation node
|
|
99
|
+
*
|
|
100
|
+
* @param delegationId - The delegation ID
|
|
101
|
+
* @returns The node, or null if not found
|
|
102
|
+
*/
|
|
103
|
+
getNode(delegationId: string): Promise<DelegationNode | null>;
|
|
104
|
+
/**
|
|
105
|
+
* Get all direct children of a delegation
|
|
106
|
+
*
|
|
107
|
+
* @param delegationId - The parent delegation ID
|
|
108
|
+
* @returns Array of child nodes
|
|
109
|
+
*/
|
|
110
|
+
getChildren(delegationId: string): Promise<DelegationNode[]>;
|
|
111
|
+
/**
|
|
112
|
+
* Get all descendants (children, grandchildren, etc.)
|
|
113
|
+
*
|
|
114
|
+
* Used for cascading revocation.
|
|
115
|
+
* Per Delegation-Revocation.md:56-67
|
|
116
|
+
*
|
|
117
|
+
* @param delegationId - The parent delegation ID
|
|
118
|
+
* @returns Array of all descendant nodes
|
|
119
|
+
*/
|
|
120
|
+
getDescendants(delegationId: string): Promise<DelegationNode[]>;
|
|
121
|
+
/**
|
|
122
|
+
* Get the full delegation chain from root to this node
|
|
123
|
+
*
|
|
124
|
+
* Used for chain validation.
|
|
125
|
+
*
|
|
126
|
+
* @param delegationId - The delegation ID
|
|
127
|
+
* @returns Array of nodes from root to this node
|
|
128
|
+
*/
|
|
129
|
+
getChain(delegationId: string): Promise<DelegationNode[]>;
|
|
130
|
+
/**
|
|
131
|
+
* Check if delegation A is an ancestor of delegation B
|
|
132
|
+
*
|
|
133
|
+
* @param ancestorId - Potential ancestor ID
|
|
134
|
+
* @param descendantId - Potential descendant ID
|
|
135
|
+
* @returns true if ancestorId is an ancestor of descendantId
|
|
136
|
+
*/
|
|
137
|
+
isAncestor(ancestorId: string, descendantId: string): Promise<boolean>;
|
|
138
|
+
/**
|
|
139
|
+
* Get the depth of a delegation in the tree
|
|
140
|
+
*
|
|
141
|
+
* @param delegationId - The delegation ID
|
|
142
|
+
* @returns Depth (0 for root, 1 for immediate child, etc.)
|
|
143
|
+
*/
|
|
144
|
+
getDepth(delegationId: string): Promise<number>;
|
|
145
|
+
/**
|
|
146
|
+
* Validate that a delegation chain is properly formed
|
|
147
|
+
*
|
|
148
|
+
* Checks that:
|
|
149
|
+
* - Each child's issuer is the parent's subject
|
|
150
|
+
* - No cycles exist
|
|
151
|
+
* - Chain is continuous
|
|
152
|
+
*
|
|
153
|
+
* @param delegationId - The delegation ID to validate
|
|
154
|
+
* @returns Validation result
|
|
155
|
+
*/
|
|
156
|
+
validateChain(delegationId: string): Promise<{
|
|
157
|
+
valid: boolean;
|
|
158
|
+
reason?: string;
|
|
159
|
+
}>;
|
|
160
|
+
/**
|
|
161
|
+
* Remove a delegation from the graph
|
|
162
|
+
*
|
|
163
|
+
* Note: This doesn't cascade - use CascadingRevocationManager for that.
|
|
164
|
+
*
|
|
165
|
+
* @param delegationId - The delegation ID to remove
|
|
166
|
+
*/
|
|
167
|
+
removeDelegation(delegationId: string): Promise<void>;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Create a delegation graph manager
|
|
171
|
+
*
|
|
172
|
+
* Convenience factory function.
|
|
173
|
+
*
|
|
174
|
+
* @param storage - Storage provider
|
|
175
|
+
* @returns DelegationGraphManager instance
|
|
176
|
+
*/
|
|
177
|
+
export declare function createDelegationGraph(storage: DelegationGraphStorageProvider): DelegationGraphManager;
|
|
178
|
+
//# sourceMappingURL=delegation-graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegation-graph.d.ts","sourceRoot":"","sources":["../../src/delegation/delegation-graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IAEX,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,EAAE,CAAC;IAEnB,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAC;IAElB,kBAAkB;IAClB,UAAU,EAAE,MAAM,CAAC;IAEnB,mDAAmD;IACnD,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAE9D;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7C;;OAEG;IACH,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAE7D;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAE1D;;OAEG;IACH,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAEhE;;OAEG;IACH,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,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gB,qBAAqB,CACnC,OAAO,EAAE,8BAA8B,GACtC,sBAAsB,CAExB"}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Delegation Graph Manager
|
|
4
|
+
*
|
|
5
|
+
* Tracks parent-child relationships between delegation credentials.
|
|
6
|
+
* Critical for cascading revocation per Delegation-Revocation.md.
|
|
7
|
+
*
|
|
8
|
+
* SOLID Principles:
|
|
9
|
+
* - Single Responsibility: Only manages delegation relationships
|
|
10
|
+
* - Open/Closed: Extensible via storage provider interface
|
|
11
|
+
* - Liskov Substitution: Any storage provider can be used
|
|
12
|
+
* - Interface Segregation: Minimal graph operations interface
|
|
13
|
+
* - Dependency Inversion: Depends on storage abstraction
|
|
14
|
+
*
|
|
15
|
+
* Related Spec: MCP-I §4.4, Delegation Chains
|
|
16
|
+
* Python Reference: Delegation-Revocation.md:45-67
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.DelegationGraphManager = void 0;
|
|
20
|
+
exports.createDelegationGraph = createDelegationGraph;
|
|
21
|
+
/**
|
|
22
|
+
* Delegation Graph Manager
|
|
23
|
+
*
|
|
24
|
+
* Manages the tree/graph structure of delegations.
|
|
25
|
+
* Per Delegation-Revocation.md:
|
|
26
|
+
* - Track parent-child relationships
|
|
27
|
+
* - Support chain validation
|
|
28
|
+
* - Enable cascading revocation
|
|
29
|
+
*/
|
|
30
|
+
class DelegationGraphManager {
|
|
31
|
+
storage;
|
|
32
|
+
constructor(storage) {
|
|
33
|
+
this.storage = storage;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Register a new delegation in the graph
|
|
37
|
+
*
|
|
38
|
+
* @param delegation - The delegation to register
|
|
39
|
+
* @returns The created node
|
|
40
|
+
*/
|
|
41
|
+
async registerDelegation(params) {
|
|
42
|
+
const node = {
|
|
43
|
+
id: params.id,
|
|
44
|
+
parentId: params.parentId,
|
|
45
|
+
children: [],
|
|
46
|
+
issuerDid: params.issuerDid,
|
|
47
|
+
subjectDid: params.subjectDid,
|
|
48
|
+
credentialStatusId: params.credentialStatusId,
|
|
49
|
+
};
|
|
50
|
+
// Save the node
|
|
51
|
+
await this.storage.setNode(node);
|
|
52
|
+
// If has parent, add this as a child to parent
|
|
53
|
+
if (params.parentId) {
|
|
54
|
+
await this.addChildToParent(params.parentId, params.id);
|
|
55
|
+
}
|
|
56
|
+
return node;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Add a child to a parent node
|
|
60
|
+
*
|
|
61
|
+
* @param parentId - Parent delegation ID
|
|
62
|
+
* @param childId - Child delegation ID
|
|
63
|
+
*/
|
|
64
|
+
async addChildToParent(parentId, childId) {
|
|
65
|
+
const parent = await this.storage.getNode(parentId);
|
|
66
|
+
if (!parent) {
|
|
67
|
+
throw new Error(`Parent delegation not found: ${parentId}`);
|
|
68
|
+
}
|
|
69
|
+
// Add child if not already present
|
|
70
|
+
if (!parent.children.includes(childId)) {
|
|
71
|
+
parent.children.push(childId);
|
|
72
|
+
await this.storage.setNode(parent);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Get a delegation node
|
|
77
|
+
*
|
|
78
|
+
* @param delegationId - The delegation ID
|
|
79
|
+
* @returns The node, or null if not found
|
|
80
|
+
*/
|
|
81
|
+
async getNode(delegationId) {
|
|
82
|
+
return this.storage.getNode(delegationId);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Get all direct children of a delegation
|
|
86
|
+
*
|
|
87
|
+
* @param delegationId - The parent delegation ID
|
|
88
|
+
* @returns Array of child nodes
|
|
89
|
+
*/
|
|
90
|
+
async getChildren(delegationId) {
|
|
91
|
+
return this.storage.getChildren(delegationId);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Get all descendants (children, grandchildren, etc.)
|
|
95
|
+
*
|
|
96
|
+
* Used for cascading revocation.
|
|
97
|
+
* Per Delegation-Revocation.md:56-67
|
|
98
|
+
*
|
|
99
|
+
* @param delegationId - The parent delegation ID
|
|
100
|
+
* @returns Array of all descendant nodes
|
|
101
|
+
*/
|
|
102
|
+
async getDescendants(delegationId) {
|
|
103
|
+
return this.storage.getDescendants(delegationId);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Get the full delegation chain from root to this node
|
|
107
|
+
*
|
|
108
|
+
* Used for chain validation.
|
|
109
|
+
*
|
|
110
|
+
* @param delegationId - The delegation ID
|
|
111
|
+
* @returns Array of nodes from root to this node
|
|
112
|
+
*/
|
|
113
|
+
async getChain(delegationId) {
|
|
114
|
+
return this.storage.getChain(delegationId);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Check if delegation A is an ancestor of delegation B
|
|
118
|
+
*
|
|
119
|
+
* @param ancestorId - Potential ancestor ID
|
|
120
|
+
* @param descendantId - Potential descendant ID
|
|
121
|
+
* @returns true if ancestorId is an ancestor of descendantId
|
|
122
|
+
*/
|
|
123
|
+
async isAncestor(ancestorId, descendantId) {
|
|
124
|
+
const chain = await this.getChain(descendantId);
|
|
125
|
+
return chain.some((node) => node.id === ancestorId);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Get the depth of a delegation in the tree
|
|
129
|
+
*
|
|
130
|
+
* @param delegationId - The delegation ID
|
|
131
|
+
* @returns Depth (0 for root, 1 for immediate child, etc.)
|
|
132
|
+
*/
|
|
133
|
+
async getDepth(delegationId) {
|
|
134
|
+
const chain = await this.getChain(delegationId);
|
|
135
|
+
return chain.length - 1; // -1 because chain includes the node itself
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Validate that a delegation chain is properly formed
|
|
139
|
+
*
|
|
140
|
+
* Checks that:
|
|
141
|
+
* - Each child's issuer is the parent's subject
|
|
142
|
+
* - No cycles exist
|
|
143
|
+
* - Chain is continuous
|
|
144
|
+
*
|
|
145
|
+
* @param delegationId - The delegation ID to validate
|
|
146
|
+
* @returns Validation result
|
|
147
|
+
*/
|
|
148
|
+
async validateChain(delegationId) {
|
|
149
|
+
const chain = await this.getChain(delegationId);
|
|
150
|
+
if (chain.length === 0) {
|
|
151
|
+
return { valid: false, reason: 'Delegation not found' };
|
|
152
|
+
}
|
|
153
|
+
// Check each link in the chain
|
|
154
|
+
for (let i = 1; i < chain.length; i++) {
|
|
155
|
+
const parent = chain[i - 1];
|
|
156
|
+
const child = chain[i];
|
|
157
|
+
// Child's issuer must be parent's subject
|
|
158
|
+
if (child.issuerDid !== parent.subjectDid) {
|
|
159
|
+
return {
|
|
160
|
+
valid: false,
|
|
161
|
+
reason: `Invalid chain: ${child.id} issued by ${child.issuerDid} but parent ${parent.id} subject is ${parent.subjectDid}`,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
// Child's parent pointer must match parent's ID
|
|
165
|
+
if (child.parentId !== parent.id) {
|
|
166
|
+
return {
|
|
167
|
+
valid: false,
|
|
168
|
+
reason: `Invalid chain: ${child.id} parentId=${child.parentId} but actual parent is ${parent.id}`,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return { valid: true };
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Remove a delegation from the graph
|
|
176
|
+
*
|
|
177
|
+
* Note: This doesn't cascade - use CascadingRevocationManager for that.
|
|
178
|
+
*
|
|
179
|
+
* @param delegationId - The delegation ID to remove
|
|
180
|
+
*/
|
|
181
|
+
async removeDelegation(delegationId) {
|
|
182
|
+
const node = await this.storage.getNode(delegationId);
|
|
183
|
+
if (!node)
|
|
184
|
+
return;
|
|
185
|
+
// Remove from parent's children list
|
|
186
|
+
if (node.parentId) {
|
|
187
|
+
const parent = await this.storage.getNode(node.parentId);
|
|
188
|
+
if (parent) {
|
|
189
|
+
parent.children = parent.children.filter((id) => id !== delegationId);
|
|
190
|
+
await this.storage.setNode(parent);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
// Delete the node
|
|
194
|
+
await this.storage.deleteNode(delegationId);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
exports.DelegationGraphManager = DelegationGraphManager;
|
|
198
|
+
/**
|
|
199
|
+
* Create a delegation graph manager
|
|
200
|
+
*
|
|
201
|
+
* Convenience factory function.
|
|
202
|
+
*
|
|
203
|
+
* @param storage - Storage provider
|
|
204
|
+
* @returns DelegationGraphManager instance
|
|
205
|
+
*/
|
|
206
|
+
function createDelegationGraph(storage) {
|
|
207
|
+
return new DelegationGraphManager(storage);
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=delegation-graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegation-graph.js","sourceRoot":"","sources":["../../src/delegation/delegation-graph.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAuRH,sDAIC;AA7ND;;;;;;;;GAQG;AACH,MAAa,sBAAsB;IACb;IAApB,YAAoB,OAAuC;QAAvC,YAAO,GAAP,OAAO,CAAgC;IAAG,CAAC;IAE/D;;;;;OAKG;IACH,KAAK,CAAC,kBAAkB,CAAC,MAMxB;QACC,MAAM,IAAI,GAAmB;YAC3B,EAAE,EAAE,MAAM,CAAC,EAAE;YACb,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,QAAQ,EAAE,EAAE;YACZ,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,kBAAkB,EAAE,MAAM,CAAC,kBAAkB;SAC9C,CAAC;QAEF,gBAAgB;QAChB,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAEjC,+CAA+C;QAC/C,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACpB,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;QAC1D,CAAC;QAED,OAAO,IAAI,CAAC;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Aa,KAAK,CAAC,QAAQ,yBAAyB,MAAM,CAAC,EAAE,EAAE;iBAClG,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,gBAAgB,CAAC,YAAoB;QACzC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI;YAAE,OAAO;QAElB,qCAAqC;QACrC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACzD,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,YAAY,CAAC,CAAC;gBACtE,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACrC,CAAC;QACH,CAAC;QAED,kBAAkB;QAClB,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IAC9C,CAAC;CACF;AAtMD,wDAsMC;AAED;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CACnC,OAAuC;IAEvC,OAAO,IAAI,sBAAsB,CAAC,OAAO,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delegation Module Exports (Platform-Agnostic)
|
|
3
|
+
*
|
|
4
|
+
* W3C VC-based delegation issuance and verification.
|
|
5
|
+
* Platform-specific adapters (Node.js, Cloudflare) provide signing/verification functions.
|
|
6
|
+
*/
|
|
7
|
+
export * from './vc-issuer';
|
|
8
|
+
export * from './vc-verifier';
|
|
9
|
+
export * from './bitstring';
|
|
10
|
+
export * from './statuslist-manager';
|
|
11
|
+
export * from './delegation-graph';
|
|
12
|
+
export * from './cascading-revocation';
|
|
13
|
+
export * from './utils';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/delegation/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Delegation Module Exports (Platform-Agnostic)
|
|
4
|
+
*
|
|
5
|
+
* W3C VC-based delegation issuance and verification.
|
|
6
|
+
* Platform-specific adapters (Node.js, Cloudflare) provide signing/verification functions.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
__exportStar(require("./vc-issuer"), exports);
|
|
24
|
+
__exportStar(require("./vc-verifier"), exports);
|
|
25
|
+
__exportStar(require("./bitstring"), exports);
|
|
26
|
+
__exportStar(require("./statuslist-manager"), exports);
|
|
27
|
+
__exportStar(require("./delegation-graph"), exports);
|
|
28
|
+
__exportStar(require("./cascading-revocation"), exports);
|
|
29
|
+
__exportStar(require("./utils"), exports);
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/delegation/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,8CAA4B;AAC5B,gDAA8B;AAC9B,8CAA4B;AAC5B,uDAAqC;AACrC,qDAAmC;AACnC,yDAAuC;AACvC,0CAAwB"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StatusList2021 Manager
|
|
3
|
+
*
|
|
4
|
+
* Manages StatusList2021 credentials for efficient delegation revocation.
|
|
5
|
+
* Follows the Python POC design from Delegation-Revocation.md.
|
|
6
|
+
*
|
|
7
|
+
* SOLID Principles:
|
|
8
|
+
* - Single Responsibility: Manages status list allocation and updates
|
|
9
|
+
* - Open/Closed: Extensible via storage provider interface
|
|
10
|
+
* - Liskov Substitution: Any storage provider can be used
|
|
11
|
+
* - Interface Segregation: Minimal storage interface
|
|
12
|
+
* - Dependency Inversion: Depends on abstractions (storage, signing)
|
|
13
|
+
*
|
|
14
|
+
* Related Spec: W3C StatusList2021
|
|
15
|
+
* Python Reference: Delegation-Revocation.md
|
|
16
|
+
*/
|
|
17
|
+
import type { StatusList2021Credential, CredentialStatus } from '@kya-os/contracts';
|
|
18
|
+
import { CompressionFunction, DecompressionFunction } from './bitstring';
|
|
19
|
+
import { VCSigningFunction } from './vc-issuer';
|
|
20
|
+
/**
|
|
21
|
+
* Storage provider interface for status lists
|
|
22
|
+
*
|
|
23
|
+
* Platform-specific implementations (CloudflareKV, DynamoDB, Redis, etc.)
|
|
24
|
+
* implement this interface.
|
|
25
|
+
*/
|
|
26
|
+
export interface StatusListStorageProvider {
|
|
27
|
+
/**
|
|
28
|
+
* Get a status list credential by ID
|
|
29
|
+
*
|
|
30
|
+
* @param statusListId - The status list URL
|
|
31
|
+
* @returns The status list credential, or null if not found
|
|
32
|
+
*/
|
|
33
|
+
getStatusList(statusListId: string): Promise<StatusList2021Credential | null>;
|
|
34
|
+
/**
|
|
35
|
+
* Save a status list credential
|
|
36
|
+
*
|
|
37
|
+
* @param statusListId - The status list URL
|
|
38
|
+
* @param credential - The status list credential
|
|
39
|
+
*/
|
|
40
|
+
setStatusList(statusListId: string, credential: StatusList2021Credential): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Allocate a new index in a status list
|
|
43
|
+
*
|
|
44
|
+
* Thread-safe allocation of the next available index.
|
|
45
|
+
*
|
|
46
|
+
* @param statusListId - The status list URL
|
|
47
|
+
* @returns The allocated index
|
|
48
|
+
*/
|
|
49
|
+
allocateIndex(statusListId: string): Promise<number>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Identity provider for signing status list credentials
|
|
53
|
+
*/
|
|
54
|
+
export interface StatusListIdentityProvider {
|
|
55
|
+
/** Get the DID of this identity */
|
|
56
|
+
getDid(): string;
|
|
57
|
+
/** Get the key ID of this identity */
|
|
58
|
+
getKeyId(): string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* StatusList2021 Manager
|
|
62
|
+
*
|
|
63
|
+
* Manages status lists for efficient delegation revocation.
|
|
64
|
+
* Per Delegation-Revocation.md:
|
|
65
|
+
* - StatusList2021 for efficient revocation distribution
|
|
66
|
+
* - Compressed bitstrings for scalability
|
|
67
|
+
* - Separate lists for revocation vs suspension
|
|
68
|
+
*/
|
|
69
|
+
export declare class StatusList2021Manager {
|
|
70
|
+
private storage;
|
|
71
|
+
private identity;
|
|
72
|
+
private signingFunction;
|
|
73
|
+
private compressor;
|
|
74
|
+
private decompressor;
|
|
75
|
+
private statusListBaseUrl;
|
|
76
|
+
private defaultListSize;
|
|
77
|
+
constructor(storage: StatusListStorageProvider, identity: StatusListIdentityProvider, signingFunction: VCSigningFunction, compressor: CompressionFunction, decompressor: DecompressionFunction, options?: {
|
|
78
|
+
/** Base URL for status lists (e.g., "https://example.com/status") */
|
|
79
|
+
statusListBaseUrl?: string;
|
|
80
|
+
/** Default size for new status lists (number of entries) */
|
|
81
|
+
defaultListSize?: number;
|
|
82
|
+
});
|
|
83
|
+
/**
|
|
84
|
+
* Allocate a status entry for a new delegation credential
|
|
85
|
+
*
|
|
86
|
+
* Per Delegation-Revocation.md: Each delegation gets a unique status list entry.
|
|
87
|
+
*
|
|
88
|
+
* @param purpose - "revocation" or "suspension"
|
|
89
|
+
* @returns CredentialStatus entry for the delegation VC
|
|
90
|
+
*/
|
|
91
|
+
allocateStatusEntry(purpose: 'revocation' | 'suspension'): Promise<CredentialStatus>;
|
|
92
|
+
/**
|
|
93
|
+
* Revoke or suspend a delegation by updating its status
|
|
94
|
+
*
|
|
95
|
+
* @param credentialStatus - The credential status entry from the VC
|
|
96
|
+
* @param revoked - true to revoke/suspend, false to restore
|
|
97
|
+
*/
|
|
98
|
+
updateStatus(credentialStatus: CredentialStatus, revoked: boolean): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Check if a credential is revoked
|
|
101
|
+
*
|
|
102
|
+
* @param credentialStatus - The credential status entry
|
|
103
|
+
* @returns true if revoked/suspended, false otherwise
|
|
104
|
+
*/
|
|
105
|
+
checkStatus(credentialStatus: CredentialStatus): Promise<boolean>;
|
|
106
|
+
/**
|
|
107
|
+
* Get all revoked indices in a status list
|
|
108
|
+
*
|
|
109
|
+
* Useful for debugging or auditing.
|
|
110
|
+
*
|
|
111
|
+
* @param statusListId - The status list URL
|
|
112
|
+
* @returns Array of revoked indices
|
|
113
|
+
*/
|
|
114
|
+
getRevokedIndices(statusListId: string): Promise<number[]>;
|
|
115
|
+
/**
|
|
116
|
+
* Ensure a status list exists, creating it if needed
|
|
117
|
+
*
|
|
118
|
+
* @param statusListId - The status list URL
|
|
119
|
+
* @param purpose - "revocation" or "suspension"
|
|
120
|
+
*/
|
|
121
|
+
private ensureStatusListExists;
|
|
122
|
+
/**
|
|
123
|
+
* Get the status list base URL
|
|
124
|
+
*/
|
|
125
|
+
getStatusListBaseUrl(): string;
|
|
126
|
+
/**
|
|
127
|
+
* Get the default list size
|
|
128
|
+
*/
|
|
129
|
+
getDefaultListSize(): number;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Create a StatusList2021 manager
|
|
133
|
+
*
|
|
134
|
+
* Convenience factory function.
|
|
135
|
+
*
|
|
136
|
+
* @param storage - Storage provider
|
|
137
|
+
* @param identity - Identity provider
|
|
138
|
+
* @param signingFunction - VC signing function
|
|
139
|
+
* @param compressor - Compression function
|
|
140
|
+
* @param decompressor - Decompression function
|
|
141
|
+
* @param options - Manager options
|
|
142
|
+
* @returns StatusList2021Manager instance
|
|
143
|
+
*/
|
|
144
|
+
export declare function createStatusListManager(storage: StatusListStorageProvider, identity: StatusListIdentityProvider, signingFunction: VCSigningFunction, compressor: CompressionFunction, decompressor: DecompressionFunction, options?: {
|
|
145
|
+
statusListBaseUrl?: string;
|
|
146
|
+
defaultListSize?: number;
|
|
147
|
+
}): StatusList2021Manager;
|
|
148
|
+
//# sourceMappingURL=statuslist-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statuslist-manager.d.ts","sourceRoot":"","sources":["../../src/delegation/statuslist-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EACV,wBAAwB,EACxB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAoB,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,iBAAiB,EAAE,MAAM,a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