cabin

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultIDKeyScheme is the default jess tool for creating ID keys
	DefaultIDKeyScheme = "Ed25519"

	// DefaultIDKeySecurityLevel is the default security level for creating ID keys
	DefaultIDKeySecurityLevel = 256 // Ed25519 security level is fixed, setting is ignored
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ExchKey

type ExchKey struct {
	Created time.Time
	Expires time.Time
	// contains filtered or unexported fields
}

ExchKey holds the private information of a HubKey.

type Identity

type Identity struct {
	record.Base

	ID    string
	Scope hub.Scope

	Signet *jess.Signet

	ExchKeys map[string]*ExchKey
	// contains filtered or unexported fields
}

Identity holds the identity of a Hub.

func CreateIdentity

func CreateIdentity(ctx context.Context, scope hub.Scope) (*Identity, error)

CreateIdentity creates a new identity.

func EnsureIdentity

func EnsureIdentity(r record.Record) (*Identity, error)

EnsureIdentity makes sure a database record is an Identity.

func LoadIdentity

func LoadIdentity(key string) (*Identity, error)

LoadIdentity loads an identify with the given key.

func (*Identity) ExportAnnouncement

func (id *Identity) ExportAnnouncement() ([]byte, error)

ExportAnnouncement serializes and signs the Announcement.

func (*Identity) ExportStatus

func (id *Identity) ExportStatus() ([]byte, error)

ExportStatus serializes and signs the Status.

func (*Identity) GetSignet

func (id *Identity) GetSignet(keyID string, recipient bool) (*jess.Signet, error)

GetSignet returns the private exchange key with the given ID.

func (*Identity) Hub

func (id *Identity) Hub() *hub.Hub

Hub returns the identity's Hub.

func (*Identity) Lock

func (id *Identity) Lock()

Lock locks the Identity through the Hub lock.

func (*Identity) MaintainAnnouncement

func (id *Identity) MaintainAnnouncement() (changed bool, err error)

MaintainAnnouncement maintains the Hub's Announcenemt and returns whether there was a change that should be communicated to other Hubs.

func (*Identity) MaintainExchKeys added in v0.2.1

func (id *Identity) MaintainExchKeys(now time.Time) (changed bool, err error)

func (*Identity) MaintainStatus

func (id *Identity) MaintainStatus(connections []*hub.HubConnection) (changed bool, err error)

MaintainStatus maintains the Hub's Status and returns whether there was a change that should be communicated to other Hubs.

func (*Identity) Save

func (id *Identity) Save() error

Save saves the Identity to the database.

func (*Identity) SignHubMsg

func (id *Identity) SignHubMsg(data []byte) ([]byte, error)

SignHubMsg signs a data blob with the identity's private key.

func (*Identity) Unlock

func (id *Identity) Unlock()

Unlock unlocks the Identity through the Hub lock.

Jump to

Keyboard shortcuts

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