mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-11 16:13:10 -06:00
Pass in user room key creator to perform join
This commit is contained in:
parent
9c0f7b7dd2
commit
ab0bf16ebd
|
|
@ -170,6 +170,14 @@ func (r *FederationInternalAPI) performJoinUsingServer(
|
|||
UserIDQuerier: func(roomID spec.RoomID, senderID spec.SenderID) (*spec.UserID, error) {
|
||||
return r.rsAPI.QueryUserIDForSender(ctx, roomID, senderID)
|
||||
},
|
||||
SenderIDCreator: func(ctx context.Context, userID spec.UserID, roomID spec.RoomID) (spec.SenderID, error) {
|
||||
key, err := r.rsAPI.GetOrCreateUserRoomPrivateKey(ctx, userID, roomID)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return spec.SenderID(spec.Base64Bytes(key).Encode()), nil
|
||||
},
|
||||
}
|
||||
response, joinErr := gomatrixserverlib.PerformJoin(ctx, r, joinInput)
|
||||
|
||||
|
|
|
|||
2
go.mod
2
go.mod
|
|
@ -22,7 +22,7 @@ require (
|
|||
github.com/matrix-org/dugong v0.0.0-20210921133753-66e6b1c67e2e
|
||||
github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91
|
||||
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530
|
||||
github.com/matrix-org/gomatrixserverlib v0.0.0-20230614131217-2d6e6fab7500
|
||||
github.com/matrix-org/gomatrixserverlib v0.0.0-20230614132606-ed482e9b7fee
|
||||
github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a
|
||||
github.com/matrix-org/util v0.0.0-20221111132719-399730281e66
|
||||
github.com/mattn/go-sqlite3 v1.14.16
|
||||
|
|
|
|||
4
go.sum
4
go.sum
|
|
@ -323,8 +323,8 @@ github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91 h1:s7fexw
|
|||
github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91/go.mod h1:e+cg2q7C7yE5QnAXgzo512tgFh1RbQLC0+jozuegKgo=
|
||||
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530 h1:kHKxCOLcHH8r4Fzarl4+Y3K5hjothkVW5z7T1dUM11U=
|
||||
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530/go.mod h1:/gBX06Kw0exX1HrwmoBibFA98yBk/jxKpGVeyQbff+s=
|
||||
github.com/matrix-org/gomatrixserverlib v0.0.0-20230614131217-2d6e6fab7500 h1:/HrUyJl02nguDKl5VDpOpwkWuDHt3L+dc4TQNWFCr0E=
|
||||
github.com/matrix-org/gomatrixserverlib v0.0.0-20230614131217-2d6e6fab7500/go.mod h1:H9V9N3Uqn1bBJqYJNGK1noqtgJTaCEhtTdcH/mp50uU=
|
||||
github.com/matrix-org/gomatrixserverlib v0.0.0-20230614132606-ed482e9b7fee h1:EKtDtgXag5GR3X9MTnPoTAyoh3pzowAWlxVQvFrYSQE=
|
||||
github.com/matrix-org/gomatrixserverlib v0.0.0-20230614132606-ed482e9b7fee/go.mod h1:H9V9N3Uqn1bBJqYJNGK1noqtgJTaCEhtTdcH/mp50uU=
|
||||
github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a h1:awrPDf9LEFySxTLKYBMCiObelNx/cBuv/wzllvCCH3A=
|
||||
github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a/go.mod h1:HchJX9oKMXaT2xYFs0Ha/6Zs06mxLU8k6F1ODnrGkeQ=
|
||||
github.com/matrix-org/util v0.0.0-20221111132719-399730281e66 h1:6z4KxomXSIGWqhHcfzExgkH3Z3UkIXry4ibJS4Aqz2Y=
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ type RoomserverInternalAPI interface {
|
|||
UserRoomserverAPI
|
||||
FederationRoomserverAPI
|
||||
QuerySenderIDAPI
|
||||
UserRoomPrivateKeyCreator
|
||||
|
||||
// needed to avoid chicken and egg scenario when setting up the
|
||||
// interdependencies between the roomserver and other input APIs
|
||||
|
|
@ -67,7 +68,9 @@ type RoomserverInternalAPI interface {
|
|||
req *QueryAuthChainRequest,
|
||||
res *QueryAuthChainResponse,
|
||||
) error
|
||||
}
|
||||
|
||||
type UserRoomPrivateKeyCreator interface {
|
||||
// GetOrCreateUserRoomPrivateKey gets the user room key for the specified user. If no key exists yet, a new one is created.
|
||||
GetOrCreateUserRoomPrivateKey(ctx context.Context, userID spec.UserID, roomID spec.RoomID) (ed25519.PrivateKey, error)
|
||||
}
|
||||
|
|
@ -228,6 +231,7 @@ type FederationRoomserverAPI interface {
|
|||
QueryLatestEventsAndStateAPI
|
||||
QueryBulkStateContentAPI
|
||||
QuerySenderIDAPI
|
||||
UserRoomPrivateKeyCreator
|
||||
|
||||
// QueryServerBannedFromRoom returns whether a server is banned from a room by server ACLs.
|
||||
QueryServerBannedFromRoom(ctx context.Context, req *QueryServerBannedFromRoomRequest, res *QueryServerBannedFromRoomResponse) error
|
||||
|
|
|
|||
Loading…
Reference in a new issue