Skip to contents

Reads Ed25519 keys from files using the openssl package. The public key is automatically derived from the private key file.

Usage

read_keypair(private_key_path)

Arguments

private_key_path

Path to the private key file.

Value

A list with:

  • public_key: A raw object

  • private_key: A raw object

  • seed: NULL

Examples

# Generate a keypair and save to disk using openssl
key = openssl::ed25519_keygen()
tmp = tempfile()
openssl::write_pem(key, tmp)

# Read it back using read_keypair
keys = read_keypair(tmp)
str(keys)
#> List of 3
#>  $ public_key : raw [1:32] d8 64 3f 1f ...
#>  $ private_key: raw [1:32] 1c ce 59 41 ...
#>  $ seed       : NULL

# Validate that keys are same
identical(keys$private_key, key$data)
#> [1] TRUE
identical(keys$public_key, key$pubkey$data)
#> [1] TRUE