Versions in this module Expand all Collapse all v1 v1.0.1 Oct 17, 2020 Changes in this version + const Code + const Name + const Protocol + const V1 + const Version + var ErrIDTooShort = fmt.Errorf("id too short") + var ErrInvalidKey = fmt.Errorf("invalid key") + var ErrInvalidToken = fmt.Errorf("invalid thread token") + var ErrTokenNotFound = fmt.Errorf("thread token not found") + var ErrVarintBuffSmall = fmt.Errorf("reading varint: buffer too small") + var ErrVarintTooBig = fmt.Errorf(...) + var Undef = ID("") + func ExtractEncoding(v string) (mbase.Encoding, error) + func NewTokenContext(ctx context.Context, token Token) context.Context + func ToAddr(id ID) ma.Multiaddr + type Credentials struct + Secure bool + func (c Credentials) GetRequestMetadata(ctx context.Context, _ ...string) (map[string]string, error) + func (c Credentials) RequireTransportSecurity() bool + type ID string + func Cast(data []byte) (ID, error) + func Decode(v string) (ID, error) + func FromAddr(addr ma.Multiaddr) (ID, error) + func NewIDV1(variant Variant, size uint8) ID + func (i *ID) UnmarshalBinary(data []byte) error + func (i *ID) UnmarshalText(text []byte) error + func (i ID) Bytes() []byte + func (i ID) Defined() bool + func (i ID) Encode(base mbase.Encoder) string + func (i ID) Equals(o ID) bool + func (i ID) KeyString() string + func (i ID) Loggable() map[string]interface{} + func (i ID) MarshalBinary() ([]byte, error) + func (i ID) MarshalText() ([]byte, error) + func (i ID) String() string + func (i ID) StringOfBase(base mbase.Encoding) (string, error) + func (i ID) Validate() error + func (i ID) Variant() Variant + func (i ID) Version() uint64 + type IDSlice []ID + func (s IDSlice) Len() int + func (s IDSlice) Less(i, j int) bool + func (s IDSlice) Swap(i, j int) + type Identity interface + Decrypt func(context.Context, []byte) ([]byte, error) + Equals func(Identity) bool + GetPublic func() PubKey + Sign func(context.Context, []byte) ([]byte, error) + func NewLibp2pIdentity(key crypto.PrivKey) Identity + type Info struct + Addrs []ma.Multiaddr + ID ID + Key Key + Logs []LogInfo + func (i Info) GetFirstPrivKeyLog() *LogInfo + type Key struct + func KeyFromBytes(b []byte) (k Key, err error) + func KeyFromString(s string) (k Key, err error) + func NewKey(sk, rk *sym.Key) Key + func NewRandomKey() Key + func NewRandomServiceKey() Key + func NewServiceKey(sk *sym.Key) Key + func (k Key) Bytes() []byte + func (k Key) CanRead() bool + func (k Key) Defined() bool + func (k Key) MarshalBinary() ([]byte, error) + func (k Key) Read() *sym.Key + func (k Key) Service() *sym.Key + func (k Key) String() string + type Libp2pIdentity struct + func (p *Libp2pIdentity) Decrypt(_ context.Context, data []byte) ([]byte, error) + func (p *Libp2pIdentity) Equals(i Identity) bool + func (p *Libp2pIdentity) GetPublic() PubKey + func (p *Libp2pIdentity) MarshalBinary() ([]byte, error) + func (p *Libp2pIdentity) Sign(_ context.Context, msg []byte) ([]byte, error) + func (p *Libp2pIdentity) UnmarshalBinary(bytes []byte) (err error) + type Libp2pPubKey struct + func (p *Libp2pPubKey) Encrypt(data []byte) ([]byte, error) + func (p *Libp2pPubKey) Equals(k PubKey) bool + func (p *Libp2pPubKey) MarshalBinary() ([]byte, error) + func (p *Libp2pPubKey) String() string + func (p *Libp2pPubKey) UnmarshalBinary(bytes []byte) (err error) + func (p *Libp2pPubKey) UnmarshalString(str string) error + type LogInfo struct + Addrs []ma.Multiaddr + Head cid.Cid + ID peer.ID + Managed bool + PrivKey crypto.PrivKey + PubKey crypto.PubKey + type PubKey interface + Encrypt func([]byte) ([]byte, error) + Equals func(PubKey) bool + UnmarshalString func(string) error + Verify func(data []byte, sig []byte) (bool, error) + func NewLibp2pPubKey(key crypto.PubKey) PubKey + type Token string + func NewToken(issuer crypto.PrivKey, key PubKey) (tok Token, err error) + func NewTokenFromMD(ctx context.Context) (tok Token, err error) + func TokenFromContext(ctx context.Context) (Token, bool) + func (t Token) Defined() bool + func (t Token) PubKey() (PubKey, error) + func (t Token) Validate(issuer crypto.PrivKey) (PubKey, error) + type Variant uint64 + const AccessControlled + const Raw + func (v Variant) String() string