@vorim/sdk 3.9.0 → 3.11.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/CHANGELOG.md +13 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/modern-treasury.cjs +178 -0
- package/dist/integrations/modern-treasury.cjs.map +1 -0
- package/dist/integrations/modern-treasury.d.cts +90 -0
- package/dist/integrations/modern-treasury.d.ts +90 -0
- package/dist/integrations/modern-treasury.js +152 -0
- package/dist/integrations/modern-treasury.js.map +1 -0
- package/dist/integrations/plaid.cjs +174 -0
- package/dist/integrations/plaid.cjs.map +1 -0
- package/dist/integrations/plaid.d.cts +86 -0
- package/dist/integrations/plaid.d.ts +86 -0
- package/dist/integrations/plaid.js +148 -0
- package/dist/integrations/plaid.js.map +1 -0
- package/dist/integrations/truanon.cjs +188 -0
- package/dist/integrations/truanon.cjs.map +1 -0
- package/dist/integrations/truanon.d.cts +115 -0
- package/dist/integrations/truanon.d.ts +115 -0
- package/dist/integrations/truanon.js +161 -0
- package/dist/integrations/truanon.js.map +1 -0
- package/package.json +31 -1
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/integrations/truanon.ts
|
|
21
|
+
var truanon_exports = {};
|
|
22
|
+
__export(truanon_exports, {
|
|
23
|
+
VorimTruAnon: () => VorimTruAnon,
|
|
24
|
+
createVorimTruAnon: () => createVorimTruAnon,
|
|
25
|
+
meetsMinimumRank: () => meetsMinimumRank
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(truanon_exports);
|
|
28
|
+
var RANK_ORDER = ["Dangerous", "Cautioned", "Credible", "Reliable", "Genuine"];
|
|
29
|
+
function meetsMinimumRank(userRank, minimumRank) {
|
|
30
|
+
if (userRank === "Unknown") return false;
|
|
31
|
+
const u = RANK_ORDER.indexOf(userRank);
|
|
32
|
+
const m = RANK_ORDER.indexOf(minimumRank);
|
|
33
|
+
return u >= 0 && m >= 0 && u >= m;
|
|
34
|
+
}
|
|
35
|
+
var VorimTruAnon = class {
|
|
36
|
+
sdk;
|
|
37
|
+
privateKey;
|
|
38
|
+
service;
|
|
39
|
+
minRank;
|
|
40
|
+
minTrustScore;
|
|
41
|
+
requiredScope;
|
|
42
|
+
truanonBaseUrl;
|
|
43
|
+
timeoutMs;
|
|
44
|
+
doFetch;
|
|
45
|
+
constructor(sdk, config) {
|
|
46
|
+
if (!config?.privateKey) throw new Error("[vorim] TruAnon integration requires a privateKey (server-side only).");
|
|
47
|
+
if (!config?.service) throw new Error("[vorim] TruAnon integration requires a service name.");
|
|
48
|
+
this.sdk = sdk;
|
|
49
|
+
this.privateKey = config.privateKey;
|
|
50
|
+
this.service = config.service;
|
|
51
|
+
this.minRank = config.minRank ?? "Credible";
|
|
52
|
+
this.minTrustScore = config.minTrustScore ?? 50;
|
|
53
|
+
this.requiredScope = config.requiredScope ?? "agent:transact";
|
|
54
|
+
this.truanonBaseUrl = (config.truanonBaseUrl ?? "https://truanon.com/api/v2").replace(/\/$/, "");
|
|
55
|
+
this.timeoutMs = config.timeoutMs ?? 3e4;
|
|
56
|
+
this.doFetch = config.fetchImpl ?? fetch;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Fetch a human's TruAnon profile (the anchor). Server-side call with your
|
|
60
|
+
* private key. Returns the rank/score/anchors; `isAnchored` is false if the
|
|
61
|
+
* lookup fails or the human has no anchor.
|
|
62
|
+
*/
|
|
63
|
+
async verifyHuman(username) {
|
|
64
|
+
const url = `${this.truanonBaseUrl}/get_profile?id=${encodeURIComponent(username)}&service=${encodeURIComponent(this.service)}`;
|
|
65
|
+
const controller = new AbortController();
|
|
66
|
+
const timer = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
67
|
+
try {
|
|
68
|
+
const res = await this.doFetch(url, {
|
|
69
|
+
method: "GET",
|
|
70
|
+
headers: { Authorization: this.privateKey, Accept: "application/json" },
|
|
71
|
+
redirect: "error",
|
|
72
|
+
signal: controller.signal
|
|
73
|
+
});
|
|
74
|
+
if (!res.ok) return this.emptyProfile();
|
|
75
|
+
const data = await res.json();
|
|
76
|
+
const rank = typeof data?.rank === "string" ? data.rank : "Unknown";
|
|
77
|
+
return {
|
|
78
|
+
rank,
|
|
79
|
+
score: typeof data?.score === "string" ? data.score : String(data?.score ?? "0"),
|
|
80
|
+
name: data?.name,
|
|
81
|
+
title: data?.title,
|
|
82
|
+
photo: data?.photo,
|
|
83
|
+
ageBadge: data?.ageBadge,
|
|
84
|
+
anchors: Array.isArray(data?.anchors) ? data.anchors : [],
|
|
85
|
+
isAnchored: rank !== "Unknown" && !!rank
|
|
86
|
+
};
|
|
87
|
+
} catch {
|
|
88
|
+
return this.emptyProfile();
|
|
89
|
+
} finally {
|
|
90
|
+
clearTimeout(timer);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The binding gate: authorize an agent to act on a human's behalf only if
|
|
95
|
+
* BOTH sides check out — the human is anchored at/above minRank (TruAnon) AND
|
|
96
|
+
* the agent holds the scope, is active, and clears trust (Vorim). Signs an
|
|
97
|
+
* audit event capturing both identities regardless of outcome.
|
|
98
|
+
*/
|
|
99
|
+
async authorizeAgentForHuman(input) {
|
|
100
|
+
const minRank = input.minRank ?? this.minRank;
|
|
101
|
+
const threshold = input.minTrustScore ?? this.minTrustScore;
|
|
102
|
+
const profile = await this.verifyHuman(input.humanUsername);
|
|
103
|
+
const rankMet = meetsMinimumRank(profile.rank, minRank);
|
|
104
|
+
const base = {
|
|
105
|
+
agentId: input.agentId,
|
|
106
|
+
humanUsername: input.humanUsername,
|
|
107
|
+
humanRank: profile.rank,
|
|
108
|
+
humanScore: profile.score,
|
|
109
|
+
humanAnchored: profile.isAnchored,
|
|
110
|
+
humanRankMet: rankMet
|
|
111
|
+
};
|
|
112
|
+
if (!profile.isAnchored) {
|
|
113
|
+
await this.logEvent(input.agentId, "truanon.bind.authorize", "denied", base, { reason: "Human is not anchored" });
|
|
114
|
+
return { ...base, authorized: false, trustScore: 0, status: "unknown", scopeVerified: false, reason: `Human ${input.humanUsername} is not anchored on TruAnon` };
|
|
115
|
+
}
|
|
116
|
+
if (!rankMet) {
|
|
117
|
+
await this.logEvent(input.agentId, "truanon.bind.authorize", "denied", base, { reason: `Rank ${profile.rank} < ${minRank}` });
|
|
118
|
+
return { ...base, authorized: false, trustScore: 0, status: "unknown", scopeVerified: false, reason: `Human rank ${profile.rank} is below the required ${minRank}` };
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
const perm = await this.sdk.check(input.agentId, this.requiredScope);
|
|
122
|
+
if (!perm.allowed) {
|
|
123
|
+
await this.logEvent(input.agentId, "truanon.bind.authorize", "denied", base, { reason: `Missing ${this.requiredScope}` });
|
|
124
|
+
return { ...base, authorized: false, trustScore: 0, status: "unknown", scopeVerified: false, reason: `Agent does not have ${this.requiredScope} permission` };
|
|
125
|
+
}
|
|
126
|
+
} catch (e) {
|
|
127
|
+
await this.logEvent(input.agentId, "truanon.bind.authorize", "denied", base, { reason: `Permission check failed: ${e.message}` });
|
|
128
|
+
return { ...base, authorized: false, trustScore: 0, status: "unknown", scopeVerified: false, reason: `Permission check failed: ${e.message}` };
|
|
129
|
+
}
|
|
130
|
+
let score = 0;
|
|
131
|
+
let status = "unknown";
|
|
132
|
+
try {
|
|
133
|
+
const trust = await this.sdk.verify(input.agentId);
|
|
134
|
+
score = trust.trust_score ?? 0;
|
|
135
|
+
status = trust.status ?? "unknown";
|
|
136
|
+
} catch {
|
|
137
|
+
}
|
|
138
|
+
if (status !== "active") {
|
|
139
|
+
await this.logEvent(input.agentId, "truanon.bind.authorize", "denied", base, { reason: `Agent status: ${status}` });
|
|
140
|
+
return { ...base, authorized: false, trustScore: score, status, scopeVerified: true, reason: `Agent is ${status}, not active` };
|
|
141
|
+
}
|
|
142
|
+
if (score < threshold) {
|
|
143
|
+
await this.logEvent(input.agentId, "truanon.bind.authorize", "denied", base, { reason: `Score ${score} < ${threshold}` });
|
|
144
|
+
return { ...base, authorized: false, trustScore: score, status, scopeVerified: true, reason: `Agent trust score ${score} is below minimum ${threshold}` };
|
|
145
|
+
}
|
|
146
|
+
await this.logEvent(input.agentId, "truanon.bind.authorize", "success", base, { trust_score: score });
|
|
147
|
+
return { ...base, authorized: true, trustScore: score, status, scopeVerified: true };
|
|
148
|
+
}
|
|
149
|
+
/** Log that an anchored-human + agent action completed (the end-to-end record). */
|
|
150
|
+
async logBoundAction(agentId, humanUsername, action, metadata) {
|
|
151
|
+
await this.logEvent(agentId, "truanon.bound_action", "success", { agentId, humanUsername }, { bound_action: action, ...metadata });
|
|
152
|
+
}
|
|
153
|
+
emptyProfile() {
|
|
154
|
+
return { rank: "Unknown", score: "0", anchors: [], isAnchored: false };
|
|
155
|
+
}
|
|
156
|
+
async logEvent(agentId, action, result, base, metadata) {
|
|
157
|
+
try {
|
|
158
|
+
await this.sdk.emit({
|
|
159
|
+
agent_id: agentId,
|
|
160
|
+
event_type: "api_request",
|
|
161
|
+
action,
|
|
162
|
+
result,
|
|
163
|
+
resource: base?.humanUsername ?? "",
|
|
164
|
+
metadata: {
|
|
165
|
+
provider: "truanon",
|
|
166
|
+
service: this.service,
|
|
167
|
+
human_username: base?.humanUsername ?? "",
|
|
168
|
+
human_rank: base?.humanRank ?? "",
|
|
169
|
+
human_score: base?.humanScore ?? "",
|
|
170
|
+
human_anchored: base?.humanAnchored ?? false,
|
|
171
|
+
human_rank_met: base?.humanRankMet ?? false,
|
|
172
|
+
...metadata
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
} catch {
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
function createVorimTruAnon(sdk, config) {
|
|
180
|
+
return new VorimTruAnon(sdk, config);
|
|
181
|
+
}
|
|
182
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
183
|
+
0 && (module.exports = {
|
|
184
|
+
VorimTruAnon,
|
|
185
|
+
createVorimTruAnon,
|
|
186
|
+
meetsMinimumRank
|
|
187
|
+
});
|
|
188
|
+
//# sourceMappingURL=truanon.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/integrations/truanon.ts"],"sourcesContent":["// ============================================================================\n// Vorim AI — TruAnon Integration\n//\n// TruAnon (truanon.com) anchors a real HUMAN to an account: a member binds their\n// profile to connections other people already know them by, without the platform\n// storing any identity documents. TruAnon returns a rank (Genuine, Reliable,\n// Credible, Cautioned, Dangerous, Unknown) and a 0-5 score for the human.\n//\n// Vorim anchors the AI AGENT: cryptographic identity, scoped permissions, and a\n// signed audit trail of what the agent did. This integration BINDS the two: it\n// verifies a human is anchored (via TruAnon) AND the acting agent is authorized\n// (via Vorim), then signs an audit event capturing BOTH identities — so you can\n// prove one accountable line from a verified human, through the platform, to the\n// specific agent and action. Protection end to end.\n//\n// It calls TruAnon's public API server-side with your private key, and Vorim's\n// verify/emit. Keep the TruAnon private key on the server — never in the browser.\n//\n// Usage:\n// import createVorim from '@vorim/sdk';\n// import { createVorimTruAnon } from '@vorim/sdk/integrations/truanon';\n//\n// const vorim = createVorim({ apiKey: 'agid_sk_...' });\n// const truanon = createVorimTruAnon(vorim, {\n// privateKey: process.env.VORIM_TRUANON_KEY!, // server-side only\n// service: process.env.VORIM_TRUANON_SERVICE!, // your TruAnon service name\n// minRank: 'Credible', // ID-verification-equivalent\n// });\n//\n// // Before an agent acts on a human's behalf, bind + authorize:\n// const auth = await truanon.authorizeAgentForHuman({\n// agentId: 'agid_abc123',\n// humanUsername: 'jtayler',\n// });\n// if (auth.authorized) { /* proceed; the binding is signed to the audit trail */ }\n// ============================================================================\n\nimport type { VorimSDK } from '../index.js';\n\n/** TruAnon rank tiers, weakest to strongest. `Unknown` never meets a minimum. */\nexport type TruAnonRank = 'Unknown' | 'Dangerous' | 'Cautioned' | 'Credible' | 'Reliable' | 'Genuine';\n\n// Verbatim from the TruAnon API: index-based ordering, Unknown is off-axis.\nconst RANK_ORDER: TruAnonRank[] = ['Dangerous', 'Cautioned', 'Credible', 'Reliable', 'Genuine'];\n\n/** Does `userRank` meet or exceed `minimumRank`? Unknown always fails. */\nexport function meetsMinimumRank(userRank: string, minimumRank: TruAnonRank): boolean {\n if (userRank === 'Unknown') return false;\n const u = RANK_ORDER.indexOf(userRank as TruAnonRank);\n const m = RANK_ORDER.indexOf(minimumRank);\n return u >= 0 && m >= 0 && u >= m;\n}\n\nexport interface TruAnonAnchor {\n name: string;\n display: string;\n icon: string;\n type: string;\n kind: string;\n}\n\n/** The get_profile response shape (the fields TruAnon returns for a human). */\nexport interface TruAnonProfile {\n rank: string;\n score: string; // \"0\" .. \"5.0\"\n name?: string;\n title?: string;\n photo?: string;\n ageBadge?: string;\n anchors?: TruAnonAnchor[];\n isAnchored: boolean; // derived: true when TruAnon returned a real rank\n}\n\nexport interface TruAnonConfig {\n /** Vorim API key (already on the sdk instance; not used directly here). */\n apiKey?: string;\n baseUrl?: string;\n /** TruAnon private API key — SERVER-SIDE ONLY. */\n privateKey: string;\n /** Your registered TruAnon service name. */\n service: string;\n /** Minimum human rank required to authorize an agent. Default 'Credible'. */\n minRank?: TruAnonRank;\n /** Minimum agent trust score. Default 50. */\n minTrustScore?: number;\n /** Required agent scope. Default 'agent:transact'. */\n requiredScope?: string;\n /** TruAnon API base. Default 'https://truanon.com/api/v2'. */\n truanonBaseUrl?: string;\n /** Per-request timeout in ms. Default 30000 (TruAnon's guidance). */\n timeoutMs?: number;\n /** Injectable fetch (for testing). Defaults to global fetch. */\n fetchImpl?: typeof fetch;\n}\n\nexport interface HumanBindingAuthorization {\n authorized: boolean;\n agentId: string;\n humanUsername: string;\n /** The human's TruAnon rank + whether it met the minimum. */\n humanRank: string;\n humanScore: string;\n humanAnchored: boolean;\n humanRankMet: boolean;\n /** The agent's Vorim standing. */\n trustScore: number;\n status: string;\n scopeVerified: boolean;\n reason?: string;\n}\n\nexport class VorimTruAnon {\n private sdk: VorimSDK;\n private privateKey: string;\n private service: string;\n private minRank: TruAnonRank;\n private minTrustScore: number;\n private requiredScope: string;\n private truanonBaseUrl: string;\n private timeoutMs: number;\n private doFetch: typeof fetch;\n\n constructor(sdk: VorimSDK, config: TruAnonConfig) {\n if (!config?.privateKey) throw new Error('[vorim] TruAnon integration requires a privateKey (server-side only).');\n if (!config?.service) throw new Error('[vorim] TruAnon integration requires a service name.');\n this.sdk = sdk;\n this.privateKey = config.privateKey;\n this.service = config.service;\n this.minRank = config.minRank ?? 'Credible';\n this.minTrustScore = config.minTrustScore ?? 50;\n this.requiredScope = config.requiredScope ?? 'agent:transact';\n this.truanonBaseUrl = (config.truanonBaseUrl ?? 'https://truanon.com/api/v2').replace(/\\/$/, '');\n this.timeoutMs = config.timeoutMs ?? 30_000;\n this.doFetch = config.fetchImpl ?? fetch;\n }\n\n /**\n * Fetch a human's TruAnon profile (the anchor). Server-side call with your\n * private key. Returns the rank/score/anchors; `isAnchored` is false if the\n * lookup fails or the human has no anchor.\n */\n async verifyHuman(username: string): Promise<TruAnonProfile> {\n const url = `${this.truanonBaseUrl}/get_profile?id=${encodeURIComponent(username)}&service=${encodeURIComponent(this.service)}`;\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), this.timeoutMs);\n try {\n // redirect: 'error' — never replay the Authorization header to a 3xx target.\n const res = await this.doFetch(url, {\n method: 'GET',\n headers: { Authorization: this.privateKey, Accept: 'application/json' },\n redirect: 'error',\n signal: controller.signal,\n });\n if (!res.ok) return this.emptyProfile();\n const data: any = await res.json();\n const rank = typeof data?.rank === 'string' ? data.rank : 'Unknown';\n return {\n rank,\n score: typeof data?.score === 'string' ? data.score : String(data?.score ?? '0'),\n name: data?.name,\n title: data?.title,\n photo: data?.photo,\n ageBadge: data?.ageBadge,\n anchors: Array.isArray(data?.anchors) ? data.anchors : [],\n isAnchored: rank !== 'Unknown' && !!rank,\n };\n } catch {\n return this.emptyProfile();\n } finally {\n clearTimeout(timer);\n }\n }\n\n /**\n * The binding gate: authorize an agent to act on a human's behalf only if\n * BOTH sides check out — the human is anchored at/above minRank (TruAnon) AND\n * the agent holds the scope, is active, and clears trust (Vorim). Signs an\n * audit event capturing both identities regardless of outcome.\n */\n async authorizeAgentForHuman(input: {\n agentId: string;\n humanUsername: string;\n minRank?: TruAnonRank;\n minTrustScore?: number;\n }): Promise<HumanBindingAuthorization> {\n const minRank = input.minRank ?? this.minRank;\n const threshold = input.minTrustScore ?? this.minTrustScore;\n\n // 1. The human side — TruAnon anchor.\n const profile = await this.verifyHuman(input.humanUsername);\n const rankMet = meetsMinimumRank(profile.rank, minRank);\n\n const base = {\n agentId: input.agentId,\n humanUsername: input.humanUsername,\n humanRank: profile.rank,\n humanScore: profile.score,\n humanAnchored: profile.isAnchored,\n humanRankMet: rankMet,\n };\n\n if (!profile.isAnchored) {\n await this.logEvent(input.agentId, 'truanon.bind.authorize', 'denied', base, { reason: 'Human is not anchored' });\n return { ...base, authorized: false, trustScore: 0, status: 'unknown', scopeVerified: false, reason: `Human ${input.humanUsername} is not anchored on TruAnon` };\n }\n if (!rankMet) {\n await this.logEvent(input.agentId, 'truanon.bind.authorize', 'denied', base, { reason: `Rank ${profile.rank} < ${minRank}` });\n return { ...base, authorized: false, trustScore: 0, status: 'unknown', scopeVerified: false, reason: `Human rank ${profile.rank} is below the required ${minRank}` };\n }\n\n // 2. The agent side — Vorim scope + status + trust.\n try {\n const perm = await this.sdk.check(input.agentId, this.requiredScope as any);\n if (!(perm as any).allowed) {\n await this.logEvent(input.agentId, 'truanon.bind.authorize', 'denied', base, { reason: `Missing ${this.requiredScope}` });\n return { ...base, authorized: false, trustScore: 0, status: 'unknown', scopeVerified: false, reason: `Agent does not have ${this.requiredScope} permission` };\n }\n } catch (e: any) {\n await this.logEvent(input.agentId, 'truanon.bind.authorize', 'denied', base, { reason: `Permission check failed: ${e.message}` });\n return { ...base, authorized: false, trustScore: 0, status: 'unknown', scopeVerified: false, reason: `Permission check failed: ${e.message}` };\n }\n\n let score = 0;\n let status = 'unknown';\n try {\n const trust = await this.sdk.verify(input.agentId);\n score = (trust as any).trust_score ?? 0;\n status = (trust as any).status ?? 'unknown';\n } catch { /* treated as not-active below */ }\n\n if (status !== 'active') {\n await this.logEvent(input.agentId, 'truanon.bind.authorize', 'denied', base, { reason: `Agent status: ${status}` });\n return { ...base, authorized: false, trustScore: score, status, scopeVerified: true, reason: `Agent is ${status}, not active` };\n }\n if (score < threshold) {\n await this.logEvent(input.agentId, 'truanon.bind.authorize', 'denied', base, { reason: `Score ${score} < ${threshold}` });\n return { ...base, authorized: false, trustScore: score, status, scopeVerified: true, reason: `Agent trust score ${score} is below minimum ${threshold}` };\n }\n\n // Both sides pass — sign the binding.\n await this.logEvent(input.agentId, 'truanon.bind.authorize', 'success', base, { trust_score: score });\n return { ...base, authorized: true, trustScore: score, status, scopeVerified: true };\n }\n\n /** Log that an anchored-human + agent action completed (the end-to-end record). */\n async logBoundAction(agentId: string, humanUsername: string, action: string, metadata?: Record<string, any>): Promise<void> {\n await this.logEvent(agentId, 'truanon.bound_action', 'success', { agentId, humanUsername }, { bound_action: action, ...metadata });\n }\n\n private emptyProfile(): TruAnonProfile {\n return { rank: 'Unknown', score: '0', anchors: [], isAnchored: false };\n }\n\n private async logEvent(\n agentId: string,\n action: string,\n result: 'success' | 'denied' | 'error',\n base?: Partial<HumanBindingAuthorization> & { agentId?: string; humanUsername?: string },\n metadata?: Record<string, any>,\n ): Promise<void> {\n try {\n await this.sdk.emit({\n agent_id: agentId,\n event_type: 'api_request',\n action,\n result,\n resource: base?.humanUsername ?? '',\n metadata: {\n provider: 'truanon',\n service: this.service,\n human_username: base?.humanUsername ?? '',\n human_rank: base?.humanRank ?? '',\n human_score: base?.humanScore ?? '',\n human_anchored: base?.humanAnchored ?? false,\n human_rank_met: base?.humanRankMet ?? false,\n ...metadata,\n },\n });\n } catch { /* never block the flow on an audit hiccup */ }\n }\n}\n\n/**\n * Create a VorimTruAnon instance. Bind a TruAnon-anchored human to a\n * Vorim-identified agent, with a signed record of both.\n *\n * @example\n * ```typescript\n * import createVorim from '@vorim/sdk';\n * import { createVorimTruAnon } from '@vorim/sdk/integrations/truanon';\n * const vorim = createVorim({ apiKey: 'agid_sk_...' });\n * const truanon = createVorimTruAnon(vorim, {\n * privateKey: process.env.VORIM_TRUANON_KEY!,\n * service: process.env.VORIM_TRUANON_SERVICE!,\n * minRank: 'Credible',\n * });\n * const auth = await truanon.authorizeAgentForHuman({ agentId: 'agid_abc', humanUsername: 'jtayler' });\n * ```\n */\nexport function createVorimTruAnon(sdk: VorimSDK, config: TruAnonConfig): VorimTruAnon {\n return new VorimTruAnon(sdk, config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2CA,IAAM,aAA4B,CAAC,aAAa,aAAa,YAAY,YAAY,SAAS;AAGvF,SAAS,iBAAiB,UAAkB,aAAmC;AACpF,MAAI,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rC;","names":[]}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { VorimSDK } from '../index.cjs';
|
|
2
|
+
import '../types-zzK9YOoa.cjs';
|
|
3
|
+
|
|
4
|
+
/** TruAnon rank tiers, weakest to strongest. `Unknown` never meets a minimum. */
|
|
5
|
+
type TruAnonRank = 'Unknown' | 'Dangerous' | 'Cautioned' | 'Credible' | 'Reliable' | 'Genuine';
|
|
6
|
+
/** Does `userRank` meet or exceed `minimumRank`? Unknown always fails. */
|
|
7
|
+
declare function meetsMinimumRank(userRank: string, minimumRank: TruAnonRank): boolean;
|
|
8
|
+
interface TruAnonAnchor {
|
|
9
|
+
name: string;
|
|
10
|
+
display: string;
|
|
11
|
+
icon: string;
|
|
12
|
+
type: string;
|
|
13
|
+
kind: string;
|
|
14
|
+
}
|
|
15
|
+
/** The get_profile response shape (the fields TruAnon returns for a human). */
|
|
16
|
+
interface TruAnonProfile {
|
|
17
|
+
rank: string;
|
|
18
|
+
score: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
title?: string;
|
|
21
|
+
photo?: string;
|
|
22
|
+
ageBadge?: string;
|
|
23
|
+
anchors?: TruAnonAnchor[];
|
|
24
|
+
isAnchored: boolean;
|
|
25
|
+
}
|
|
26
|
+
interface TruAnonConfig {
|
|
27
|
+
/** Vorim API key (already on the sdk instance; not used directly here). */
|
|
28
|
+
apiKey?: string;
|
|
29
|
+
baseUrl?: string;
|
|
30
|
+
/** TruAnon private API key — SERVER-SIDE ONLY. */
|
|
31
|
+
privateKey: string;
|
|
32
|
+
/** Your registered TruAnon service name. */
|
|
33
|
+
service: string;
|
|
34
|
+
/** Minimum human rank required to authorize an agent. Default 'Credible'. */
|
|
35
|
+
minRank?: TruAnonRank;
|
|
36
|
+
/** Minimum agent trust score. Default 50. */
|
|
37
|
+
minTrustScore?: number;
|
|
38
|
+
/** Required agent scope. Default 'agent:transact'. */
|
|
39
|
+
requiredScope?: string;
|
|
40
|
+
/** TruAnon API base. Default 'https://truanon.com/api/v2'. */
|
|
41
|
+
truanonBaseUrl?: string;
|
|
42
|
+
/** Per-request timeout in ms. Default 30000 (TruAnon's guidance). */
|
|
43
|
+
timeoutMs?: number;
|
|
44
|
+
/** Injectable fetch (for testing). Defaults to global fetch. */
|
|
45
|
+
fetchImpl?: typeof fetch;
|
|
46
|
+
}
|
|
47
|
+
interface HumanBindingAuthorization {
|
|
48
|
+
authorized: boolean;
|
|
49
|
+
agentId: string;
|
|
50
|
+
humanUsername: string;
|
|
51
|
+
/** The human's TruAnon rank + whether it met the minimum. */
|
|
52
|
+
humanRank: string;
|
|
53
|
+
humanScore: string;
|
|
54
|
+
humanAnchored: boolean;
|
|
55
|
+
humanRankMet: boolean;
|
|
56
|
+
/** The agent's Vorim standing. */
|
|
57
|
+
trustScore: number;
|
|
58
|
+
status: string;
|
|
59
|
+
scopeVerified: boolean;
|
|
60
|
+
reason?: string;
|
|
61
|
+
}
|
|
62
|
+
declare class VorimTruAnon {
|
|
63
|
+
private sdk;
|
|
64
|
+
private privateKey;
|
|
65
|
+
private service;
|
|
66
|
+
private minRank;
|
|
67
|
+
private minTrustScore;
|
|
68
|
+
private requiredScope;
|
|
69
|
+
private truanonBaseUrl;
|
|
70
|
+
private timeoutMs;
|
|
71
|
+
private doFetch;
|
|
72
|
+
constructor(sdk: VorimSDK, config: TruAnonConfig);
|
|
73
|
+
/**
|
|
74
|
+
* Fetch a human's TruAnon profile (the anchor). Server-side call with your
|
|
75
|
+
* private key. Returns the rank/score/anchors; `isAnchored` is false if the
|
|
76
|
+
* lookup fails or the human has no anchor.
|
|
77
|
+
*/
|
|
78
|
+
verifyHuman(username: string): Promise<TruAnonProfile>;
|
|
79
|
+
/**
|
|
80
|
+
* The binding gate: authorize an agent to act on a human's behalf only if
|
|
81
|
+
* BOTH sides check out — the human is anchored at/above minRank (TruAnon) AND
|
|
82
|
+
* the agent holds the scope, is active, and clears trust (Vorim). Signs an
|
|
83
|
+
* audit event capturing both identities regardless of outcome.
|
|
84
|
+
*/
|
|
85
|
+
authorizeAgentForHuman(input: {
|
|
86
|
+
agentId: string;
|
|
87
|
+
humanUsername: string;
|
|
88
|
+
minRank?: TruAnonRank;
|
|
89
|
+
minTrustScore?: number;
|
|
90
|
+
}): Promise<HumanBindingAuthorization>;
|
|
91
|
+
/** Log that an anchored-human + agent action completed (the end-to-end record). */
|
|
92
|
+
logBoundAction(agentId: string, humanUsername: string, action: string, metadata?: Record<string, any>): Promise<void>;
|
|
93
|
+
private emptyProfile;
|
|
94
|
+
private logEvent;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Create a VorimTruAnon instance. Bind a TruAnon-anchored human to a
|
|
98
|
+
* Vorim-identified agent, with a signed record of both.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* import createVorim from '@vorim/sdk';
|
|
103
|
+
* import { createVorimTruAnon } from '@vorim/sdk/integrations/truanon';
|
|
104
|
+
* const vorim = createVorim({ apiKey: 'agid_sk_...' });
|
|
105
|
+
* const truanon = createVorimTruAnon(vorim, {
|
|
106
|
+
* privateKey: process.env.VORIM_TRUANON_KEY!,
|
|
107
|
+
* service: process.env.VORIM_TRUANON_SERVICE!,
|
|
108
|
+
* minRank: 'Credible',
|
|
109
|
+
* });
|
|
110
|
+
* const auth = await truanon.authorizeAgentForHuman({ agentId: 'agid_abc', humanUsername: 'jtayler' });
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
declare function createVorimTruAnon(sdk: VorimSDK, config: TruAnonConfig): VorimTruAnon;
|
|
114
|
+
|
|
115
|
+
export { type HumanBindingAuthorization, type TruAnonAnchor, type TruAnonConfig, type TruAnonProfile, type TruAnonRank, VorimTruAnon, createVorimTruAnon, meetsMinimumRank };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { VorimSDK } from '../index.js';
|
|
2
|
+
import '../types-zzK9YOoa.js';
|
|
3
|
+
|
|
4
|
+
/** TruAnon rank tiers, weakest to strongest. `Unknown` never meets a minimum. */
|
|
5
|
+
type TruAnonRank = 'Unknown' | 'Dangerous' | 'Cautioned' | 'Credible' | 'Reliable' | 'Genuine';
|
|
6
|
+
/** Does `userRank` meet or exceed `minimumRank`? Unknown always fails. */
|
|
7
|
+
declare function meetsMinimumRank(userRank: string, minimumRank: TruAnonRank): boolean;
|
|
8
|
+
interface TruAnonAnchor {
|
|
9
|
+
name: string;
|
|
10
|
+
display: string;
|
|
11
|
+
icon: string;
|
|
12
|
+
type: string;
|
|
13
|
+
kind: string;
|
|
14
|
+
}
|
|
15
|
+
/** The get_profile response shape (the fields TruAnon returns for a human). */
|
|
16
|
+
interface TruAnonProfile {
|
|
17
|
+
rank: string;
|
|
18
|
+
score: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
title?: string;
|
|
21
|
+
photo?: string;
|
|
22
|
+
ageBadge?: string;
|
|
23
|
+
anchors?: TruAnonAnchor[];
|
|
24
|
+
isAnchored: boolean;
|
|
25
|
+
}
|
|
26
|
+
interface TruAnonConfig {
|
|
27
|
+
/** Vorim API key (already on the sdk instance; not used directly here). */
|
|
28
|
+
apiKey?: string;
|
|
29
|
+
baseUrl?: string;
|
|
30
|
+
/** TruAnon private API key — SERVER-SIDE ONLY. */
|
|
31
|
+
privateKey: string;
|
|
32
|
+
/** Your registered TruAnon service name. */
|
|
33
|
+
service: string;
|
|
34
|
+
/** Minimum human rank required to authorize an agent. Default 'Credible'. */
|
|
35
|
+
minRank?: TruAnonRank;
|
|
36
|
+
/** Minimum agent trust score. Default 50. */
|
|
37
|
+
minTrustScore?: number;
|
|
38
|
+
/** Required agent scope. Default 'agent:transact'. */
|
|
39
|
+
requiredScope?: string;
|
|
40
|
+
/** TruAnon API base. Default 'https://truanon.com/api/v2'. */
|
|
41
|
+
truanonBaseUrl?: string;
|
|
42
|
+
/** Per-request timeout in ms. Default 30000 (TruAnon's guidance). */
|
|
43
|
+
timeoutMs?: number;
|
|
44
|
+
/** Injectable fetch (for testing). Defaults to global fetch. */
|
|
45
|
+
fetchImpl?: typeof fetch;
|
|
46
|
+
}
|
|
47
|
+
interface HumanBindingAuthorization {
|
|
48
|
+
authorized: boolean;
|
|
49
|
+
agentId: string;
|
|
50
|
+
humanUsername: string;
|
|
51
|
+
/** The human's TruAnon rank + whether it met the minimum. */
|
|
52
|
+
humanRank: string;
|
|
53
|
+
humanScore: string;
|
|
54
|
+
humanAnchored: boolean;
|
|
55
|
+
humanRankMet: boolean;
|
|
56
|
+
/** The agent's Vorim standing. */
|
|
57
|
+
trustScore: number;
|
|
58
|
+
status: string;
|
|
59
|
+
scopeVerified: boolean;
|
|
60
|
+
reason?: string;
|
|
61
|
+
}
|
|
62
|
+
declare class VorimTruAnon {
|
|
63
|
+
private sdk;
|
|
64
|
+
private privateKey;
|
|
65
|
+
private service;
|
|
66
|
+
private minRank;
|
|
67
|
+
private minTrustScore;
|
|
68
|
+
private requiredScope;
|
|
69
|
+
private truanonBaseUrl;
|
|
70
|
+
private timeoutMs;
|
|
71
|
+
private doFetch;
|
|
72
|
+
constructor(sdk: VorimSDK, config: TruAnonConfig);
|
|
73
|
+
/**
|
|
74
|
+
* Fetch a human's TruAnon profile (the anchor). Server-side call with your
|
|
75
|
+
* private key. Returns the rank/score/anchors; `isAnchored` is false if the
|
|
76
|
+
* lookup fails or the human has no anchor.
|
|
77
|
+
*/
|
|
78
|
+
verifyHuman(username: string): Promise<TruAnonProfile>;
|
|
79
|
+
/**
|
|
80
|
+
* The binding gate: authorize an agent to act on a human's behalf only if
|
|
81
|
+
* BOTH sides check out — the human is anchored at/above minRank (TruAnon) AND
|
|
82
|
+
* the agent holds the scope, is active, and clears trust (Vorim). Signs an
|
|
83
|
+
* audit event capturing both identities regardless of outcome.
|
|
84
|
+
*/
|
|
85
|
+
authorizeAgentForHuman(input: {
|
|
86
|
+
agentId: string;
|
|
87
|
+
humanUsername: string;
|
|
88
|
+
minRank?: TruAnonRank;
|
|
89
|
+
minTrustScore?: number;
|
|
90
|
+
}): Promise<HumanBindingAuthorization>;
|
|
91
|
+
/** Log that an anchored-human + agent action completed (the end-to-end record). */
|
|
92
|
+
logBoundAction(agentId: string, humanUsername: string, action: string, metadata?: Record<string, any>): Promise<void>;
|
|
93
|
+
private emptyProfile;
|
|
94
|
+
private logEvent;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Create a VorimTruAnon instance. Bind a TruAnon-anchored human to a
|
|
98
|
+
* Vorim-identified agent, with a signed record of both.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* import createVorim from '@vorim/sdk';
|
|
103
|
+
* import { createVorimTruAnon } from '@vorim/sdk/integrations/truanon';
|
|
104
|
+
* const vorim = createVorim({ apiKey: 'agid_sk_...' });
|
|
105
|
+
* const truanon = createVorimTruAnon(vorim, {
|
|
106
|
+
* privateKey: process.env.VORIM_TRUANON_KEY!,
|
|
107
|
+
* service: process.env.VORIM_TRUANON_SERVICE!,
|
|
108
|
+
* minRank: 'Credible',
|
|
109
|
+
* });
|
|
110
|
+
* const auth = await truanon.authorizeAgentForHuman({ agentId: 'agid_abc', humanUsername: 'jtayler' });
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
declare function createVorimTruAnon(sdk: VorimSDK, config: TruAnonConfig): VorimTruAnon;
|
|
114
|
+
|
|
115
|
+
export { type HumanBindingAuthorization, type TruAnonAnchor, type TruAnonConfig, type TruAnonProfile, type TruAnonRank, VorimTruAnon, createVorimTruAnon, meetsMinimumRank };
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
// src/integrations/truanon.ts
|
|
2
|
+
var RANK_ORDER = ["Dangerous", "Cautioned", "Credible", "Reliable", "Genuine"];
|
|
3
|
+
function meetsMinimumRank(userRank, minimumRank) {
|
|
4
|
+
if (userRank === "Unknown") return false;
|
|
5
|
+
const u = RANK_ORDER.indexOf(userRank);
|
|
6
|
+
const m = RANK_ORDER.indexOf(minimumRank);
|
|
7
|
+
return u >= 0 && m >= 0 && u >= m;
|
|
8
|
+
}
|
|
9
|
+
var VorimTruAnon = class {
|
|
10
|
+
sdk;
|
|
11
|
+
privateKey;
|
|
12
|
+
service;
|
|
13
|
+
minRank;
|
|
14
|
+
minTrustScore;
|
|
15
|
+
requiredScope;
|
|
16
|
+
truanonBaseUrl;
|
|
17
|
+
timeoutMs;
|
|
18
|
+
doFetch;
|
|
19
|
+
constructor(sdk, config) {
|
|
20
|
+
if (!config?.privateKey) throw new Error("[vorim] TruAnon integration requires a privateKey (server-side only).");
|
|
21
|
+
if (!config?.service) throw new Error("[vorim] TruAnon integration requires a service name.");
|
|
22
|
+
this.sdk = sdk;
|
|
23
|
+
this.privateKey = config.privateKey;
|
|
24
|
+
this.service = config.service;
|
|
25
|
+
this.minRank = config.minRank ?? "Credible";
|
|
26
|
+
this.minTrustScore = config.minTrustScore ?? 50;
|
|
27
|
+
this.requiredScope = config.requiredScope ?? "agent:transact";
|
|
28
|
+
this.truanonBaseUrl = (config.truanonBaseUrl ?? "https://truanon.com/api/v2").replace(/\/$/, "");
|
|
29
|
+
this.timeoutMs = config.timeoutMs ?? 3e4;
|
|
30
|
+
this.doFetch = config.fetchImpl ?? fetch;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Fetch a human's TruAnon profile (the anchor). Server-side call with your
|
|
34
|
+
* private key. Returns the rank/score/anchors; `isAnchored` is false if the
|
|
35
|
+
* lookup fails or the human has no anchor.
|
|
36
|
+
*/
|
|
37
|
+
async verifyHuman(username) {
|
|
38
|
+
const url = `${this.truanonBaseUrl}/get_profile?id=${encodeURIComponent(username)}&service=${encodeURIComponent(this.service)}`;
|
|
39
|
+
const controller = new AbortController();
|
|
40
|
+
const timer = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
41
|
+
try {
|
|
42
|
+
const res = await this.doFetch(url, {
|
|
43
|
+
method: "GET",
|
|
44
|
+
headers: { Authorization: this.privateKey, Accept: "application/json" },
|
|
45
|
+
redirect: "error",
|
|
46
|
+
signal: controller.signal
|
|
47
|
+
});
|
|
48
|
+
if (!res.ok) return this.emptyProfile();
|
|
49
|
+
const data = await res.json();
|
|
50
|
+
const rank = typeof data?.rank === "string" ? data.rank : "Unknown";
|
|
51
|
+
return {
|
|
52
|
+
rank,
|
|
53
|
+
score: typeof data?.score === "string" ? data.score : String(data?.score ?? "0"),
|
|
54
|
+
name: data?.name,
|
|
55
|
+
title: data?.title,
|
|
56
|
+
photo: data?.photo,
|
|
57
|
+
ageBadge: data?.ageBadge,
|
|
58
|
+
anchors: Array.isArray(data?.anchors) ? data.anchors : [],
|
|
59
|
+
isAnchored: rank !== "Unknown" && !!rank
|
|
60
|
+
};
|
|
61
|
+
} catch {
|
|
62
|
+
return this.emptyProfile();
|
|
63
|
+
} finally {
|
|
64
|
+
clearTimeout(timer);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The binding gate: authorize an agent to act on a human's behalf only if
|
|
69
|
+
* BOTH sides check out — the human is anchored at/above minRank (TruAnon) AND
|
|
70
|
+
* the agent holds the scope, is active, and clears trust (Vorim). Signs an
|
|
71
|
+
* audit event capturing both identities regardless of outcome.
|
|
72
|
+
*/
|
|
73
|
+
async authorizeAgentForHuman(input) {
|
|
74
|
+
const minRank = input.minRank ?? this.minRank;
|
|
75
|
+
const threshold = input.minTrustScore ?? this.minTrustScore;
|
|
76
|
+
const profile = await this.verifyHuman(input.humanUsername);
|
|
77
|
+
const rankMet = meetsMinimumRank(profile.rank, minRank);
|
|
78
|
+
const base = {
|
|
79
|
+
agentId: input.agentId,
|
|
80
|
+
humanUsername: input.humanUsername,
|
|
81
|
+
humanRank: profile.rank,
|
|
82
|
+
humanScore: profile.score,
|
|
83
|
+
humanAnchored: profile.isAnchored,
|
|
84
|
+
humanRankMet: rankMet
|
|
85
|
+
};
|
|
86
|
+
if (!profile.isAnchored) {
|
|
87
|
+
await this.logEvent(input.agentId, "truanon.bind.authorize", "denied", base, { reason: "Human is not anchored" });
|
|
88
|
+
return { ...base, authorized: false, trustScore: 0, status: "unknown", scopeVerified: false, reason: `Human ${input.humanUsername} is not anchored on TruAnon` };
|
|
89
|
+
}
|
|
90
|
+
if (!rankMet) {
|
|
91
|
+
await this.logEvent(input.agentId, "truanon.bind.authorize", "denied", base, { reason: `Rank ${profile.rank} < ${minRank}` });
|
|
92
|
+
return { ...base, authorized: false, trustScore: 0, status: "unknown", scopeVerified: false, reason: `Human rank ${profile.rank} is below the required ${minRank}` };
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
const perm = await this.sdk.check(input.agentId, this.requiredScope);
|
|
96
|
+
if (!perm.allowed) {
|
|
97
|
+
await this.logEvent(input.agentId, "truanon.bind.authorize", "denied", base, { reason: `Missing ${this.requiredScope}` });
|
|
98
|
+
return { ...base, authorized: false, trustScore: 0, status: "unknown", scopeVerified: false, reason: `Agent does not have ${this.requiredScope} permission` };
|
|
99
|
+
}
|
|
100
|
+
} catch (e) {
|
|
101
|
+
await this.logEvent(input.agentId, "truanon.bind.authorize", "denied", base, { reason: `Permission check failed: ${e.message}` });
|
|
102
|
+
return { ...base, authorized: false, trustScore: 0, status: "unknown", scopeVerified: false, reason: `Permission check failed: ${e.message}` };
|
|
103
|
+
}
|
|
104
|
+
let score = 0;
|
|
105
|
+
let status = "unknown";
|
|
106
|
+
try {
|
|
107
|
+
const trust = await this.sdk.verify(input.agentId);
|
|
108
|
+
score = trust.trust_score ?? 0;
|
|
109
|
+
status = trust.status ?? "unknown";
|
|
110
|
+
} catch {
|
|
111
|
+
}
|
|
112
|
+
if (status !== "active") {
|
|
113
|
+
await this.logEvent(input.agentId, "truanon.bind.authorize", "denied", base, { reason: `Agent status: ${status}` });
|
|
114
|
+
return { ...base, authorized: false, trustScore: score, status, scopeVerified: true, reason: `Agent is ${status}, not active` };
|
|
115
|
+
}
|
|
116
|
+
if (score < threshold) {
|
|
117
|
+
await this.logEvent(input.agentId, "truanon.bind.authorize", "denied", base, { reason: `Score ${score} < ${threshold}` });
|
|
118
|
+
return { ...base, authorized: false, trustScore: score, status, scopeVerified: true, reason: `Agent trust score ${score} is below minimum ${threshold}` };
|
|
119
|
+
}
|
|
120
|
+
await this.logEvent(input.agentId, "truanon.bind.authorize", "success", base, { trust_score: score });
|
|
121
|
+
return { ...base, authorized: true, trustScore: score, status, scopeVerified: true };
|
|
122
|
+
}
|
|
123
|
+
/** Log that an anchored-human + agent action completed (the end-to-end record). */
|
|
124
|
+
async logBoundAction(agentId, humanUsername, action, metadata) {
|
|
125
|
+
await this.logEvent(agentId, "truanon.bound_action", "success", { agentId, humanUsername }, { bound_action: action, ...metadata });
|
|
126
|
+
}
|
|
127
|
+
emptyProfile() {
|
|
128
|
+
return { rank: "Unknown", score: "0", anchors: [], isAnchored: false };
|
|
129
|
+
}
|
|
130
|
+
async logEvent(agentId, action, result, base, metadata) {
|
|
131
|
+
try {
|
|
132
|
+
await this.sdk.emit({
|
|
133
|
+
agent_id: agentId,
|
|
134
|
+
event_type: "api_request",
|
|
135
|
+
action,
|
|
136
|
+
result,
|
|
137
|
+
resource: base?.humanUsername ?? "",
|
|
138
|
+
metadata: {
|
|
139
|
+
provider: "truanon",
|
|
140
|
+
service: this.service,
|
|
141
|
+
human_username: base?.humanUsername ?? "",
|
|
142
|
+
human_rank: base?.humanRank ?? "",
|
|
143
|
+
human_score: base?.humanScore ?? "",
|
|
144
|
+
human_anchored: base?.humanAnchored ?? false,
|
|
145
|
+
human_rank_met: base?.humanRankMet ?? false,
|
|
146
|
+
...metadata
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
} catch {
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
function createVorimTruAnon(sdk, config) {
|
|
154
|
+
return new VorimTruAnon(sdk, config);
|
|
155
|
+
}
|
|
156
|
+
export {
|
|
157
|
+
VorimTruAnon,
|
|
158
|
+
createVorimTruAnon,
|
|
159
|
+
meetsMinimumRank
|
|
160
|
+
};
|
|
161
|
+
//# sourceMappingURL=truanon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/integrations/truanon.ts"],"sourcesContent":["// ============================================================================\n// Vorim AI — TruAnon Integration\n//\n// TruAnon (truanon.com) anchors a real HUMAN to an account: a member binds their\n// profile to connections other people already know them by, without the platform\n// storing any identity documents. TruAnon returns a rank (Genuine, Reliable,\n// Credible, Cautioned, Dangerous, Unknown) and a 0-5 score for the human.\n//\n// Vorim anchors the AI AGENT: cryptographic identity, scoped permissions, and a\n// signed audit trail of what the agent did. This integration BINDS the two: it\n// verifies a human is anchored (via TruAnon) AND the acting agent is authorized\n// (via Vorim), then signs an audit event capturing BOTH identities — so you can\n// prove one accountable line from a verified human, through the platform, to the\n// specific agent and action. Protection end to end.\n//\n// It calls TruAnon's public API server-side with your private key, and Vorim's\n// verify/emit. Keep the TruAnon private key on the server — never in the browser.\n//\n// Usage:\n// import createVorim from '@vorim/sdk';\n// import { createVorimTruAnon } from '@vorim/sdk/integrations/truanon';\n//\n// const vorim = createVorim({ apiKey: 'agid_sk_...' });\n// const truanon = createVorimTruAnon(vorim, {\n// privateKey: process.env.VORIM_TRUANON_KEY!, // server-side only\n// service: process.env.VORIM_TRUANON_SERVICE!, // your TruAnon service name\n// minRank: 'Credible', // ID-verification-equivalent\n// });\n//\n// // Before an agent acts on a human's behalf, bind + authorize:\n// const auth = await truanon.authorizeAgentForHuman({\n// agentId: 'agid_abc123',\n// humanUsername: 'jtayler',\n// });\n// if (auth.authorized) { /* proceed; the binding is signed to the audit trail */ }\n// ============================================================================\n\nimport type { VorimSDK } from '../index.js';\n\n/** TruAnon rank tiers, weakest to strongest. `Unknown` never meets a minimum. */\nexport type TruAnonRank = 'Unknown' | 'Dangerous' | 'Cautioned' | 'Credible' | 'Reliable' | 'Genuine';\n\n// Verbatim from the TruAnon API: index-based ordering, Unknown is off-axis.\nconst RANK_ORDER: TruAnonRank[] = ['Dangerous', 'Cautioned', 'Credible', 'Reliable', 'Genuine'];\n\n/** Does `userRank` meet or exceed `minimumRank`? Unknown always fails. */\nexport function meetsMinimumRank(userRank: string, minimumRank: TruAnonRank): boolean {\n if (userRank === 'Unknown') return false;\n const u = RANK_ORDER.indexOf(userRank as TruAnonRank);\n const m = RANK_ORDER.indexOf(minimumRank);\n return u >= 0 && m >= 0 && u >= m;\n}\n\nexport interface TruAnonAnchor {\n name: string;\n display: string;\n icon: string;\n type: string;\n kind: string;\n}\n\n/** The get_profile response shape (the fields TruAnon returns for a human). */\nexport interface TruAnonProfile {\n rank: string;\n score: string; // \"0\" .. \"5.0\"\n name?: string;\n title?: string;\n photo?: string;\n ageBadge?: string;\n anchors?: TruAnonAnchor[];\n isAnchored: boolean; // derived: true when TruAnon returned a real rank\n}\n\nexport interface TruAnonConfig {\n /** Vorim API key (already on the sdk instance; not used directly here). */\n apiKey?: string;\n baseUrl?: string;\n /** TruAnon private API key — SERVER-SIDE ONLY. */\n privateKey: string;\n /** Your registered TruAnon service name. */\n service: string;\n /** Minimum human rank required to authorize an agent. Default 'Credible'. */\n minRank?: TruAnonRank;\n /** Minimum agent trust score. Default 50. */\n minTrustScore?: number;\n /** Required agent scope. Default 'agent:transact'. */\n requiredScope?: string;\n /** TruAnon API base. Default 'https://truanon.com/api/v2'. */\n truanonBaseUrl?: string;\n /** Per-request timeout in ms. Default 30000 (TruAnon's guidance). */\n timeoutMs?: number;\n /** Injectable fetch (for testing). Defaults to global fetch. */\n fetchImpl?: typeof fetch;\n}\n\nexport interface HumanBindingAuthorization {\n authorized: boolean;\n agentId: string;\n humanUsername: string;\n /** The human's TruAnon rank + whether it met the minimum. */\n humanRank: string;\n humanScore: string;\n humanAnchored: boolean;\n humanRankMet: boolean;\n /** The agent's Vorim standing. */\n trustScore: number;\n status: string;\n scopeVerified: boolean;\n reason?: string;\n}\n\nexport class VorimTruAnon {\n private sdk: VorimSDK;\n private privateKey: string;\n private service: string;\n private minRank: TruAnonRank;\n private minTrustScore: number;\n private requiredScope: string;\n private truanonBaseUrl: string;\n private timeoutMs: number;\n private doFetch: typeof fetch;\n\n constructor(sdk: VorimSDK, config: TruAnonConfig) {\n if (!config?.privateKey) throw new Error('[vorim] TruAnon integration requires a privateKey (server-side only).');\n if (!config?.service) throw new Error('[vorim] TruAnon integration requires a service name.');\n this.sdk = sdk;\n this.privateKey = config.privateKey;\n this.service = config.service;\n this.minRank = config.minRank ?? 'Credible';\n this.minTrustScore = config.minTrustScore ?? 50;\n this.requiredScope = config.requiredScope ?? 'agent:transact';\n this.truanonBaseUrl = (config.truanonBaseUrl ?? 'https://truanon.com/api/v2').replace(/\\/$/, '');\n this.timeoutMs = config.timeoutMs ?? 30_000;\n this.doFetch = config.fetchImpl ?? fetch;\n }\n\n /**\n * Fetch a human's TruAnon profile (the anchor). Server-side call with your\n * private key. Returns the rank/score/anchors; `isAnchored` is false if the\n * lookup fails or the human has no anchor.\n */\n async verifyHuman(username: string): Promise<TruAnonProfile> {\n const url = `${this.truanonBaseUrl}/get_profile?id=${encodeURIComponent(username)}&service=${encodeURIComponent(this.service)}`;\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), this.timeoutMs);\n try {\n // redirect: 'error' — never replay the Authorization header to a 3xx target.\n const res = await this.doFetch(url, {\n method: 'GET',\n headers: { Authorization: this.privateKey, Accept: 'application/json' },\n redirect: 'error',\n signal: controller.signal,\n });\n if (!res.ok) return this.emptyProfile();\n const data: any = await res.json();\n const rank = typeof data?.rank === 'string' ? data.rank : 'Unknown';\n return {\n rank,\n score: typeof data?.score === 'string' ? data.score : String(data?.score ?? '0'),\n name: data?.name,\n title: data?.title,\n photo: data?.photo,\n ageBadge: data?.ageBadge,\n anchors: Array.isArray(data?.anchors) ? data.anchors : [],\n isAnchored: rank !== 'Unknown' && !!rank,\n };\n } catch {\n return this.emptyProfile();\n } finally {\n clearTimeout(timer);\n }\n }\n\n /**\n * The binding gate: authorize an agent to act on a human's behalf only if\n * BOTH sides check out — the human is anchored at/above minRank (TruAnon) AND\n * the agent holds the scope, is active, and clears trust (Vorim). Signs an\n * audit event capturing both identities regardless of outcome.\n */\n async authorizeAgentForHuman(input: {\n agentId: string;\n humanUsername: string;\n minRank?: TruAnonRank;\n minTrustScore?: number;\n }): Promise<HumanBindingAuthorization> {\n const minRank = input.minRank ?? this.minRank;\n const threshold = input.minTrustScore ?? this.minTrustScore;\n\n // 1. The human side — TruAnon anchor.\n const profile = await this.verifyHuman(input.humanUsername);\n const rankMet = meetsMinimumRank(profile.rank, minRank);\n\n const base = {\n agentId: input.agentId,\n humanUsername: input.humanUsername,\n humanRank: profile.rank,\n humanScore: profile.score,\n humanAnchored: profile.isAnchored,\n humanRankMet: rankMet,\n };\n\n if (!profile.isAnchored) {\n await this.logEvent(input.agentId, 'truanon.bind.authorize', 'denied', base, { reason: 'Human is not anchored' });\n return { ...base, authorized: false, trustScore: 0, status: 'unknown', scopeVerified: false, reason: `Human ${input.humanUsername} is not anchored on TruAnon` };\n }\n if (!rankMet) {\n await this.logEvent(input.agentId, 'truanon.bind.authorize', 'denied', base, { reason: `Rank ${profile.rank} < ${minRank}` });\n return { ...base, authorized: false, trustScore: 0, status: 'unknown', scopeVerified: false, reason: `Human rank ${profile.rank} is below the required ${minRank}` };\n }\n\n // 2. The agent side — Vorim scope + status + trust.\n try {\n const perm = await this.sdk.check(input.agentId, this.requiredScope as any);\n if (!(perm as any).allowed) {\n await this.logEvent(input.agentId, 'truanon.bind.authorize', 'denied', base, { reason: `Missing ${this.requiredScope}` });\n return { ...base, authorized: false, trustScore: 0, status: 'unknown', scopeVerified: false, reason: `Agent does not have ${this.requiredScope} permission` };\n }\n } catch (e: any) {\n await this.logEvent(input.agentId, 'truanon.bind.authorize', 'denied', base, { reason: `Permission check failed: ${e.message}` });\n return { ...base, authorized: false, trustScore: 0, status: 'unknown', scopeVerified: false, reason: `Permission check failed: ${e.message}` };\n }\n\n let score = 0;\n let status = 'unknown';\n try {\n const trust = await this.sdk.verify(input.agentId);\n score = (trust as any).trust_score ?? 0;\n status = (trust as any).status ?? 'unknown';\n } catch { /* treated as not-active below */ }\n\n if (status !== 'active') {\n await this.logEvent(input.agentId, 'truanon.bind.authorize', 'denied', base, { reason: `Agent status: ${status}` });\n return { ...base, authorized: false, trustScore: score, status, scopeVerified: true, reason: `Agent is ${status}, not active` };\n }\n if (score < threshold) {\n await this.logEvent(input.agentId, 'truanon.bind.authorize', 'denied', base, { reason: `Score ${score} < ${threshold}` });\n return { ...base, authorized: false, trustScore: score, status, scopeVerified: true, reason: `Agent trust score ${score} is below minimum ${threshold}` };\n }\n\n // Both sides pass — sign the binding.\n await this.logEvent(input.agentId, 'truanon.bind.authorize', 'success', base, { trust_score: score });\n return { ...base, authorized: true, trustScore: score, status, scopeVerified: true };\n }\n\n /** Log that an anchored-human + agent action completed (the end-to-end record). */\n async logBoundAction(agentId: string, humanUsername: string, action: string, metadata?: Record<string, any>): Promise<void> {\n await this.logEvent(agentId, 'truanon.bound_action', 'success', { agentId, humanUsername }, { bound_action: action, ...metadata });\n }\n\n private emptyProfile(): TruAnonProfile {\n return { rank: 'Unknown', score: '0', anchors: [], isAnchored: false };\n }\n\n private async logEvent(\n agentId: string,\n action: string,\n result: 'success' | 'denied' | 'error',\n base?: Partial<HumanBindingAuthorization> & { agentId?: string; humanUsername?: string },\n metadata?: Record<string, any>,\n ): Promise<void> {\n try {\n await this.sdk.emit({\n agent_id: agentId,\n event_type: 'api_request',\n action,\n result,\n resource: base?.humanUsername ?? '',\n metadata: {\n provider: 'truanon',\n service: this.service,\n human_username: base?.humanUsername ?? '',\n human_rank: base?.humanRank ?? '',\n human_score: base?.humanScore ?? '',\n human_anchored: base?.humanAnchored ?? false,\n human_rank_met: base?.humanRankMet ?? false,\n ...metadata,\n },\n });\n } catch { /* never block the flow on an audit hiccup */ }\n }\n}\n\n/**\n * Create a VorimTruAnon instance. Bind a TruAnon-anchored human to a\n * Vorim-identified agent, with a signed record of both.\n *\n * @example\n * ```typescript\n * import createVorim from '@vorim/sdk';\n * import { createVorimTruAnon } from '@vorim/sdk/integrations/truanon';\n * const vorim = createVorim({ apiKey: 'agid_sk_...' });\n * const truanon = createVorimTruAnon(vorim, {\n * privateKey: process.env.VORIM_TRUANON_KEY!,\n * service: process.env.VORIM_TRUANON_SERVICE!,\n * minRank: 'Credible',\n * });\n * const auth = await truanon.authorizeAgentForHuman({ agentId: 'agid_abc', humanUsername: 'jtayler' });\n * ```\n */\nexport function createVorimTruAnon(sdk: VorimSDK, config: TruAnonConfig): VorimTruAnon {\n return new VorimTruAnon(sdk, config);\n}\n"],"mappings":";AA2CA,IAAM,aAA4B,CAAC,aAAa,aAAa,YAAY,YAAY,SAAS;AAGvF,SAAS,iBAAiB,UAAkB,aAAmC;AACpF,MAAI,aAAa,UAAW,QAAO;AACnC,QAAM,IAAI,WAAW,QAAQ,QAAuB;AACpD,QAAM,IAAI,WAAW,QAAQ,WAAW;AACxC,SAAO,KAAK,KAAK,KAAK,KAAK,KAAK;AAClC;AA4DO,IAAM,eAAN,MAAmB;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAER,YAAY,KAAe,QAAuB;AAChD,QAAI,CAAC,QAAQ,WAAY,OAAM,IAAI,MAAM,uEAAuE;AAChH,QAAI,CAAC,QAAQ,QAAS,OAAM,IAAI,MAAM,sDAAsD;AAC5F,SAAK,MAAM;AACX,SAAK,aAAa,OAAO;AACzB,SAAK,UAAU,OAAO;AACtB,SAAK,UAAU,OAAO,WAAW;AACjC,SAAK,gBAAgB,OAAO,iBAAiB;AAC7C,SAAK,gBAAgB,OAAO,iBAAiB;AAC7C,SAAK,kBAAkB,OAAO,kBAAkB,8BAA8B,QAAQ,OAAO,EAAE;AAC/F,SAAK,YAAY,OAAO,aAAa;AACrC,SAAK,UAAU,OAAO,aAAa;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,YAAY,UAA2C;AAC3D,U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