Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
2974bd3
Update match-maker-client.js
sevenbitbyte Mar 25, 2026
34d7484
add runner to EndpointContext
nullagent May 18, 2026
3b407d6
key management and ephemeral sessions
nullagent May 18, 2026
6df2d70
cleanup ephemeral sessions every 15 minutes
nullagent May 18, 2026
8ddc422
admin only access to API
nullagent May 25, 2026
015a46b
debounce start
nullagent May 25, 2026
1bd2b5c
build with tar of static files and add file hashes & signing to servi…
nullagent May 29, 2026
aac16e1
packages uploading during build but not finished yet
nullagent May 30, 2026
c022c12
hash tar file during build
nullagent May 30, 2026
09ab900
verifying service & tars, saving files to disc
nullagent May 31, 2026
1c794ad
services written to db
nullagent May 31, 2026
2b68a1d
regular expression for safeworkspace path and move file save to after…
nullagent May 31, 2026
1890907
initial project schema
nullagent Jun 2, 2026
7a08ea0
move reasable package parts
nullagent Jun 9, 2026
237adf2
venued commands
nullagent Jun 10, 2026
e94db4e
moar commands
nullagent Jun 10, 2026
b6e4ac7
venue package build
nullagent Jun 10, 2026
690a542
i2p tweaks
sevenbitbyte Jun 12, 2026
df68ba3
initial create project
nullagent Jun 13, 2026
45cfb17
install i2p script ubuntu
nullagent Jun 13, 2026
de356a4
Merge branch 'billing-checkout-client' of github.com:datapartyjs/data…
nullagent Jun 13, 2026
2fa54e8
clean up regression in schema generation
nullagent Jun 13, 2026
b68cfb7
move sig
nullagent Jun 14, 2026
2159b3b
origin router fork
nullagent Jun 14, 2026
1ee6319
ephemeral-client
nullagent Jun 14, 2026
9ec28a0
autoreconnect
nullagent Jun 14, 2026
4f2f2c8
improve reconnect timer math
nullagent Jun 14, 2026
9fc0dc2
clean top level signals
nullagent Jun 14, 2026
68d4800
sane defaults
nullagent Jun 14, 2026
affd9c8
randomize reconnect timing
nullagent Jun 14, 2026
90b3d9d
add timing info
nullagent Jun 14, 2026
68f5446
project build
nullagent Jun 14, 2026
f3d0e3b
suport deploy
nullagent Jun 14, 2026
a393621
clients
nullagent Jun 16, 2026
270c5e8
cleanup duplicate code
nullagent Jun 19, 2026
3ec1a77
missed cleanup task move and add start of peer client
nullagent Jun 19, 2026
8151261
improve role logic and access in PeerInvite
nullagent Jun 20, 2026
ca50083
matchmaker client identity
nullagent Jun 20, 2026
32f6005
plumbing model
nullagent Jun 20, 2026
c116a77
model, socket, internal calls plumbing
nullagent Jun 20, 2026
fc84be8
plumb access controls better
nullagent Jun 20, 2026
eea8375
project staticTar handling
nullagent Jun 20, 2026
53d0437
tar handling in package
nullagent Jun 21, 2026
fde4fb3
project flow fixes
nullagent Jun 21, 2026
44b8210
cleanup package and project creation
nullagent Jun 21, 2026
3cd8232
dynamic loading
nullagent Jun 21, 2026
c9b81e2
static file hosting working
nullagent Jun 21, 2026
fdad1c5
venue remote repl
sevenbitbyte Jun 28, 2026
f27761e
peer query handler
sevenbitbyte Jun 28, 2026
54935f9
version bump
sevenbitbyte Jun 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion examples/secure-config-argon2.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const HELP_INFO = `
`

async function main(){
const memoryConfig = new Dataparty.Config.MemoryConfig({foo: 'bar'})


const jsonConfig = new Dataparty.Config.JsonFileConfig({
Expand Down
24 changes: 17 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@dataparty/api",
"private": false,
"version": "1.2.25",
"version": "1.3.0",
"main": "dist/dataparty.js",
"frontend": "dist/dataparty-browser.js",
"backend": "dist/dataparty.js",
Expand Down Expand Up @@ -47,6 +47,10 @@
"dist",
"src/*"
],
"bin": {
"venue": "./src/venue/bin/venue.js",
"venued": "./src/venue/bin/venued.js"
},
"scripts": {
"test": "npx lab",
"build": "npx parcel build --no-scope-hoist",
Expand All @@ -63,10 +67,10 @@
},
"dependencies": {
"@babel/runtime": "^7.28.4",
"@dataparty/bouncer-db": "1.0.1",
"@dataparty/bouncer-db": "https://github.com/datapartyjs/bouncer-db#mongoose-latest",
"@dataparty/crypto": "github:datapartyjs/dataparty-crypto",
"@dataparty/tasker": "^0.0.3",
"@diva.exchange/i2p-sam": "^4.1.8",
"@diva.exchange/i2p-sam": "5.5.2",
"@markwylde/liferaft": "^1.3.4",
"@sevenbitbyte/ncc": "0.0.2",
"ajv": "6.12.5",
Expand All @@ -77,18 +81,22 @@
"buffer": "^6.0.3",
"bufferutil": "^4.0.8",
"colors": "1.3.1",
"command-tree": "github:datapartyjs/command-tree",
"cors": "^2.8.5",
"debug": "^3.1.0",
"dom-storage": "^2.1.0",
"eventemitter3": "^4.0.7",
"express": "^4.17.1",
"express-ipfilter": "^1.3.2",
"express-list-routes": "^1.1.9",
"fast-safe-stringify": "^2.1.1",
"find-up-json": "^2.0.5",
"git-repo-info": "^2.1.1",
"joi": "^17.13.3",
"glob": "^13.0.6",
"joi": "^18.2.1",
"joi-objectid": "^4.0.2",
"jshashes": "^1.0.8",
"jsonpath-plus": "^0.20.1",
"jsonpath-plus": "10.4.0",
"last-eventemitter": "^1.1.1",
"lodash": "^4.17.21",
"lokijs": "1.5.12",
Expand All @@ -100,14 +108,15 @@
"node-mocks-http": "^1.12.1",
"node-object-hash": "^3.0.0",
"node-persist": "^3.0.1",
"origin-router": "^1.6.4",
"origin-router": "https://github.com/datapartyjs/origin-router.git",
"parse-url": "^5.0.1",
"promisfy": "^1.2.0",
"roslib": "^1.3.0",
"sanitize-filename": "^1.6.3",
"simple-peer": "9.11.1",
"source-map": "^0.7.3",
"store-js": "^2.0.4",
"tar": "^7.5.15",
"tingodb": "^0.6.1",
"touch": "^3.1.0",
"url-parse": "^1.4.7",
Expand All @@ -118,8 +127,9 @@
"zangodb": "https://github.com/sevenbitbyte/zangodb#hash-patch"
},
"devDependencies": {
"@dataparty/bouncer-model": "1.4.3",
"@dataparty/bouncer-model": "https://github.com/datapartyjs/bouncer-model#mongoose-latest",
"@hapi/code": "^9.0.1",
"@hapi/joi": "^17.1.1",
"@hapi/lab": "^25.0.1",
"argon2": "^0.30.3",
"argon2-browser": "^1.18.0",
Expand Down
6 changes: 6 additions & 0 deletions scripts/install-i2p-ubuntu-24.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

sudo add-apt-repository ppa:purplei2p/i2pd
sudo apt update
sudo apt install --yes i2pd

7 changes: 5 additions & 2 deletions src/bouncer/db/tingo-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,13 @@ module.exports = class TingoDb extends IDb {
debug('find collection=', collectionName, ' query=', JSON.stringify(query,null,2))
let collection = await this.getCollection(collectionName)
let cursor = await promisfy(collection.find.bind(collection))(
query,
mongoQuery.hasSort() ? mongoQuery.getSort() : undefined
query
)

if(mongoQuery.hasSort()){
cursor = cursor.sort(mongoQuery.getSort())
}

if(mongoQuery.hasLimit()){
cursor = cursor.limit(mongoQuery.getLimit())
}
Expand Down
2 changes: 1 addition & 1 deletion src/bouncer/ischema.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const debug = require('debug')('bouncer.ISchema')
const debug = require('debug')('dataparty.bouncer.ISchema')
const MgoUtils = require('../utils/mongoose-scheme-utils')

module.exports = class ISchema {
Expand Down
6 changes: 5 additions & 1 deletion src/bouncer/mongo-query.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ class MongoQuery {
}

getSort () {
return { [this.spec.sort.param.join('.')]: this.spec.sort.direction }
if(Array.isArray(this.spec.sort.param)){
return { [this.spec.sort.param.join('.')]: this.spec.sort.direction }
}

return { [this.spec.sort.param]: this.spec.sort.direction }
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/comms/isocket-comms.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class ISocketComms extends EventEmitter {
this.connected = false
debug('Server closed connection')
this.emit('close')
this.emit('server-close')
}

onopen(){
Expand Down
47 changes: 39 additions & 8 deletions src/comms/peer-comms.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ class PeerComms extends ISocketComms {

this.uuid = uuidv4()
this.socket = socket || null
this.stopped = false
this.started = false
//this.auto_reconnect = !socket && !host

this.host = host //! Is comms host\
this.oncall = null
Expand Down Expand Up @@ -89,7 +92,7 @@ class PeerComms extends ISocketComms {

let response = null
let request = await this.decrypt( {data: message}, this.remoteIdentity )
debug('handleHostCall', truncateString(request, 1024))
debug('handleClientCall', truncateString(JSON.stringify(request, null, 2), 1024))

let inputValidated

Expand Down Expand Up @@ -203,11 +206,16 @@ class PeerComms extends ISocketComms {

async start(){
debug('start')

if(this.started){ return }

this.started = true

if(this.socketInit){
await this.socketInit()
}

this.socket.on('close', this.stop.bind(this))
this.socket.on('close', this.socketStop.bind(this))

if(this.host){
debug('host mode comms')
Expand All @@ -226,7 +234,14 @@ class PeerComms extends ISocketComms {
}
}

socketStop(){
debug('socket stop')
this.close()
}

async stop(){
this.stopped = true
this.started = false
debug('stop')
this.close()
}
Expand Down Expand Up @@ -385,13 +400,13 @@ class PeerComms extends ISocketComms {

if(this.party.hostRunner){
const actor = await this.party.hostRunner.auth.lookupIdentity(offer.sender)
const verified = await Routines.verifyDataPQ(actor, signature, offerBSON)
const verified = await Routines.verifyDataPQ(offer.sender, signature, offerBSON)

if(!verified){
throw new Error('DENY(hostRunner) - auth op signature is not valid')
}

if(this.discoverRemoteIdentity){ this.remoteIdentity = actor }
if(this.discoverRemoteIdentity){ this.remoteIdentity = offer.sender }

const authorized = await this.party.hostRunner.auth.isSocketConnectionAllowed(actor)
if(!authorized){
Expand All @@ -406,6 +421,7 @@ class PeerComms extends ISocketComms {
await this.stop()

debug('DENY - client not allowed - ', this.remoteIdentity)
throw new Error('DENY - client not allowed')
}
} else {
const actor = offer.sender
Expand All @@ -420,7 +436,7 @@ class PeerComms extends ISocketComms {
}
}

debug('clienr auth op offer -', offer)
debug('client auth op offer -', offer)
debug('ALLOW - allowing client - ', this.remoteIdentity)

this.aesStream = await AESStream.recoverStream(
Expand All @@ -445,22 +461,34 @@ class PeerComms extends ISocketComms {
async handleCallOp(op){
debug('peer-call', op.input.endpoint)

const actor = await this.party.hostRunner.auth.lookupIdentity(this.remoteIdentity)

if(this.party.hostRunner){

debug('calling runner')

if(op.input.endpoint == 'api-v2-peer-bouncer' && await this.party.hostRunner.auth.isAdmin(this.remoteIdentity)){


if(op.input.endpoint == 'api-v2-peer-bouncer' && await this.party.hostRunner.auth.isAdmin(actor)){
debug('ask->', truncateString(op.input.data, 1024))
op.result = {result: await this.party.handleCall(op.input.data) }

op.setState(HostOp.STATES.Finished_Success)
return
}

debug('input type', typeof op.input.data, Object.keys(op.input.data))
debug('op.msg type', typeof op.msg, Object.keys(op.msg), Buffer.isBuffer(op.msg))

let bodyValue = Buffer.isBuffer(op.msg) ?
op.input.data :
//Routines.BSON.parseObject(new Routines.BSON.BaseParser( op.msg )) :
JSON.parse(op.msg.toString())

const req = HttpMocks.createRequest({
method: 'GET',
url: '/'+op.input.endpoint,
body: (op.input.data) ? JSON.parse(op.msg.toString()) : undefined
body: bodyValue
})

const res = HttpMocks.createResponse()
Expand All @@ -473,6 +501,9 @@ class PeerComms extends ISocketComms {

debug('route',route)

req.peer = this
req.source = 'PeerComms'

debug('call route', await route._events.route({
method: req.method,
pathname: req.url,
Expand All @@ -487,7 +518,7 @@ class PeerComms extends ISocketComms {
op.setState(HostOp.STATES.Finished_Success)
return

} else if(op.input.endpoint == 'api-v2-peer-bouncer' && await this.party.hostRunner.auth.isAdmin(this.remoteIdentity)){
} else if(op.input.endpoint == 'api-v2-peer-bouncer' && await this.party.hostRunner.auth.isAdmin(actor)){

debug('ask->',op.input.data)
op.result = {result: await this.party.handleCall(op.input.data) }
Expand Down
16 changes: 14 additions & 2 deletions src/comms/rest-comms.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,19 @@ class RestComms extends EventEmitter {
// debug('raw reply ->', reply)
} catch (error) {
debug('rest', fullPath, ' call fail ->', error.message)
throw new Error('RestCommsError')

console.log(Object.keys(error), Object.keys(error.response))

const simpleError = {
name: error.name,
code: error.code,
//message: error.message,
statusCode: error.response.statusCode,
statusMessage: error.response.statusMessage,
data: error.response.data
}

throw simpleError
}

const msg = await this.party.decrypt(
Expand Down Expand Up @@ -207,7 +219,7 @@ class RestComms extends EventEmitter {
const serverIdentity = await RestComms.HttpGet(this.uri + `${this.uriPrefix}identity`)
debug('server identity - ', serverIdentity)

this.remoteIdentity = new dataparty_crypto.Identity(serverIdentity)
this.remoteIdentity = dataparty_crypto.Identity.fromJSON(serverIdentity)
}

return this.remoteIdentity
Expand Down
37 changes: 35 additions & 2 deletions src/comms/websocket-comms.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ const WebsocketShim = require('./websocket-shim')
* @see https://en.wikipedia.org/wiki/WebSocket
*/
class WebsocketComms extends PeerComms {
constructor({uri, connection, remoteIdentity, host, party, ...options}){
constructor({uri, connection, timeout=20000, remoteIdentity, host, party, ...options}){
super({remoteIdentity, host, party, ...options})

this.uri = uri
this.connection = connection
this.timeout = timeout
this.timer = null

debug('starting host=',host, ' uuid=', this.uuid, ' uri=', this.uri)

Expand All @@ -34,13 +36,44 @@ class WebsocketComms extends PeerComms {

async socketInit(){
debug('init')

let isNewConnection = false

if(!this.host && !this.connection){
debug('opening client connection to',this.uri)
this.connection = new WebSocket(this.uri)

isNewConnection = true
}

this.socket = new WebsocketShim(this.connection)

if(isNewConnection){

//await new Promise((resolve,reject)=>{
this.timer = setTimeout(() => {
debug('websocket timeout')
this.connection.close()
this.emit('timeout')
//reject(new Error("WebSocket connection timeout"));
}, this.timeout);

this.socket.once('connect', () => {
debug('websocket opened')
clearTimeout(this.timer);
//resolve();
})

this.socket.once('error',(error) => {
debug('websocket error', error)
clearTimeout(this.timer)
this.emit('error', error)
//this.connection.close()
//reject(error);
})
//})
}


}
}

Expand Down
3 changes: 2 additions & 1 deletion src/comms/websocket-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class WebsocketShim extends EventEmitter {
}

this.conn.onclose = (event) => {
debug('onclose', event)
debug('onclose', event, event.code, event.reason)
this.emit('close', event)
}

Expand All @@ -39,6 +39,7 @@ class WebsocketShim extends EventEmitter {
}

destroy(){
if(this.conn && this.conn.terminate)
this.conn.terminate()
}

Expand Down
Loading