@bandeira-tech/b3nd-web 0.4.0 → 0.5.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.
@@ -48,9 +48,15 @@ var HttpClient = class {
48
48
  try {
49
49
  const { protocol, domain, path } = this.parseUri(uri);
50
50
  const requestPath = `/api/v1/write/${protocol}/${domain}${path}`;
51
+ const isBinary = value instanceof Uint8Array;
52
+ const body = isBinary ? value : JSON.stringify({ value });
53
+ const contentType = isBinary ? "application/octet-stream" : "application/json";
51
54
  const response = await this.request(requestPath, {
52
55
  method: "POST",
53
- body: JSON.stringify({ value })
56
+ body,
57
+ headers: {
58
+ "Content-Type": contentType
59
+ }
54
60
  });
55
61
  const result = await response.json();
56
62
  if (!response.ok) {
@@ -90,6 +96,16 @@ var HttpClient = class {
90
96
  error: `Read failed: ${response.statusText}`
91
97
  };
92
98
  }
99
+ const contentType = response.headers.get("Content-Type") || "";
100
+ const isBinary = contentType === "application/octet-stream" || contentType.startsWith("image/") || contentType.startsWith("audio/") || contentType.startsWith("video/") || contentType.startsWith("font/") || contentType === "application/wasm";
101
+ if (isBinary) {
102
+ const buffer = await response.arrayBuffer();
103
+ const data = new Uint8Array(buffer);
104
+ return {
105
+ success: true,
106
+ record: { data, ts: Date.now() }
107
+ };
108
+ }
93
109
  const result = await response.json();
94
110
  return {
95
111
  success: true,
@@ -1,6 +1,3 @@
1
- import {
2
- HttpClient
3
- } from "./chunk-OY4CDOHY.js";
4
1
  import {
5
2
  createAuthenticatedMessage,
6
3
  createSignedEncryptedMessage,
@@ -8,9 +5,11 @@ import {
8
5
  decrypt,
9
6
  encodeHex,
10
7
  encrypt,
11
- verify,
12
8
  verifyPayload
13
9
  } from "./chunk-JN75UL5C.js";
10
+ import {
11
+ HttpClient
12
+ } from "./chunk-32YBATXQ.js";
14
13
 
15
14
  // wallet-server/interfaces.ts
16
15
  var defaultLogger = {
@@ -1417,20 +1416,6 @@ var WalletServerCore = class {
1417
1416
  }
1418
1417
  return { valid: false, reason: "invalid_session_status" };
1419
1418
  }
1420
- /**
1421
- * Verify that a login request signature is valid for the given session pubkey.
1422
- * The signature should be over the stringified login payload (without the signature field).
1423
- * Uses SDK crypto for consistent verification across the codebase.
1424
- */
1425
- async verifySessionSignature(sessionPubkey, signature, payload) {
1426
- try {
1427
- const { sessionSignature: _, ...signedPayload } = payload;
1428
- return await verify(sessionPubkey, signature, signedPayload);
1429
- } catch (error) {
1430
- this.logger.error("Session signature verification failed:", error);
1431
- return false;
1432
- }
1433
- }
1434
1419
  createApp() {
1435
1420
  const app = new Hono();
1436
1421
  const serverPublicKey = this.serverKeys.identityKey.publicKeyHex;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  WalletServerCore
3
- } from "./chunk-RW4GWQIG.js";
3
+ } from "./chunk-7PZMJECC.js";
4
4
  import {
5
5
  createAuthenticatedMessageWithHex,
6
6
  exportPrivateKeyPem,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  HttpClient
3
- } from "../../chunk-OY4CDOHY.js";
3
+ } from "../../chunk-32YBATXQ.js";
4
4
  import "../../chunk-MLKGABMK.js";
5
5
  export {
6
6
  HttpClient
@@ -279,12 +279,6 @@ declare class WalletServerCore {
279
279
  * @returns { valid: true } if approved, { valid: false, reason } if not
280
280
  */
281
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;
288
282
  private createApp;
289
283
  }
290
284
 
@@ -1,23 +1,23 @@
1
1
  import {
2
- WalletClient
3
- } from "../chunk-45DWSOND.js";
4
- import "../chunk-RW4GWQIG.js";
2
+ WebSocketClient
3
+ } from "../chunk-UUHVOWVI.js";
5
4
  import {
6
- HttpClient
7
- } from "../chunk-OY4CDOHY.js";
5
+ AppsClient
6
+ } from "../chunk-VAZUCGED.js";
7
+ import {
8
+ WalletClient
9
+ } from "../chunk-PYCSO5U6.js";
10
+ import "../chunk-7PZMJECC.js";
8
11
  import {
9
12
  mod_exports
10
13
  } from "../chunk-JN75UL5C.js";
11
14
  import {
12
- AppsClient
13
- } from "../chunk-VAZUCGED.js";
14
- import {
15
- WebSocketClient
16
- } from "../chunk-UUHVOWVI.js";
17
- import "../chunk-O53KW746.js";
15
+ HttpClient
16
+ } from "../chunk-32YBATXQ.js";
18
17
  import {
19
18
  LocalStorageClient
20
19
  } from "../chunk-PZFEKQ7F.js";
20
+ import "../chunk-O53KW746.js";
21
21
  import "../chunk-MLKGABMK.js";
22
22
  export {
23
23
  AppsClient,
@@ -1,7 +1,7 @@
1
1
  import { A as AuthSession, H as HealthResponse, S as SessionKeypair, U as UserCredentials, P as PasswordResetToken, a as UserPublicKeys, b as ProxyWriteRequest, c as ProxyWriteResponse, d as ProxyReadRequest, e as ProxyReadResponse, f as ProxyReadMultiRequest, g as ProxyReadMultiResponse } from '../client-DHCiJ9I7.js';
2
2
  export { l as ApiResponse, C as ChangePasswordResponse, G as GoogleAuthSession, 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-DHCiJ9I7.js';
3
3
  import { N as NodeProtocolInterface, S as Schema } from '../types-uuvn4oKw.js';
4
- import { S as ServerKeys, W as WalletServerCore } from '../core-ClnuubZw.js';
4
+ import { S as ServerKeys, W as WalletServerCore } from '../core-BGUpkKnP.js';
5
5
  import { MemoryClient } from '../clients/memory/mod.js';
6
6
  import 'hono';
7
7
 
@@ -4,10 +4,10 @@ import {
4
4
  createTestEnvironment,
5
5
  generateSessionKeypair,
6
6
  generateTestServerKeys
7
- } from "../chunk-45DWSOND.js";
8
- import "../chunk-RW4GWQIG.js";
9
- import "../chunk-OY4CDOHY.js";
7
+ } from "../chunk-PYCSO5U6.js";
8
+ import "../chunk-7PZMJECC.js";
10
9
  import "../chunk-JN75UL5C.js";
10
+ import "../chunk-32YBATXQ.js";
11
11
  import "../chunk-O53KW746.js";
12
12
  import "../chunk-MLKGABMK.js";
13
13
  export {
@@ -1,5 +1,5 @@
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';
1
+ import { F as FileStorage, S as ServerKeys, W as WalletServerCore } from '../../core-BGUpkKnP.js';
2
+ export { C as BrowserEnvironment, M as BrowserMemoryStorage } from '../../core-BGUpkKnP.js';
3
3
  import 'hono';
4
4
  import '../../types-uuvn4oKw.js';
5
5
 
@@ -2,9 +2,9 @@ import {
2
2
  ConfigEnvironment,
3
3
  MemoryFileStorage,
4
4
  WalletServerCore
5
- } from "../../chunk-RW4GWQIG.js";
6
- import "../../chunk-OY4CDOHY.js";
5
+ } from "../../chunk-7PZMJECC.js";
7
6
  import "../../chunk-JN75UL5C.js";
7
+ import "../../chunk-32YBATXQ.js";
8
8
  import {
9
9
  LocalStorageClient
10
10
  } from "../../chunk-PZFEKQ7F.js";
@@ -1,5 +1,5 @@
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';
1
+ import { P as ProxyWriteRequest, a as ProxyWriteResponse, b as ProxyReadResponse, U as UserKeys, L as Logger, H as HttpFetch } from '../core-BGUpkKnP.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-BGUpkKnP.js';
3
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';
@@ -34,9 +34,9 @@ import {
34
34
  userExists,
35
35
  verifyGoogleIdToken,
36
36
  verifyJwt
37
- } from "../chunk-RW4GWQIG.js";
38
- import "../chunk-OY4CDOHY.js";
37
+ } from "../chunk-7PZMJECC.js";
39
38
  import "../chunk-JN75UL5C.js";
39
+ import "../chunk-32YBATXQ.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.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Browser-focused B3nd SDK bundle",
5
5
  "type": "module",
6
6
  "main": "./dist/src/mod.web.js",