Merge pull request #95 from ssb-ngi-pointer/add-js-test-for-aliases
add JS test for alias register and revoke
This commit is contained in:
commit
33c708df5e
@ -123,8 +123,11 @@ func runroomsrv() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
if httpsDomain == "" && !development {
|
||||
return fmt.Errorf("https-domain can't be empty. See '%s -h' for a full list of options", os.Args[0])
|
||||
if httpsDomain == "" {
|
||||
if !development {
|
||||
return fmt.Errorf("https-domain can't be empty. See '%s -h' for a full list of options", os.Args[0])
|
||||
}
|
||||
httpsDomain = "dev.testing.local"
|
||||
}
|
||||
|
||||
// validate listen addresses to bail out on invalid flag input before doing anything else
|
||||
@ -204,6 +207,7 @@ func runroomsrv() error {
|
||||
roomsrv, err := mksrv.New(
|
||||
db.Members,
|
||||
db.Aliases,
|
||||
httpsDomain,
|
||||
opts...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to instantiate ssb server: %w", err)
|
||||
|
@ -13,9 +13,10 @@ import (
|
||||
kitlog "github.com/go-kit/kit/log"
|
||||
"go.cryptoscope.co/muxrpc/v2"
|
||||
|
||||
"github.com/ssb-ngi-pointer/go-ssb-room/aliases"
|
||||
"github.com/ssb-ngi-pointer/go-ssb-room/internal/aliases"
|
||||
"github.com/ssb-ngi-pointer/go-ssb-room/internal/network"
|
||||
"github.com/ssb-ngi-pointer/go-ssb-room/roomdb"
|
||||
"github.com/ssb-ngi-pointer/go-ssb-room/web/router"
|
||||
refs "go.mindeco.de/ssb-refs"
|
||||
)
|
||||
|
||||
@ -25,12 +26,16 @@ type Handler struct {
|
||||
self refs.FeedRef
|
||||
|
||||
db roomdb.AliasesService
|
||||
|
||||
roomDomain string // the http(s) domain of the room to signal alias addresses
|
||||
}
|
||||
|
||||
// New returns a fresh alias muxrpc handler
|
||||
func New(log kitlog.Logger, self refs.FeedRef, aliasesDB roomdb.AliasesService) Handler {
|
||||
func New(log kitlog.Logger, self refs.FeedRef, aliasesDB roomdb.AliasesService, roomDomain string) Handler {
|
||||
|
||||
var h Handler
|
||||
h.self = self
|
||||
h.roomDomain = roomDomain
|
||||
h.logger = log
|
||||
h.db = aliasesDB
|
||||
|
||||
@ -39,6 +44,8 @@ func New(log kitlog.Logger, self refs.FeedRef, aliasesDB roomdb.AliasesService)
|
||||
|
||||
const sigSuffix = ".sig.ed25519"
|
||||
|
||||
var httpRouter = router.CompleteApp()
|
||||
|
||||
// Register is an async muxrpc method handler for registering aliases.
|
||||
// It receives two string arguments over muxrpc (alias and signature),
|
||||
// checks the signature confirmation is correct (for this room and signed by the key of theconnection)
|
||||
@ -93,7 +100,14 @@ func (h Handler) Register(ctx context.Context, req *muxrpc.Request) (interface{}
|
||||
return nil, fmt.Errorf("registerAlias: could not register alias: %w", err)
|
||||
}
|
||||
|
||||
return true, nil
|
||||
resolveURL, err := httpRouter.Get(router.CompleteAliasResolve).URL("alias", confirmation.Alias)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resolveURL.Host = h.roomDomain
|
||||
resolveURL.Scheme = "https"
|
||||
|
||||
return resolveURL.String(), nil
|
||||
}
|
||||
|
||||
// Revoke checks that the alias is from that user before revoking the alias from the database.
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"encoding/base64"
|
||||
"net/url"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -14,7 +15,7 @@ import (
|
||||
"go.cryptoscope.co/muxrpc/v2"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
"github.com/ssb-ngi-pointer/go-ssb-room/aliases"
|
||||
"github.com/ssb-ngi-pointer/go-ssb-room/internal/aliases"
|
||||
"github.com/ssb-ngi-pointer/go-ssb-room/internal/maybemod/keys"
|
||||
"github.com/ssb-ngi-pointer/go-ssb-room/roomdb"
|
||||
"github.com/ssb-ngi-pointer/go-ssb-room/roomsrv"
|
||||
@ -96,10 +97,16 @@ func TestAliasRegister(t *testing.T) {
|
||||
// encode the signature as base64
|
||||
sig := base64.StdEncoding.EncodeToString(confirmation.Signature) + ".sig.ed25519"
|
||||
|
||||
var worked bool
|
||||
err = clientForServer.Async(ctx, &worked, muxrpc.TypeJSON, muxrpc.Method{"room", "registerAlias"}, "bob", sig)
|
||||
var registerResponse string
|
||||
err = clientForServer.Async(ctx, ®isterResponse, muxrpc.TypeString, muxrpc.Method{"room", "registerAlias"}, "bob", sig)
|
||||
r.NoError(err)
|
||||
a.True(worked)
|
||||
a.NotEqual("", registerResponse, "response isn't empty")
|
||||
|
||||
resolveURL, err := url.Parse(registerResponse)
|
||||
r.NoError(err)
|
||||
t.Log("got URL:", resolveURL)
|
||||
a.Equal("srv", resolveURL.Host)
|
||||
a.Equal("/bob", resolveURL.Path)
|
||||
|
||||
// server should have the alias now
|
||||
alias, err := serv.Aliases.Resolve(ctx, "bob")
|
||||
|
@ -88,7 +88,7 @@ func makeNamedTestBot(t testing.TB, name string, opts []roomsrv.Option) (roomdb.
|
||||
t.Log("db close failed: ", err)
|
||||
}
|
||||
})
|
||||
theBot, err := roomsrv.New(db.Members, db.Aliases, botOptions...)
|
||||
theBot, err := roomsrv.New(db.Members, db.Aliases, name, botOptions...)
|
||||
r.NoError(err)
|
||||
return db.Members, theBot
|
||||
}
|
||||
|
64
muxrpc/test/nodejs/aliases_test.go
Normal file
64
muxrpc/test/nodejs/aliases_test.go
Normal file
@ -0,0 +1,64 @@
|
||||
package nodejs_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/ssb-ngi-pointer/go-ssb-room/internal/aliases"
|
||||
"github.com/ssb-ngi-pointer/go-ssb-room/roomdb"
|
||||
"github.com/ssb-ngi-pointer/go-ssb-room/roomdb/mockdb"
|
||||
)
|
||||
|
||||
func TestGoServerJSClientAliases(t *testing.T) {
|
||||
a := assert.New(t)
|
||||
r := require.New(t)
|
||||
|
||||
ts := newRandomSession(t)
|
||||
// ts := newSession(t, nil)
|
||||
|
||||
var membersDB = &mockdb.FakeMembersService{}
|
||||
var aliasesDB = &mockdb.FakeAliasesService{}
|
||||
srv := ts.startGoServer(membersDB, aliasesDB)
|
||||
// allow all peers (there arent any we dont want to allow)
|
||||
membersDB.GetByFeedReturns(roomdb.Member{Nickname: "free4all"}, nil)
|
||||
|
||||
// setup mocks for this test
|
||||
aliasesDB.RegisterReturns(nil)
|
||||
|
||||
alice := ts.startJSClient("alice", "./testscripts/modern_aliases.js",
|
||||
srv.Network.GetListenAddr(),
|
||||
srv.Whoami(),
|
||||
)
|
||||
|
||||
// the revoke call checks who the alias belongs to
|
||||
aliasesDB.ResolveReturns(roomdb.Alias{
|
||||
Name: "alice",
|
||||
Feed: alice,
|
||||
}, nil)
|
||||
|
||||
time.Sleep(5 * time.Second)
|
||||
|
||||
// wait for both to exit
|
||||
ts.wait()
|
||||
|
||||
r.Equal(1, aliasesDB.RegisterCallCount(), "register call count")
|
||||
_, name, ref, signature := aliasesDB.RegisterArgsForCall(0)
|
||||
a.Equal("alice", name, "wrong alias registered")
|
||||
a.Equal(alice.Ref(), ref.Ref())
|
||||
|
||||
var aliasReq aliases.Confirmation
|
||||
aliasReq.Alias = name
|
||||
aliasReq.Signature = signature
|
||||
aliasReq.UserID = alice
|
||||
aliasReq.RoomID = srv.Whoami()
|
||||
|
||||
a.True(aliasReq.Verify(), "signature validation")
|
||||
|
||||
r.Equal(1, aliasesDB.RevokeCallCount(), "revoke call count")
|
||||
_, name = aliasesDB.RevokeArgsForCall(0)
|
||||
a.Equal("alice", name, "wrong alias revoked")
|
||||
|
||||
}
|
373
muxrpc/test/nodejs/package-lock.json
generated
373
muxrpc/test/nodejs/package-lock.json
generated
@ -145,21 +145,6 @@
|
||||
"flumecodec": "0.0.1",
|
||||
"idb-kv-store": "^4.5.0",
|
||||
"mutexify": "^1.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"flumecodec": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/flumecodec/-/flumecodec-0.0.1.tgz",
|
||||
"integrity": "sha1-rgSacUOGu4PjQmV6gpJLcDZKkNY=",
|
||||
"requires": {
|
||||
"level-codec": "^6.2.0"
|
||||
}
|
||||
},
|
||||
"level-codec": {
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/level-codec/-/level-codec-6.2.0.tgz",
|
||||
"integrity": "sha1-pLUkS7akwvcj1oodZOmAxTYn2dQ="
|
||||
}
|
||||
}
|
||||
},
|
||||
"atomically": {
|
||||
@ -534,37 +519,65 @@
|
||||
}
|
||||
},
|
||||
"es-abstract": {
|
||||
"version": "1.18.0-next.2",
|
||||
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.2.tgz",
|
||||
"integrity": "sha512-Ih4ZMFHEtZupnUh6497zEL4y2+w8+1ljnCyaTa+adcoafI1GOvMwFlDjBLfWR7y9VLfrjRJe9ocuHY1PSR9jjw==",
|
||||
"version": "1.18.0",
|
||||
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0.tgz",
|
||||
"integrity": "sha512-LJzK7MrQa8TS0ja2w3YNLzUgJCGPdPOV1yVvezjNnS89D+VR08+Szt2mz3YB2Dck/+w5tfIq/RoUAFqJJGM2yw==",
|
||||
"requires": {
|
||||
"call-bind": "^1.0.2",
|
||||
"es-to-primitive": "^1.2.1",
|
||||
"function-bind": "^1.1.1",
|
||||
"get-intrinsic": "^1.0.2",
|
||||
"get-intrinsic": "^1.1.1",
|
||||
"has": "^1.0.3",
|
||||
"has-symbols": "^1.0.1",
|
||||
"is-callable": "^1.2.2",
|
||||
"has-symbols": "^1.0.2",
|
||||
"is-callable": "^1.2.3",
|
||||
"is-negative-zero": "^2.0.1",
|
||||
"is-regex": "^1.1.1",
|
||||
"is-regex": "^1.1.2",
|
||||
"is-string": "^1.0.5",
|
||||
"object-inspect": "^1.9.0",
|
||||
"object-keys": "^1.1.1",
|
||||
"object.assign": "^4.1.2",
|
||||
"string.prototype.trimend": "^1.0.3",
|
||||
"string.prototype.trimstart": "^1.0.3"
|
||||
"string.prototype.trimend": "^1.0.4",
|
||||
"string.prototype.trimstart": "^1.0.4",
|
||||
"unbox-primitive": "^1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"get-intrinsic": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz",
|
||||
"integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==",
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1",
|
||||
"has": "^1.0.3",
|
||||
"has-symbols": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"has-symbols": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz",
|
||||
"integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw=="
|
||||
},
|
||||
"is-regex": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.2.tgz",
|
||||
"integrity": "sha512-axvdhb5pdhEVThqJzYXwMlVuZwC+FF2DpcOhTS+y/8jVq4trxyPgfcwIxIKiyeuLlSQYKkmUaPQJ8ZE4yNKXDg==",
|
||||
"requires": {
|
||||
"call-bind": "^1.0.2",
|
||||
"has-symbols": "^1.0.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"es-get-iterator": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.1.tgz",
|
||||
"integrity": "sha512-qorBw8Y7B15DVLaJWy6WdEV/ZkieBcu6QCq/xzWzGOKJqgG1j754vXRfZ3NY7HSShneqU43mPB4OkQBTkvHhFw==",
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.2.tgz",
|
||||
"integrity": "sha512-+DTO8GYwbMCwbywjimwZMHp8AuYXOS2JZFWoi2AlPOS3ebnII9w/NLpNZtA7A0YLaVDw+O7KFCeoIV7OPvM7hQ==",
|
||||
"requires": {
|
||||
"call-bind": "^1.0.0",
|
||||
"get-intrinsic": "^1.0.1",
|
||||
"call-bind": "^1.0.2",
|
||||
"get-intrinsic": "^1.1.0",
|
||||
"has-symbols": "^1.0.1",
|
||||
"is-arguments": "^1.0.4",
|
||||
"is-map": "^2.0.1",
|
||||
"is-set": "^2.0.1",
|
||||
"is-arguments": "^1.1.0",
|
||||
"is-map": "^2.0.2",
|
||||
"is-set": "^2.0.2",
|
||||
"is-string": "^1.0.5",
|
||||
"isarray": "^2.0.5"
|
||||
}
|
||||
@ -729,6 +742,21 @@
|
||||
"path-exists": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"flumecodec": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/flumecodec/-/flumecodec-0.0.1.tgz",
|
||||
"integrity": "sha1-rgSacUOGu4PjQmV6gpJLcDZKkNY=",
|
||||
"requires": {
|
||||
"level-codec": "^6.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"level-codec": {
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/level-codec/-/level-codec-6.2.0.tgz",
|
||||
"integrity": "sha1-pLUkS7akwvcj1oodZOmAxTYn2dQ="
|
||||
}
|
||||
}
|
||||
},
|
||||
"flumelog-offset": {
|
||||
"version": "3.4.4",
|
||||
"resolved": "https://registry.npmjs.org/flumelog-offset/-/flumelog-offset-3.4.4.tgz",
|
||||
@ -833,16 +861,16 @@
|
||||
"ansi-regex": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"has-bigints": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz",
|
||||
"integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA=="
|
||||
},
|
||||
"has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
|
||||
},
|
||||
"has-network": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/has-network/-/has-network-0.0.1.tgz",
|
||||
"integrity": "sha1-Pup7RMqpYBeXEkvouonSKMQQFJk="
|
||||
},
|
||||
"has-network2": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has-network2/-/has-network2-0.0.3.tgz",
|
||||
@ -980,9 +1008,9 @@
|
||||
}
|
||||
},
|
||||
"is-callable": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.2.tgz",
|
||||
"integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA=="
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.3.tgz",
|
||||
"integrity": "sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ=="
|
||||
},
|
||||
"is-canonical-base64": {
|
||||
"version": "1.1.1",
|
||||
@ -1059,13 +1087,13 @@
|
||||
}
|
||||
},
|
||||
"is-typed-array": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.4.tgz",
|
||||
"integrity": "sha512-ILaRgn4zaSrVNXNGtON6iFNotXW3hAPF3+0fB1usg2jFlWqo5fEDdmJkz0zBfoi7Dgskr8Khi2xZ8cXqZEfXNA==",
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.5.tgz",
|
||||
"integrity": "sha512-S+GRDgJlR3PyEbsX/Fobd9cqpZBuvUS+8asRqYDMLCb2qMzt1oz5m5oxQCxOgUDxiWsOVNi4yaF+/uvdlHlYug==",
|
||||
"requires": {
|
||||
"available-typed-arrays": "^1.0.2",
|
||||
"call-bind": "^1.0.0",
|
||||
"es-abstract": "^1.18.0-next.1",
|
||||
"call-bind": "^1.0.2",
|
||||
"es-abstract": "^1.18.0-next.2",
|
||||
"foreach": "^2.0.5",
|
||||
"has-symbols": "^1.0.1"
|
||||
}
|
||||
@ -1457,15 +1485,6 @@
|
||||
"pull-stream": "^3.6.10"
|
||||
}
|
||||
},
|
||||
"muxrpc-validation": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/muxrpc-validation/-/muxrpc-validation-3.0.2.tgz",
|
||||
"integrity": "sha512-iWo/23xFnl+IGeX+LlfwoVKtyY4volPSodf3nwPScPgxjws4k2ZUozPG98OouMA0yn0JamqApjRw7eqLrzyV2A==",
|
||||
"requires": {
|
||||
"pull-stream": "^3.6.11",
|
||||
"zerr": "^1.0.4"
|
||||
}
|
||||
},
|
||||
"napi-macros": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz",
|
||||
@ -1571,11 +1590,6 @@
|
||||
"resolved": "https://registry.npmjs.org/obz/-/obz-1.0.2.tgz",
|
||||
"integrity": "sha512-c+EtVwT2IpXz5we2mR40aPLJ1s0eNOsxYeaYbaHhmsY6kWKo3IRkpwpBU5ck0aHfqfKUUEiKabC6rzsrG/hSHw=="
|
||||
},
|
||||
"on-change-network": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/on-change-network/-/on-change-network-0.0.2.tgz",
|
||||
"integrity": "sha1-2XcklHf5FyaUnYDoI0batu9FIWs="
|
||||
},
|
||||
"on-change-network-strict": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/on-change-network-strict/-/on-change-network-strict-1.0.0.tgz",
|
||||
@ -2269,11 +2283,11 @@
|
||||
"integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc="
|
||||
},
|
||||
"resolve": {
|
||||
"version": "1.19.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz",
|
||||
"integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==",
|
||||
"version": "2.0.0-next.3",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.3.tgz",
|
||||
"integrity": "sha512-W8LucSynKUIDu9ylraa7ueVZ7hc0uAgJBxVsQSKOXOyle8a93qXhcz+XAXZ8bIq2d6i4Ehddn6Evt+0/UwKk6Q==",
|
||||
"requires": {
|
||||
"is-core-module": "^2.1.0",
|
||||
"is-core-module": "^2.2.0",
|
||||
"path-parse": "^1.0.6"
|
||||
}
|
||||
},
|
||||
@ -2602,11 +2616,11 @@
|
||||
}
|
||||
},
|
||||
"ssb-conn": {
|
||||
"version": "0.19.1",
|
||||
"resolved": "https://registry.npmjs.org/ssb-conn/-/ssb-conn-0.19.1.tgz",
|
||||
"integrity": "sha512-7HEiZPZyeIurrZsL1kxYgM164eNU+PRbqfhMzGNwQOrU5Ku+tciZhrZsbYtgNJHHIaoQQZfX79IaQQsD1ZrW5A==",
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ssb-conn/-/ssb-conn-2.1.0.tgz",
|
||||
"integrity": "sha512-cs3AVZ0QVvhbLkSuP2LIAoJv/6t5pMtri8aD/F1rmSFarz81RC0nks//uuziH4R2946mH3SHb02G3ExAyzvl1g==",
|
||||
"requires": {
|
||||
"debug": "~4.2.0",
|
||||
"debug": "^4.3.0",
|
||||
"has-network2": ">=0.0.3",
|
||||
"ip": "^1.1.5",
|
||||
"on-change-network-strict": "1.0.0",
|
||||
@ -2616,46 +2630,28 @@
|
||||
"pull-ping": "^2.0.3",
|
||||
"pull-stream": "^3.6.14",
|
||||
"secret-stack-decorators": "1.1.0",
|
||||
"ssb-conn-db": "~0.3.3",
|
||||
"ssb-conn-hub": "~0.2.7",
|
||||
"ssb-conn-query": "~0.4.6",
|
||||
"ssb-conn-staging": "~0.1.0",
|
||||
"ssb-ref": "^2.14.2",
|
||||
"ssb-typescript": "^2.1.0",
|
||||
"ssb-conn-db": "~1.0.1",
|
||||
"ssb-conn-hub": "~1.1.0",
|
||||
"ssb-conn-query": "~1.1.0",
|
||||
"ssb-conn-staging": "~1.0.0",
|
||||
"ssb-ref": "^2.14.3",
|
||||
"ssb-typescript": "^2.2.0",
|
||||
"statistics": "^3.3.0",
|
||||
"zii": "~1.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz",
|
||||
"integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==",
|
||||
"requires": {
|
||||
"ms": "2.1.2"
|
||||
}
|
||||
}
|
||||
"ziii": "~1.0.2"
|
||||
}
|
||||
},
|
||||
"ssb-conn-db": {
|
||||
"version": "0.3.3",
|
||||
"resolved": "https://registry.npmjs.org/ssb-conn-db/-/ssb-conn-db-0.3.3.tgz",
|
||||
"integrity": "sha512-N2C/PweOlzEnrcfhGusnFhrZusfGyEMqip2WpQR/dgLAwHHQK8Wxn9KkC0457AHYlIO3UDH4Q1Mewsz8RLweMw==",
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ssb-conn-db/-/ssb-conn-db-1.0.1.tgz",
|
||||
"integrity": "sha512-lTXhHmJ9La7S+YFotLnvn+4uxX5lP+zDNS3N4zPnDDy/3f1AQI6jxEnRDmbhfWqrAEI2gy7Yu6LcgC5rX+MRDA==",
|
||||
"requires": {
|
||||
"atomic-file": "^2.1.1",
|
||||
"debug": "~4.1.1",
|
||||
"debug": "^4.3.1",
|
||||
"multiserver-address": "~1.0.1",
|
||||
"pull-notify": "~0.1.1",
|
||||
"ssb-ref": "~2.13.9"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
|
||||
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"ssb-ref": {
|
||||
"version": "2.13.9",
|
||||
"resolved": "https://registry.npmjs.org/ssb-ref/-/ssb-ref-2.13.9.tgz",
|
||||
@ -2670,48 +2666,35 @@
|
||||
}
|
||||
},
|
||||
"ssb-conn-hub": {
|
||||
"version": "0.2.7",
|
||||
"resolved": "https://registry.npmjs.org/ssb-conn-hub/-/ssb-conn-hub-0.2.7.tgz",
|
||||
"integrity": "sha512-fvX7HK44V65C8uMQhTK9B4SHZE7K5P0AU/cHVuDciKPNagEFV0QHKk//JnrrMKHKKvz1msKUxhA0S0iH0S4gqQ==",
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ssb-conn-hub/-/ssb-conn-hub-1.1.0.tgz",
|
||||
"integrity": "sha512-l/PVhYdO1ZrTfWHXvbDKNQaSXiEroiYbXZsAPQiYHRS4TAzrBPhI5uuFp69s3xzKKCVJJDkPhUIWBwZF6SCDgg==",
|
||||
"requires": {
|
||||
"debug": "^4.1.1",
|
||||
"debug": "^4.3.1",
|
||||
"ip": "^1.1.5",
|
||||
"multiserver": "^3.4.0",
|
||||
"multiserver": "^3.7.0",
|
||||
"multiserver-address": "~1.0.1",
|
||||
"promisify-tuple": "^1.0.0",
|
||||
"promisify-tuple": "^1.0.1",
|
||||
"pull-cat": "~1.1.11",
|
||||
"pull-notify": "~0.1.1",
|
||||
"pull-stream": "~3.6.9",
|
||||
"ssb-ref": "~2.13.9"
|
||||
},
|
||||
"dependencies": {
|
||||
"ssb-ref": {
|
||||
"version": "2.13.9",
|
||||
"resolved": "https://registry.npmjs.org/ssb-ref/-/ssb-ref-2.13.9.tgz",
|
||||
"integrity": "sha512-TfatNqLvoP+eW/pMIbCmNcaoDq4R2k8jCtWkwDKx4AtluN/LwtyP931d5Mh+2gmzA04W7kxkr6f5ENGgdadMYg==",
|
||||
"requires": {
|
||||
"ip": "^1.1.3",
|
||||
"is-canonical-base64": "^1.1.1",
|
||||
"is-valid-domain": "~0.0.1",
|
||||
"multiserver-address": "^1.0.1"
|
||||
}
|
||||
}
|
||||
"pull-stream": "^3.6.14",
|
||||
"ssb-ref": "^2.14.3"
|
||||
}
|
||||
},
|
||||
"ssb-conn-query": {
|
||||
"version": "0.4.6",
|
||||
"resolved": "https://registry.npmjs.org/ssb-conn-query/-/ssb-conn-query-0.4.6.tgz",
|
||||
"integrity": "sha512-qwa0xYK4r3DwbJQQ/K5umw4VAt3aGTkRbFN0E43Mb33+M94jnXMhDIxZWrPoX1vVQSRZLlCb+laXQiGlxW32AQ==",
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ssb-conn-query/-/ssb-conn-query-1.1.0.tgz",
|
||||
"integrity": "sha512-ynSlzwrtAPwQTOsZ74DmM90zRRCy6fI3kaePqKbSI4TVRUDh6zTn83lTYP56PiAr2PPNMB0ICIVLCstY4W70zg==",
|
||||
"requires": {
|
||||
"ssb-conn-db": "~0.3.3",
|
||||
"ssb-conn-hub": "~0.2.7",
|
||||
"ssb-conn-staging": "~0.1.0"
|
||||
"ssb-conn-db": "~1.0.1",
|
||||
"ssb-conn-hub": "~1.1.0",
|
||||
"ssb-conn-staging": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"ssb-conn-staging": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ssb-conn-staging/-/ssb-conn-staging-0.1.0.tgz",
|
||||
"integrity": "sha512-bFtArSUiF3QrJ9LJ1auonC40pxJd58eBzozBiWsburwbZLUuxqrnW/kCaoyu+PYwTvc0FvMzZR/g4yL2wcE4Yw==",
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ssb-conn-staging/-/ssb-conn-staging-1.0.0.tgz",
|
||||
"integrity": "sha512-NOy1qZoBkhH0XNzLteaaKKePXigEJSCntD4RPRU6vWLMlQ10+SzlIz4TWKgvEVx0LfCe6tEx/vhQf6vBWO/Ylw==",
|
||||
"requires": {
|
||||
"debug": "^4.1.1",
|
||||
"multiserver-address": "~1.0.1",
|
||||
@ -2787,40 +2770,27 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"ssb-gossip": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ssb-gossip/-/ssb-gossip-1.1.1.tgz",
|
||||
"integrity": "sha512-lbizlDBCtOOnbnz7zS81NOtnAyHnXu9E3gxrAJHZe7oyxINRI7IpQ8J79to9aXzkb8+2M32R8K4whmsAHGvJAg==",
|
||||
"requires": {
|
||||
"atomic-file": "^1.1.5",
|
||||
"deep-equal": "^1.0.1",
|
||||
"has-network": "0.0.1",
|
||||
"ip": "^1.1.5",
|
||||
"muxrpc-validation": "^3.0.0",
|
||||
"on-change-network": "0.0.2",
|
||||
"on-wakeup": "^1.0.1",
|
||||
"pull-notify": "^0.1.1",
|
||||
"pull-ping": "^2.0.2",
|
||||
"pull-stream": "^3.6.9",
|
||||
"ssb-ref": "^2.13.9",
|
||||
"statistics": "^3.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"atomic-file": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/atomic-file/-/atomic-file-1.1.5.tgz",
|
||||
"integrity": "sha512-TG+5YFiaKQ6CZiSQsosGMJ/IJzwMZ4V/rSdEXlD6+DwKyv8OyeUcprq34kp4yuS6bfQYXhxBC2Vm8PWo+iKBGQ=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"ssb-keys": {
|
||||
"version": "8.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ssb-keys/-/ssb-keys-8.0.1.tgz",
|
||||
"integrity": "sha512-UrNf65+pCM+XT9kAzKbz438xft3ymRBKFtd0xCCWhyIm5U0CzATw8dhyEBSIbwJ9Ibf4eGZKq1xnEPqlWsf7gA==",
|
||||
"version": "8.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ssb-keys/-/ssb-keys-8.1.0.tgz",
|
||||
"integrity": "sha512-RC2gFMptimj2QZZESOViKVhzqgXCnfW3IqUeKLQ/E8nnTdODuCVa3soLYu4KUF8nGIzFIfdKq7L2Teg32kD85w==",
|
||||
"requires": {
|
||||
"chloride": "~2.4.0",
|
||||
"chloride": "~2.4.1",
|
||||
"mkdirp": "~0.5.0",
|
||||
"private-box": "~0.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"chloride": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmjs.org/chloride/-/chloride-2.4.1.tgz",
|
||||
"integrity": "sha512-ZiID87W2o2llvuF4C7Fvt9GJisazSdMsSkjAq4WaMed9zn77nlkcy08ZfrPtOGAXyaxTDj0VjnuyD97EdJLz3g==",
|
||||
"requires": {
|
||||
"sodium-browserify": "^1.2.7",
|
||||
"sodium-browserify-tweetnacl": "^0.2.5",
|
||||
"sodium-chloride": "^1.1.2",
|
||||
"sodium-native": "^3.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ssb-logging": {
|
||||
@ -2953,15 +2923,16 @@
|
||||
}
|
||||
},
|
||||
"ssb-room-client": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/ssb-room-client/-/ssb-room-client-0.2.0.tgz",
|
||||
"integrity": "sha512-yTLxsY4R/enw3gICP3r5Eyf/o/LzL+qhyBS02k54Y3r1P3jQZsEjFx2CVpZ2HfvjlwTF6xo1k3QzwxiliIqqcA==",
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/ssb-room-client/-/ssb-room-client-0.4.0.tgz",
|
||||
"integrity": "sha512-qQSOYH2qQ+rYZjBx/cgluzMpOkfN/TalctVI6/hhdukvloxY0FbCbyqvJCEbxXWLreL6LGGz1N4UESOcimTECg==",
|
||||
"requires": {
|
||||
"debug": "^4.3.1",
|
||||
"pull-pair": "^1.1.0",
|
||||
"pull-stream": "^3.6.14",
|
||||
"ssb-conn-hub": ">=0.2.0",
|
||||
"ssb-conn-staging": ">=0.1.0",
|
||||
"ssb-keys": ">=8.1.0",
|
||||
"ssb-ref": "^2.14.3",
|
||||
"ssb-typescript": "^2.2.0"
|
||||
}
|
||||
@ -3022,30 +2993,30 @@
|
||||
}
|
||||
},
|
||||
"string.prototype.trim": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.3.tgz",
|
||||
"integrity": "sha512-16IL9pIBA5asNOSukPfxX2W68BaBvxyiRK16H3RA/lWW9BDosh+w7f+LhomPHpXJ82QEe7w7/rY/S1CV97raLg==",
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.4.tgz",
|
||||
"integrity": "sha512-hWCk/iqf7lp0/AgTF7/ddO1IWtSNPASjlzCicV5irAVdE1grjsneK26YG6xACMBEdCvO8fUST0UzDMh/2Qy+9Q==",
|
||||
"requires": {
|
||||
"call-bind": "^1.0.0",
|
||||
"call-bind": "^1.0.2",
|
||||
"define-properties": "^1.1.3",
|
||||
"es-abstract": "^1.18.0-next.1"
|
||||
"es-abstract": "^1.18.0-next.2"
|
||||
}
|
||||
},
|
||||
"string.prototype.trimend": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.3.tgz",
|
||||
"integrity": "sha512-ayH0pB+uf0U28CtjlLvL7NaohvR1amUvVZk+y3DYb0Ey2PUV5zPkkKy9+U1ndVEIXO8hNg18eIv9Jntbii+dKw==",
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz",
|
||||
"integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==",
|
||||
"requires": {
|
||||
"call-bind": "^1.0.0",
|
||||
"call-bind": "^1.0.2",
|
||||
"define-properties": "^1.1.3"
|
||||
}
|
||||
},
|
||||
"string.prototype.trimstart": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.3.tgz",
|
||||
"integrity": "sha512-oBIBUy5lea5tt0ovtOFiEQaBkoBBkyJhZXzJYrSmDo5IUUqbOPvVezuRs/agBIdZ2p2Eo1FD6bD9USyBLfl3xg==",
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz",
|
||||
"integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==",
|
||||
"requires": {
|
||||
"call-bind": "^1.0.0",
|
||||
"call-bind": "^1.0.2",
|
||||
"define-properties": "^1.1.3"
|
||||
}
|
||||
},
|
||||
@ -3168,11 +3139,11 @@
|
||||
}
|
||||
},
|
||||
"tape": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/tape/-/tape-5.1.1.tgz",
|
||||
"integrity": "sha512-ujhT+ZJPqSGY9Le02mIGBnyWo7Ks05FEGS9PnlqECr3sM3KyV4CSCXAvSBJKMN+t+aZYLKEFUEo0l4wFJMhppQ==",
|
||||
"version": "5.2.2",
|
||||
"resolved": "https://registry.npmjs.org/tape/-/tape-5.2.2.tgz",
|
||||
"integrity": "sha512-grXrzPC1ly2kyTMKdqxh5GiLpb0BpNctCuecTB0psHX4Gu0nc+uxWR4xKjTh/4CfQlH4zhvTM2/EXmHXp6v/uA==",
|
||||
"requires": {
|
||||
"call-bind": "^1.0.0",
|
||||
"call-bind": "^1.0.2",
|
||||
"deep-equal": "^2.0.5",
|
||||
"defined": "^1.0.0",
|
||||
"dotignore": "^0.1.2",
|
||||
@ -3180,14 +3151,14 @@
|
||||
"glob": "^7.1.6",
|
||||
"has": "^1.0.3",
|
||||
"inherits": "^2.0.4",
|
||||
"is-regex": "^1.1.1",
|
||||
"is-regex": "^1.1.2",
|
||||
"minimist": "^1.2.5",
|
||||
"object-inspect": "^1.9.0",
|
||||
"object-is": "^1.1.4",
|
||||
"object-is": "^1.1.5",
|
||||
"object.assign": "^4.1.2",
|
||||
"resolve": "^1.19.0",
|
||||
"resolve": "^2.0.0-next.3",
|
||||
"resumer": "^0.0.0",
|
||||
"string.prototype.trim": "^1.2.3",
|
||||
"string.prototype.trim": "^1.2.4",
|
||||
"through": "^2.3.8"
|
||||
},
|
||||
"dependencies": {
|
||||
@ -3212,6 +3183,24 @@
|
||||
"which-collection": "^1.0.1",
|
||||
"which-typed-array": "^1.1.2"
|
||||
}
|
||||
},
|
||||
"is-regex": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.2.tgz",
|
||||
"integrity": "sha512-axvdhb5pdhEVThqJzYXwMlVuZwC+FF2DpcOhTS+y/8jVq4trxyPgfcwIxIKiyeuLlSQYKkmUaPQJ8ZE4yNKXDg==",
|
||||
"requires": {
|
||||
"call-bind": "^1.0.2",
|
||||
"has-symbols": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"object-is": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz",
|
||||
"integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==",
|
||||
"requires": {
|
||||
"call-bind": "^1.0.2",
|
||||
"define-properties": "^1.1.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -3362,6 +3351,17 @@
|
||||
"resolved": "https://registry.npmjs.org/ultron/-/ultron-1.0.2.tgz",
|
||||
"integrity": "sha1-rOEWq1V80Zc4ak6I9GhTeMiy5Po="
|
||||
},
|
||||
"unbox-primitive": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.0.tgz",
|
||||
"integrity": "sha512-P/51NX+JXyxK/aigg1/ZgyccdAxm5K1+n8+tvqSntjOivPt19gvm1VC49RWYetsiub8WViUchdxl/KWHHB0kzA==",
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1",
|
||||
"has-bigints": "^1.0.0",
|
||||
"has-symbols": "^1.0.0",
|
||||
"which-boxed-primitive": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"unpipe": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||
@ -3456,15 +3456,10 @@
|
||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
||||
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
|
||||
},
|
||||
"zerr": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/zerr/-/zerr-1.0.4.tgz",
|
||||
"integrity": "sha1-YoFN15nv+DYfKiKPQfcFxeGd5Mk="
|
||||
},
|
||||
"zii": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/zii/-/zii-1.1.0.tgz",
|
||||
"integrity": "sha512-l4EKO8dgLsEWxdb/koCjv92FplAIAQaV4Riq5n/38dTC7Z3NwaFSKQ5Bda+CUTu11VtFE1D+4+HPfPt7/86CRw=="
|
||||
"ziii": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/ziii/-/ziii-1.0.2.tgz",
|
||||
"integrity": "sha512-q1FogtBIchy1W0fkxUpe6A4n4WUvAM+hAHN1J6LjBNCV42ZegeC5JSz0mcNv4qxnI0V4cL4FNeEhPMm97Ed0kA=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,17 +10,16 @@
|
||||
"dependencies": {
|
||||
"run-parallel": "^1.1.9",
|
||||
"run-series": "^1.1.9",
|
||||
"secret-stack": "^6.3.1",
|
||||
"secret-stack": "^6.3.2",
|
||||
"sodium-native": "^3.2.0",
|
||||
"ssb-config": "^3.4.5",
|
||||
"ssb-conn": "^0.19.1",
|
||||
"ssb-conn": "^2.1.0",
|
||||
"ssb-db2": "^1.18.5",
|
||||
"ssb-gossip": "^1.1.1",
|
||||
"ssb-keys": "^8.0.0",
|
||||
"ssb-keys": "^8.1.0",
|
||||
"ssb-replicate": "^1.3.2",
|
||||
"ssb-room": "^1.3.0",
|
||||
"ssb-room-client": "^0.2.0",
|
||||
"ssb-room-client": "^0.4.0",
|
||||
"tap-spec": "^5.0.0",
|
||||
"tape": "^5.0.1"
|
||||
"tape": "^5.2.2"
|
||||
}
|
||||
}
|
||||
|
@ -19,21 +19,18 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/ssb-ngi-pointer/go-ssb-room/internal/network"
|
||||
|
||||
"github.com/ssb-ngi-pointer/go-ssb-room/roomdb"
|
||||
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.cryptoscope.co/muxrpc/v2/debug"
|
||||
"go.cryptoscope.co/netwrap"
|
||||
refs "go.mindeco.de/ssb-refs"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
"github.com/ssb-ngi-pointer/go-ssb-room/internal/maybemod/testutils"
|
||||
"github.com/ssb-ngi-pointer/go-ssb-room/internal/network"
|
||||
"github.com/ssb-ngi-pointer/go-ssb-room/roomdb"
|
||||
"github.com/ssb-ngi-pointer/go-ssb-room/roomsrv"
|
||||
refs "go.mindeco.de/ssb-refs"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -120,7 +117,7 @@ func (ts *testSession) startGoServer(
|
||||
}),
|
||||
)
|
||||
|
||||
srv, err := roomsrv.New(membersDB, aliasDB, opts...)
|
||||
srv, err := roomsrv.New(membersDB, aliasDB, "go.test.room.server", opts...)
|
||||
r.NoError(err, "failed to init tees a server")
|
||||
ts.t.Logf("go server: %s", srv.Whoami().Ref())
|
||||
ts.t.Cleanup(func() {
|
||||
|
27
muxrpc/test/nodejs/testscripts/modern_aliases.js
Normal file
27
muxrpc/test/nodejs/testscripts/modern_aliases.js
Normal file
@ -0,0 +1,27 @@
|
||||
const secretStackPlugins = require('./secretstack-modern')
|
||||
const before = require('./minimal-before-setup')
|
||||
|
||||
module.exports = {
|
||||
secretStackPlugins,
|
||||
before,
|
||||
after: (t, sbot, rpc, exit) => {
|
||||
|
||||
// give ssb-conn a moment to settle
|
||||
setTimeout(() => {
|
||||
|
||||
sbot.roomClient.registerAlias(rpc.id, "alice", (err, ret) => {
|
||||
t.error(err, 'registerAlias')
|
||||
t.ok(ret)
|
||||
t.equals(typeof ret, 'string')
|
||||
t.ok(new URL(ret))
|
||||
|
||||
sbot.roomClient.revokeAlias(rpc.id, "alice", (err, ret) => {
|
||||
t.error(err, 'revokeAlias')
|
||||
t.comment(`revokeAlias value: ${ret}`)
|
||||
exit()
|
||||
})
|
||||
})
|
||||
|
||||
}, 1000)
|
||||
}
|
||||
}
|
@ -28,6 +28,7 @@ func (s *Server) initHandlers(aliasDB roomdb.AliasesService) {
|
||||
kitlog.With(s.logger, "unit", "aliases"),
|
||||
s.Whoami(),
|
||||
aliasDB,
|
||||
s.domain,
|
||||
)
|
||||
|
||||
// register muxrpc commands
|
||||
|
@ -45,6 +45,8 @@ type Server struct {
|
||||
wsAddr string
|
||||
dialer netwrap.Dialer
|
||||
|
||||
domain string // the DNS domain name of the room
|
||||
|
||||
loadUnixSock bool
|
||||
|
||||
repo repo.Interface
|
||||
@ -73,6 +75,7 @@ func (s Server) Whoami() refs.FeedRef {
|
||||
func New(
|
||||
membersdb roomdb.MembersService,
|
||||
aliasdb roomdb.AliasesService,
|
||||
domainName string,
|
||||
opts ...Option,
|
||||
) (*Server, error) {
|
||||
var s Server
|
||||
@ -81,6 +84,8 @@ func New(
|
||||
s.Members = membersdb
|
||||
s.Aliases = aliasdb
|
||||
|
||||
s.domain = domainName
|
||||
|
||||
for i, opt := range opts {
|
||||
err := opt(&s)
|
||||
if err != nil {
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
"go.mindeco.de/http/render"
|
||||
refs "go.mindeco.de/ssb-refs"
|
||||
|
||||
"github.com/ssb-ngi-pointer/go-ssb-room/aliases"
|
||||
"github.com/ssb-ngi-pointer/go-ssb-room/internal/aliases"
|
||||
"github.com/ssb-ngi-pointer/go-ssb-room/roomdb"
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user