// loadKeys returns a keypair from a wallet string, or generates a new one
// if no wallet is provided.
loadKeys returns a keypair from a wallet string, or generates a new one
if no wallet is provided.
// loadKeys returns a keypair from a wallet string or generates a new one // if no wallet is provided .
func loadKeys(wallet string) (*skademlia.Keypair, error) {
	if wallet == "" {
		return skademlia.NewKeys(sys.SKademliaC1, sys.SKademliaC2)
	}
	if len(wallet) != hex.EncodedLen(edwards25519.SizePrivateKey) {
		return nil, fmt.Errorf("private key is not of the right length")
	}
	var privateKey edwards25519.PrivateKey
	n, err := hex.Decode(privateKey[:], []byte(wallet))
	if err != nil {
		return nil, err
	}
	if n != edwards25519.SizePrivateKey {
		return nil, fmt.Errorf("private key is not of the right length")
	}
	keys, err := skademlia.LoadKeys(privateKey, sys.SKademliaC1, sys.SKademliaC2)
	if err != nil {
		return nil, err
	}
	return keys, nil
}
func loadKeys ( wallet string ) ( * skademlia . Keypair , error ) { if wallet == " " { return skademlia . NewKeys ( sys . SKademliaC1 , sys . SKademliaC2 ) } if len ( wallet ) != hex . EncodedLen ( edwards25519 . SizePrivateKey ) { return nil , fmt . Errorf ( " " ) } var privateKey edwards25519 . PrivateKey n , err := hex . Decode ( privateKey [ : ] , [ ] byte ( wallet ) ) if err != nil { return nil , err } if n != edwards25519 . SizePrivateKey { return nil , fmt . Errorf ( " " ) } keys , err := skademlia . LoadKeys ( privateKey , sys . SKademliaC1 , sys . SKademliaC2 ) if err != nil { return nil , err } return keys , nil }
loadKeys returns a keypair from a wallet string, or generates a new one
if no wallet is provided.
loadKeys returns a keypair from a wallet string or generates a new one if no wallet is provided .
// Generate a keypair if wallet is empty