@bandeira-tech/b3nd-web 0.2.2 → 0.2.3
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.
|
@@ -267,6 +267,31 @@ var WalletClient = class {
|
|
|
267
267
|
}
|
|
268
268
|
return data;
|
|
269
269
|
}
|
|
270
|
+
/**
|
|
271
|
+
* Proxy a read request through the wallet server
|
|
272
|
+
* The server decrypts encrypted data using user's encryption key
|
|
273
|
+
* Requires active authentication session
|
|
274
|
+
*/
|
|
275
|
+
async proxyRead(request) {
|
|
276
|
+
if (!this.currentSession) {
|
|
277
|
+
throw new Error("Not authenticated. Please login first.");
|
|
278
|
+
}
|
|
279
|
+
const url = new URL(`${this.walletServerUrl}${this.apiBasePath}/proxy/read`);
|
|
280
|
+
url.searchParams.set("uri", request.uri);
|
|
281
|
+
const response = await this.fetchImpl(url.toString(), {
|
|
282
|
+
method: "GET",
|
|
283
|
+
headers: {
|
|
284
|
+
Authorization: `Bearer ${this.currentSession.token}`
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
const data = await response.json();
|
|
288
|
+
if (!response.ok || !data.success) {
|
|
289
|
+
throw new Error(
|
|
290
|
+
data.error || `Proxy read failed: ${response.statusText}`
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
return data;
|
|
294
|
+
}
|
|
270
295
|
/**
|
|
271
296
|
* Convenience method: Get current user's public keys
|
|
272
297
|
* Requires active authentication session
|
package/dist/src/mod.web.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AppsClient
|
|
3
|
-
} from "../chunk-VAZUCGED.js";
|
|
4
1
|
import {
|
|
5
2
|
mod_exports
|
|
6
3
|
} from "../chunk-K3ZSSVHR.js";
|
|
7
4
|
import {
|
|
8
5
|
WalletClient
|
|
9
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-S7NJA6B6.js";
|
|
10
7
|
import {
|
|
11
8
|
HttpClient
|
|
12
9
|
} from "../chunk-LFUC4ETD.js";
|
|
@@ -16,6 +13,9 @@ import {
|
|
|
16
13
|
import {
|
|
17
14
|
WebSocketClient
|
|
18
15
|
} from "../chunk-T43IWAQK.js";
|
|
16
|
+
import {
|
|
17
|
+
AppsClient
|
|
18
|
+
} from "../chunk-VAZUCGED.js";
|
|
19
19
|
import "../chunk-MLKGABMK.js";
|
|
20
20
|
export {
|
|
21
21
|
AppsClient,
|
package/dist/wallet/mod.d.ts
CHANGED
|
@@ -70,6 +70,25 @@ interface ProxyWriteResponse {
|
|
|
70
70
|
ts: number;
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Read proxy request
|
|
75
|
+
*/
|
|
76
|
+
interface ProxyReadRequest {
|
|
77
|
+
uri: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Read proxy response
|
|
81
|
+
*/
|
|
82
|
+
interface ProxyReadResponse {
|
|
83
|
+
success: boolean;
|
|
84
|
+
uri: string;
|
|
85
|
+
record?: {
|
|
86
|
+
data: unknown;
|
|
87
|
+
ts: number;
|
|
88
|
+
};
|
|
89
|
+
decrypted?: unknown;
|
|
90
|
+
error?: string;
|
|
91
|
+
}
|
|
73
92
|
/**
|
|
74
93
|
* API response wrapper
|
|
75
94
|
*/
|
|
@@ -290,6 +309,12 @@ declare class WalletClient {
|
|
|
290
309
|
* Requires active authentication session
|
|
291
310
|
*/
|
|
292
311
|
proxyWrite(request: ProxyWriteRequest): Promise<ProxyWriteResponse>;
|
|
312
|
+
/**
|
|
313
|
+
* Proxy a read request through the wallet server
|
|
314
|
+
* The server decrypts encrypted data using user's encryption key
|
|
315
|
+
* Requires active authentication session
|
|
316
|
+
*/
|
|
317
|
+
proxyRead(request: ProxyReadRequest): Promise<ProxyReadResponse>;
|
|
293
318
|
/**
|
|
294
319
|
* Convenience method: Get current user's public keys
|
|
295
320
|
* Requires active authentication session
|
|
@@ -326,4 +351,4 @@ declare class WalletClient {
|
|
|
326
351
|
loginWithGoogle(appKey: string, token: string, session: string, googleIdToken: string): Promise<GoogleAuthSession>;
|
|
327
352
|
}
|
|
328
353
|
|
|
329
|
-
export { type ApiResponse, type AuthSession, type ChangePasswordResponse, type GoogleAuthSession, type GoogleLoginResponse, type GoogleSignupResponse, type HealthResponse, type LoginResponse, type PasswordResetToken, type ProxyWriteRequest, type ProxyWriteResponse, type PublicKeysResponse, type RequestPasswordResetResponse, type ResetPasswordResponse, type SignupResponse, type UserCredentials, type UserPublicKeys, WalletClient, type WalletClientConfig };
|
|
354
|
+
export { type ApiResponse, type AuthSession, type ChangePasswordResponse, type GoogleAuthSession, type GoogleLoginResponse, type GoogleSignupResponse, type HealthResponse, type LoginResponse, type PasswordResetToken, type ProxyReadRequest, type ProxyReadResponse, type ProxyWriteRequest, type ProxyWriteResponse, type PublicKeysResponse, type RequestPasswordResetResponse, type ResetPasswordResponse, type SignupResponse, type UserCredentials, type UserPublicKeys, WalletClient, type WalletClientConfig };
|
package/dist/wallet/mod.js
CHANGED