mcard-js 2.1.13 → 2.1.15
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/README.md +48 -0
- package/dist/model/CardCollection.d.ts +55 -0
- package/dist/model/CardCollection.d.ts.map +1 -1
- package/dist/model/CardCollection.js +55 -0
- package/dist/model/CardCollection.js.map +1 -1
- package/dist/model/MCard.d.ts +79 -2
- package/dist/model/MCard.d.ts.map +1 -1
- package/dist/model/MCard.js +80 -1
- package/dist/model/MCard.js.map +1 -1
- package/dist/model/PCard.d.ts +50 -0
- package/dist/model/PCard.d.ts.map +1 -0
- package/dist/model/PCard.js +110 -0
- package/dist/model/PCard.js.map +1 -0
- package/dist/model/VCard.d.ts +162 -0
- package/dist/model/VCard.d.ts.map +1 -0
- package/dist/model/VCard.js +298 -0
- package/dist/model/VCard.js.map +1 -0
- package/dist/model/vcard_ext/core.d.ts +22 -0
- package/dist/model/vcard_ext/core.d.ts.map +1 -0
- package/dist/model/vcard_ext/core.js +41 -0
- package/dist/model/vcard_ext/core.js.map +1 -0
- package/dist/model/vcard_ext/index.d.ts +14 -0
- package/dist/model/vcard_ext/index.d.ts.map +1 -0
- package/dist/model/vcard_ext/index.js +24 -0
- package/dist/model/vcard_ext/index.js.map +1 -0
- package/dist/model/vcard_ext/network.d.ts +6 -0
- package/dist/model/vcard_ext/network.d.ts.map +1 -0
- package/dist/model/vcard_ext/network.js +23 -0
- package/dist/model/vcard_ext/network.js.map +1 -0
- package/dist/model/vcard_ext/observability.d.ts +6 -0
- package/dist/model/vcard_ext/observability.d.ts.map +1 -0
- package/dist/model/vcard_ext/observability.js +62 -0
- package/dist/model/vcard_ext/observability.js.map +1 -0
- package/dist/model/vcard_ext/storage.d.ts +6 -0
- package/dist/model/vcard_ext/storage.d.ts.map +1 -0
- package/dist/model/vcard_ext/storage.js +47 -0
- package/dist/model/vcard_ext/storage.js.map +1 -0
- package/dist/model/vcard_ext/vendors.d.ts +12 -0
- package/dist/model/vcard_ext/vendors.d.ts.map +1 -0
- package/dist/model/vcard_ext/vendors.js +210 -0
- package/dist/model/vcard_ext/vendors.js.map +1 -0
- package/dist/model/vcard_vocabulary.d.ts +174 -0
- package/dist/model/vcard_vocabulary.d.ts.map +1 -0
- package/dist/model/vcard_vocabulary.js +187 -0
- package/dist/model/vcard_vocabulary.js.map +1 -0
- package/dist/ptr/node/runtimes/loader.d.ts.map +1 -1
- package/dist/ptr/node/runtimes/loader.js +17 -1
- package/dist/ptr/node/runtimes/loader.js.map +1 -1
- package/dist/types/dots.d.ts +206 -0
- package/dist/types/dots.d.ts.map +1 -0
- package/dist/types/dots.js +201 -0
- package/dist/types/dots.js.map +1 -0
- package/dist/util/Loader.d.ts.map +1 -1
- package/dist/util/Loader.js +23 -1
- package/dist/util/Loader.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VCard Model (Application Plane) - Implementation of Arena + Action.
|
|
3
|
+
*
|
|
4
|
+
* This module defines the VCard, which represents the sovereign decision layer
|
|
5
|
+
* in the MVP Cards architecture. VCard is the IO Monad that manages all side effects.
|
|
6
|
+
*
|
|
7
|
+
* ## DOTS Vocabulary Role: Arena + Action
|
|
8
|
+
*
|
|
9
|
+
* VCard is both:
|
|
10
|
+
* - **Arena**: The interface type defining what can interact (subject_did, capabilities, external_refs)
|
|
11
|
+
* - **Action**: The morphism where interactions (PCards) act on systems (MCards) to produce new systems
|
|
12
|
+
*
|
|
13
|
+
* ## EOS Role: Sovereign Decision
|
|
14
|
+
*
|
|
15
|
+
* VCard is the controlled symmetry breaker. It:
|
|
16
|
+
* - Manages credentials and authorization
|
|
17
|
+
* - Controls side effects (IO Monad pattern)
|
|
18
|
+
* - Acts as the ingress/egress gatekeeper for the PKC boundary
|
|
19
|
+
*
|
|
20
|
+
* ## The Four Roles:
|
|
21
|
+
* 1. Identity & Credential Container (The "Who")
|
|
22
|
+
* 2. Verification Hub (The "Rules")
|
|
23
|
+
* 3. Side Effect Manager (The "Bridge")
|
|
24
|
+
* 4. Input/Output Gatekeeper (The "Gate")
|
|
25
|
+
*
|
|
26
|
+
* @see docs/WorkingNotes/Permanent/Projects/PKC Kernel/VCard.md
|
|
27
|
+
* @see docs/VCard_Impl.md
|
|
28
|
+
*/
|
|
29
|
+
import { MCard } from './MCard';
|
|
30
|
+
import { DOTSMetadata } from '../types/dots';
|
|
31
|
+
/**
|
|
32
|
+
* Scope of a capability token.
|
|
33
|
+
*/
|
|
34
|
+
export declare enum CapabilityScope {
|
|
35
|
+
READ = "read",
|
|
36
|
+
WRITE = "write",
|
|
37
|
+
EXECUTE = "execute",
|
|
38
|
+
ADMIN = "admin",
|
|
39
|
+
DELEGATE = "delegate"
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Direction of gatekeeper authorization.
|
|
43
|
+
*/
|
|
44
|
+
export declare enum GatekeeperDirection {
|
|
45
|
+
INGRESS = "ingress",// Content entering the PKC
|
|
46
|
+
EGRESS = "egress"
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A capability token defining authorized actions.
|
|
50
|
+
*/
|
|
51
|
+
export interface Capability {
|
|
52
|
+
capabilityId: string;
|
|
53
|
+
actorDid: string;
|
|
54
|
+
scope: CapabilityScope;
|
|
55
|
+
resourcePattern: string;
|
|
56
|
+
expiresAt?: Date;
|
|
57
|
+
constraints?: Record<string, any>;
|
|
58
|
+
transferable: boolean;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A verified external reference managed by VCard.
|
|
62
|
+
*/
|
|
63
|
+
export interface ExternalRef {
|
|
64
|
+
uri: string;
|
|
65
|
+
contentHash: string;
|
|
66
|
+
status: 'verified' | 'pending' | 'stale' | 'invalid';
|
|
67
|
+
signature?: string;
|
|
68
|
+
lastVerified?: Date;
|
|
69
|
+
qosMetrics?: Record<string, any>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* An ingress or egress gatekeeper event.
|
|
73
|
+
*/
|
|
74
|
+
export interface GatekeeperEvent {
|
|
75
|
+
direction: GatekeeperDirection;
|
|
76
|
+
timestamp: Date;
|
|
77
|
+
sourceDid?: string;
|
|
78
|
+
destinationDid?: string;
|
|
79
|
+
contentHash: string;
|
|
80
|
+
authorized: boolean;
|
|
81
|
+
capabilityUsed?: string;
|
|
82
|
+
signature?: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* VCard - The Application Plane unit (Arena + Action).
|
|
86
|
+
*
|
|
87
|
+
* VCard is the sovereign decision layer that:
|
|
88
|
+
* 1. Holds identity and credentials (DID, keys, capabilities)
|
|
89
|
+
* 2. Manages verification (test cases, PCard references)
|
|
90
|
+
* 3. Describes side effects (external refs, IO operations)
|
|
91
|
+
* 4. Gates all ingress/egress (nothing enters or leaves without authorization)
|
|
92
|
+
*/
|
|
93
|
+
export declare class VCard extends MCard {
|
|
94
|
+
readonly subjectDid: string;
|
|
95
|
+
readonly controllerPubkeys: string[];
|
|
96
|
+
private capabilities;
|
|
97
|
+
private externalRefs;
|
|
98
|
+
private exportManifest;
|
|
99
|
+
private gatekeeperLog;
|
|
100
|
+
protected constructor(content: Uint8Array, hash: string, g_time: string, contentType: string, hashFunction: string, subjectDid: string, controllerPubkeys: string[], capabilities: Capability[], externalRefs: ExternalRef[]);
|
|
101
|
+
/**
|
|
102
|
+
* Create a new VCard.
|
|
103
|
+
*/
|
|
104
|
+
static createVCard(subjectDid: string, controllerPubkeys: string[], capabilities?: Capability[], externalRefs?: ExternalRef[], hashAlgorithm?: string): Promise<VCard>;
|
|
105
|
+
/**
|
|
106
|
+
* Get DOTS metadata for this VCard.
|
|
107
|
+
*/
|
|
108
|
+
getDOTSMetadata(): DOTSMetadata;
|
|
109
|
+
/**
|
|
110
|
+
* Add a new capability to this VCard.
|
|
111
|
+
*/
|
|
112
|
+
addCapability(capability: Capability): void;
|
|
113
|
+
/**
|
|
114
|
+
* Get all currently valid capabilities.
|
|
115
|
+
*/
|
|
116
|
+
getValidCapabilities(): Capability[];
|
|
117
|
+
/**
|
|
118
|
+
* Check if VCard has a valid capability for a resource.
|
|
119
|
+
*/
|
|
120
|
+
hasCapability(scope: CapabilityScope, resourceHash: string): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Register a PCard for verification.
|
|
123
|
+
*/
|
|
124
|
+
addPCardReference(pcardHash: string): void;
|
|
125
|
+
/**
|
|
126
|
+
* Get all registered PCard hashes.
|
|
127
|
+
*/
|
|
128
|
+
getPCardReferences(): string[];
|
|
129
|
+
/**
|
|
130
|
+
* Add an external reference (describes a side effect).
|
|
131
|
+
*/
|
|
132
|
+
addExternalRef(ref: ExternalRef): void;
|
|
133
|
+
/**
|
|
134
|
+
* Get external references by verification status.
|
|
135
|
+
*/
|
|
136
|
+
getExternalRefsByStatus(status: ExternalRef['status']): ExternalRef[];
|
|
137
|
+
/**
|
|
138
|
+
* Verify an external reference and update its status (QoS check).
|
|
139
|
+
*/
|
|
140
|
+
verifyExternalRef(uri: string, newHash: string): boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Authorize content entering the PKC (ingress).
|
|
143
|
+
*/
|
|
144
|
+
authorizeIngress(sourceDid: string, contentHash: string, capabilityId?: string): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Register content for potential egress.
|
|
147
|
+
*/
|
|
148
|
+
registerForEgress(contentHash: string): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Authorize content leaving the PKC (egress).
|
|
151
|
+
*/
|
|
152
|
+
authorizeEgress(destinationDid: string, contentHash: string, capabilityId?: string): boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Get gatekeeper audit log.
|
|
155
|
+
*/
|
|
156
|
+
getGatekeeperLog(direction?: GatekeeperDirection): GatekeeperEvent[];
|
|
157
|
+
/**
|
|
158
|
+
* Get the export manifest (content registered for egress).
|
|
159
|
+
*/
|
|
160
|
+
getExportManifest(): string[];
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=VCard.d.ts.map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Ac,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI;IAItC;;OAEG;IACH,uBAAuB,CAAC,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,GAAG,WAAW,EAAE;IAIrE;;OAEG;IACH,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IAoBxD;;OAEG;IACH,gBAAgB,CACZ,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,MAAM,GACtB,OAAO;IA4BV;;OAEG;IACH,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO;IAQ/C;;OAEG;IACH,eAAe,CACX,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,MAAM,GACtB,OAAO;IA2CV;;OAEG;IACH,gBAAgB,CAAC,SAAS,CAAC,EAAE,mBAAmB,GAAG,eAAe,EAAE;IAOpE;;OAEG;IACH,iBAAiB,IAAI,MAAM,EAAE;CAGhC"}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VCard Model (Application Plane) - Implementation of Arena + Action.
|
|
3
|
+
*
|
|
4
|
+
* This module defines the VCard, which represents the sovereign decision layer
|
|
5
|
+
* in the MVP Cards architecture. VCard is the IO Monad that manages all side effects.
|
|
6
|
+
*
|
|
7
|
+
* ## DOTS Vocabulary Role: Arena + Action
|
|
8
|
+
*
|
|
9
|
+
* VCard is both:
|
|
10
|
+
* - **Arena**: The interface type defining what can interact (subject_did, capabilities, external_refs)
|
|
11
|
+
* - **Action**: The morphism where interactions (PCards) act on systems (MCards) to produce new systems
|
|
12
|
+
*
|
|
13
|
+
* ## EOS Role: Sovereign Decision
|
|
14
|
+
*
|
|
15
|
+
* VCard is the controlled symmetry breaker. It:
|
|
16
|
+
* - Manages credentials and authorization
|
|
17
|
+
* - Controls side effects (IO Monad pattern)
|
|
18
|
+
* - Acts as the ingress/egress gatekeeper for the PKC boundary
|
|
19
|
+
*
|
|
20
|
+
* ## The Four Roles:
|
|
21
|
+
* 1. Identity & Credential Container (The "Who")
|
|
22
|
+
* 2. Verification Hub (The "Rules")
|
|
23
|
+
* 3. Side Effect Manager (The "Bridge")
|
|
24
|
+
* 4. Input/Output Gatekeeper (The "Gate")
|
|
25
|
+
*
|
|
26
|
+
* @see docs/WorkingNotes/Permanent/Projects/PKC Kernel/VCard.md
|
|
27
|
+
* @see docs/VCard_Impl.md
|
|
28
|
+
*/
|
|
29
|
+
import { MCard } from './MCard';
|
|
30
|
+
import { HashValidator } from '../hash/HashValidator';
|
|
31
|
+
import { GTime } from './GTime';
|
|
32
|
+
import { ContentTypeInterpreter } from './detectors/ContentTypeInterpreter';
|
|
33
|
+
import { createVCardDOTSMetadata } from '../types/dots';
|
|
34
|
+
/**
|
|
35
|
+
* Scope of a capability token.
|
|
36
|
+
*/
|
|
37
|
+
export var CapabilityScope;
|
|
38
|
+
(function (CapabilityScope) {
|
|
39
|
+
CapabilityScope["READ"] = "read";
|
|
40
|
+
CapabilityScope["WRITE"] = "write";
|
|
41
|
+
CapabilityScope["EXECUTE"] = "execute";
|
|
42
|
+
CapabilityScope["ADMIN"] = "admin";
|
|
43
|
+
CapabilityScope["DELEGATE"] = "delegate";
|
|
44
|
+
})(CapabilityScope || (CapabilityScope = {}));
|
|
45
|
+
/**
|
|
46
|
+
* Direction of gatekeeper authorization.
|
|
47
|
+
*/
|
|
48
|
+
export var GatekeeperDirection;
|
|
49
|
+
(function (GatekeeperDirection) {
|
|
50
|
+
GatekeeperDirection["INGRESS"] = "ingress";
|
|
51
|
+
GatekeeperDirection["EGRESS"] = "egress"; // Content leaving the PKC
|
|
52
|
+
})(GatekeeperDirection || (GatekeeperDirection = {}));
|
|
53
|
+
/**
|
|
54
|
+
* VCard - The Application Plane unit (Arena + Action).
|
|
55
|
+
*
|
|
56
|
+
* VCard is the sovereign decision layer that:
|
|
57
|
+
* 1. Holds identity and credentials (DID, keys, capabilities)
|
|
58
|
+
* 2. Manages verification (test cases, PCard references)
|
|
59
|
+
* 3. Describes side effects (external refs, IO operations)
|
|
60
|
+
* 4. Gates all ingress/egress (nothing enters or leaves without authorization)
|
|
61
|
+
*/
|
|
62
|
+
export class VCard extends MCard {
|
|
63
|
+
subjectDid;
|
|
64
|
+
controllerPubkeys;
|
|
65
|
+
capabilities;
|
|
66
|
+
externalRefs;
|
|
67
|
+
exportManifest;
|
|
68
|
+
gatekeeperLog;
|
|
69
|
+
constructor(content, hash, g_time, contentType, hashFunction, subjectDid, controllerPubkeys, capabilities, externalRefs) {
|
|
70
|
+
super(content, hash, g_time, contentType, hashFunction);
|
|
71
|
+
this.subjectDid = subjectDid;
|
|
72
|
+
this.controllerPubkeys = controllerPubkeys;
|
|
73
|
+
this.capabilities = capabilities;
|
|
74
|
+
this.externalRefs = externalRefs;
|
|
75
|
+
this.exportManifest = [];
|
|
76
|
+
this.gatekeeperLog = [];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Create a new VCard.
|
|
80
|
+
*/
|
|
81
|
+
static async createVCard(subjectDid, controllerPubkeys, capabilities = [], externalRefs = [], hashAlgorithm = 'sha256') {
|
|
82
|
+
// Serialize state
|
|
83
|
+
const state = {
|
|
84
|
+
type: 'VCard',
|
|
85
|
+
subjectDid,
|
|
86
|
+
controllerPubkeys,
|
|
87
|
+
capabilities: capabilities.map(c => ({
|
|
88
|
+
id: c.capabilityId,
|
|
89
|
+
actor: c.actorDid,
|
|
90
|
+
scope: c.scope,
|
|
91
|
+
resourcePattern: c.resourcePattern,
|
|
92
|
+
expiresAt: c.expiresAt?.toISOString(),
|
|
93
|
+
transferable: c.transferable
|
|
94
|
+
})),
|
|
95
|
+
externalRefs: externalRefs.map(r => ({
|
|
96
|
+
uri: r.uri,
|
|
97
|
+
contentHash: r.contentHash,
|
|
98
|
+
status: r.status
|
|
99
|
+
})),
|
|
100
|
+
exportManifest: []
|
|
101
|
+
};
|
|
102
|
+
const content = JSON.stringify(state, Object.keys(state).sort());
|
|
103
|
+
const bytes = new TextEncoder().encode(content);
|
|
104
|
+
const hash = await HashValidator.computeHash(bytes, hashAlgorithm);
|
|
105
|
+
const g_time = GTime.stampNow(hashAlgorithm);
|
|
106
|
+
const contentType = ContentTypeInterpreter.detect(bytes);
|
|
107
|
+
return new VCard(bytes, hash, g_time, contentType, hashAlgorithm, subjectDid, controllerPubkeys, capabilities, externalRefs);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Get DOTS metadata for this VCard.
|
|
111
|
+
*/
|
|
112
|
+
getDOTSMetadata() {
|
|
113
|
+
return createVCardDOTSMetadata();
|
|
114
|
+
}
|
|
115
|
+
// =========================================================================
|
|
116
|
+
// Role 1: Identity & Credential Container
|
|
117
|
+
// =========================================================================
|
|
118
|
+
/**
|
|
119
|
+
* Add a new capability to this VCard.
|
|
120
|
+
*/
|
|
121
|
+
addCapability(capability) {
|
|
122
|
+
this.capabilities.push(capability);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Get all currently valid capabilities.
|
|
126
|
+
*/
|
|
127
|
+
getValidCapabilities() {
|
|
128
|
+
const now = new Date();
|
|
129
|
+
return this.capabilities.filter(c => c.expiresAt === undefined || c.expiresAt > now);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Check if VCard has a valid capability for a resource.
|
|
133
|
+
*/
|
|
134
|
+
hasCapability(scope, resourceHash) {
|
|
135
|
+
for (const cap of this.getValidCapabilities()) {
|
|
136
|
+
if (cap.scope === scope) {
|
|
137
|
+
const regex = new RegExp(cap.resourcePattern);
|
|
138
|
+
if (regex.test(resourceHash)) {
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
// =========================================================================
|
|
146
|
+
// Role 2: Verification Hub (CLM Balanced Dimension)
|
|
147
|
+
// =========================================================================
|
|
148
|
+
/**
|
|
149
|
+
* Register a PCard for verification.
|
|
150
|
+
*/
|
|
151
|
+
addPCardReference(pcardHash) {
|
|
152
|
+
const ref = {
|
|
153
|
+
uri: `pcard://${pcardHash}`,
|
|
154
|
+
contentHash: pcardHash,
|
|
155
|
+
status: 'verified'
|
|
156
|
+
};
|
|
157
|
+
this.externalRefs.push(ref);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Get all registered PCard hashes.
|
|
161
|
+
*/
|
|
162
|
+
getPCardReferences() {
|
|
163
|
+
return this.externalRefs
|
|
164
|
+
.filter(ref => ref.uri.startsWith('pcard://'))
|
|
165
|
+
.map(ref => ref.contentHash);
|
|
166
|
+
}
|
|
167
|
+
// =========================================================================
|
|
168
|
+
// Role 3: Side Effect Manager (IO Monad)
|
|
169
|
+
// =========================================================================
|
|
170
|
+
/**
|
|
171
|
+
* Add an external reference (describes a side effect).
|
|
172
|
+
*/
|
|
173
|
+
addExternalRef(ref) {
|
|
174
|
+
this.externalRefs.push(ref);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Get external references by verification status.
|
|
178
|
+
*/
|
|
179
|
+
getExternalRefsByStatus(status) {
|
|
180
|
+
return this.externalRefs.filter(r => r.status === status);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Verify an external reference and update its status (QoS check).
|
|
184
|
+
*/
|
|
185
|
+
verifyExternalRef(uri, newHash) {
|
|
186
|
+
for (const ref of this.externalRefs) {
|
|
187
|
+
if (ref.uri === uri) {
|
|
188
|
+
if (ref.contentHash === newHash) {
|
|
189
|
+
ref.status = 'verified';
|
|
190
|
+
ref.lastVerified = new Date();
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
ref.status = 'stale';
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
// =========================================================================
|
|
202
|
+
// Role 4: Input/Output Gatekeeper
|
|
203
|
+
// =========================================================================
|
|
204
|
+
/**
|
|
205
|
+
* Authorize content entering the PKC (ingress).
|
|
206
|
+
*/
|
|
207
|
+
authorizeIngress(sourceDid, contentHash, capabilityId) {
|
|
208
|
+
let authorized = false;
|
|
209
|
+
let usedCapability;
|
|
210
|
+
for (const cap of this.getValidCapabilities()) {
|
|
211
|
+
if (cap.actorDid === sourceDid &&
|
|
212
|
+
(cap.scope === CapabilityScope.WRITE || cap.scope === CapabilityScope.ADMIN)) {
|
|
213
|
+
if (capabilityId === undefined || cap.capabilityId === capabilityId) {
|
|
214
|
+
authorized = true;
|
|
215
|
+
usedCapability = cap.capabilityId;
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
const event = {
|
|
221
|
+
direction: GatekeeperDirection.INGRESS,
|
|
222
|
+
timestamp: new Date(),
|
|
223
|
+
sourceDid,
|
|
224
|
+
contentHash,
|
|
225
|
+
authorized,
|
|
226
|
+
capabilityUsed: usedCapability
|
|
227
|
+
};
|
|
228
|
+
this.gatekeeperLog.push(event);
|
|
229
|
+
return authorized;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Register content for potential egress.
|
|
233
|
+
*/
|
|
234
|
+
registerForEgress(contentHash) {
|
|
235
|
+
if (!this.exportManifest.includes(contentHash)) {
|
|
236
|
+
this.exportManifest.push(contentHash);
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Authorize content leaving the PKC (egress).
|
|
243
|
+
*/
|
|
244
|
+
authorizeEgress(destinationDid, contentHash, capabilityId) {
|
|
245
|
+
// Content must be registered for egress
|
|
246
|
+
if (!this.exportManifest.includes(contentHash)) {
|
|
247
|
+
const event = {
|
|
248
|
+
direction: GatekeeperDirection.EGRESS,
|
|
249
|
+
timestamp: new Date(),
|
|
250
|
+
destinationDid,
|
|
251
|
+
contentHash,
|
|
252
|
+
authorized: false
|
|
253
|
+
};
|
|
254
|
+
this.gatekeeperLog.push(event);
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
let authorized = false;
|
|
258
|
+
let usedCapability;
|
|
259
|
+
for (const cap of this.getValidCapabilities()) {
|
|
260
|
+
if (cap.scope === CapabilityScope.READ || cap.scope === CapabilityScope.ADMIN) {
|
|
261
|
+
const regex = new RegExp(cap.resourcePattern);
|
|
262
|
+
if (regex.test(contentHash)) {
|
|
263
|
+
if (capabilityId === undefined || cap.capabilityId === capabilityId) {
|
|
264
|
+
authorized = true;
|
|
265
|
+
usedCapability = cap.capabilityId;
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
const event = {
|
|
272
|
+
direction: GatekeeperDirection.EGRESS,
|
|
273
|
+
timestamp: new Date(),
|
|
274
|
+
destinationDid,
|
|
275
|
+
contentHash,
|
|
276
|
+
authorized,
|
|
277
|
+
capabilityUsed: usedCapability
|
|
278
|
+
};
|
|
279
|
+
this.gatekeeperLog.push(event);
|
|
280
|
+
return authorized;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Get gatekeeper audit log.
|
|
284
|
+
*/
|
|
285
|
+
getGatekeeperLog(direction) {
|
|
286
|
+
if (direction === undefined) {
|
|
287
|
+
return this.gatekeeperLog;
|
|
288
|
+
}
|
|
289
|
+
return this.gatekeeperLog.filter(e => e.direction === direction);
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Get the export manifest (content registered for egress).
|
|
293
|
+
*/
|
|
294
|
+
getExportManifest() {
|
|
295
|
+
return [...this.exportManifest];
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
//# sourceMappingURL=VCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VCard.js","sourceRoot":"","sources":["../../src/model/VCard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;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CAAC,aAAa,CAAC;QAC9B,CAAC;QACD,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;IACrE,CAAC;IAED;;OAEG;IACH,iBAAiB;QACb,OAAO,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC;IACpC,CAAC;CACJ"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core resource types and base registry.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum ResourceCategory {
|
|
5
|
+
ENVIRONMENT = "env",
|
|
6
|
+
FILESYSTEM = "file",
|
|
7
|
+
STORAGE = "storage",
|
|
8
|
+
NETWORK = "network",
|
|
9
|
+
OBSERVABILITY = "observability",
|
|
10
|
+
COMPUTE = "compute",
|
|
11
|
+
RANDOM = "random"
|
|
12
|
+
}
|
|
13
|
+
export interface ResourceType {
|
|
14
|
+
name: string;
|
|
15
|
+
category: string;
|
|
16
|
+
uriTemplate: string;
|
|
17
|
+
hashTemplate: string;
|
|
18
|
+
defaultOptions: Record<string, any>;
|
|
19
|
+
argNames: string[];
|
|
20
|
+
}
|
|
21
|
+
export declare const RESOURCE_REGISTRY: Record<string, ResourceType>;
|
|
22
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/model/vcard_ext/core.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,oBAAY,gBAAgB;IACxB,WAAW,QAAQ;IACnB,UAAU,SAAS;IACnB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,aAAa,kBAAkB;IAC/B,OAAO,YAAY;IACnB,MAAM,WAAW;CACpB;AAED,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACpC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACtB;AAGD,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAyB1D,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core resource types and base registry.
|
|
3
|
+
*/
|
|
4
|
+
export var ResourceCategory;
|
|
5
|
+
(function (ResourceCategory) {
|
|
6
|
+
ResourceCategory["ENVIRONMENT"] = "env";
|
|
7
|
+
ResourceCategory["FILESYSTEM"] = "file";
|
|
8
|
+
ResourceCategory["STORAGE"] = "storage";
|
|
9
|
+
ResourceCategory["NETWORK"] = "network";
|
|
10
|
+
ResourceCategory["OBSERVABILITY"] = "observability";
|
|
11
|
+
ResourceCategory["COMPUTE"] = "compute";
|
|
12
|
+
ResourceCategory["RANDOM"] = "random";
|
|
13
|
+
})(ResourceCategory || (ResourceCategory = {}));
|
|
14
|
+
// Core resource types that are always available
|
|
15
|
+
export const RESOURCE_REGISTRY = {
|
|
16
|
+
env: {
|
|
17
|
+
name: 'env',
|
|
18
|
+
category: ResourceCategory.ENVIRONMENT,
|
|
19
|
+
uriTemplate: 'env://{name}',
|
|
20
|
+
hashTemplate: 'env:{name}:{required}:{secret}',
|
|
21
|
+
defaultOptions: { required: true, secret: false },
|
|
22
|
+
argNames: ['name']
|
|
23
|
+
},
|
|
24
|
+
file: {
|
|
25
|
+
name: 'file',
|
|
26
|
+
category: ResourceCategory.FILESYSTEM,
|
|
27
|
+
uriTemplate: 'file://{path}',
|
|
28
|
+
hashTemplate: 'file:{path}',
|
|
29
|
+
defaultOptions: { mode: 'read', required: true },
|
|
30
|
+
argNames: ['path']
|
|
31
|
+
},
|
|
32
|
+
directory: {
|
|
33
|
+
name: 'directory',
|
|
34
|
+
category: ResourceCategory.FILESYSTEM,
|
|
35
|
+
uriTemplate: 'file://{path}/',
|
|
36
|
+
hashTemplate: 'dir:{path}',
|
|
37
|
+
defaultOptions: { recursive: true, isDirectory: true },
|
|
38
|
+
argNames: ['path']
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/model/vcard_ext/core.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAN,IAAY,gBAQX;AARD,WAAY,gBAAgB;IACxB,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;IACnB,mDAA+B,CAAA;IAC/B,uCAAmB,CAAA;IACnB,qCAAiB,CAAA;AACrB,CAAC,EARW,gBAAgB,KAAhB,gBAAgB,QAQ3B;AAWD,gDAAgD;AAChD,MAAM,CAAC,MAAM,iBAAiB,GAAiC;IAC3D,GAAG,EAAE;QACD,IAAI,EAAE,KAAK;QACX,QAAQ,EAAE,gBAAgB,CAAC,WAAW;QACtC,WAAW,EAAE,cAAc;QAC3B,YAAY,EAAE,gCAAgC;QAC9C,cAAc,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;QACjD,QAAQ,EAAE,CAAC,MAAM,CAAC;KACrB;IACD,IAAI,EAAE;QACF,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,gBAAgB,CAAC,UAAU;QACrC,WAAW,EAAE,eAAe;QAC5B,YAAY,EAAE,aAAa;QAC3B,cAAc,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;QAChD,QAAQ,EAAE,CAAC,MAAM,CAAC;KACrB;IACD,SAAS,EAAE;QACP,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,gBAAgB,CAAC,UAAU;QACrC,WAAW,EAAE,gBAAgB;QAC7B,YAAY,EAAE,YAAY;QAC1B,cAAc,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE;QACtD,QAAQ,EAAE,CAAC,MAAM,CAAC;KACrB;CACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VCard Extension Types - Resource type definitions as pure data.
|
|
3
|
+
*
|
|
4
|
+
* This module provides modular resource type definitions that are loaded
|
|
5
|
+
* automatically into the VCard vocabulary.
|
|
6
|
+
*/
|
|
7
|
+
export * from './core.js';
|
|
8
|
+
export * from './storage.js';
|
|
9
|
+
export * from './network.js';
|
|
10
|
+
export * from './observability.js';
|
|
11
|
+
export * from './vendors.js';
|
|
12
|
+
import { RESOURCE_REGISTRY } from './core.js';
|
|
13
|
+
export { RESOURCE_REGISTRY };
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/model/vcard_ext/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAa9C,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VCard Extension Types - Resource type definitions as pure data.
|
|
3
|
+
*
|
|
4
|
+
* This module provides modular resource type definitions that are loaded
|
|
5
|
+
* automatically into the VCard vocabulary.
|
|
6
|
+
*/
|
|
7
|
+
export * from './core.js';
|
|
8
|
+
export * from './storage.js';
|
|
9
|
+
export * from './network.js';
|
|
10
|
+
export * from './observability.js';
|
|
11
|
+
export * from './vendors.js';
|
|
12
|
+
import { RESOURCE_REGISTRY } from './core.js';
|
|
13
|
+
import { STORAGE_TYPES } from './storage.js';
|
|
14
|
+
import { NETWORK_TYPES } from './network.js';
|
|
15
|
+
import { OBSERVABILITY_TYPES } from './observability.js';
|
|
16
|
+
import { VENDOR_TYPES } from './vendors.js';
|
|
17
|
+
// Auto-register all extension types
|
|
18
|
+
for (const types of [STORAGE_TYPES, NETWORK_TYPES, OBSERVABILITY_TYPES, VENDOR_TYPES]) {
|
|
19
|
+
for (const [name, type] of Object.entries(types)) {
|
|
20
|
+
RESOURCE_REGISTRY[name] = type;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export { RESOURCE_REGISTRY };
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/model/vcard_ext/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,oCAAoC;AACpC,KAAK,MAAM,KAAK,IAAI,CAAC,aAAa,EAAE,aAAa,EAAE,mBAAmB,EAAE,YAAY,CAAC,EAAE,CAAC;IACpF,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/C,iBAAiB,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACnC,CAAC;AACL,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../../src/model/vcard_ext/network.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAoB,MAAM,WAAW,CAAC;AAE3D,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAiBtD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Network resource types - APIs and webhooks.
|
|
3
|
+
*/
|
|
4
|
+
import { ResourceCategory } from './core.js';
|
|
5
|
+
export const NETWORK_TYPES = {
|
|
6
|
+
api: {
|
|
7
|
+
name: 'api',
|
|
8
|
+
category: ResourceCategory.NETWORK,
|
|
9
|
+
uriTemplate: '{endpoint}',
|
|
10
|
+
hashTemplate: 'api:{method}:{endpoint}',
|
|
11
|
+
defaultOptions: { type: 'api', method: 'GET', _preserveUri: true },
|
|
12
|
+
argNames: ['endpoint']
|
|
13
|
+
},
|
|
14
|
+
webhook: {
|
|
15
|
+
name: 'webhook',
|
|
16
|
+
category: ResourceCategory.NETWORK,
|
|
17
|
+
uriTemplate: '{endpoint}',
|
|
18
|
+
hashTemplate: 'webhook:{endpoint}',
|
|
19
|
+
defaultOptions: { type: 'webhook', _preserveUri: true },
|
|
20
|
+
argNames: ['endpoint']
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=network.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"","sources":["../../../src/model/vcard_ext/network.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAgB,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE3D,MAAM,CAAC,MAAM,aAAa,GAAiC;IACvD,GAAG,EAAE;QACD,IAAI,EAAE,KAAK;QACX,QAAQ,EAAE,gBAAgB,CAAC,OAAO;QAClC,WAAW,EAAE,YAAY;QACzB,YAAY,EAAE,yBAAyB;QACvC,cAAc,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE;QAClE,QAAQ,EAAE,CAAC,UAAU,CAAC;KACzB;IACD,OAAO,EAAE;QACL,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,gBAAgB,CAAC,OAAO;QAClC,WAAW,EAAE,YAAY;QACzB,YAAY,EAAE,oBAAoB;QAClC,cAAc,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE;QACvD,QAAQ,EAAE,CAAC,UAAU,CAAC;KACzB;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observability.d.ts","sourceRoot":"","sources":["../../../src/model/vcard_ext/observability.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAyD5D,CAAC"}
|