OpenID Connect (OIDC) identity and OAuth 2.0 provider with pluggable connectors
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
package internal
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"encoding/base64"
|
|
|
|
|
|
|
|
|
|
"google.golang.org/protobuf/proto"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Marshal converts a protobuf message to a URL legal string.
|
|
|
|
|
func Marshal(message proto.Message) (string, error) {
|
|
|
|
|
data, err := proto.Marshal(message)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return "", err
|
|
|
|
|
}
|
|
|
|
|
return base64.RawURLEncoding.EncodeToString(data), nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Unmarshal decodes a protobuf message.
|
|
|
|
|
func Unmarshal(s string, message proto.Message) error {
|
|
|
|
|
data, err := base64.RawURLEncoding.DecodeString(s)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
return proto.Unmarshal(data, message)
|
|
|
|
|
}
|