mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-17 15:46:44 +00:00
Other: Fix wrong encoding used for public key during sending
The newer liteapi contact code saves keys as *crypto.Key, however the legacy code expects them to be strings. There was a bug in connecting the new code to the legacy code: it was assumed these strings were meant to be a base64 encoded string but they were actually just raw string bytes.
This commit is contained in:
2
go.mod
2
go.mod
@ -39,7 +39,7 @@ require (
|
||||
github.com/stretchr/testify v1.8.0
|
||||
github.com/urfave/cli/v2 v2.20.3
|
||||
github.com/vmihailenco/msgpack/v5 v5.3.5
|
||||
gitlab.protontech.ch/go/liteapi v0.37.1
|
||||
gitlab.protontech.ch/go/liteapi v0.37.2
|
||||
go.uber.org/goleak v1.2.0
|
||||
golang.org/x/exp v0.0.0-20221023144134-a1e5550cf13e
|
||||
golang.org/x/net v0.1.0
|
||||
|
||||
4
go.sum
4
go.sum
@ -403,8 +403,8 @@ github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsr
|
||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
github.com/zclconf/go-cty v1.11.0 h1:726SxLdi2SDnjY+BStqB9J1hNp4+2WlzyXLuimibIe0=
|
||||
github.com/zclconf/go-cty v1.11.0/go.mod h1:s9IfD1LK5ccNMSWCVFCE2rJfHiZgi7JijgeWIMfhLvA=
|
||||
gitlab.protontech.ch/go/liteapi v0.37.1 h1:ajYSnz733L//i9SKOSqxGlZh4bNFYkCnfrUYli52CS4=
|
||||
gitlab.protontech.ch/go/liteapi v0.37.1/go.mod h1:IM7ADWjgIL2hXopzx0WNamizEuMgM2QZl7QH12FNflk=
|
||||
gitlab.protontech.ch/go/liteapi v0.37.2 h1:9oM5knclpye72tFpphvGbqb4uPnC4q1VwFu+WksS9Xg=
|
||||
gitlab.protontech.ch/go/liteapi v0.37.2/go.mod h1:IM7ADWjgIL2hXopzx0WNamizEuMgM2QZl7QH12FNflk=
|
||||
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
|
||||
"github.com/ProtonMail/gluon/rfc822"
|
||||
@ -62,23 +61,15 @@ func newContactSettings(settings liteapi.ContactSettings) *contactSettings {
|
||||
}
|
||||
|
||||
if settings.Scheme != nil {
|
||||
switch *settings.Scheme {
|
||||
switch *settings.Scheme { // nolint:exhaustive
|
||||
case liteapi.PGPMIMEScheme:
|
||||
metadata.Scheme = pgpMIME
|
||||
|
||||
case liteapi.PGPInlineScheme:
|
||||
metadata.Scheme = pgpInline
|
||||
|
||||
case liteapi.InternalScheme:
|
||||
fallthrough
|
||||
case liteapi.EncryptedOutsideScheme:
|
||||
fallthrough
|
||||
case liteapi.ClearScheme:
|
||||
fallthrough
|
||||
case liteapi.ClearMIMEScheme:
|
||||
fallthrough
|
||||
default:
|
||||
break
|
||||
panic("unknown scheme")
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,7 +80,7 @@ func newContactSettings(settings liteapi.ContactSettings) *contactSettings {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
metadata.Keys = append(metadata.Keys, base64.StdEncoding.EncodeToString(b))
|
||||
metadata.Keys = append(metadata.Keys, string(b))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user