first key exchange thing
This commit is contained in:
@@ -2,22 +2,18 @@ package game
|
||||
|
||||
import (
|
||||
"crypto/ed25519"
|
||||
"crypto/rand"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
Name string
|
||||
PublicKey ed25519.PublicKey
|
||||
PrivateKey ed25519.PrivateKey
|
||||
Name string
|
||||
PublicKey ed25519.PublicKey
|
||||
}
|
||||
|
||||
func NewUser(name string) User {
|
||||
func NewUser(name string, publicKey ed25519.PublicKey) User {
|
||||
// ed25519
|
||||
|
||||
public, private, _ := ed25519.GenerateKey(rand.Reader)
|
||||
return User{
|
||||
Name: name,
|
||||
PublicKey: public,
|
||||
PrivateKey: private,
|
||||
Name: name,
|
||||
PublicKey: publicKey,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user