Documentation
¶
Overview ¶
Package eventid is a codec for managing nostr event Ids (hash of the canonical form of a nostr event).
Index ¶
- type T
- func (ei *T) ByteString(src []byte) (b []byte)
- func (ei *T) Bytes() (b []byte)
- func (ei *T) Equal(ei2 *T) (eq bool)
- func (ei *T) Len() int
- func (ei *T) Marshal(dst []byte) (b []byte)
- func (ei *T) Set(b []byte) (err error)
- func (ei *T) String() string
- func (ei *T) Unmarshal(b []byte) (rem []byte, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type T ¶
T is the SHA256 hash in hexadecimal of the canonical form of an event as produced by the output of T.ToCanonical().Bytes().
func New ¶
func New() (ei *T)
New creates a new eventid.T. This is actually more wordy than simply creating a &T{} via slice literal.
func NewFromBytes ¶
NewFromBytes creates a new eventid.T from the raw event Id hash.
func NewFromString ¶
NewFromString inspects a string and ensures it is a valid, 64 character long hexadecimal string, returns the string coerced to the type.
func NewWith ¶
NewWith creates an eventid.T out of bytes or string but assumes it is binary and that it is the right length. The result is either truncated or padded automatically by the use of the "copy" operation.
func (*T) ByteString ¶
ByteString renders an eventid.T as bytes in ASCII hex.