Documentation
¶
Index ¶
- Variables
- func Marshal[M any, P Pointer[M], T Marshaler[P]](v T) ([]byte, error)
- func Time(t time.Time) *pbt.Timestamp
- func Unmarshal[M any, P Pointer[M], T Unmarshaler[P]](b []byte, v T) error
- type HMACKey
- type KeyVersion
- func (*KeyVersion) Descriptor() ([]byte, []int)deprecated
- func (x *KeyVersion) GetCreatedAt() *timestamppb.Timestamp
- func (x *KeyVersion) GetCreatedBy() string
- func (x *KeyVersion) GetHMACKey() *HMACKey
- func (x *KeyVersion) GetKey() *SecretKey
- func (*KeyVersion) ProtoMessage()
- func (x *KeyVersion) ProtoReflect() protoreflect.Message
- func (x *KeyVersion) Reset()
- func (x *KeyVersion) String() string
- type Marshaler
- type Pointer
- type SecretKey
- type Unmarshaler
Constants ¶
This section is empty.
Variables ¶
var File_crypto_proto protoreflect.FileDescriptor
Functions ¶
func Marshal ¶
Marshal returns v's protobuf binary data by first converting v into its protobuf representation type M and then marshaling M into the protobuf wire format.
Types ¶
type HMACKey ¶
type HMACKey struct { Key []byte `protobuf:"bytes,1,opt,name=Key,json=key,proto3" json:"Key,omitempty"` Hash uint32 `protobuf:"varint,2,opt,name=Hash,json=hash,proto3" json:"Hash,omitempty"` // contains filtered or unexported fields }
func (*HMACKey) Descriptor
deprecated
func (*HMACKey) ProtoMessage ¶
func (*HMACKey) ProtoMessage()
func (*HMACKey) ProtoReflect ¶
func (x *HMACKey) ProtoReflect() protoreflect.Message
type KeyVersion ¶
type KeyVersion struct { Key *SecretKey `protobuf:"bytes,1,opt,name=Key,json=key,proto3" json:"Key,omitempty"` HMACKey *HMACKey `protobuf:"bytes,2,opt,name=HMACKey,json=hmac_key,proto3" json:"HMACKey,omitempty"` CreatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=CreatedAt,json=created_at,proto3" json:"CreatedAt,omitempty"` CreatedBy string `protobuf:"bytes,4,opt,name=CreatedBy,json=created_by,proto3" json:"CreatedBy,omitempty"` // contains filtered or unexported fields }
func (*KeyVersion) Descriptor
deprecated
func (*KeyVersion) Descriptor() ([]byte, []int)
Deprecated: Use KeyVersion.ProtoReflect.Descriptor instead.
func (*KeyVersion) GetCreatedAt ¶
func (x *KeyVersion) GetCreatedAt() *timestamppb.Timestamp
func (*KeyVersion) GetCreatedBy ¶
func (x *KeyVersion) GetCreatedBy() string
func (*KeyVersion) GetHMACKey ¶
func (x *KeyVersion) GetHMACKey() *HMACKey
func (*KeyVersion) GetKey ¶
func (x *KeyVersion) GetKey() *SecretKey
func (*KeyVersion) ProtoMessage ¶
func (*KeyVersion) ProtoMessage()
func (*KeyVersion) ProtoReflect ¶
func (x *KeyVersion) ProtoReflect() protoreflect.Message
func (*KeyVersion) Reset ¶
func (x *KeyVersion) Reset()
func (*KeyVersion) String ¶
func (x *KeyVersion) String() string
type Marshaler ¶
Marshaler is an interface implemented by types that know how to marshal themselves into their protobuf representation T.
type Pointer ¶
type Pointer[M any] interface { proto.Message *M // Anything implementing Pointer must also be a pointer type of M }
Pointer is a type constraint used to express that some type P is a pointer of some other type T such that:
var t T var p P = &t
This proposition is useful when unmarshalling data into types without additional dynamic dispatch or heap allocations.
A generic function that wants to use the default value of some type T but also wants to call pointer receiver methods on instances of T has to have two type parameters:
func foo[T any, P pointer[T]]() { var t T var p P = &t }
This functionality cannot be achieved with a single type parameter because:
func foo[T proto.Message]() { var t T // compiles but t is nil if T is a pointer type var t2 T = *new(T) // compiles but t2 is nil if T is a pointer type var t3 = T{} // compiler error - e.g. T may be a pointer type }
type SecretKey ¶
type SecretKey struct { Key []byte `protobuf:"bytes,1,opt,name=Key,json=key,proto3" json:"Key,omitempty"` Type uint32 `protobuf:"varint,2,opt,name=Type,json=type,proto3" json:"Type,omitempty"` // contains filtered or unexported fields }
func (*SecretKey) Descriptor
deprecated
func (*SecretKey) ProtoMessage ¶
func (*SecretKey) ProtoMessage()
func (*SecretKey) ProtoReflect ¶
func (x *SecretKey) ProtoReflect() protoreflect.Message
type Unmarshaler ¶
Unmarshaler is an interface implemented by types that know how to unmarshal themselves from their protobuf representation T.