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"
|
|
|
|
)
|
|
|
|
|
2023-07-09 11:16:52 +00:00
|
|
|
func GetWebEncryptionKey(WebPairKey []byte) ([]byte, *binary.AuthenticationContainer, error) {
|
2023-06-30 09:54:08 +00:00
|
|
|
id := util.RandomUUIDv4()
|
2023-07-09 11:16:52 +00:00
|
|
|
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
|
|
|
|
}
|