@trustthenverify/sdk 1.0.0 → 2.0.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/index.d.ts CHANGED
@@ -4,34 +4,23 @@
4
4
  * TypeScript SDK for the AI agent trust registry.
5
5
  * https://trustthenverify.com
6
6
  */
7
+ export interface TrustDimension {
8
+ score: number;
9
+ max: number;
10
+ }
7
11
  export interface TrustScore {
8
12
  total: number;
9
13
  confidence: number;
10
- tier: number;
11
- tier_label: string;
12
- badge: string;
13
14
  dimensions: {
14
- identity: {
15
- score: number;
16
- max: number;
17
- };
18
- economic: {
19
- score: number;
20
- max: number;
21
- };
22
- track_record: {
23
- score: number;
24
- max: number;
25
- };
26
- social: {
27
- score: number;
28
- max: number;
29
- };
30
- behavioral: {
31
- score: number;
32
- max: number;
33
- };
15
+ identity: TrustDimension;
16
+ economic: TrustDimension;
17
+ social: TrustDimension;
18
+ behavioral: TrustDimension;
34
19
  };
20
+ risk_flags: string[];
21
+ safe_to_transact: boolean;
22
+ risk_level: "low" | "medium" | "high" | "unknown";
23
+ evidence_summary: string;
35
24
  }
36
25
  export interface Agent {
37
26
  id: string;
@@ -39,6 +28,7 @@ export interface Agent {
39
28
  description?: string;
40
29
  contact?: string;
41
30
  trust_score?: number;
31
+ trust_tier?: number;
42
32
  capabilities?: string[];
43
33
  lightning_pubkey?: string;
44
34
  nostr_npub?: string;
@@ -46,6 +36,17 @@ export interface Agent {
46
36
  website?: string;
47
37
  created_at?: string;
48
38
  }
39
+ export interface PaginatedAgents {
40
+ agents: Agent[];
41
+ page: number;
42
+ limit: number;
43
+ total: number;
44
+ total_pages: number;
45
+ }
46
+ export interface ListAgentsOptions {
47
+ page?: number;
48
+ limit?: number;
49
+ }
49
50
  export interface RegisterResponse {
50
51
  agent_id: string;
51
52
  trust_score: number;
@@ -60,9 +61,13 @@ export interface ReviewResponse {
60
61
  review_id?: string;
61
62
  error?: string;
62
63
  }
64
+ export declare class TrustRegistryOfflineError extends Error {
65
+ constructor(message?: string);
66
+ }
63
67
  export declare class TrustClient {
64
68
  private baseUrl;
65
69
  constructor(baseUrl?: string);
70
+ private safeFetch;
66
71
  /**
67
72
  * Look up an agent's trust score
68
73
  */
@@ -75,9 +80,25 @@ export declare class TrustClient {
75
80
  */
76
81
  getAgent(agentId: string): Promise<Agent | null>;
77
82
  /**
78
- * List all registered agents
83
+ * List registered agents (paginated)
79
84
  */
80
- listAgents(): Promise<Agent[]>;
85
+ listAgents(options?: ListAgentsOptions): Promise<PaginatedAgents>;
86
+ /**
87
+ * Update an agent's fields (requires auth secret = contact value)
88
+ */
89
+ updateAgent(agentId: string, updates: Partial<Pick<Agent, "description" | "capabilities" | "lightning_pubkey" | "x_handle" | "website" | "contact">>, authSecret: string): Promise<{
90
+ success: boolean;
91
+ message?: string;
92
+ error?: string;
93
+ }>;
94
+ /**
95
+ * Soft-delete an agent (requires auth secret = contact value)
96
+ */
97
+ deleteAgent(agentId: string, authSecret: string): Promise<{
98
+ success: boolean;
99
+ message?: string;
100
+ error?: string;
101
+ }>;
81
102
  /**
82
103
  * Register a new agent
83
104
  */
@@ -121,7 +142,17 @@ export declare const lookup: (agentId: string) => Promise<{
121
142
  } | null>;
122
143
  export declare const register: (name: string, contact: string, options?: Parameters<TrustClient["register"]>[2]) => Promise<RegisterResponse>;
123
144
  export declare const review: (agentId: string, rating: number, comment: string, options?: Parameters<TrustClient["review"]>[3]) => Promise<ReviewResponse>;
124
- export declare const listAgents: () => Promise<Agent[]>;
145
+ export declare const listAgents: (options?: ListAgentsOptions) => Promise<PaginatedAgents>;
146
+ export declare const updateAgent: (agentId: string, updates: Parameters<TrustClient["updateAgent"]>[1], authSecret: string) => Promise<{
147
+ success: boolean;
148
+ message?: string;
149
+ error?: string;
150
+ }>;
151
+ export declare const deleteAgent: (agentId: string, authSecret: string) => Promise<{
152
+ success: boolean;
153
+ message?: string;
154
+ error?: string;
155
+ }>;
125
156
  export declare const isTrusted: (agentId: string) => Promise<boolean>;
126
157
  export declare const badgeUrl: (agentId: string) => string;
127
158
  /**
package/dist/index.js CHANGED
@@ -6,18 +6,38 @@
6
6
  * https://trustthenverify.com
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.badgeUrl = exports.isTrusted = exports.listAgents = exports.review = exports.register = exports.lookup = exports.trust = exports.TrustClient = void 0;
9
+ exports.badgeUrl = exports.isTrusted = exports.deleteAgent = exports.updateAgent = exports.listAgents = exports.review = exports.register = exports.lookup = exports.trust = exports.TrustClient = exports.TrustRegistryOfflineError = void 0;
10
10
  exports.ensureRegistered = ensureRegistered;
11
11
  exports.checkBeforeTransaction = checkBeforeTransaction;
12
+ class TrustRegistryOfflineError extends Error {
13
+ constructor(message = "Trust registry is temporarily offline") {
14
+ super(message);
15
+ this.name = "TrustRegistryOfflineError";
16
+ }
17
+ }
18
+ exports.TrustRegistryOfflineError = TrustRegistryOfflineError;
12
19
  class TrustClient {
13
20
  constructor(baseUrl = "https://trustthenverify.com") {
14
21
  this.baseUrl = baseUrl.replace(/\/$/, "");
15
22
  }
23
+ async safeFetch(url, init) {
24
+ let res;
25
+ try {
26
+ res = await fetch(url, init);
27
+ }
28
+ catch (err) {
29
+ throw new TrustRegistryOfflineError(`Registry unreachable: ${err.message || "network error"}`);
30
+ }
31
+ if (res.status === 502 || res.status === 503 || res.status === 504) {
32
+ throw new TrustRegistryOfflineError(`Registry returned ${res.status}`);
33
+ }
34
+ return res;
35
+ }
16
36
  /**
17
37
  * Look up an agent's trust score
18
38
  */
19
39
  async lookup(agentId) {
20
- const res = await fetch(`${this.baseUrl}/registry/trust/${agentId}`);
40
+ const res = await this.safeFetch(`${this.baseUrl}/v1/trust/${agentId}`);
21
41
  if (!res.ok)
22
42
  return null;
23
43
  return res.json();
@@ -26,37 +46,77 @@ class TrustClient {
26
46
  * Get an agent by ID
27
47
  */
28
48
  async getAgent(agentId) {
29
- const res = await fetch(`${this.baseUrl}/registry/agent/${agentId}`);
49
+ const res = await this.safeFetch(`${this.baseUrl}/registry/agent/${agentId}`);
30
50
  if (!res.ok)
31
51
  return null;
32
52
  return res.json();
33
53
  }
34
54
  /**
35
- * List all registered agents
55
+ * List registered agents (paginated)
36
56
  */
37
- async listAgents() {
38
- const res = await fetch(`${this.baseUrl}/registry/agents`);
57
+ async listAgents(options) {
58
+ const params = new URLSearchParams();
59
+ if (options?.page)
60
+ params.set("page", String(options.page));
61
+ if (options?.limit)
62
+ params.set("limit", String(options.limit));
63
+ const qs = params.toString();
64
+ const res = await this.safeFetch(`${this.baseUrl}/registry/agents${qs ? `?${qs}` : ""}`);
39
65
  if (!res.ok)
40
- return [];
66
+ return { agents: [], page: 1, limit: 50, total: 0, total_pages: 0 };
41
67
  const data = await res.json();
42
- return data.agents || [];
68
+ return {
69
+ agents: data.agents || [],
70
+ page: data.page || 1,
71
+ limit: data.limit || 50,
72
+ total: data.total || 0,
73
+ total_pages: data.total_pages || 0,
74
+ };
75
+ }
76
+ /**
77
+ * Update an agent's fields (requires auth secret = contact value)
78
+ */
79
+ async updateAgent(agentId, updates, authSecret) {
80
+ const res = await this.safeFetch(`${this.baseUrl}/registry/agent/${agentId}`, {
81
+ method: "PATCH",
82
+ headers: {
83
+ "Content-Type": "application/json",
84
+ "X-Agent-Secret": authSecret,
85
+ },
86
+ body: JSON.stringify(updates),
87
+ });
88
+ return res.json();
89
+ }
90
+ /**
91
+ * Soft-delete an agent (requires auth secret = contact value)
92
+ */
93
+ async deleteAgent(agentId, authSecret) {
94
+ const res = await this.safeFetch(`${this.baseUrl}/registry/agent/${agentId}`, {
95
+ method: "DELETE",
96
+ headers: { "X-Agent-Secret": authSecret },
97
+ });
98
+ return res.json();
43
99
  }
44
100
  /**
45
101
  * Register a new agent
46
102
  */
47
103
  async register(name, contact, options) {
48
- const res = await fetch(`${this.baseUrl}/register`, {
104
+ const res = await this.safeFetch(`${this.baseUrl}/register`, {
49
105
  method: "POST",
50
106
  headers: { "Content-Type": "application/json" },
51
107
  body: JSON.stringify({ name, contact, ...options }),
52
108
  });
109
+ if (!res.ok) {
110
+ const body = await res.json().catch(() => ({}));
111
+ throw new Error(body.error || `Registration failed (${res.status})`);
112
+ }
53
113
  return res.json();
54
114
  }
55
115
  /**
56
116
  * Submit a review for an agent
57
117
  */
58
118
  async review(agentId, rating, comment, options) {
59
- const res = await fetch(`${this.baseUrl}/registry/review`, {
119
+ const res = await this.safeFetch(`${this.baseUrl}/registry/review`, {
60
120
  method: "POST",
61
121
  headers: { "Content-Type": "application/json" },
62
122
  body: JSON.stringify({
@@ -66,6 +126,10 @@ class TrustClient {
66
126
  ...options,
67
127
  }),
68
128
  });
129
+ if (!res.ok) {
130
+ const body = await res.json().catch(() => ({}));
131
+ throw new Error(body.error || `Review failed (${res.status})`);
132
+ }
69
133
  return res.json();
70
134
  }
71
135
  /**
@@ -108,8 +172,12 @@ const register = (name, contact, options) => exports.trust.register(name, contac
108
172
  exports.register = register;
109
173
  const review = (agentId, rating, comment, options) => exports.trust.review(agentId, rating, comment, options);
110
174
  exports.review = review;
111
- const listAgents = () => exports.trust.listAgents();
175
+ const listAgents = (options) => exports.trust.listAgents(options);
112
176
  exports.listAgents = listAgents;
177
+ const updateAgent = (agentId, updates, authSecret) => exports.trust.updateAgent(agentId, updates, authSecret);
178
+ exports.updateAgent = updateAgent;
179
+ const deleteAgent = (agentId, authSecret) => exports.trust.deleteAgent(agentId, authSecret);
180
+ exports.deleteAgent = deleteAgent;
113
181
  const isTrusted = (agentId) => exports.trust.isTrusted(agentId);
114
182
  exports.isTrusted = isTrusted;
115
183
  const badgeUrl = (agentId) => exports.trust.badgeUrl(agentId);
@@ -128,19 +196,19 @@ exports.badgeUrl = badgeUrl;
128
196
  * });
129
197
  */
130
198
  async function ensureRegistered(options) {
131
- // Check if already registered by name
132
- const agents = await exports.trust.listAgents();
133
- const existing = agents.find(a => a.name.toLowerCase() === options.name.toLowerCase());
199
+ // Search by name instead of listing all agents
200
+ const result = await exports.trust.listAgents({ limit: 50 });
201
+ const existing = result.agents.find(a => a.name.toLowerCase() === options.name.toLowerCase());
134
202
  if (existing) {
135
203
  return existing.id;
136
204
  }
137
205
  // Register new agent
138
- const result = await exports.trust.register(options.name, options.contact || `sdk-auto-${Date.now()}`, {
206
+ const regResult = await exports.trust.register(options.name, options.contact || `sdk-auto-${Date.now()}`, {
139
207
  description: options.description,
140
208
  nostr_npub: options.npub,
141
209
  lightning_pubkey: options.lightning_pubkey,
142
210
  });
143
- return result.agent_id;
211
+ return regResult.agent_id;
144
212
  }
145
213
  /**
146
214
  * Check trust before transaction helper
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustthenverify/sdk",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "description": "TypeScript SDK for the Trust Then Verify agent registry",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -1,23 +1,28 @@
1
1
  /**
2
2
  * Trust Then Verify SDK
3
- *
3
+ *
4
4
  * TypeScript SDK for the AI agent trust registry.
5
5
  * https://trustthenverify.com
6
6
  */
7
7
 
8
+ export interface TrustDimension {
9
+ score: number;
10
+ max: number;
11
+ }
12
+
8
13
  export interface TrustScore {
9
14
  total: number;
10
15
  confidence: number;
11
- tier: number;
12
- tier_label: string;
13
- badge: string;
14
16
  dimensions: {
15
- identity: { score: number; max: number };
16
- economic: { score: number; max: number };
17
- track_record: { score: number; max: number };
18
- social: { score: number; max: number };
19
- behavioral: { score: number; max: number };
17
+ identity: TrustDimension;
18
+ economic: TrustDimension;
19
+ social: TrustDimension;
20
+ behavioral: TrustDimension;
20
21
  };
22
+ risk_flags: string[];
23
+ safe_to_transact: boolean;
24
+ risk_level: "low" | "medium" | "high" | "unknown";
25
+ evidence_summary: string;
21
26
  }
22
27
 
23
28
  export interface Agent {
@@ -26,6 +31,7 @@ export interface Agent {
26
31
  description?: string;
27
32
  contact?: string;
28
33
  trust_score?: number;
34
+ trust_tier?: number;
29
35
  capabilities?: string[];
30
36
  lightning_pubkey?: string;
31
37
  nostr_npub?: string;
@@ -34,6 +40,19 @@ export interface Agent {
34
40
  created_at?: string;
35
41
  }
36
42
 
43
+ export interface PaginatedAgents {
44
+ agents: Agent[];
45
+ page: number;
46
+ limit: number;
47
+ total: number;
48
+ total_pages: number;
49
+ }
50
+
51
+ export interface ListAgentsOptions {
52
+ page?: number;
53
+ limit?: number;
54
+ }
55
+
37
56
  export interface RegisterResponse {
38
57
  agent_id: string;
39
58
  trust_score: number;
@@ -47,6 +66,13 @@ export interface ReviewResponse {
47
66
  error?: string;
48
67
  }
49
68
 
69
+ export class TrustRegistryOfflineError extends Error {
70
+ constructor(message = "Trust registry is temporarily offline") {
71
+ super(message);
72
+ this.name = "TrustRegistryOfflineError";
73
+ }
74
+ }
75
+
50
76
  export class TrustClient {
51
77
  private baseUrl: string;
52
78
 
@@ -54,11 +80,28 @@ export class TrustClient {
54
80
  this.baseUrl = baseUrl.replace(/\/$/, "");
55
81
  }
56
82
 
83
+ private async safeFetch(url: string, init?: RequestInit): Promise<Response> {
84
+ let res: Response;
85
+ try {
86
+ res = await fetch(url, init);
87
+ } catch (err: any) {
88
+ throw new TrustRegistryOfflineError(
89
+ `Registry unreachable: ${err.message || "network error"}`
90
+ );
91
+ }
92
+ if (res.status === 502 || res.status === 503 || res.status === 504) {
93
+ throw new TrustRegistryOfflineError(
94
+ `Registry returned ${res.status}`
95
+ );
96
+ }
97
+ return res;
98
+ }
99
+
57
100
  /**
58
101
  * Look up an agent's trust score
59
102
  */
60
103
  async lookup(agentId: string): Promise<{ agent: Agent; trust_score: TrustScore } | null> {
61
- const res = await fetch(`${this.baseUrl}/registry/trust/${agentId}`);
104
+ const res = await this.safeFetch(`${this.baseUrl}/v1/trust/${agentId}`);
62
105
  if (!res.ok) return null;
63
106
  return res.json();
64
107
  }
@@ -67,19 +110,62 @@ export class TrustClient {
67
110
  * Get an agent by ID
68
111
  */
69
112
  async getAgent(agentId: string): Promise<Agent | null> {
70
- const res = await fetch(`${this.baseUrl}/registry/agent/${agentId}`);
113
+ const res = await this.safeFetch(`${this.baseUrl}/registry/agent/${agentId}`);
71
114
  if (!res.ok) return null;
72
115
  return res.json();
73
116
  }
74
117
 
75
118
  /**
76
- * List all registered agents
119
+ * List registered agents (paginated)
77
120
  */
78
- async listAgents(): Promise<Agent[]> {
79
- const res = await fetch(`${this.baseUrl}/registry/agents`);
80
- if (!res.ok) return [];
121
+ async listAgents(options?: ListAgentsOptions): Promise<PaginatedAgents> {
122
+ const params = new URLSearchParams();
123
+ if (options?.page) params.set("page", String(options.page));
124
+ if (options?.limit) params.set("limit", String(options.limit));
125
+ const qs = params.toString();
126
+ const res = await this.safeFetch(`${this.baseUrl}/registry/agents${qs ? `?${qs}` : ""}`);
127
+ if (!res.ok) return { agents: [], page: 1, limit: 50, total: 0, total_pages: 0 };
81
128
  const data = await res.json();
82
- return data.agents || [];
129
+ return {
130
+ agents: data.agents || [],
131
+ page: data.page || 1,
132
+ limit: data.limit || 50,
133
+ total: data.total || 0,
134
+ total_pages: data.total_pages || 0,
135
+ };
136
+ }
137
+
138
+ /**
139
+ * Update an agent's fields (requires auth secret = contact value)
140
+ */
141
+ async updateAgent(
142
+ agentId: string,
143
+ updates: Partial<Pick<Agent, "description" | "capabilities" | "lightning_pubkey" | "x_handle" | "website" | "contact">>,
144
+ authSecret: string
145
+ ): Promise<{ success: boolean; message?: string; error?: string }> {
146
+ const res = await this.safeFetch(`${this.baseUrl}/registry/agent/${agentId}`, {
147
+ method: "PATCH",
148
+ headers: {
149
+ "Content-Type": "application/json",
150
+ "X-Agent-Secret": authSecret,
151
+ },
152
+ body: JSON.stringify(updates),
153
+ });
154
+ return res.json();
155
+ }
156
+
157
+ /**
158
+ * Soft-delete an agent (requires auth secret = contact value)
159
+ */
160
+ async deleteAgent(
161
+ agentId: string,
162
+ authSecret: string
163
+ ): Promise<{ success: boolean; message?: string; error?: string }> {
164
+ const res = await this.safeFetch(`${this.baseUrl}/registry/agent/${agentId}`, {
165
+ method: "DELETE",
166
+ headers: { "X-Agent-Secret": authSecret },
167
+ });
168
+ return res.json();
83
169
  }
84
170
 
85
171
  /**
@@ -97,11 +183,15 @@ export class TrustClient {
97
183
  website?: string;
98
184
  }
99
185
  ): Promise<RegisterResponse> {
100
- const res = await fetch(`${this.baseUrl}/register`, {
186
+ const res = await this.safeFetch(`${this.baseUrl}/register`, {
101
187
  method: "POST",
102
188
  headers: { "Content-Type": "application/json" },
103
189
  body: JSON.stringify({ name, contact, ...options }),
104
190
  });
191
+ if (!res.ok) {
192
+ const body = await res.json().catch(() => ({}));
193
+ throw new Error(body.error || `Registration failed (${res.status})`);
194
+ }
105
195
  return res.json();
106
196
  }
107
197
 
@@ -118,7 +208,7 @@ export class TrustClient {
118
208
  proof_of_payment?: string;
119
209
  }
120
210
  ): Promise<ReviewResponse> {
121
- const res = await fetch(`${this.baseUrl}/registry/review`, {
211
+ const res = await this.safeFetch(`${this.baseUrl}/registry/review`, {
122
212
  method: "POST",
123
213
  headers: { "Content-Type": "application/json" },
124
214
  body: JSON.stringify({
@@ -128,6 +218,10 @@ export class TrustClient {
128
218
  ...options,
129
219
  }),
130
220
  });
221
+ if (!res.ok) {
222
+ const body = await res.json().catch(() => ({}));
223
+ throw new Error(body.error || `Review failed (${res.status})`);
224
+ }
131
225
  return res.json();
132
226
  }
133
227
 
@@ -168,16 +262,19 @@ export const register = (name: string, contact: string, options?: Parameters<Tru
168
262
  trust.register(name, contact, options);
169
263
  export const review = (agentId: string, rating: number, comment: string, options?: Parameters<TrustClient["review"]>[3]) =>
170
264
  trust.review(agentId, rating, comment, options);
171
- export const listAgents = () => trust.listAgents();
265
+ export const listAgents = (options?: ListAgentsOptions) => trust.listAgents(options);
266
+ export const updateAgent = (agentId: string, updates: Parameters<TrustClient["updateAgent"]>[1], authSecret: string) =>
267
+ trust.updateAgent(agentId, updates, authSecret);
268
+ export const deleteAgent = (agentId: string, authSecret: string) => trust.deleteAgent(agentId, authSecret);
172
269
  export const isTrusted = (agentId: string) => trust.isTrusted(agentId);
173
270
  export const badgeUrl = (agentId: string) => trust.badgeUrl(agentId);
174
271
 
175
272
  /**
176
273
  * Auto-register helper for agents
177
- *
274
+ *
178
275
  * Ensures the calling agent is registered before making lookups.
179
276
  * Returns the agent ID for future reference.
180
- *
277
+ *
181
278
  * @example
182
279
  * const myId = await ensureRegistered({
183
280
  * name: "MyAgent",
@@ -192,16 +289,16 @@ export async function ensureRegistered(options: {
192
289
  lightning_pubkey?: string;
193
290
  description?: string;
194
291
  }): Promise<string> {
195
- // Check if already registered by name
196
- const agents = await trust.listAgents();
197
- const existing = agents.find(a => a.name.toLowerCase() === options.name.toLowerCase());
198
-
292
+ // Search by name instead of listing all agents
293
+ const result = await trust.listAgents({ limit: 50 });
294
+ const existing = result.agents.find(a => a.name.toLowerCase() === options.name.toLowerCase());
295
+
199
296
  if (existing) {
200
297
  return existing.id;
201
298
  }
202
-
299
+
203
300
  // Register new agent
204
- const result = await trust.register(
301
+ const regResult = await trust.register(
205
302
  options.name,
206
303
  options.contact || `sdk-auto-${Date.now()}`,
207
304
  {
@@ -210,15 +307,15 @@ export async function ensureRegistered(options: {
210
307
  lightning_pubkey: options.lightning_pubkey,
211
308
  }
212
309
  );
213
-
214
- return result.agent_id;
310
+
311
+ return regResult.agent_id;
215
312
  }
216
313
 
217
314
  /**
218
315
  * Check trust before transaction helper
219
- *
316
+ *
220
317
  * Returns detailed recommendation for whether to proceed.
221
- *
318
+ *
222
319
  * @example
223
320
  * const check = await checkBeforeTransaction("target-agent", 1000);
224
321
  * if (check.proceed) {
@@ -237,7 +334,7 @@ export async function checkBeforeTransaction(
237
334
  riskLevel: "low" | "medium" | "high" | "unknown";
238
335
  }> {
239
336
  const result = await trust.lookup(agentId);
240
-
337
+
241
338
  if (!result) {
242
339
  return {
243
340
  proceed: false,
@@ -246,13 +343,13 @@ export async function checkBeforeTransaction(
246
343
  riskLevel: "unknown",
247
344
  };
248
345
  }
249
-
346
+
250
347
  const score = result.trust_score.total;
251
348
  const tier = TrustClient.getTier(score);
252
-
349
+
253
350
  // High amounts require higher trust
254
351
  const requiredScore = amountSats > 10000 ? 60 : amountSats > 1000 ? 40 : 20;
255
-
352
+
256
353
  if (score >= requiredScore) {
257
354
  return {
258
355
  proceed: true,
@@ -261,7 +358,7 @@ export async function checkBeforeTransaction(
261
358
  riskLevel: tier.safe ? "low" : "medium",
262
359
  };
263
360
  }
264
-
361
+
265
362
  return {
266
363
  proceed: false,
267
364
  score,