gmessages/libgm/payload/getWebEncryptionKey.go

23 lines
578 B
Go
Raw Normal View History

2023-06-30 09:54:08 +00:00
package payload
import (
"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
},
}
encodedPayload, err2 := binary.EncodeProtoMessage(payload)
if err2 != nil {
return nil, payload, err2
}
return encodedPayload, payload, nil
}