crypto

package
v0.3.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyStore

type KeyStore struct {
	// contains filtered or unexported fields
}

KeyStore manages cryptographic keys for the client

func NewKeyStore

func NewKeyStore(keystorePath string) *KeyStore

NewKeyStore creates a new key store

func (*KeyStore) DecryptMessage

func (ks *KeyStore) DecryptMessage(encrypted *shared.EncryptedMessage, conversationID string) (*shared.Message, error)

DecryptMessage decrypts a message using the appropriate session key

func (*KeyStore) DeriveSessionKey

func (ks *KeyStore) DeriveSessionKey(otherUsername, conversationID string) (*shared.SessionKey, error)

DeriveSessionKey creates a session key for a conversation

func (*KeyStore) EncryptMessage

func (ks *KeyStore) EncryptMessage(sender, content, conversationID string) (*shared.EncryptedMessage, error)

EncryptMessage encrypts a message for a specific conversation

func (*KeyStore) GetKeyPair

func (ks *KeyStore) GetKeyPair() *shared.KeyPair

GetKeyPair returns the user's keypair

func (*KeyStore) GetMyPublicKey

func (ks *KeyStore) GetMyPublicKey() []byte

GetMyPublicKey returns the user's public key

func (*KeyStore) GetPublicKey

func (ks *KeyStore) GetPublicKey(username string) *shared.PublicKeyInfo

GetPublicKey retrieves another user's public key

func (*KeyStore) GetPublicKeyInfo

func (ks *KeyStore) GetPublicKeyInfo(username string) *shared.PublicKeyInfo

GetPublicKeyInfo returns the user's public key info for distribution

func (*KeyStore) GetSessionKey

func (ks *KeyStore) GetSessionKey(conversationID string) *shared.SessionKey

GetSessionKey retrieves a session key for a conversation

func (*KeyStore) Initialize

func (ks *KeyStore) Initialize(passphrase string) error

Initialize creates a new keypair if one doesn't exist

func (*KeyStore) Load

func (ks *KeyStore) Load(passphrase string) error

Load loads the keystore from disk

func (*KeyStore) StorePublicKey

func (ks *KeyStore) StorePublicKey(pubKeyInfo *shared.PublicKeyInfo) error

StorePublicKey stores another user's public key

Jump to

Keyboard shortcuts

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