Wrapper around @session.js/bun-remote for transferring requests through network. https://www.npmjs.com/package/@session.js/bun-network-remote
Find a file
2026-01-29 13:01:58 +01:00
.vscode Add prettier and formatter, make code style consistent, sort package.json, migrate from bun.lockb to bun.lock 2026-01-28 15:08:43 +01:00
src Add prettier and formatter, make code style consistent, sort package.json, migrate from bun.lockb to bun.lock 2026-01-28 15:08:43 +01:00
.gitignore Initial commit 2024-07-17 02:24:23 +04:00
.prettierignore Add prettier and formatter, make code style consistent, sort package.json, migrate from bun.lockb to bun.lock 2026-01-28 15:08:43 +01:00
.prettierrc Add prettier and formatter, make code style consistent, sort package.json, migrate from bun.lockb to bun.lock 2026-01-28 15:08:43 +01:00
bun.lock Bump @session.js/types 2026-01-29 13:01:58 +01:00
eslint.config.js Add prettier and formatter, make code style consistent, sort package.json, migrate from bun.lockb to bun.lock 2026-01-28 15:08:43 +01:00
LICENSE Add prettier and formatter, make code style consistent, sort package.json, migrate from bun.lockb to bun.lock 2026-01-28 15:08:43 +01:00
package.json Bump @session.js/types 2026-01-29 13:01:58 +01:00
README.md Add prettier and formatter, make code style consistent, sort package.json, migrate from bun.lockb to bun.lock 2026-01-28 15:08:43 +01:00
tsconfig.build.json Add prettier and formatter, make code style consistent, sort package.json, migrate from bun.lockb to bun.lock 2026-01-28 15:08:43 +01:00
tsconfig.json Add prettier and formatter, make code style consistent, sort package.json, migrate from bun.lockb to bun.lock 2026-01-28 15:08:43 +01:00

@session.js/bun-network-remote

This network adapter for @session.js/client uses Bun.sh runtime to fetch Session nodes. It is intended to be used in environments that should keep secret keys but can't connect to Session nodes, such as browsers. This network connector fetches serverside part of this package that validates request and passes it to onRequest method from @session.js/bun-network.

Simple example of project that uses @session.js/bun-network-remote

Usage:

Client-side (where Session client runs):

import { Session } from '@session.js/client'
import { BunNetworkRemoteClient } from '@session.js/bun-network-remote'

new Session({ 
  network: new BunNetworkRemoteClient({ 
    proxy: 'https://my-proxy.example.org:12345/' 
    // this endpoint must be accessible in your environment
    // i.e. if you're building Session client in browser, make sure
    // that my-proxy.example.org has a valid SSL certificate, CORS and SSL settings
  })
})

Client-side part will send POST requests to this URL with FormData or JSON body.

Server-side (proxy server):

// Runtime must be Bun.sh
// Web server can be anything: Express, Fastify, Elysia, Bun's web server, etc...
// Validation is done internally and throws @session.js/error RuntimeValidation errors

import { Elysia } from 'elysia'
import { BunNetworkRemoteServer } from '@session.js/bun-network-remote'
const network = new BunNetworkRemoteServer()

new Elysia()
  .post('/', ({ body }) => network.onRequest(body))
  .listen(12345)

Made for Session.js

Use Session messenger programmatically with Session.js: Session bots, custom Session clients, and more.

Donate

hloth.dev/donate · Tor: hlothdevzkti6suoksy7lcy7hmpxnr3msu5waokzaslsi2mnx5ouu4qd.onion/donate

License

MIT