24 lines
347 B
Go
24 lines
347 B
Go
package game
|
|
|
|
import (
|
|
"crypto/ed25519"
|
|
"crypto/rand"
|
|
)
|
|
|
|
type User struct {
|
|
Name string
|
|
PublicKey ed25519.PublicKey
|
|
PrivateKey ed25519.PrivateKey
|
|
}
|
|
|
|
func NewUser(name string) User {
|
|
// ed25519
|
|
|
|
public, private, _ := ed25519.GenerateKey(rand.Reader)
|
|
return User{
|
|
Name: name,
|
|
PublicKey: public,
|
|
PrivateKey: private,
|
|
}
|
|
}
|