mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-05 21:23:10 -06:00
pull dendrite subtree and resolve merge conflicts
This commit is contained in:
parent
1f48e57e6f
commit
38642eb363
|
|
@ -29,7 +29,7 @@ import (
|
|||
type LoginPublicKeyEthereum struct {
|
||||
// https://github.com/tak-hntlabs/matrix-spec-proposals/blob/main/proposals/3782-matrix-publickey-login-spec.md#client-sends-login-request-with-authentication-data
|
||||
Type string `json:"type"`
|
||||
Address string `json:"address"`
|
||||
UserId string `json:"user_id"`
|
||||
Session string `json:"session"`
|
||||
Message string `json:"message"`
|
||||
Signature string `json:"signature"`
|
||||
|
|
@ -51,7 +51,7 @@ func CreatePublicKeyEthereumHandler(
|
|||
pk.config = config
|
||||
pk.userAPI = userAPI
|
||||
// Case-insensitive
|
||||
pk.Address = strings.ToLower(pk.Address)
|
||||
pk.UserId = strings.ToLower(pk.UserId)
|
||||
|
||||
return &pk, nil
|
||||
}
|
||||
|
|
@ -65,7 +65,7 @@ func (pk LoginPublicKeyEthereum) GetType() string {
|
|||
}
|
||||
|
||||
func (pk LoginPublicKeyEthereum) AccountExists(ctx context.Context) (string, *jsonerror.MatrixError) {
|
||||
localPart, err := userutil.ParseUsernameParam(pk.Address, &pk.config.Matrix.ServerName)
|
||||
localPart, err := userutil.ParseUsernameParam(pk.UserId, &pk.config.Matrix.ServerName)
|
||||
if err != nil {
|
||||
// userId does not exist
|
||||
return "", jsonerror.Forbidden("the address is incorrect, or the account does not exist.")
|
||||
|
|
@ -110,7 +110,7 @@ func (pk LoginPublicKeyEthereum) ValidateLoginResponse() (bool, *jsonerror.Matri
|
|||
func (pk LoginPublicKeyEthereum) CreateLogin() *Login {
|
||||
identifier := LoginIdentifier{
|
||||
Type: "m.id.publickey",
|
||||
User: pk.Address,
|
||||
User: pk.UserId,
|
||||
}
|
||||
login := Login{
|
||||
Identifier: identifier,
|
||||
|
|
|
|||
|
|
@ -775,7 +775,7 @@ func handleRegistrationFlow(
|
|||
if isCompleted {
|
||||
sessions.addCompletedSessionStage(sessionID, authType)
|
||||
} else {
|
||||
newPublicKeyAuthSession(&r)
|
||||
newPublicKeyAuthSession(&r, sessions, sessionID)
|
||||
}
|
||||
|
||||
case "":
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ import (
|
|||
"github.com/tidwall/gjson"
|
||||
)
|
||||
|
||||
func newPublicKeyAuthSession(request *registerRequest) {
|
||||
func newPublicKeyAuthSession(request *registerRequest, sessions *sessionsDict, sessionID string) {
|
||||
sessions.sessions[sessionID] = append(sessions.sessions[sessionID], authtypes.LoginTypePublicKey)
|
||||
// Public key auth does not use password. But the registration flow
|
||||
// requires setting a password in order to create the account.
|
||||
// Create a random password to satisfy the requirement.
|
||||
|
|
|
|||
Loading…
Reference in a new issue