Use []byte directly for ImportKeys and ExportKeys
This commit is contained in:
parent
0a9612bf14
commit
c47252979c
2
go.mod
2
go.mod
@ -23,7 +23,7 @@ require (
|
|||||||
golang.org/x/net v0.0.0-20200602114024-627f9648deb9
|
golang.org/x/net v0.0.0-20200602114024-627f9648deb9
|
||||||
gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2
|
gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2
|
||||||
gopkg.in/yaml.v2 v2.3.0
|
gopkg.in/yaml.v2 v2.3.0
|
||||||
maunium.net/go/mautrix v0.7.3
|
maunium.net/go/mautrix v0.7.4
|
||||||
maunium.net/go/mauview v0.1.1
|
maunium.net/go/mauview v0.1.1
|
||||||
maunium.net/go/tcell v0.2.0
|
maunium.net/go/tcell v0.2.0
|
||||||
)
|
)
|
||||||
|
2
go.sum
2
go.sum
@ -121,6 +121,8 @@ maunium.net/go/mautrix v0.7.1 h1:ctoAVWUPs0D1AADzuA3KLmaRONnSY61mdUoP2smNqe4=
|
|||||||
maunium.net/go/mautrix v0.7.1/go.mod h1:Va/74MijqaS0DQ3aUqxmFO54/PMfr1LVsCOcGRHbYmo=
|
maunium.net/go/mautrix v0.7.1/go.mod h1:Va/74MijqaS0DQ3aUqxmFO54/PMfr1LVsCOcGRHbYmo=
|
||||||
maunium.net/go/mautrix v0.7.3 h1:yC287SXL0pTZzAtpGIvwtlxPHZsWMuq2DmI5/POTKFE=
|
maunium.net/go/mautrix v0.7.3 h1:yC287SXL0pTZzAtpGIvwtlxPHZsWMuq2DmI5/POTKFE=
|
||||||
maunium.net/go/mautrix v0.7.3/go.mod h1:Va/74MijqaS0DQ3aUqxmFO54/PMfr1LVsCOcGRHbYmo=
|
maunium.net/go/mautrix v0.7.3/go.mod h1:Va/74MijqaS0DQ3aUqxmFO54/PMfr1LVsCOcGRHbYmo=
|
||||||
|
maunium.net/go/mautrix v0.7.4 h1:MDjrvDyHcu5ozKAa80ohcXmYAXZTHgHxrhiERtvkEdY=
|
||||||
|
maunium.net/go/mautrix v0.7.4/go.mod h1:Va/74MijqaS0DQ3aUqxmFO54/PMfr1LVsCOcGRHbYmo=
|
||||||
maunium.net/go/mauview v0.1.1 h1:wfTXyPx3LGAGpTskh+UbBv/QItUWnEpaneHmywoYnfY=
|
maunium.net/go/mauview v0.1.1 h1:wfTXyPx3LGAGpTskh+UbBv/QItUWnEpaneHmywoYnfY=
|
||||||
maunium.net/go/mauview v0.1.1/go.mod h1:3QBUiuLct9moP1LgDhCGIg0Ovxn38Bd2sGndnUOuj4o=
|
maunium.net/go/mauview v0.1.1/go.mod h1:3QBUiuLct9moP1LgDhCGIg0Ovxn38Bd2sGndnUOuj4o=
|
||||||
maunium.net/go/tcell v0.2.0 h1:1Q0kN3wCOGAIGu1r3QHADsjSUOPDylKREvCv3EzJpVg=
|
maunium.net/go/tcell v0.2.0 h1:1Q0kN3wCOGAIGu1r3QHADsjSUOPDylKREvCv3EzJpVg=
|
||||||
|
@ -246,7 +246,7 @@ func cmdImportKeys(cmd *Command) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
mach := cmd.Matrix.Crypto().(*crypto.OlmMachine)
|
mach := cmd.Matrix.Crypto().(*crypto.OlmMachine)
|
||||||
imported, total, err := mach.ImportKeys(extremelyTemporaryHardcodedPassphrase, string(data))
|
imported, total, err := mach.ImportKeys(extremelyTemporaryHardcodedPassphrase, data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cmd.Reply("Failed to import sessions: %v", err)
|
cmd.Reply("Failed to import sessions: %v", err)
|
||||||
} else {
|
} else {
|
||||||
@ -259,7 +259,7 @@ func exportKeys(cmd *Command, sessions []*crypto.InboundGroupSession) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
cmd.Reply("Failed to export sessions: %v", err)
|
cmd.Reply("Failed to export sessions: %v", err)
|
||||||
}
|
}
|
||||||
err = ioutil.WriteFile(cmd.RawArgs, []byte(export), 0400)
|
err = ioutil.WriteFile(cmd.RawArgs, export, 0400)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cmd.Reply("Failed to write sessions to %s: %v", cmd.RawArgs, err)
|
cmd.Reply("Failed to write sessions to %s: %v", cmd.RawArgs, err)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user