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

21 lines
385 B
Go

package crypto
import (
"encoding/base64"
"google.golang.org/protobuf/proto"
"go.mau.fi/mautrix-gmessages/libgm/binary"
)
func DecodeAndEncodeB64(data string, msg proto.Message) error {
decodedBytes, err := base64.StdEncoding.DecodeString(data)
if err != nil {
return err
}
err = binary.DecodeProtoMessage(decodedBytes, msg)
if err != nil {
return err
}
return nil
}