irc

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2021 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgTTL       = 1 * time.Minute
	AEADOverhead = 16 // take from xcha
)
View Source
const (
	IdentityFilePriv = "id_ed25519"
	IdentityFilePub  = IdentityFilePriv + ".pub"
	TrustedFile      = "authorized_nicks"
)
View Source
const (
	KexTTL = 1 * time.Minute
)

Variables

This section is empty.

Functions

func LoadTrust

func LoadTrust(wicHome string) (m map[uint32]*Personae, err error)

Types

type Alias

type Alias struct {
	// contains filtered or unexported fields
}

func NewAlias

func NewAlias(nickhost string) (a *Alias)

func (*Alias) Host

func (a *Alias) Host() string

func (*Alias) Nick

func (a *Alias) Nick() string

func (*Alias) NickHost

func (a *Alias) NickHost() string

func (*Alias) SetHost

func (a *Alias) SetHost(host string)

func (*Alias) SetNick

func (a *Alias) SetNick(nick string)

type Channel

type Channel struct {
	sync.Mutex // to protect the key mask/unmask
	// contains filtered or unexported fields
}

func NewChannel

func NewChannel(name string) (*Channel, error)

func NewChannelFromKey

func NewChannelFromKey(name string, key []byte) (*Channel, error)

func (*Channel) CloneKey added in v0.2.1

func (c *Channel) CloneKey() *symmetric.Key

func (*Channel) Name

func (c *Channel) Name() string

func (*Channel) Open

func (c *Channel) Open(srcnickhost, dst string, tstamp uint64, in []byte) (out string, err error)

pedro -> src: bluh dst: pedro bluh -> src: pedro dst: bluh

func (*Channel) Seal

func (c *Channel) Seal(srcnickhost, dst string, in []byte) (out []byte, tstamp uint64, err error)

pedro -> src: pedro dst: bluh bluh -> src: bluh dst: pedro

func (*Channel) SealLen

func (c *Channel) SealLen(inlen int) int

func (*Channel) SetName

func (c *Channel) SetName(name string)

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(me *Self, trust map[uint32]*Personae, dbg *log.Logger) (ic *Client, err error)

func (*Client) CheckAndUpdateTrust added in v0.1.1

func (ic *Client) CheckAndUpdateTrust(wicHome string) error

func (*Client) CountNetwork added in v0.2.0

func (ic *Client) CountNetwork() int

func (*Client) CountTrust added in v0.2.0

func (ic *Client) CountTrust() int

func (*Client) DelNetwork

func (ic *Client) DelNetwork(name string) error

func (*Client) Me

func (ic *Client) Me() *Self

func (*Client) Network

func (ic *Client) Network(name string) (*Network, error)

func (*Client) NewNetwork

func (ic *Client) NewNetwork(name string)

func (*Client) NewTrust

func (ic *Client) NewTrust(trust map[uint32]*Personae)

func (*Client) TrustLookup

func (ic *Client) TrustLookup(id uint32) (*Personae, error)

func (*Client) TrustUpdateTime added in v0.2.0

func (ic *Client) TrustUpdateTime() int64

type Network

type Network struct {
	// contains filtered or unexported fields
}

func (*Network) ChannelKey

func (n *Network) ChannelKey(name string) (c *Channel, ok bool)

func (*Network) DeleteChannelKey

func (n *Network) DeleteChannelKey(name string)

func (*Network) DeletePersonae

func (n *Network) DeletePersonae(nick string)

func (*Network) Me

func (n *Network) Me() *Self

func (*Network) Personae

func (n *Network) Personae(nick string) (p *Personae, ok bool)

func (n *NetworkContext) Personae(nick string) (p *personae.Personae, err error) {

func (*Network) SetChannelKey

func (n *Network) SetChannelKey(name string, k *Channel)

func (n *Network) SetChannelKey(k *Channel, name string) {

func (*Network) SetPersonae

func (n *Network) SetPersonae(nick string, p *Personae)

type Personae

type Personae struct {
	// contains filtered or unexported fields
}

func FromEphemeral

func FromEphemeral(nickhost string, pk []byte) (p *Personae, err error)

func FromIdentity

func FromIdentity(nick, pub string) (p *Personae, err error)

func FromIdentity(nick, pub string, dbg *log.Logger) (p *Personae, err error) {

func (*Personae) Alias

func (p *Personae) Alias() *Alias

func (*Personae) CanKexOpen

func (p *Personae) CanKexOpen(peer *Personae) bool

func (*Personae) CanSign

func (p *Personae) CanSign() bool

just verify we have private key.

func (*Personae) CanVerify

func (p *Personae) CanVerify() bool

func (*Personae) FromEphemeral

func (p *Personae) FromEphemeral(channel, nickhost string, pk, sig []byte, tstamp uint64) (err error)

func (*Personae) FromIdentityKeys

func (p *Personae) FromIdentityKeys(pub, priv []byte) error

func (*Personae) Host

func (p *Personae) Host() string

func (*Personae) Id

func (p *Personae) Id() (uint32, error)

func (*Personae) IdentityKeys

func (p *Personae) IdentityKeys() (pub, priv []byte)

func (*Personae) IdentityNick

func (p *Personae) IdentityNick() string

func (*Personae) IsKexReady

func (p *Personae) IsKexReady() bool

func (*Personae) IsTrusted

func (p *Personae) IsTrusted() bool

func (*Personae) NewPublicKey

func (p *Personae) NewPublicKey() error

func (*Personae) Nick

func (p *Personae) Nick() string

func (*Personae) NickHost

func (p *Personae) NickHost() string

type Self

type Self struct {
	*Personae
	// contains filtered or unexported fields
}

func NewIdentity

func NewIdentity(nick string) (s *Self, err error)

func OpenIdentity

func OpenIdentity(nick, wicHome, password string, dbg *log.Logger) (s *Self, err error)

func (*Self) Alias

func (p *Self) Alias(network string) (a *Alias, ok bool)

func (*Self) KeyExchangeOpen

func (s *Self) KeyExchangeOpen(src *Personae, network, channel, nickhost string, kex, sig []byte, id uint32, tstamp uint64) (key []byte, err error)

func (*Self) KeyExchangeSeal

func (s *Self) KeyExchangeSeal(to *Personae, network, channel string, key []byte) (kex, sig []byte, id uint32, tstamp uint64, err error)

KEY EXCHANGE

scenarios: - no ephemeral -> ERROR - always sign - timestamp uses unixnano sec as counter. nonce building: sha3(timestamp_nano_bigendian)||sha3(server)||sha3(channel)||sha3(src_nick)||sha3(dst_nick)

output: gob( uint32 nonce, timestamp_nano int64 : []byte blob ) func (p *Personae) KeyExchangeSeal(dst *Personae, channel string, key []byte) (out string, err error) { func (s *Self) KeyExchangeSeal(to *Personae, network, channel string, key []byte) (kex, tstamp, sig, id []byte, err error) {

func (*Self) PublicKey

func (p *Self) PublicKey(network, channel string) (pk, sig []byte, id uint32, tstamp uint64, err error)

func (p *Self) PublicKey(network, channel string) (pk, tstamp, sig, id []byte, err error) {

func (*Self) Seal

func (s *Self) Seal(wicHome, password string) error

func (*Self) SetAlias

func (p *Self) SetAlias(network, nick, host string)

func (*Self) Unalias

func (p *Self) Unalias(server, nick string)

func (*Self) UntrustedKeyExchangeOpen

func (s *Self) UntrustedKeyExchangeOpen(src *Personae, network, channel, nickhost string, kex []byte, id uint32, tstamp uint64) (key []byte, err error)

this is the NON verifying version

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL