gmessages/libgm/qr.go
Tulir Asokan 1615e146b6 Update library
Co-authored-by: zero <108243503+0xzer@users.noreply.github.com>
2023-07-09 14:49:55 +03:00

22 lines
544 B
Go

package libgm
import (
"encoding/base64"
"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,
AESKey: p.client.authData.Cryptor.AESKey,
HMACKey: p.client.authData.Cryptor.HMACKey,
}
encodedUrlData, err := binary.EncodeProtoMessage(urlData)
if err != nil {
return "", err
}
cData := base64.StdEncoding.EncodeToString(encodedUrlData)
return util.QRCodeURLBase + cData, nil
}