mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-29 06:35:07 +03:00
Implement pubkeys in API functions
This commit is contained in:
parent
a101fc0556
commit
c107f891d2
4 changed files with 49 additions and 11 deletions
|
@ -194,6 +194,16 @@ type BoxSharedKey [BoxSharedKeyLen]byte
|
|||
// BoxNonce is the nonce used in NaCl-like crypto "box" operations (curve25519+xsalsa20+poly1305), and must not be reused for different messages encrypted using the same BoxSharedKey.
|
||||
type BoxNonce [BoxNonceLen]byte
|
||||
|
||||
// String returns a string representation of the "box" key.
|
||||
func (k BoxPubKey) String() string {
|
||||
return hex.EncodeToString(k[:])
|
||||
}
|
||||
|
||||
// Network returns "pubkey" for "box" keys.
|
||||
func (n BoxPubKey) Network() string {
|
||||
return "pubkey"
|
||||
}
|
||||
|
||||
// NewBoxKeys generates a new pair of public/private crypto box keys.
|
||||
func NewBoxKeys() (*BoxPubKey, *BoxPrivKey) {
|
||||
pubBytes, privBytes, err := box.GenerateKey(rand.Reader)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue