@bandeira-tech/b3nd-web 0.3.0 → 0.3.1
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/{chunk-4C4YY2X7.js → chunk-B4VAPGAO.js} +191 -14
- package/dist/{chunk-IILPY4TK.js → chunk-GWPCZVXV.js} +198 -48
- package/dist/{chunk-OXHGNAQJ.js → chunk-O53KW746.js} +25 -1
- package/dist/{chunk-LFUC4ETD.js → chunk-OY4CDOHY.js} +45 -0
- package/dist/{chunk-7U5JDFQW.js → chunk-PZFEKQ7F.js} +24 -0
- package/dist/{chunk-T43IWAQK.js → chunk-UUHVOWVI.js} +29 -0
- package/dist/{client-fsiY-9VW.d.ts → client-C4oQxiDu.d.ts} +102 -11
- package/dist/clients/http/mod.d.ts +3 -1
- package/dist/clients/http/mod.js +1 -1
- package/dist/clients/local-storage/mod.d.ts +2 -1
- package/dist/clients/local-storage/mod.js +1 -1
- package/dist/clients/memory/mod.d.ts +2 -1
- package/dist/clients/memory/mod.js +1 -1
- package/dist/clients/websocket/mod.d.ts +2 -1
- package/dist/clients/websocket/mod.js +1 -1
- package/dist/{core-BLTm0eu6.d.ts → core-ClnuubZw.d.ts} +16 -1
- package/dist/src/mod.web.d.ts +2 -2
- package/dist/src/mod.web.js +8 -8
- package/dist/{types-oQCx3U-_.d.ts → types-uuvn4oKw.d.ts} +36 -2
- package/dist/wallet/mod.d.ts +52 -12
- package/dist/wallet/mod.js +6 -4
- package/dist/wallet-server/adapters/browser.d.ts +3 -3
- package/dist/wallet-server/adapters/browser.js +3 -3
- package/dist/wallet-server/mod.d.ts +8 -5
- package/dist/wallet-server/mod.js +2 -2
- package/package.json +1 -1
|
@@ -101,6 +101,30 @@ var MemoryClient = class {
|
|
|
101
101
|
record: current.value
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
|
+
async readMulti(uris) {
|
|
105
|
+
if (uris.length > 50) {
|
|
106
|
+
return {
|
|
107
|
+
success: false,
|
|
108
|
+
results: [],
|
|
109
|
+
summary: { total: uris.length, succeeded: 0, failed: uris.length }
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const results = await Promise.all(
|
|
113
|
+
uris.map(async (uri) => {
|
|
114
|
+
const result = await this.read(uri);
|
|
115
|
+
if (result.success && result.record) {
|
|
116
|
+
return { uri, success: true, record: result.record };
|
|
117
|
+
}
|
|
118
|
+
return { uri, success: false, error: result.error || "Read failed" };
|
|
119
|
+
})
|
|
120
|
+
);
|
|
121
|
+
const succeeded = results.filter((r) => r.success).length;
|
|
122
|
+
return {
|
|
123
|
+
success: succeeded > 0,
|
|
124
|
+
results,
|
|
125
|
+
summary: { total: uris.length, succeeded, failed: uris.length - succeeded }
|
|
126
|
+
};
|
|
127
|
+
}
|
|
104
128
|
list(uri, options) {
|
|
105
129
|
const result = target(uri, this.schema, this.storage);
|
|
106
130
|
if (!result.success) {
|
|
@@ -130,7 +154,7 @@ var MemoryClient = class {
|
|
|
130
154
|
});
|
|
131
155
|
}
|
|
132
156
|
let items = Array.from(current.children.entries()).map(([key, child]) => ({
|
|
133
|
-
uri: path.endsWith("/") ? `${program}
|
|
157
|
+
uri: path.endsWith("/") ? `${program}${path}${key}` : `${program}${path}/${key}`,
|
|
134
158
|
type: child.value ? "file" : "directory"
|
|
135
159
|
}));
|
|
136
160
|
if (options?.pattern) {
|
|
@@ -102,6 +102,51 @@ var HttpClient = class {
|
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
+
async readMulti(uris) {
|
|
106
|
+
if (uris.length > 50) {
|
|
107
|
+
return {
|
|
108
|
+
success: false,
|
|
109
|
+
results: [],
|
|
110
|
+
summary: { total: uris.length, succeeded: 0, failed: uris.length }
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
try {
|
|
114
|
+
const response = await this.request("/api/v1/read-multi", {
|
|
115
|
+
method: "POST",
|
|
116
|
+
body: JSON.stringify({ uris })
|
|
117
|
+
});
|
|
118
|
+
if (!response.ok) {
|
|
119
|
+
if (response.status === 404) {
|
|
120
|
+
return this.readMultiFallback(uris);
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
success: false,
|
|
124
|
+
results: uris.map((uri) => ({ uri, success: false, error: response.statusText })),
|
|
125
|
+
summary: { total: uris.length, succeeded: 0, failed: uris.length }
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
return await response.json();
|
|
129
|
+
} catch (error) {
|
|
130
|
+
return this.readMultiFallback(uris);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
async readMultiFallback(uris) {
|
|
134
|
+
const results = await Promise.all(
|
|
135
|
+
uris.map(async (uri) => {
|
|
136
|
+
const result = await this.read(uri);
|
|
137
|
+
if (result.success && result.record) {
|
|
138
|
+
return { uri, success: true, record: result.record };
|
|
139
|
+
}
|
|
140
|
+
return { uri, success: false, error: result.error || "Read failed" };
|
|
141
|
+
})
|
|
142
|
+
);
|
|
143
|
+
const succeeded = results.filter((r) => r.success).length;
|
|
144
|
+
return {
|
|
145
|
+
success: succeeded > 0,
|
|
146
|
+
results,
|
|
147
|
+
summary: { total: uris.length, succeeded, failed: uris.length - succeeded }
|
|
148
|
+
};
|
|
149
|
+
}
|
|
105
150
|
async list(uri, options) {
|
|
106
151
|
try {
|
|
107
152
|
const { protocol, domain, path } = this.parseUri(uri);
|
|
@@ -104,6 +104,30 @@ var LocalStorageClient = class {
|
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
+
async readMulti(uris) {
|
|
108
|
+
if (uris.length > 50) {
|
|
109
|
+
return {
|
|
110
|
+
success: false,
|
|
111
|
+
results: [],
|
|
112
|
+
summary: { total: uris.length, succeeded: 0, failed: uris.length }
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
const results = await Promise.all(
|
|
116
|
+
uris.map(async (uri) => {
|
|
117
|
+
const result = await this.read(uri);
|
|
118
|
+
if (result.success && result.record) {
|
|
119
|
+
return { uri, success: true, record: result.record };
|
|
120
|
+
}
|
|
121
|
+
return { uri, success: false, error: result.error || "Read failed" };
|
|
122
|
+
})
|
|
123
|
+
);
|
|
124
|
+
const succeeded = results.filter((r) => r.success).length;
|
|
125
|
+
return {
|
|
126
|
+
success: succeeded > 0,
|
|
127
|
+
results,
|
|
128
|
+
summary: { total: uris.length, succeeded, failed: uris.length - succeeded }
|
|
129
|
+
};
|
|
130
|
+
}
|
|
107
131
|
async list(uri, options) {
|
|
108
132
|
try {
|
|
109
133
|
const { page = 1, limit = 50, pattern, sortBy = "name", sortOrder = "asc" } = options || {};
|
|
@@ -195,6 +195,35 @@ var WebSocketClient = class {
|
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
+
async readMulti(uris) {
|
|
199
|
+
if (uris.length > 50) {
|
|
200
|
+
return {
|
|
201
|
+
success: false,
|
|
202
|
+
results: [],
|
|
203
|
+
summary: { total: uris.length, succeeded: 0, failed: uris.length }
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
try {
|
|
207
|
+
const result = await this.sendRequest("readMulti", { uris });
|
|
208
|
+
return result;
|
|
209
|
+
} catch {
|
|
210
|
+
const results = await Promise.all(
|
|
211
|
+
uris.map(async (uri) => {
|
|
212
|
+
const result = await this.read(uri);
|
|
213
|
+
if (result.success && result.record) {
|
|
214
|
+
return { uri, success: true, record: result.record };
|
|
215
|
+
}
|
|
216
|
+
return { uri, success: false, error: result.error || "Read failed" };
|
|
217
|
+
})
|
|
218
|
+
);
|
|
219
|
+
const succeeded = results.filter((r) => r.success).length;
|
|
220
|
+
return {
|
|
221
|
+
success: succeeded > 0,
|
|
222
|
+
results,
|
|
223
|
+
summary: { total: uris.length, succeeded, failed: uris.length - succeeded }
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
}
|
|
198
227
|
async list(uri, options) {
|
|
199
228
|
try {
|
|
200
229
|
const result = await this.sendRequest("list", { uri, options });
|
|
@@ -35,8 +35,16 @@ interface WalletClientInterface {
|
|
|
35
35
|
identityPublicKeyHex: string;
|
|
36
36
|
encryptionPublicKeyHex: string;
|
|
37
37
|
}>;
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Signup with session keypair.
|
|
40
|
+
* Session must be approved by app at mutable://accounts/{appKey}/sessions/{sessionPubkey} = 1
|
|
41
|
+
*/
|
|
42
|
+
signupWithToken(appKey: string, session: SessionKeypair, credentials: UserCredentials): Promise<AuthSession>;
|
|
43
|
+
/**
|
|
44
|
+
* Login with session keypair.
|
|
45
|
+
* Session must be approved by app at mutable://accounts/{appKey}/sessions/{sessionPubkey} = 1
|
|
46
|
+
*/
|
|
47
|
+
loginWithTokenSession(appKey: string, session: SessionKeypair, credentials: UserCredentials): Promise<AuthSession>;
|
|
40
48
|
changePassword(appKey: string, oldPassword: string, newPassword: string): Promise<void>;
|
|
41
49
|
requestPasswordResetWithToken(appKey: string, tokenOrUsername: string, maybeUsername?: string): Promise<PasswordResetToken>;
|
|
42
50
|
resetPasswordWithToken(appKey: string, tokenOrUsername: string, usernameOrReset: string, resetToken?: string, newPassword?: string): Promise<AuthSession>;
|
|
@@ -44,8 +52,9 @@ interface WalletClientInterface {
|
|
|
44
52
|
getMyPublicKeys(appKey: string): Promise<UserPublicKeys>;
|
|
45
53
|
proxyWrite(request: ProxyWriteRequest): Promise<ProxyWriteResponse>;
|
|
46
54
|
proxyRead(request: ProxyReadRequest): Promise<ProxyReadResponse>;
|
|
55
|
+
proxyReadMulti(request: ProxyReadMultiRequest): Promise<ProxyReadMultiResponse>;
|
|
47
56
|
signupWithGoogle(appKey: string, token: string, googleIdToken: string): Promise<GoogleAuthSession>;
|
|
48
|
-
loginWithGoogle(appKey: string, token: string, session:
|
|
57
|
+
loginWithGoogle(appKey: string, token: string, session: SessionKeypair, googleIdToken: string): Promise<GoogleAuthSession>;
|
|
49
58
|
}
|
|
50
59
|
/**
|
|
51
60
|
* Configuration for wallet client
|
|
@@ -71,6 +80,17 @@ interface UserCredentials {
|
|
|
71
80
|
username: string;
|
|
72
81
|
password: string;
|
|
73
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Session keypair for authentication
|
|
85
|
+
* Sessions are Ed25519 keypairs. The client creates the session, requests
|
|
86
|
+
* approval from the app, then uses the private key to sign login requests.
|
|
87
|
+
*/
|
|
88
|
+
interface SessionKeypair {
|
|
89
|
+
/** Session public key (hex encoded) - used as session identifier */
|
|
90
|
+
publicKeyHex: string;
|
|
91
|
+
/** Session private key (hex encoded) - used to sign login requests */
|
|
92
|
+
privateKeyHex: string;
|
|
93
|
+
}
|
|
74
94
|
/**
|
|
75
95
|
* Authenticated session with JWT token
|
|
76
96
|
*/
|
|
@@ -133,6 +153,38 @@ interface ProxyReadResponse {
|
|
|
133
153
|
decrypted?: unknown;
|
|
134
154
|
error?: string;
|
|
135
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Read-multi proxy request
|
|
158
|
+
*/
|
|
159
|
+
interface ProxyReadMultiRequest {
|
|
160
|
+
uris: string[];
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Read-multi proxy result item
|
|
164
|
+
*/
|
|
165
|
+
interface ProxyReadMultiResultItem {
|
|
166
|
+
uri: string;
|
|
167
|
+
success: boolean;
|
|
168
|
+
record?: {
|
|
169
|
+
data: unknown;
|
|
170
|
+
ts: number;
|
|
171
|
+
};
|
|
172
|
+
decrypted?: unknown;
|
|
173
|
+
error?: string;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Read-multi proxy response
|
|
177
|
+
*/
|
|
178
|
+
interface ProxyReadMultiResponse {
|
|
179
|
+
success: boolean;
|
|
180
|
+
results: ProxyReadMultiResultItem[];
|
|
181
|
+
summary: {
|
|
182
|
+
total: number;
|
|
183
|
+
succeeded: number;
|
|
184
|
+
failed: number;
|
|
185
|
+
};
|
|
186
|
+
error?: string;
|
|
187
|
+
}
|
|
136
188
|
/**
|
|
137
189
|
* API response wrapper
|
|
138
190
|
*/
|
|
@@ -327,13 +379,31 @@ declare class WalletClient {
|
|
|
327
379
|
*/
|
|
328
380
|
resetPassword(_username: string, _resetToken: string, _newPassword: string): Promise<AuthSession>;
|
|
329
381
|
/**
|
|
330
|
-
* Sign up with
|
|
382
|
+
* Sign up with session keypair (scoped to an app)
|
|
383
|
+
*
|
|
384
|
+
* The session must be approved by the app beforehand:
|
|
385
|
+
* 1. Client writes request to: immutable://inbox/{appKey}/sessions/{sessionPubkey} = 1
|
|
386
|
+
* 2. App approves by writing: mutable://accounts/{appKey}/sessions/{sessionPubkey} = 1
|
|
387
|
+
* 3. Client calls this method with the session keypair
|
|
388
|
+
*
|
|
389
|
+
* @param appKey - The app's public key
|
|
390
|
+
* @param session - Session keypair (generated via generateSessionKeypair)
|
|
391
|
+
* @param credentials - User credentials (username/password)
|
|
331
392
|
*/
|
|
332
|
-
signupWithToken(appKey: string,
|
|
393
|
+
signupWithToken(appKey: string, session: SessionKeypair, credentials: UserCredentials): Promise<AuthSession>;
|
|
333
394
|
/**
|
|
334
|
-
* Login with
|
|
395
|
+
* Login with session keypair (scoped to an app)
|
|
396
|
+
*
|
|
397
|
+
* The session must be approved by the app beforehand:
|
|
398
|
+
* 1. Client writes request to: immutable://inbox/{appKey}/sessions/{sessionPubkey} = 1
|
|
399
|
+
* 2. App approves by writing: mutable://accounts/{appKey}/sessions/{sessionPubkey} = 1
|
|
400
|
+
* 3. Client calls this method with the session keypair
|
|
401
|
+
*
|
|
402
|
+
* @param appKey - The app's public key
|
|
403
|
+
* @param session - Session keypair (generated via generateSessionKeypair)
|
|
404
|
+
* @param credentials - User credentials (username/password)
|
|
335
405
|
*/
|
|
336
|
-
loginWithTokenSession(appKey: string,
|
|
406
|
+
loginWithTokenSession(appKey: string, session: SessionKeypair, credentials: UserCredentials): Promise<AuthSession>;
|
|
337
407
|
/**
|
|
338
408
|
* Request password reset scoped to app token
|
|
339
409
|
*/
|
|
@@ -363,6 +433,15 @@ declare class WalletClient {
|
|
|
363
433
|
* @returns ProxyReadResponse - check `success` field for result, `decrypted` for decrypted data
|
|
364
434
|
*/
|
|
365
435
|
proxyRead(request: ProxyReadRequest): Promise<ProxyReadResponse>;
|
|
436
|
+
/**
|
|
437
|
+
* Proxy multiple read requests through the wallet server
|
|
438
|
+
* Reads multiple URIs in a single request (max 50 URIs)
|
|
439
|
+
* The server decrypts encrypted data using user's encryption key
|
|
440
|
+
* Requires active authentication session
|
|
441
|
+
*
|
|
442
|
+
* @returns ProxyReadMultiResponse - check `success` for overall result, `results` for per-URI results
|
|
443
|
+
*/
|
|
444
|
+
proxyReadMulti(request: ProxyReadMultiRequest): Promise<ProxyReadMultiResponse>;
|
|
366
445
|
/**
|
|
367
446
|
* Convenience method: Get current user's public keys
|
|
368
447
|
* Requires active authentication session
|
|
@@ -388,15 +467,27 @@ declare class WalletClient {
|
|
|
388
467
|
*/
|
|
389
468
|
signupWithGoogle(appKey: string, token: string, googleIdToken: string): Promise<GoogleAuthSession>;
|
|
390
469
|
/**
|
|
391
|
-
* Login with Google OAuth (scoped to app token and session)
|
|
470
|
+
* Login with Google OAuth (scoped to app token and session keypair)
|
|
392
471
|
* Returns session data with Google profile info - call setSession() to activate it
|
|
393
472
|
*
|
|
473
|
+
* The session must be approved by the app beforehand.
|
|
474
|
+
*
|
|
475
|
+
* @param appKey - The app's public key
|
|
394
476
|
* @param token - App token from app server
|
|
395
|
-
* @param session - Session
|
|
477
|
+
* @param session - Session keypair (generated via generateSessionKeypair)
|
|
396
478
|
* @param googleIdToken - Google ID token from Google Sign-In
|
|
397
479
|
* @returns GoogleAuthSession with username, JWT token, and Google profile info
|
|
398
480
|
*/
|
|
399
|
-
loginWithGoogle(appKey: string, token: string, session:
|
|
481
|
+
loginWithGoogle(appKey: string, token: string, session: SessionKeypair, googleIdToken: string): Promise<GoogleAuthSession>;
|
|
400
482
|
}
|
|
483
|
+
/**
|
|
484
|
+
* Generate a new session keypair for authentication
|
|
485
|
+
* The public key should be registered with the app before login.
|
|
486
|
+
*
|
|
487
|
+
* Uses SDK crypto for consistent key generation across the codebase.
|
|
488
|
+
*
|
|
489
|
+
* @returns SessionKeypair with publicKeyHex and privateKeyHex
|
|
490
|
+
*/
|
|
491
|
+
declare function generateSessionKeypair(): Promise<SessionKeypair>;
|
|
401
492
|
|
|
402
|
-
export { type AuthSession as A, type ChangePasswordResponse as C, type GoogleAuthSession as G, type HealthResponse as H, type LoginResponse as L, type PasswordResetToken as P, type RequestPasswordResetResponse as R, type
|
|
493
|
+
export { type AuthSession as A, type ChangePasswordResponse as C, type GoogleAuthSession as G, type HealthResponse as H, type LoginResponse as L, type PasswordResetToken as P, type RequestPasswordResetResponse as R, type SessionKeypair as S, type UserCredentials as U, WalletClient as W, type UserPublicKeys as a, type ProxyWriteRequest as b, type ProxyWriteResponse as c, type ProxyReadRequest as d, type ProxyReadResponse as e, type ProxyReadMultiRequest as f, type ProxyReadMultiResponse as g, generateSessionKeypair as h, type WalletClientInterface as i, type WalletClientConfig as j, type ProxyReadMultiResultItem as k, type ApiResponse as l, type SignupResponse as m, type PublicKeysResponse as n, type ResetPasswordResponse as o, type GoogleSignupResponse as p, type GoogleLoginResponse as q };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as NodeProtocolInterface, a as HttpClientConfig, g as WriteResult, R as ReadResult, b as ListOptions, c as ListResult, D as DeleteResult, H as HealthStatus } from '../../types-
|
|
1
|
+
import { N as NodeProtocolInterface, a as HttpClientConfig, g as WriteResult, R as ReadResult, h as ReadMultiResult, b as ListOptions, c as ListResult, D as DeleteResult, H as HealthStatus } from '../../types-uuvn4oKw.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* HttpClient - HTTP implementation of NodeProtocolInterface
|
|
@@ -23,6 +23,8 @@ declare class HttpClient implements NodeProtocolInterface {
|
|
|
23
23
|
private parseUri;
|
|
24
24
|
write<T = unknown>(uri: string, value: T): Promise<WriteResult<T>>;
|
|
25
25
|
read<T = unknown>(uri: string): Promise<ReadResult<T>>;
|
|
26
|
+
readMulti<T = unknown>(uris: string[]): Promise<ReadMultiResult<T>>;
|
|
27
|
+
private readMultiFallback;
|
|
26
28
|
list(uri: string, options?: ListOptions): Promise<ListResult>;
|
|
27
29
|
delete(uri: string): Promise<DeleteResult>;
|
|
28
30
|
health(): Promise<HealthStatus>;
|
package/dist/clients/http/mod.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as NodeProtocolInterface, d as LocalStorageClientConfig, g as WriteResult, R as ReadResult, b as ListOptions, c as ListResult, D as DeleteResult, H as HealthStatus } from '../../types-
|
|
1
|
+
import { N as NodeProtocolInterface, d as LocalStorageClientConfig, g as WriteResult, R as ReadResult, h as ReadMultiResult, b as ListOptions, c as ListResult, D as DeleteResult, H as HealthStatus } from '../../types-uuvn4oKw.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* LocalStorageClient - Browser localStorage implementation of NodeProtocolInterface
|
|
@@ -34,6 +34,7 @@ declare class LocalStorageClient implements NodeProtocolInterface {
|
|
|
34
34
|
private deserialize;
|
|
35
35
|
write<T = unknown>(uri: string, value: T): Promise<WriteResult<T>>;
|
|
36
36
|
read<T = unknown>(uri: string): Promise<ReadResult<T>>;
|
|
37
|
+
readMulti<T = unknown>(uris: string[]): Promise<ReadMultiResult<T>>;
|
|
37
38
|
list(uri: string, options?: ListOptions): Promise<ListResult>;
|
|
38
39
|
/**
|
|
39
40
|
* Check if a URI has children (is a directory)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as NodeProtocolInterface, S as Schema, g as WriteResult, R as ReadResult, b as ListOptions, c as ListResult, H as HealthStatus, D as DeleteResult } from '../../types-
|
|
1
|
+
import { N as NodeProtocolInterface, S as Schema, g as WriteResult, R as ReadResult, h as ReadMultiResult, b as ListOptions, c as ListResult, H as HealthStatus, D as DeleteResult } from '../../types-uuvn4oKw.js';
|
|
2
2
|
|
|
3
3
|
type MemoryClientStorageNode<T> = {
|
|
4
4
|
value?: T;
|
|
@@ -36,6 +36,7 @@ declare class MemoryClient implements NodeProtocolInterface {
|
|
|
36
36
|
constructor(config: MemoryClientConfig);
|
|
37
37
|
write<T = unknown>(uri: string, payload: T): Promise<WriteResult<T>>;
|
|
38
38
|
read<T>(uri: string): Promise<ReadResult<T>>;
|
|
39
|
+
readMulti<T = unknown>(uris: string[]): Promise<ReadMultiResult<T>>;
|
|
39
40
|
list(uri: string, options?: ListOptions): Promise<ListResult>;
|
|
40
41
|
health(): Promise<HealthStatus>;
|
|
41
42
|
getSchema(): Promise<string[]>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as NodeProtocolInterface, W as WebSocketClientConfig, g as WriteResult, R as ReadResult, b as ListOptions, c as ListResult, D as DeleteResult, H as HealthStatus } from '../../types-
|
|
1
|
+
import { N as NodeProtocolInterface, W as WebSocketClientConfig, g as WriteResult, R as ReadResult, h as ReadMultiResult, b as ListOptions, c as ListResult, D as DeleteResult, H as HealthStatus } from '../../types-uuvn4oKw.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* WebSocketClient - WebSocket implementation of NodeProtocolInterface
|
|
@@ -52,6 +52,7 @@ declare class WebSocketClient implements NodeProtocolInterface {
|
|
|
52
52
|
private sendRequest;
|
|
53
53
|
write<T = unknown>(uri: string, value: T): Promise<WriteResult<T>>;
|
|
54
54
|
read<T = unknown>(uri: string): Promise<ReadResult<T>>;
|
|
55
|
+
readMulti<T = unknown>(uris: string[]): Promise<ReadMultiResult<T>>;
|
|
55
56
|
list(uri: string, options?: ListOptions): Promise<ListResult>;
|
|
56
57
|
delete(uri: string): Promise<DeleteResult>;
|
|
57
58
|
health(): Promise<HealthStatus>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
|
-
import { N as NodeProtocolInterface } from './types-
|
|
2
|
+
import { N as NodeProtocolInterface } from './types-uuvn4oKw.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Wallet Server Dependency Injection Interfaces
|
|
@@ -269,7 +269,22 @@ declare class WalletServerCore {
|
|
|
269
269
|
private normalizeApiBasePath;
|
|
270
270
|
private readBootstrapState;
|
|
271
271
|
private writeBootstrapState;
|
|
272
|
+
/**
|
|
273
|
+
* Validate that a session is approved by the app.
|
|
274
|
+
* Sessions are keypairs - the sessionPubkey is used directly as the identifier.
|
|
275
|
+
* App approves sessions by writing 1 to mutable://accounts/{appKey}/sessions/{sessionPubkey}
|
|
276
|
+
*
|
|
277
|
+
* @param appKey - The app's public key
|
|
278
|
+
* @param sessionPubkey - The session's public key (hex encoded)
|
|
279
|
+
* @returns { valid: true } if approved, { valid: false, reason } if not
|
|
280
|
+
*/
|
|
272
281
|
private sessionExists;
|
|
282
|
+
/**
|
|
283
|
+
* Verify that a login request signature is valid for the given session pubkey.
|
|
284
|
+
* The signature should be over the stringified login payload (without the signature field).
|
|
285
|
+
* Uses SDK crypto for consistent verification across the codebase.
|
|
286
|
+
*/
|
|
287
|
+
private verifySessionSignature;
|
|
273
288
|
private createApp;
|
|
274
289
|
}
|
|
275
290
|
|
package/dist/src/mod.web.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { C as ClientError, D as DeleteResult, H as HealthStatus, a as HttpClientConfig, L as ListItem, b as ListOptions, c as ListResult, d as LocalStorageClientConfig, N as NodeProtocolInterface, P as PersistenceRecord, R as ReadResult, S as Schema, V as ValidationFn, W as WebSocketClientConfig, e as WebSocketRequest, f as WebSocketResponse, g as WriteResult } from '../types-
|
|
1
|
+
export { C as ClientError, D as DeleteResult, H as HealthStatus, a as HttpClientConfig, L as ListItem, b as ListOptions, c as ListResult, d as LocalStorageClientConfig, N as NodeProtocolInterface, P as PersistenceRecord, R as ReadResult, S as Schema, V as ValidationFn, W as WebSocketClientConfig, e as WebSocketRequest, f as WebSocketResponse, g as WriteResult } from '../types-uuvn4oKw.js';
|
|
2
2
|
export { HttpClient } from '../clients/http/mod.js';
|
|
3
3
|
export { WebSocketClient } from '../clients/websocket/mod.js';
|
|
4
4
|
export { LocalStorageClient } from '../clients/local-storage/mod.js';
|
|
5
|
-
export { W as WalletClient } from '../client-
|
|
5
|
+
export { W as WalletClient } from '../client-C4oQxiDu.js';
|
|
6
6
|
export { AppsClient } from '../apps/mod.js';
|
|
7
7
|
export { m as encrypt } from '../mod-CII9wqu2.js';
|
package/dist/src/mod.web.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WebSocketClient
|
|
3
|
+
} from "../chunk-UUHVOWVI.js";
|
|
1
4
|
import {
|
|
2
5
|
AppsClient
|
|
3
6
|
} from "../chunk-VAZUCGED.js";
|
|
4
7
|
import {
|
|
5
8
|
WalletClient
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-4C4YY2X7.js";
|
|
9
|
+
} from "../chunk-GWPCZVXV.js";
|
|
10
|
+
import "../chunk-B4VAPGAO.js";
|
|
9
11
|
import {
|
|
10
12
|
mod_exports
|
|
11
13
|
} from "../chunk-JN75UL5C.js";
|
|
12
14
|
import {
|
|
13
15
|
HttpClient
|
|
14
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-OY4CDOHY.js";
|
|
15
17
|
import {
|
|
16
18
|
LocalStorageClient
|
|
17
|
-
} from "../chunk-
|
|
18
|
-
import
|
|
19
|
-
WebSocketClient
|
|
20
|
-
} from "../chunk-T43IWAQK.js";
|
|
19
|
+
} from "../chunk-PZFEKQ7F.js";
|
|
20
|
+
import "../chunk-O53KW746.js";
|
|
21
21
|
import "../chunk-MLKGABMK.js";
|
|
22
22
|
export {
|
|
23
23
|
AppsClient,
|
|
@@ -25,6 +25,33 @@ interface ReadResult<T> {
|
|
|
25
25
|
record?: PersistenceRecord<T>;
|
|
26
26
|
error?: string;
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Result for a single URI in a multi-read operation
|
|
30
|
+
*/
|
|
31
|
+
type ReadMultiResultItem<T = unknown> = {
|
|
32
|
+
uri: string;
|
|
33
|
+
success: true;
|
|
34
|
+
record: PersistenceRecord<T>;
|
|
35
|
+
} | {
|
|
36
|
+
uri: string;
|
|
37
|
+
success: false;
|
|
38
|
+
error: string;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Result of reading multiple URIs in a single operation
|
|
42
|
+
*/
|
|
43
|
+
interface ReadMultiResult<T = unknown> {
|
|
44
|
+
/** true if at least one read succeeded */
|
|
45
|
+
success: boolean;
|
|
46
|
+
/** Per-URI results */
|
|
47
|
+
results: ReadMultiResultItem<T>[];
|
|
48
|
+
/** Summary statistics */
|
|
49
|
+
summary: {
|
|
50
|
+
total: number;
|
|
51
|
+
succeeded: number;
|
|
52
|
+
failed: number;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
28
55
|
/**
|
|
29
56
|
* Result of a delete operation
|
|
30
57
|
*/
|
|
@@ -109,6 +136,13 @@ interface NodeProtocolWriteInterface {
|
|
|
109
136
|
interface NodeProtocolReadInterface {
|
|
110
137
|
/** Read data from a URI */
|
|
111
138
|
read<T = unknown>(uri: string): Promise<ReadResult<T>>;
|
|
139
|
+
/**
|
|
140
|
+
* Read multiple URIs in a single operation.
|
|
141
|
+
* Implementations may optimize for batch reads (e.g., SQL IN clause).
|
|
142
|
+
* @param uris - Array of URIs to read (max 50)
|
|
143
|
+
* @returns ReadMultiResult with per-URI results and summary
|
|
144
|
+
*/
|
|
145
|
+
readMulti<T = unknown>(uris: string[]): Promise<ReadMultiResult<T>>;
|
|
112
146
|
/** List items at a URI path */
|
|
113
147
|
list(uri: string, options?: ListOptions): Promise<ListResult>;
|
|
114
148
|
/** Health status */
|
|
@@ -206,7 +240,7 @@ declare class ClientError extends Error {
|
|
|
206
240
|
*/
|
|
207
241
|
interface WebSocketRequest {
|
|
208
242
|
id: string;
|
|
209
|
-
type: "write" | "read" | "list" | "delete" | "health" | "getSchema";
|
|
243
|
+
type: "write" | "read" | "readMulti" | "list" | "delete" | "health" | "getSchema";
|
|
210
244
|
payload: unknown;
|
|
211
245
|
}
|
|
212
246
|
interface WebSocketResponse {
|
|
@@ -216,4 +250,4 @@ interface WebSocketResponse {
|
|
|
216
250
|
error?: string;
|
|
217
251
|
}
|
|
218
252
|
|
|
219
|
-
export { ClientError as C, type DeleteResult as D, type HealthStatus as H, type ListItem as L, type NodeProtocolInterface as N, type PersistenceRecord as P, type ReadResult as R, type Schema as S, type ValidationFn as V, type WebSocketClientConfig as W, type HttpClientConfig as a, type ListOptions as b, type ListResult as c, type LocalStorageClientConfig as d, type WebSocketRequest as e, type WebSocketResponse as f, type WriteResult as g };
|
|
253
|
+
export { ClientError as C, type DeleteResult as D, type HealthStatus as H, type ListItem as L, type NodeProtocolInterface as N, type PersistenceRecord as P, type ReadResult as R, type Schema as S, type ValidationFn as V, type WebSocketClientConfig as W, type HttpClientConfig as a, type ListOptions as b, type ListResult as c, type LocalStorageClientConfig as d, type WebSocketRequest as e, type WebSocketResponse as f, type WriteResult as g, type ReadMultiResult as h };
|