Example #1
0
// NewIdent creates a new DHT identity and generates a new keypair for it.
func NewIdent() (*Ident, error) {
	publicKey, secretKey, err := crypto.GenerateKeyPair()
	if err != nil {
		return nil, err
	}

	inst := &Ident{
		PublicKey: publicKey,
		SecretKey: secretKey,
	}

	return inst, nil
}
Example #2
0
func NewConnection() (*Connection, error) {
	publicKey, secretKey, err := crypto.GenerateKeyPair()
	if err != nil {
		return nil, err
	}

	conn := &Connection{
		PublicKey: publicKey,
		SecretKey: secretKey,
		verified:  false,
	}

	return conn, nil
}