Documentation ¶
Index ¶
Constants ¶
View Source
const NaclBoxNonceSize = 24
View Source
const PrivateKeySize = 32
View Source
const PublicKeySize = 32
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NaclBoxNonce ¶
type NaclBoxNonce [NaclBoxNonceSize]byte
NaclBoxNonce is a Nacl box nonce wrapper (24 bytes)
func (NaclBoxNonce) MarshalJSON ¶
func (nbn NaclBoxNonce) MarshalJSON() ([]byte, error)
MarshalJSON returns the base64 value of a nacl box nonce.
func (*NaclBoxNonce) UnmarshalJSON ¶
func (nbn *NaclBoxNonce) UnmarshalJSON(data []byte) error
UnmarshalJSON accepts a base64 value to load a nacl box nonce.
type PrivateKey ¶
type PrivateKey [PrivateKeySize]byte
PrivateKey is an X25519 private key wrapper (32 bytes).
func (*PrivateKey) Open ¶
func (pk *PrivateKey) Open(encryptedMessage []byte, senderPublicKey *PublicKey, nonce *NaclBoxNonce) ([]byte, bool)
Open decrypts an encrypted message with the appropriate sender information.
func (*PrivateKey) Seal ¶
func (pk *PrivateKey) Seal(message []byte, recipientPublicKey *PublicKey) (*NaclBoxNonce, []byte, error)
Seal encrypts a plain text message decipherable afterwards by the recipient public key.
type PublicKey ¶
type PublicKey [PublicKeySize]byte
PublicKey is an X25519 public key wrapper (32 bytes).
func (PublicKey) MarshalJSON ¶
MarshalJSON returns the base64 value of an X25519 public key.
func (*PublicKey) UnmarshalJSON ¶
UnmarshalJSON accepts a base64 value to load an X25519 public key.
Click to show internal directories.
Click to hide internal directories.