user

package
v0.0.0-...-198cc34 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Me

type Me struct {
	User
	// The Me user will also have a priv key, used by libp2p to sign messages
	IdentPrivKey libp2pcrypto.PrivKey
}

func NewMe

func NewMe(nick string, address string) (Me, error)

Create a user which is ourselves

func (Me) MarshalJSON

func (u Me) MarshalJSON() ([]byte, error)

func (*Me) UnmarshalJSON

func (u *Me) UnmarshalJSON(b []byte) error

TODO Please let there be a nicer way to do this

type User

type User struct {
	Nick    string
	Address string
	// All users will have a pub key used for identification in libp2p
	IdentPubKey libp2pcrypto.PubKey
}

func NewUser

func NewUser(nick string, address string, identpubkey libp2pcrypto.PubKey) (User, error)

func (User) IsVerified

func (u User) IsVerified() bool

TODO how to do this? verify that a particular nick verified somehow, use libp2p pub/priv key?

func (User) MarshalJSON

func (u User) MarshalJSON() ([]byte, error)

func (User) PartyID

func (u User) PartyID() party.ID

The MSP protocol lib requires each user to have a unique Party ID represented as an exactly 32 byte string Since each user has a pub key, which is used as a peer id in libp2p, lets use that. Marshal the key to bytes, convert to Pretty() format, then take last 32 characters.

func (User) PeerID

func (u User) PeerID() peer.ID

func (*User) UnmarshalJSON

func (u *User) UnmarshalJSON(b []byte) error

TODO Please let there be a nicer way to do this

Jump to

Keyboard shortcuts

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