Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeP2PPrivKey(encoded string) (crypto.PrivKey, error)
- type CommunityKey
- type KeyRing
- func (kr *KeyRing) AddCommunityKey(channelURI string, key CommunityKey)
- func (kr *KeyRing) AddKeyPair(channelURI string, id MemberID, pub MemberPublicKey, priv MemberPrivateKey)
- func (kr *KeyRing) AddMemberKey(channelURI string, id MemberID, pub MemberPublicKey)
- func (kr *KeyRing) DecodeEntry(entry *pb.Msg) ([]byte, error)
- func (kr *KeyRing) EncodeEntry(body []byte, channelURI string) (*pb.Msg, error)
- func (kr *KeyRing) GetIdentityKey() crypto.PrivKey
- func (kr *KeyRing) RemoveMemberKey(channelURI string, id MemberID) error
- type KeySet
- type MemberID
- type MemberPrivateKey
- type MemberPublicKey
Constants ¶
const InMemory = ":memory:"
InMemory lets us configure keys for testing that live in memory and get thrown out once we're done with them
Variables ¶
var ( ErrorDecryptFailedAsym = errors.New("assymmetric decryption failed") ErrorDecryptFailedSym = errors.New("symmetric decryption failed") ErrorInvalidSignature = errors.New("invalid or missing signature") ErrorUnknownChannel = errors.New("unknown channel") ErrorUnknownKey = errors.New("unknown key") )
Functions ¶
Types ¶
type CommunityKey ¶
type CommunityKey *[32]byte
type KeyRing ¶
type KeyRing struct {
// contains filtered or unexported fields
}
func NewFromFile ¶
func NewKeyRing ¶
func NewKeyRing() *KeyRing
func (*KeyRing) AddCommunityKey ¶
func (kr *KeyRing) AddCommunityKey(channelURI string, key CommunityKey)
AddCommunityKey adds a community key to the channel keyring. TODO: this is a placeholder until we have an embedded pnode client.
func (*KeyRing) AddKeyPair ¶
func (kr *KeyRing) AddKeyPair(channelURI string, id MemberID, pub MemberPublicKey, priv MemberPrivateKey)
AddKeyPair adds this client's keypair to the channel keyring. TODO: this is a placeholder until we have an embedded pnode client.
func (*KeyRing) AddMemberKey ¶
func (kr *KeyRing) AddMemberKey(channelURI string, id MemberID, pub MemberPublicKey)
AddMemberKey adds a different member's public key to the keyring, for signing verification. TODO: this is a placeholder until we have an embedded pnode client.
func (*KeyRing) DecodeEntry ¶
DecodeEntry verifies the signature of the entry, and returns the decrypted body
func (*KeyRing) EncodeEntry ¶
EncodeEntry encrypts the body for a specific channel and signs the result, returning a new entry Msg. Note that we have to encode an entry for a specific channel because a given Member can have different keys for different channels.
func (*KeyRing) GetIdentityKey ¶
GetIdentityKey gets the keyring's encoded identity key and returns it as a libp2p private key
type KeySet ¶
type KeySet struct { CommunityKey CommunityKey MemberID MemberID // this client's Id PrivateKey MemberPrivateKey // this client's private key PublicKey MemberPublicKey // this client's public key // contains filtered or unexported fields }
KeySet is associated with a Channel; the caller is responsible for tracking multiple keychains and rotating them if needed
type MemberPrivateKey ¶
type MemberPrivateKey *[64]byte
func MemberPrivateKeyFromBytes ¶
func MemberPrivateKeyFromBytes(b []byte) MemberPrivateKey
func MemberPrivateKeyFromP2PKey ¶
func MemberPrivateKeyFromP2PKey(k crypto.PrivKey) (MemberPrivateKey, error)
type MemberPublicKey ¶
type MemberPublicKey *[32]byte
func MemberPublicKeyDecodeBase64 ¶
func MemberPublicKeyDecodeBase64(s string) (MemberPublicKey, error)
func MemberPublicKeyFromBytes ¶
func MemberPublicKeyFromBytes(b []byte) MemberPublicKey
func MemberPublicKeyFromP2PKey ¶
func MemberPublicKeyFromP2PKey(k crypto.PubKey) (MemberPublicKey, error)