Skip to contents

Store a key pair in the morie keystore

Usage

morie_crypto_keystore_store(
  name,
  pk,
  sk,
  password,
  path = .morie_keystore_default_path()
)

Arguments

name

Identifier.

pk

Raw vector: public key.

sk

Raw vector: secret key.

password

Character scalar.

path

Keystore path.

Value

Invisibly, NULL.

Examples

if (morie_crypto_sodium_available()) {
  path <- tempfile(fileext = ".keystore")
  morie_crypto_keystore_create("pw", path = path)
  pk <- as.raw(sample(0:255, 32, replace = TRUE))
  sk <- as.raw(sample(0:255, 64, replace = TRUE))
  morie_crypto_keystore_store("alice", pk = pk, sk = sk, password = "pw", path = path)
  print(morie_crypto_keystore_list("pw", path = path))
  unlink(path)
}
#> [1] "alice"