Crypto Lib
    Preparing search index...

    Function generate

    • Generates a new OpenPGP public and private key pair. Supports RSA and ECC keys. The generated primary key has signing capabilities and an encryption subkey is also generated by default.

      Parameters

      • data: dataGenerate

        Generation parameters.

        Parameters for OpenPGP key pair generation.

        • date: Date

          Creation date of the key pair.

        • name: string

          Display name for the primary user ID.

        • email: string

          Email address for the primary user ID.

        • userIDs: UserID[]

          Array of user IDs to embed in the key.

        • type: keyof typeof type

          Key type (e.g. 'ecc' or 'rsa').

        • passphrase: string

          Passphrase used to encrypt the private key.

        • rsaBits: number

          RSA key size in bits (only used when type is 'rsa').

        • curve: keyof typeof curve

          Elliptic curve name (only used when type is 'ecc').

        • keyExpirationTime: number

          Seconds until the key expires (0 for no expiration).

        • format: keyof typeof format

          Output format of the generated key (e.g. 'armored').

      Returns Promise<object>

      • Armored public/private key and revocation certificate.