@fungi.computer/veil 0.3.0 → 0.5.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/connections/cleanup.d.ts +21 -0
- package/dist/connections/cleanup.js +66 -0
- package/dist/connections/contract.d.ts +287 -0
- package/dist/connections/contract.js +95 -0
- package/dist/connections/core.d.ts +98 -0
- package/dist/connections/core.js +631 -0
- package/dist/connections/discover.d.ts +3 -0
- package/dist/connections/discover.js +23 -0
- package/dist/connections/egress.d.ts +8 -0
- package/dist/connections/egress.js +78 -0
- package/dist/connections/index.d.ts +4 -0
- package/dist/connections/index.js +4 -0
- package/dist/connections/internal.d.ts +78 -0
- package/dist/connections/internal.js +66 -0
- package/dist/connections/mcp-agent.d.ts +37 -0
- package/dist/connections/mcp-agent.js +75 -0
- package/dist/connections/nango.d.ts +30 -0
- package/dist/connections/nango.js +136 -0
- package/dist/connections/oauth-flow.d.ts +81 -0
- package/dist/connections/oauth-flow.js +322 -0
- package/dist/connections/oauth-provider.d.ts +31 -0
- package/dist/connections/oauth-provider.js +96 -0
- package/dist/connections/oauth.d.ts +93 -0
- package/dist/connections/oauth.js +239 -0
- package/dist/connections/openapi.d.ts +36 -0
- package/dist/connections/openapi.js +120 -0
- package/dist/connections/sealed.d.ts +21 -0
- package/dist/connections/sealed.js +73 -0
- package/dist/connections/source.d.ts +17 -0
- package/dist/connections/source.js +111 -0
- package/dist/connections/update.d.ts +41 -0
- package/dist/connections/update.js +81 -0
- package/dist/credential-store.d.ts +64 -0
- package/dist/credential-store.js +151 -0
- package/dist/gatekeeper.d.ts +21 -1
- package/dist/gatekeeper.js +74 -12
- package/dist/index.d.ts +1 -1
- package/dist/model-keys.d.ts +24 -0
- package/dist/nango.d.ts +41 -0
- package/dist/nango.js +6 -6
- package/dist/openapi-secrets.d.ts +1 -1
- package/dist/openapi-secrets.js +19 -58
- package/package.json +22 -1
package/dist/openapi-secrets.js
CHANGED
|
@@ -1,76 +1,37 @@
|
|
|
1
|
-
import { Buffer } from "node:buffer";
|
|
2
|
-
import * as Schema from "effect/Schema";
|
|
3
1
|
import { OpenApiError, } from "./openapi-contract.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
version: Schema.Literal(1),
|
|
8
|
-
keyId: keyIdSchema,
|
|
9
|
-
iv: Schema.String.pipe(Schema.check(Schema.isPattern(/^[A-Za-z0-9_-]{16}$/u))),
|
|
10
|
-
ciphertext: Schema.String.pipe(Schema.check(Schema.isPattern(/^[A-Za-z0-9_-]{22,22000}$/u))),
|
|
11
|
-
});
|
|
12
|
-
const encoder = new TextEncoder();
|
|
13
|
-
const binding = (access, keyId) => encoder.encode(JSON.stringify([
|
|
14
|
-
"fungi.veil.openapi.v1",
|
|
15
|
-
keyId,
|
|
2
|
+
import { createCredentialSealer } from "./credential-store.js";
|
|
3
|
+
/** The connector's owner address and policy are the sealed value's context. */
|
|
4
|
+
const context = (access) => [
|
|
16
5
|
access.teamId,
|
|
17
6
|
access.connectorId,
|
|
18
7
|
access.baseUrl,
|
|
19
8
|
access.auth.kind,
|
|
20
|
-
access.auth.kind === "api_key_header" ||
|
|
21
|
-
access.auth.kind === "api_key_query"
|
|
9
|
+
access.auth.kind === "api_key_header" || access.auth.kind === "api_key_query"
|
|
22
10
|
? access.auth.param
|
|
23
11
|
: null,
|
|
24
|
-
]
|
|
25
|
-
/**
|
|
12
|
+
];
|
|
13
|
+
/** Connector credentials sealed by Veil's one credential sealer. */
|
|
26
14
|
export function createOpenApiSecrets(configuration) {
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
activeKeyId = Schema.decodeUnknownSync(keyIdSchema)(configuration.activeKeyId);
|
|
31
|
-
for (const [id, encoded] of Object.entries(configuration.keys)) {
|
|
32
|
-
Schema.decodeUnknownSync(keyIdSchema)(id);
|
|
33
|
-
const parsed = Schema.decodeUnknownSync(keySchema)(encoded);
|
|
34
|
-
const bytes = Uint8Array.from(Buffer.from(parsed, "base64url"));
|
|
35
|
-
if (bytes.length !== 32)
|
|
36
|
-
throw new OpenApiError("unavailable");
|
|
37
|
-
keys.set(id, crypto.subtle.importKey("raw", bytes, "AES-GCM", false, [
|
|
38
|
-
"encrypt",
|
|
39
|
-
"decrypt",
|
|
40
|
-
]));
|
|
15
|
+
const sealer = (() => {
|
|
16
|
+
try {
|
|
17
|
+
return createCredentialSealer(configuration, "fungi.veil.openapi.v1");
|
|
41
18
|
}
|
|
42
|
-
|
|
19
|
+
catch {
|
|
43
20
|
throw new OpenApiError("unavailable");
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
throw new OpenApiError("unavailable");
|
|
47
|
-
}
|
|
48
|
-
const key = (id) => {
|
|
49
|
-
const found = keys.get(id);
|
|
50
|
-
if (!found)
|
|
51
|
-
throw new OpenApiError("denied");
|
|
52
|
-
return found;
|
|
53
|
-
};
|
|
21
|
+
}
|
|
22
|
+
})();
|
|
54
23
|
return {
|
|
55
24
|
async seal(access, credential) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
ciphertext: Buffer.from(ciphertext).toString("base64url"),
|
|
63
|
-
});
|
|
25
|
+
try {
|
|
26
|
+
return await sealer.seal(context(access), credential);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
throw new OpenApiError("denied");
|
|
30
|
+
}
|
|
64
31
|
},
|
|
65
32
|
async open(access, sealed) {
|
|
66
33
|
try {
|
|
67
|
-
|
|
68
|
-
const plaintext = await crypto.subtle.decrypt({
|
|
69
|
-
name: "AES-GCM",
|
|
70
|
-
iv: Uint8Array.from(Buffer.from(envelope.iv, "base64url")),
|
|
71
|
-
additionalData: binding(access, envelope.keyId),
|
|
72
|
-
}, await key(envelope.keyId), Uint8Array.from(Buffer.from(envelope.ciphertext, "base64url")));
|
|
73
|
-
return new TextDecoder().decode(plaintext);
|
|
34
|
+
return await sealer.open(context(access), sealed);
|
|
74
35
|
}
|
|
75
36
|
catch {
|
|
76
37
|
throw new OpenApiError("denied");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/veil",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"author": "Levi <levi@technomancy.dev>",
|
|
5
5
|
"description": "Team-authorized credential custody and provider access",
|
|
6
6
|
"type": "module",
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
"types": "./dist/model-credentials.d.ts",
|
|
24
24
|
"import": "./dist/model-credentials.js"
|
|
25
25
|
},
|
|
26
|
+
"./credential-store": {
|
|
27
|
+
"types": "./dist/credential-store.d.ts",
|
|
28
|
+
"import": "./dist/credential-store.js"
|
|
29
|
+
},
|
|
26
30
|
"./model-keys": {
|
|
27
31
|
"types": "./dist/model-keys.d.ts",
|
|
28
32
|
"import": "./dist/model-keys.js"
|
|
@@ -78,6 +82,18 @@
|
|
|
78
82
|
"./owned-infrastructure": {
|
|
79
83
|
"types": "./dist/owned-infrastructure.d.ts",
|
|
80
84
|
"import": "./dist/owned-infrastructure.js"
|
|
85
|
+
},
|
|
86
|
+
"./connections": {
|
|
87
|
+
"types": "./dist/connections/index.d.ts",
|
|
88
|
+
"import": "./dist/connections/index.js"
|
|
89
|
+
},
|
|
90
|
+
"./connections/nango": {
|
|
91
|
+
"types": "./dist/connections/nango.d.ts",
|
|
92
|
+
"import": "./dist/connections/nango.js"
|
|
93
|
+
},
|
|
94
|
+
"./connections/source": {
|
|
95
|
+
"types": "./dist/connections/source.d.ts",
|
|
96
|
+
"import": "./dist/connections/source.js"
|
|
81
97
|
}
|
|
82
98
|
},
|
|
83
99
|
"files": [
|
|
@@ -87,6 +103,9 @@
|
|
|
87
103
|
],
|
|
88
104
|
"dependencies": {
|
|
89
105
|
"@fungi.computer/cairn": "0.1.0",
|
|
106
|
+
"@fungi.computer/forage": "0.3.1",
|
|
107
|
+
"@fungi.computer/mycelium": "0.3.4",
|
|
108
|
+
"@modelcontextprotocol/client": "2.0.0",
|
|
90
109
|
"@nangohq/node": "0.71.6",
|
|
91
110
|
"effect": "4.0.2",
|
|
92
111
|
"http-parser-js": "0.5.10",
|
|
@@ -94,6 +113,8 @@
|
|
|
94
113
|
"zod": "4.4.3"
|
|
95
114
|
},
|
|
96
115
|
"devDependencies": {
|
|
116
|
+
"@fungi.computer/watchdog": "0.1.0",
|
|
117
|
+
"@modelcontextprotocol/server": "2.0.0",
|
|
97
118
|
"@types/node": "24.13.3",
|
|
98
119
|
"typescript": "5.9.3",
|
|
99
120
|
"vitest": "4.1.11"
|