@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.
@@ -1,7 +1,7 @@
1
- import { A as AuthSession, H as HealthResponse, U as UserCredentials, P as PasswordResetToken, a as UserPublicKeys, b as ProxyWriteRequest, c as ProxyWriteResponse, d as ProxyReadRequest, e as ProxyReadResponse, G as GoogleAuthSession } from '../client-fsiY-9VW.js';
2
- export { h as ApiResponse, C as ChangePasswordResponse, l as GoogleLoginResponse, k as GoogleSignupResponse, L as LoginResponse, i as PublicKeysResponse, R as RequestPasswordResetResponse, j as ResetPasswordResponse, S as SignupResponse, W as WalletClient, g as WalletClientConfig, f as WalletClientInterface } from '../client-fsiY-9VW.js';
3
- import { N as NodeProtocolInterface, S as Schema } from '../types-oQCx3U-_.js';
4
- import { S as ServerKeys, W as WalletServerCore } from '../core-BLTm0eu6.js';
1
+ import { A as AuthSession, H as HealthResponse, U as UserCredentials, S as SessionKeypair, P as PasswordResetToken, a as UserPublicKeys, b as ProxyWriteRequest, c as ProxyWriteResponse, d as ProxyReadRequest, e as ProxyReadResponse, f as ProxyReadMultiRequest, g as ProxyReadMultiResponse, G as GoogleAuthSession } from '../client-C4oQxiDu.js';
2
+ export { l as ApiResponse, C as ChangePasswordResponse, q as GoogleLoginResponse, p as GoogleSignupResponse, L as LoginResponse, k as ProxyReadMultiResultItem, n as PublicKeysResponse, R as RequestPasswordResetResponse, o as ResetPasswordResponse, m as SignupResponse, W as WalletClient, j as WalletClientConfig, i as WalletClientInterface, h as generateSessionKeypair } from '../client-C4oQxiDu.js';
3
+ import { N as NodeProtocolInterface, S as Schema } from '../types-uuvn4oKw.js';
4
+ import { S as ServerKeys, W as WalletServerCore } from '../core-ClnuubZw.js';
5
5
  import { MemoryClient } from '../clients/memory/mod.js';
6
6
  import 'hono';
7
7
 
@@ -107,8 +107,32 @@ declare class MemoryWalletClient {
107
107
  }>;
108
108
  signup(_credentials: UserCredentials): Promise<AuthSession>;
109
109
  login(_credentials: UserCredentials): Promise<AuthSession>;
110
- signupWithToken(appKey: string, tokenOrCredentials: string | UserCredentials, maybeCredentials?: UserCredentials): Promise<AuthSession>;
111
- loginWithTokenSession(appKey: string, tokenOrSession: string, sessionOrCredentials: string | UserCredentials, maybeCredentials?: UserCredentials): Promise<AuthSession>;
110
+ /**
111
+ * Sign up with session keypair (scoped to an app)
112
+ *
113
+ * The session must be approved by the app beforehand:
114
+ * 1. Client writes request to: immutable://inbox/{appKey}/sessions/{sessionPubkey} = 1
115
+ * 2. App approves by writing: mutable://accounts/{appKey}/sessions/{sessionPubkey} = 1
116
+ * 3. Client calls this method with the session keypair
117
+ *
118
+ * @param appKey - The app's public key
119
+ * @param session - Session keypair (generated via generateSessionKeypair)
120
+ * @param credentials - User credentials (username/password)
121
+ */
122
+ signupWithToken(appKey: string, session: SessionKeypair, credentials: UserCredentials): Promise<AuthSession>;
123
+ /**
124
+ * Login with session keypair (scoped to an app)
125
+ *
126
+ * The session must be approved by the app beforehand:
127
+ * 1. Client writes request to: immutable://inbox/{appKey}/sessions/{sessionPubkey} = 1
128
+ * 2. App approves by writing: mutable://accounts/{appKey}/sessions/{sessionPubkey} = 1
129
+ * 3. Client calls this method with the session keypair
130
+ *
131
+ * @param appKey - The app's public key
132
+ * @param session - Session keypair (generated via generateSessionKeypair)
133
+ * @param credentials - User credentials (username/password)
134
+ */
135
+ loginWithTokenSession(appKey: string, session: SessionKeypair, credentials: UserCredentials): Promise<AuthSession>;
112
136
  changePassword(appKey: string, oldPassword: string, newPassword: string): Promise<void>;
113
137
  requestPasswordReset(_username: string): Promise<PasswordResetToken>;
114
138
  resetPassword(_username: string, _resetToken: string, _newPassword: string): Promise<AuthSession>;
@@ -118,8 +142,21 @@ declare class MemoryWalletClient {
118
142
  getMyPublicKeys(appKey: string): Promise<UserPublicKeys>;
119
143
  proxyWrite(request: ProxyWriteRequest): Promise<ProxyWriteResponse>;
120
144
  proxyRead(request: ProxyReadRequest): Promise<ProxyReadResponse>;
145
+ proxyReadMulti(request: ProxyReadMultiRequest): Promise<ProxyReadMultiResponse>;
121
146
  signupWithGoogle(appKey: string, token: string, googleIdToken: string): Promise<GoogleAuthSession>;
122
- loginWithGoogle(appKey: string, token: string, session: string, googleIdToken: string): Promise<GoogleAuthSession>;
147
+ /**
148
+ * Login with Google OAuth (scoped to app token and session keypair)
149
+ * Returns session data with Google profile info - call setSession() to activate it
150
+ *
151
+ * The session must be approved by the app beforehand.
152
+ *
153
+ * @param appKey - The app's public key
154
+ * @param token - App token from app server
155
+ * @param session - Session keypair (generated via generateSessionKeypair)
156
+ * @param googleIdToken - Google ID token from Google Sign-In
157
+ * @returns GoogleAuthSession with username, JWT token, and Google profile info
158
+ */
159
+ loginWithGoogle(appKey: string, token: string, session: SessionKeypair, googleIdToken: string): Promise<GoogleAuthSession>;
123
160
  /**
124
161
  * Get the underlying WalletServerCore (for testing/inspection)
125
162
  */
@@ -197,28 +234,31 @@ interface TestEnvironment {
197
234
  serverKeys: ServerKeys;
198
235
  /**
199
236
  * Sign up a test user and set the session.
237
+ * Automatically generates and approves a session keypair for testing.
200
238
  *
201
239
  * @param appKey - App key for the signup
202
240
  * @param username - Username
203
241
  * @param password - Password
204
- * @returns Session and user public keys
242
+ * @returns Session, user public keys, and the session keypair used
205
243
  */
206
244
  signupTestUser(appKey: string, username: string, password: string): Promise<{
207
245
  session: AuthSession;
208
246
  keys: UserPublicKeys;
247
+ sessionKeypair: SessionKeypair;
209
248
  }>;
210
249
  /**
211
250
  * Login a test user and set the session.
251
+ * Automatically generates and approves a session keypair for testing.
212
252
  *
213
253
  * @param appKey - App key for the login
214
- * @param sessionKey - Session key (can be any string for tests)
215
254
  * @param username - Username
216
255
  * @param password - Password
217
- * @returns Session and user public keys
256
+ * @returns Session, user public keys, and the session keypair used
218
257
  */
219
- loginTestUser(appKey: string, sessionKey: string, username: string, password: string): Promise<{
258
+ loginTestUser(appKey: string, username: string, password: string): Promise<{
220
259
  session: AuthSession;
221
260
  keys: UserPublicKeys;
261
+ sessionKeypair: SessionKeypair;
222
262
  }>;
223
263
  /**
224
264
  * Clean up the test environment.
@@ -267,4 +307,4 @@ interface TestEnvironment {
267
307
  */
268
308
  declare function createTestEnvironment(config?: TestEnvironmentConfig): Promise<TestEnvironment>;
269
309
 
270
- export { AuthSession, GoogleAuthSession, HealthResponse, MemoryWalletClient, type MemoryWalletClientConfig, PasswordResetToken, ProxyReadRequest, ProxyReadResponse, ProxyWriteRequest, ProxyWriteResponse, type TestEnvironment, type TestEnvironmentConfig, UserCredentials, UserPublicKeys, createTestEnvironment, generateTestServerKeys };
310
+ export { AuthSession, GoogleAuthSession, HealthResponse, MemoryWalletClient, type MemoryWalletClientConfig, PasswordResetToken, ProxyReadMultiRequest, ProxyReadMultiResponse, ProxyReadRequest, ProxyReadResponse, ProxyWriteRequest, ProxyWriteResponse, SessionKeypair, type TestEnvironment, type TestEnvironmentConfig, UserCredentials, UserPublicKeys, createTestEnvironment, generateTestServerKeys };
@@ -2,16 +2,18 @@ import {
2
2
  MemoryWalletClient,
3
3
  WalletClient,
4
4
  createTestEnvironment,
5
+ generateSessionKeypair,
5
6
  generateTestServerKeys
6
- } from "../chunk-IILPY4TK.js";
7
- import "../chunk-OXHGNAQJ.js";
8
- import "../chunk-4C4YY2X7.js";
7
+ } from "../chunk-GWPCZVXV.js";
8
+ import "../chunk-B4VAPGAO.js";
9
9
  import "../chunk-JN75UL5C.js";
10
- import "../chunk-LFUC4ETD.js";
10
+ import "../chunk-OY4CDOHY.js";
11
+ import "../chunk-O53KW746.js";
11
12
  import "../chunk-MLKGABMK.js";
12
13
  export {
13
14
  MemoryWalletClient,
14
15
  WalletClient,
15
16
  createTestEnvironment,
17
+ generateSessionKeypair,
16
18
  generateTestServerKeys
17
19
  };
@@ -1,7 +1,7 @@
1
- import { F as FileStorage, S as ServerKeys, W as WalletServerCore } from '../../core-BLTm0eu6.js';
2
- export { C as BrowserEnvironment, M as BrowserMemoryStorage } from '../../core-BLTm0eu6.js';
1
+ import { F as FileStorage, S as ServerKeys, W as WalletServerCore } from '../../core-ClnuubZw.js';
2
+ export { C as BrowserEnvironment, M as BrowserMemoryStorage } from '../../core-ClnuubZw.js';
3
3
  import 'hono';
4
- import '../../types-oQCx3U-_.js';
4
+ import '../../types-uuvn4oKw.js';
5
5
 
6
6
  /**
7
7
  * Browser Adapter for Wallet Server
@@ -2,12 +2,12 @@ import {
2
2
  ConfigEnvironment,
3
3
  MemoryFileStorage,
4
4
  WalletServerCore
5
- } from "../../chunk-4C4YY2X7.js";
5
+ } from "../../chunk-B4VAPGAO.js";
6
6
  import "../../chunk-JN75UL5C.js";
7
- import "../../chunk-LFUC4ETD.js";
7
+ import "../../chunk-OY4CDOHY.js";
8
8
  import {
9
9
  LocalStorageClient
10
- } from "../../chunk-7U5JDFQW.js";
10
+ } from "../../chunk-PZFEKQ7F.js";
11
11
  import "../../chunk-MLKGABMK.js";
12
12
 
13
13
  // wallet-server/adapters/browser.ts
@@ -1,6 +1,6 @@
1
- import { P as ProxyWriteRequest, a as ProxyWriteResponse, b as ProxyReadResponse, U as UserKeys, L as Logger, H as HttpFetch } from '../core-BLTm0eu6.js';
2
- export { A as AppBackendConfig, f as AuthSessionResponse, C as ConfigEnvironment, E as Environment, F as FileStorage, h as HealthResponse, M as MemoryFileStorage, g as PublicKeysResponse, R as ResolvedWalletServerConfig, e as ServerKeyPair, S as ServerKeys, i as ServerKeysResponse, c as WalletServerConfig, W as WalletServerCore, d as WalletServerDeps, j as defaultLogger } from '../core-BLTm0eu6.js';
3
- import { N as NodeProtocolInterface } from '../types-oQCx3U-_.js';
1
+ import { P as ProxyWriteRequest, a as ProxyWriteResponse, b as ProxyReadResponse, U as UserKeys, L as Logger, H as HttpFetch } from '../core-ClnuubZw.js';
2
+ export { A as AppBackendConfig, f as AuthSessionResponse, C as ConfigEnvironment, E as Environment, F as FileStorage, h as HealthResponse, M as MemoryFileStorage, g as PublicKeysResponse, R as ResolvedWalletServerConfig, e as ServerKeyPair, S as ServerKeys, i as ServerKeysResponse, c as WalletServerConfig, W as WalletServerCore, d as WalletServerDeps, j as defaultLogger } from '../core-ClnuubZw.js';
3
+ import { N as NodeProtocolInterface } from '../types-uuvn4oKw.js';
4
4
  import { S as SignedEncryptedMessage, E as EncryptedPayload } from '../mod-CII9wqu2.js';
5
5
  import 'hono';
6
6
 
@@ -143,7 +143,7 @@ declare function createUser(client: NodeProtocolInterface, serverPublicKey: stri
143
143
  /**
144
144
  * Authenticate user with password
145
145
  */
146
- declare function authenticateUser(client: NodeProtocolInterface, serverPublicKey: string, username: string, password: string, serverIdentityPublicKeyHex: string, serverEncryptionPrivateKeyPem: string, appScope?: string, logger?: Logger): Promise<boolean>;
146
+ declare function authenticateUser(client: NodeProtocolInterface, serverPublicKey: string, username: string, password: string, serverEncryptionPrivateKeyPem: string, appScope?: string, logger?: Logger): Promise<boolean>;
147
147
  /**
148
148
  * Change user password
149
149
  */
@@ -193,7 +193,10 @@ interface CredentialResult {
193
193
  */
194
194
  interface BaseCredentialPayload {
195
195
  type: string;
196
- session?: string;
196
+ /** Session public key (hex). Required for login - identifies the session. */
197
+ sessionPubkey?: string;
198
+ /** Signature of the login payload by session private key (hex). Required for login. */
199
+ sessionSignature?: string;
197
200
  }
198
201
  /**
199
202
  * Password credential payload
@@ -34,9 +34,9 @@ import {
34
34
  userExists,
35
35
  verifyGoogleIdToken,
36
36
  verifyJwt
37
- } from "../chunk-4C4YY2X7.js";
37
+ } from "../chunk-B4VAPGAO.js";
38
38
  import "../chunk-JN75UL5C.js";
39
- import "../chunk-LFUC4ETD.js";
39
+ import "../chunk-OY4CDOHY.js";
40
40
  import "../chunk-MLKGABMK.js";
41
41
  export {
42
42
  ConfigEnvironment,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bandeira-tech/b3nd-web",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Browser-focused B3nd SDK bundle",
5
5
  "type": "module",
6
6
  "main": "./dist/src/mod.web.js",