channel

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: BSD-2-Clause Imports: 18 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SignChannelIdentityRequest

func SignChannelIdentityRequest(userEdPub ed25519.PublicKey,
	ts time.Time, userRsaPriv rsa.PrivateKey, rng io.Reader) ([]byte, error)

SignChannelIdentityRequest accepts a User's ED public key & a timestamp and signs them using the given private key. It is used by clients to sign their ED public key for verification when requesting a channel identity from User Discovery.

func SignChannelLease

func SignChannelLease(userPublicKey ed25519.PublicKey, username string,
	lease time.Time, pk ed25519.PrivateKey) []byte

SignChannelLease accepts a user's ed25519 pub key, username & a given lease and signs them with an ed25519 private key. It is used by User Discovery to prove that users' channel identities are valid, and are the same values passed to user discovery.

func VerifyChannelIdentityRequest

func VerifyChannelIdentityRequest(sig []byte,
	userEdPub ed25519.PublicKey, now, ts time.Time,
	userRsaPub rsa.PublicKey) error

VerifyChannelIdentityRequest verifies a user's request generated by SignChannelIdentityRequest, accepting the same information and a corresponding public key. It is used by User Discovery to verify the authenticity of channel identity requests from users. It also ensures that the received timestamp is fresh based on passed in current timestamp.

func VerifyChannelLease

func VerifyChannelLease(sig []byte, userPublicKey ed25519.PublicKey,
	username string, lease time.Time, signerPubKey ed25519.PublicKey) bool

VerifyChannelLease verifies a signature generated by SignChannelLease, accepting the same info and a corresponding ed25519 public key. It is meant to be used in channel logic to authenticate channel identities. It proves that a user with a given username is authorized by user discovery to use this username until lease time using the given public key.

Types

type Identity

type Identity struct {
	codename.Identity
}

Identity for a channel is identical to a codename PrivateIdentity.

func ConstructIdentity

func ConstructIdentity(pub ed25519.PublicKey, codesetVersion uint8) (Identity,
	error)

ConstructIdentity creates a codename from an extant identity for a given version

func UnmarshalIdentity

func UnmarshalIdentity(data []byte) (Identity, error)

UnmarshalIdentity created an identity from a marshaled version

type PrivateIdentity

type PrivateIdentity struct {
	codename.PrivateIdentity
}

PrivateIdentity for a channel is identical to a codename PrivateIdentity.

func GenerateIdentity

func GenerateIdentity(rng io.Reader) (PrivateIdentity, error)

GenerateIdentity create a new channels identity from scratch and assigns it a codename

func ImportPrivateIdentity

func ImportPrivateIdentity(password string, data []byte) (PrivateIdentity, error)

ImportPrivateIdentity generates a new PrivateIdentity from exported data.

func UnmarshalPrivateIdentity

func UnmarshalPrivateIdentity(data []byte) (PrivateIdentity, error)

UnmarshalPrivateIdentity creates a private identity from a marshaled version

func (PrivateIdentity) Export

func (i PrivateIdentity) Export(password string, csprng io.Reader) ([]byte, error)

Export exports the PrivateIdentity into a portable encrypted string that can be used to restore it later.

func (*PrivateIdentity) GetIdentity

func (pi *PrivateIdentity) GetIdentity() Identity

GetIdentity returns a channel identity object from the PrivateIdentity

Jump to

Keyboard shortcuts

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