Update gomatrixserverlib (#90)

This commit is contained in:
Mark Haines 2017-05-05 17:43:42 +01:00 committed by GitHub
parent 0309035aad
commit a56f609b74
10 changed files with 71 additions and 62 deletions

View file

@ -22,7 +22,7 @@ import (
// ClientAPI contains the config information necessary to spin up a clientapi process.
type ClientAPI struct {
// The name of the server. This is usually the domain name, e.g 'matrix.org', 'localhost'.
ServerName string
ServerName gomatrixserverlib.ServerName
// The private key which will be used to sign events.
PrivateKey ed25519.PrivateKey
// An arbitrary string used to uniquely identify the PrivateKey. Must start with the

View file

@ -19,6 +19,7 @@ import (
"github.com/matrix-org/dendrite/clientapi/config"
"github.com/matrix-org/dendrite/clientapi/httputil"
"github.com/matrix-org/dendrite/clientapi/jsonerror"
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/util"
"net/http"
)
@ -38,9 +39,9 @@ type passwordRequest struct {
}
type loginResponse struct {
UserID string `json:"user_id"`
AccessToken string `json:"access_token"`
HomeServer string `json:"home_server"`
UserID string `json:"user_id"`
AccessToken string `json:"access_token"`
HomeServer gomatrixserverlib.ServerName `json:"home_server"`
}
func passwordLogin() loginFlows {
@ -85,6 +86,6 @@ func Login(req *http.Request, cfg config.ClientAPI) util.JSONResponse {
}
}
func makeUserID(localpart, domain string) string {
func makeUserID(localpart string, domain gomatrixserverlib.ServerName) string {
return fmt.Sprintf("@%s:%s", localpart, domain)
}

View file

@ -111,7 +111,10 @@ func buildAndOutput() gomatrixserverlib.EventReference {
eventID++
id := fmt.Sprintf("$%d:%s", eventID, *serverName)
now = time.Unix(0, 0)
event, err := b.Build(id, now, *serverName, gomatrixserverlib.KeyID(*keyID), privateKey)
name := gomatrixserverlib.ServerName(*serverName)
key := gomatrixserverlib.KeyID(*keyID)
event, err := b.Build(id, now, name, key, privateKey)
if err != nil {
panic(err)
}