use cutting-edge secret-stack with bare and shse.pubkey

This commit is contained in:
Andre Staltz 2023-07-14 13:35:38 +03:00
parent 403fcefc3a
commit ffb8860fb8
No known key found for this signature in database
GPG Key ID: 9EDE23EA7E8A4890
3 changed files with 7 additions and 9 deletions

View File

@ -36,14 +36,13 @@ module.exports = {
function createStream(remoteId, iamClient) {
// prettier-ignore
debug('Opening a stream with remote %s %s', iamClient ? 'server' : 'client', remoteId)
const stream = new SyncStream(peer.pubkey, debug, goals, algo)
const stream = new SyncStream(peer.shse.pubkey, debug, goals, algo)
streams.push(stream)
return stream
}
peer.on('rpc:connect', function onSyncRPCConnect(rpc, iamClient) {
// TODO: eliminate SSB base64 `.id`, use SHSE `.pubkey` instead
if (rpc.id === peer.pubkey) return // local client connecting to local server
if (rpc.shse.pubkey === peer.shse.pubkey) return // local client connecting to local server
if (!iamClient) return
const local = toPull.duplex(createStream(rpc.id, true))
@ -51,7 +50,7 @@ module.exports = {
const remote = rpc.tangleSync.connect((networkError) => {
if (networkError && getSeverity(networkError) >= 3) {
if (isMuxrpcMissingError(networkError, 'tangleSync', 'connect')) {
debug('peer %s does not support tangleSync', rpc.id)
debug('peer %s does not support tangleSync', rpc.shse.pubkey)
// } else if (isReconnectedError(networkError)) { // TODO: bring back
// Do nothing, this is a harmless error
} else {

View File

@ -41,8 +41,8 @@
"prettier": "^2.6.2",
"pretty-quick": "^3.1.3",
"rimraf": "^4.4.0",
"secret-stack": "^6.4.1",
"secret-handshake-ext": "^0.0.7",
"secret-stack": "ssbc/secret-stack#bare-mode",
"secret-handshake-ext": "^0.0.8",
"ssb-box": "^1.0.1"
},
"scripts": {

View File

@ -14,9 +14,8 @@ function createPeer(opts) {
if (!opts.keypair) throw new Error('need opts.keypair in createPeer()')
rimraf.sync(opts.path)
return require('secret-stack/lib/api')([], {})
.use(require('secret-stack/lib/core'))
.use(require('secret-stack/lib/plugins/net'))
return require('secret-stack/bare')()
.use(require('secret-stack/plugins/net'))
.use(require('secret-handshake-ext/secret-stack'))
.use(require('ppppp-db'))
.use(require('ssb-box'))