gmessages/libgm/qr.go

23 lines
555 B
Go
Raw Normal View History

2023-06-30 09:54:08 +00:00
package textgapi
import (
2023-06-30 10:48:52 +00:00
"encoding/base64"
2023-06-30 09:54:08 +00:00
"go.mau.fi/mautrix-gmessages/libgm/binary"
"go.mau.fi/mautrix-gmessages/libgm/util"
)
func (p *Pairer) GenerateQRCodeData() (string, error) {
urlData := &binary.UrlData{
PairingKey: p.pairingKey,
AES_CTR_KEY_256: p.client.cryptor.AES_CTR_KEY_256,
SHA_256_KEY: p.client.cryptor.SHA_256_KEY,
}
encodedUrlData, err := binary.EncodeProtoMessage(urlData)
if err != nil {
return "", err
}
2023-06-30 10:48:52 +00:00
cData := base64.StdEncoding.EncodeToString(encodedUrlData)
2023-06-30 09:54:08 +00:00
return util.QR_CODE_URL + cData, nil
}