 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package encryption defines utilities with regards to cryptography.
Index ¶
Constants ¶
      View Source
      
  
const KeySize = 32
    Variables ¶
This section is empty.
Functions ¶
func DecryptWithKeyPair ¶
func DecryptWithKeyPair(keys IKeyPair, base64EncodedEncryptedMessage string) (decryptedMessage string, err error)
DecryptWithKeyPair decrypts small base64 encoded messages
func EncryptWithPublicKey ¶
func EncryptWithPublicKey(base64EncodedPublicKey string, message string) (encryptedBase64Message string, err error)
EncryptWithPublicKey encrypts small messages using a 32-byte public key (See https://libsodium.gitbook.io/doc/public-key_cryptography/sealed_boxes)
Types ¶
type IKeyPair ¶
type IKeyPair interface {
	fmt.Stringer
	fmt.GoStringer
	json.Marshaler
	// GetPublicKey returns the public key (base64 encoded)
	GetPublicKey() string
	// GetPrivateKey returns the private key (base64 encoded)
	GetPrivateKey() string
}
    IKeyPair defines an asymmetric key pair for cryptography.
func GenerateKeyPair ¶
GenerateKeyPair generates a asymmetric key pair suitable for use with encryption utilities. Works with [NaCl box](https://nacl.cr.yp.to/box.html.)
 Click to show internal directories. 
   Click to hide internal directories.