gmessages/libgm/payload/getWebEncryptionKey.go

25 lines
603 B
Go
Raw Normal View History

2023-06-30 09:54:08 +00:00
package payload
import (
2023-07-15 17:43:28 +00:00
"google.golang.org/protobuf/proto"
2023-06-30 09:54:08 +00:00
"go.mau.fi/mautrix-gmessages/libgm/binary"
"go.mau.fi/mautrix-gmessages/libgm/util"
)
func GetWebEncryptionKey(WebPairKey []byte) ([]byte, *binary.AuthenticationContainer, error) {
2023-06-30 09:54:08 +00:00
id := util.RandomUUIDv4()
payload := &binary.AuthenticationContainer{
AuthMessage: &binary.AuthenticationMessage{
RequestID: id,
TachyonAuthToken: WebPairKey,
ConfigVersion: ConfigMessage,
2023-06-30 09:54:08 +00:00
},
}
2023-07-15 17:43:28 +00:00
encodedPayload, err2 := proto.Marshal(payload)
2023-06-30 09:54:08 +00:00
if err2 != nil {
return nil, payload, err2
}
return encodedPayload, payload, nil
}