Make generating cross-signing keys work

This commit is contained in:
Tulir Asokan 2020-09-12 02:47:10 +03:00
parent ae862b9f44
commit c6d1c62b65
4 changed files with 14 additions and 5 deletions

2
go.mod
View File

@ -29,4 +29,4 @@ require (
)
//replace maunium.net/go/mautrix => ../mautrix-go
replace maunium.net/go/mautrix => github.com/nikofil/mautrix-go v0.5.2-0.20200911232449-6010305aed05
replace maunium.net/go/mautrix => github.com/nikofil/mautrix-go v0.5.2-0.20200911234625-a585557b3750

2
go.sum
View File

@ -54,6 +54,8 @@ github.com/nikofil/mautrix-go v0.5.2-0.20200911223256-b40ab761fadc h1:Un166sriST
github.com/nikofil/mautrix-go v0.5.2-0.20200911223256-b40ab761fadc/go.mod h1:xd0D0ekVts/UDBbjeDSs4wGlBfcarJDg0MMhVgHbxhs=
github.com/nikofil/mautrix-go v0.5.2-0.20200911232449-6010305aed05 h1:WFyJHdXasAvpno0OSvKgfmZHlq0WoyK+254vxmz4Mag=
github.com/nikofil/mautrix-go v0.5.2-0.20200911232449-6010305aed05/go.mod h1:xd0D0ekVts/UDBbjeDSs4wGlBfcarJDg0MMhVgHbxhs=
github.com/nikofil/mautrix-go v0.5.2-0.20200911234625-a585557b3750 h1:3eUgrAhYHnI0HidL2uO1uga8dpnqpAXIN0DB7uWc95Y=
github.com/nikofil/mautrix-go v0.5.2-0.20200911234625-a585557b3750/go.mod h1:xd0D0ekVts/UDBbjeDSs4wGlBfcarJDg0MMhVgHbxhs=
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=

View File

@ -42,6 +42,7 @@ const uiaFallbackPage = `<!DOCTYPE html>
</head>
<body>
<h2>Please complete the login in the popup window</h2>
<p>Keep this page open while logging in, it will close automatically after the login finishes.</p>
<button onclick="openPopup()">Open popup</button>
<button onclick="finish(false)">Cancel</button>
<script>

View File

@ -350,6 +350,7 @@ func cmdS4Status(cmd *Command, mach *crypto.OlmMachine, keyID string) {
}
if errors.Is(err, ssss.ErrNoDefaultKeyAccountDataEvent) {
cmd.Reply("SSSS is not set up: no default key set")
return
} else if err != nil {
cmd.Reply("Failed to get key data: %v", err)
return
@ -366,7 +367,7 @@ func cmdS4Status(cmd *Command, mach *crypto.OlmMachine, keyID string) {
}
func cmdS4Generate(cmd *Command, mach *crypto.OlmMachine, setDefault bool) {
passphrase, ok := cmd.MainView.AskPassword("Passphrase", "", "", false)
passphrase, ok := cmd.MainView.AskPassword("Passphrase", "", "", true)
if !ok {
return
}
@ -554,9 +555,9 @@ func cmdCrossSigningGenerate(cmd *Command, container ifc.MatrixContainer, mach *
cmd.Reply("Authentication failed: %v", err)
return nil
}
return &mautrix.BaseAuthData{
Type: flow.Stages[0],
return &mautrix.ReqUIAuthFallback{
Session: uia.Session,
User: mach.Client.UserID.String(),
}
}
cmd.Reply("No supported authentication mechanisms found")
@ -581,6 +582,12 @@ func cmdCrossSigningGenerate(cmd *Command, container ifc.MatrixContainer, mach *
}
mach.CrossSigningKeys = keys
cmd.Reply("Successfully generated and published cross-signing keys")
err = mach.SignOwnMasterKey()
if err != nil {
cmd.Reply("Failed to sign master key with device key: %v", err)
}
}
func getSSSS(cmd *Command, mach *crypto.OlmMachine) *ssss.Key {
@ -646,7 +653,6 @@ func cmdCrossSigningUpload(cmd *Command, mach *crypto.OlmMachine) {
}
}
func cmdCrossSigningSelfSign(cmd *Command, mach *crypto.OlmMachine) {
if mach.CrossSigningKeys == nil {
cmd.Reply("Cross-signing keys not cached")