mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-10 15:43:09 -06:00
Rename method
This commit is contained in:
parent
0873d83d82
commit
6a1d689f65
|
|
@ -68,8 +68,8 @@ type RoomserverInternalAPI interface {
|
|||
res *QueryAuthChainResponse,
|
||||
) error
|
||||
|
||||
// GetUserRoomPrivateKey gets the user room key for the specified user. If no key exists yet, a new one is created.
|
||||
GetUserRoomPrivateKey(ctx context.Context, userID spec.UserID, roomID spec.RoomID) (ed25519.PrivateKey, error)
|
||||
// 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)
|
||||
}
|
||||
|
||||
type InputRoomEventsAPI interface {
|
||||
|
|
|
|||
|
|
@ -272,8 +272,8 @@ func (r *RoomserverInternalAPI) PerformForget(
|
|||
return r.Forgetter.PerformForget(ctx, req, resp)
|
||||
}
|
||||
|
||||
// GetUserRoomPrivateKey gets the user room key for the specified user. If no key exists yet, a new one is created.
|
||||
func (r *RoomserverInternalAPI) GetUserRoomPrivateKey(ctx context.Context, userID spec.UserID, roomID spec.RoomID) (ed25519.PrivateKey, error) {
|
||||
// GetOrCreateUserRoomPrivateKey gets the user room key for the specified user. If no key exists yet, a new one is created.
|
||||
func (r *RoomserverInternalAPI) GetOrCreateUserRoomPrivateKey(ctx context.Context, userID spec.UserID, roomID spec.RoomID) (ed25519.PrivateKey, error) {
|
||||
key, err := r.DB.SelectUserRoomPrivateKey(ctx, userID, roomID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
|
|
@ -366,9 +366,9 @@ func (c *Creator) PerformCreateRoom(ctx context.Context, userID spec.UserID, roo
|
|||
|
||||
// create user room key if needed
|
||||
if createRequest.RoomVersion == gomatrixserverlib.RoomVersionPseudoIDs {
|
||||
_, err = c.RSAPI.GetUserRoomPrivateKey(ctx, userID, roomID)
|
||||
_, err = c.RSAPI.GetOrCreateUserRoomPrivateKey(ctx, userID, roomID)
|
||||
if err != nil {
|
||||
util.GetLogger(ctx).WithError(err).Error("GetUserRoomPrivateKey failed")
|
||||
util.GetLogger(ctx).WithError(err).Error("GetOrCreateUserRoomPrivateKey failed")
|
||||
return "", &util.JSONResponse{
|
||||
Code: http.StatusInternalServerError,
|
||||
JSON: spec.InternalServerError{},
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ func (r *Inviter) PerformInvite(
|
|||
|
||||
// if we invited a local user, we can also create a user room key, if it doesn't exist yet.
|
||||
if isTargetLocal && event.Version() == gomatrixserverlib.RoomVersionPseudoIDs {
|
||||
_, err = r.RSAPI.GetUserRoomPrivateKey(ctx, *invitedUser, *validRoomID)
|
||||
_, err = r.RSAPI.GetOrCreateUserRoomPrivateKey(ctx, *invitedUser, *validRoomID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get user room private key: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -296,9 +296,9 @@ func (r *Joiner) performJoinRoomByID(
|
|||
case nil:
|
||||
// create user room key if needed
|
||||
if buildRes.RoomVersion == gomatrixserverlib.RoomVersionPseudoIDs {
|
||||
_, err = r.RSAPI.GetUserRoomPrivateKey(ctx, *userID, *roomID)
|
||||
_, err = r.RSAPI.GetOrCreateUserRoomPrivateKey(ctx, *userID, *roomID)
|
||||
if err != nil {
|
||||
util.GetLogger(ctx).WithError(err).Error("GetUserRoomPrivateKey failed")
|
||||
util.GetLogger(ctx).WithError(err).Error("GetOrCreateUserRoomPrivateKey failed")
|
||||
return "", "", fmt.Errorf("failed to get user room private key: %w", err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue