Documentation ¶
Index ¶
- Constants
- type Cabin
- type ExchKey
- type Identity
- func (id *Identity) ExportAnnouncement() ([]byte, error)
- func (id *Identity) ExportStatus() ([]byte, error)
- func (id *Identity) GetSignet(keyID string, recipient bool) (*jess.Signet, error)
- func (id *Identity) Lock()
- func (id *Identity) MaintainAnnouncement(newInfo *hub.Announcement, selfcheck bool) (changed bool, err error)
- func (id *Identity) MaintainExchKeys(newStatus *hub.Status, now time.Time) (changed bool, err error)
- func (id *Identity) MaintainStatus(lanes []*hub.Lane, load *int, flags []string, selfcheck bool) (changed bool, err error)
- func (id *Identity) MakeOfflineStatus() (offlineStatusExport []byte, err error)
- func (id *Identity) Save() error
- func (id *Identity) SignHubMsg(data []byte) ([]byte, error)
- func (id *Identity) SignVerificationRequest(request []byte, purpose, clientReference, serverReference string) (response []byte, err error)
- func (id *Identity) Unlock()
- type Verification
Constants ¶
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 Cabin ¶ added in v1.6.19
type Cabin struct {
// contains filtered or unexported fields
}
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 Map string Hub *hub.Hub Signet *jess.Signet ExchKeys map[string]*ExchKey // contains filtered or unexported fields }
Identity holds the identity of a Hub.
func CreateIdentity ¶
CreateIdentity creates a new identity.
func EnsureIdentity ¶
EnsureIdentity makes sure a database record is an Identity.
func LoadIdentity ¶
LoadIdentity loads an identify with the given key.
func (*Identity) ExportAnnouncement ¶
ExportAnnouncement serializes and signs the Announcement.
func (*Identity) ExportStatus ¶
ExportStatus serializes and signs the Status.
func (*Identity) MaintainAnnouncement ¶
func (id *Identity) MaintainAnnouncement(newInfo *hub.Announcement, selfcheck bool) (changed bool, err error)
MaintainAnnouncement maintains the Hub's Announcenemt and returns whether there was a change that should be communicated to other Hubs. If newInfo is nil, it will be derived from configuration.
func (*Identity) MaintainExchKeys ¶
func (id *Identity) MaintainExchKeys(newStatus *hub.Status, now time.Time) (changed bool, err error)
MaintainExchKeys maintains the exchange keys, creating new ones and deprecating and deleting old ones.
func (*Identity) MaintainStatus ¶
func (id *Identity) MaintainStatus(lanes []*hub.Lane, load *int, flags []string, selfcheck bool) (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) MakeOfflineStatus ¶
MakeOfflineStatus creates and signs an offline status message.
func (*Identity) SignHubMsg ¶
SignHubMsg signs a data blob with the identity's private key.
func (*Identity) SignVerificationRequest ¶
func (id *Identity) SignVerificationRequest(request []byte, purpose, clientReference, serverReference string) (response []byte, err error)
SignVerificationRequest sign a verification request. The purpose and references must match the request, else the verification will fail.
type Verification ¶
type Verification struct { // Challenge is a random value chosen by the client. Challenge []byte `json:"c"` // Purpose defines the purpose of the verification. Protects against using verification for other purposes. Purpose string `json:"p"` // ClientReference is an optional field for exchanging metadata about the client. Protects against forwarding/relay attacks. ClientReference string `json:"cr"` // ServerReference is an optional field for exchanging metadata about the server. Protects against forwarding/relay attacks. ServerReference string `json:"sr"` }
Verification is used to verify certain aspects of another Hub.
func CreateVerificationRequest ¶
func CreateVerificationRequest(purpose, clientReference, serverReference string) (v *Verification, request []byte, err error)
CreateVerificationRequest creates a new verification request with the given purpose and references.