// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.key package placestream import ( "encoding/json" "io" glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" ) func init() { glex.RegisterType("place.stream.key", &Key{}) } // Record linking an atproto identity with a stream signing key type Key struct { LexiconTypeID string `json:"$type,omitempty"` // createdAt: Client-declared timestamp when this key was created. CreatedAt string `json:"createdAt"` // createdBy: The name of the client that created this key. CreatedBy *string `json:"createdBy,omitempty"` // signingKey: The did:key signing key for the stream. SigningKey string `json:"signingKey"` } // RecordTypeID implements glex.Record. func (t *Key) RecordTypeID() string { return "place.stream.key" } // MarshalJSON stamps the $type field, like MarshalCBOR does. The value // receiver operates on a copy, so the record is never mutated and both // Key and *Key marshal with $type. func (t Key) MarshalJSON() ([]byte, error) { t.LexiconTypeID = "place.stream.key" type alias Key return json.Marshal((alias)(t)) } func (t *Key) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } // stamp $type on a copy so marshal never mutates the record cp := *t cp.LexiconTypeID = "place.stream.key" return glex.MarshalCBOR(w, &cp) } func (t *Key) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) }