age_keygen: Generate a new age identity

View source: R/identity.R

age_keygenR Documentation

Generate a new age identity

Description

Creates a fresh X25519 identity (key pair). The secret key is generated in C and never returned to R; to persist it, pass path so it is written directly to a key file in the standard age format.

Usage

age_keygen(path = NULL, overwrite = FALSE)

Arguments

path

Optional file path. If given, the identity is written as a key file (⁠# created:⁠ / ⁠# public key:⁠ / ⁠AGE-SECRET-KEY-1...⁠) and the object is returned invisibly. If NULL (default), nothing is written.

overwrite

If FALSE (default) and path already exists, error rather than clobbering an existing key.

Value

An age_identity object. Its print method shows only the public key; the secret is never printed.

Examples

id <- age_keygen()
id
age_pubkey(id)

agecrypt documentation built on Aug. 5, 2026, 9:08 a.m.