Documentation ¶
Overview ¶
Package wallet will contain the logic for managing user wallets. In blockchain, a wallet is a digital container that stores the cryptographic keys used to access and manage a user’s assets. It consists of a private key and a public key. The public key is shared within the blockchain network and is mainly used to receive funds and verify the authenticity of digital signatures. With a public key, anyone can encrypt data that can only be decrypted by the corresponding private key. The private key is a secret cryptographic key that should be kept secure and known only to the owner. It creates digital signatures, signs transactions, and decrypts data encrypted with the corresponding public key.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateRSAKeys ¶
func GenerateRSAKeys() (*rsa.PrivateKey, *rsa.PublicKey, error)
GenerateRSAKeys generates a private, public key pair
func VerifyTransaction ¶
func VerifyTransaction(transaction *transaction.Transaction, publicKey *rsa.PublicKey, signature string) error
VerifyTransaction verifies a given transaction with a public key and the signature returning an error if verification fails
Types ¶
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
Wallet structure representing a user's wallet with access to assets. RSA is sued for key generation, signing of transactions, and verification of transaction signatures.
func (*Wallet) SignTransaction ¶
func (w *Wallet) SignTransaction(transaction *transaction.Transaction) (string, error)
SignTransaction signs a given transaction and returns the signature of the signing or an error the signature is then used to validate a transaction