@cto.af/ca - v2.4.0
    Preparing search index...

    Class KeyCert

    A certificate and its private key.

    Index

    Constructors

    Properties

    ca: undefined | KeyCert
    cert: string
    key: undefined | string = undefined
    name: string

    Accessors

    • get certFile(): undefined | string

      The file name of the certificate. The file is encoded as PEM.

      Returns undefined | string

      The filename, or undefined if unknown.

    • get issuer(): string

      Issuer DN string.

      Returns string

      A string of the form '/C=US'.

    • get keyFile(): undefined | string

      The account name of the key, stored under KEYCHAIN_SERVICE in the OS-specific keychain. This corresponds to the file name that the key used to be stored in. This file should no longer exist after the upgrade procedure runs.

      Returns undefined | string

      If known, the filename, otherwise undefined.

    • get notAfter(): Date

      Certificate not valid after this date.

      Returns Date

      Date constructed from X509.

    • get notBefore(): Date

      Certificate not valid before this date.

      Returns Date

      Date constructed from X509.

    • get san(): undefined | GeneralName[]

      List of subjectAlternativeNames for the cert.

      Returns undefined | GeneralName[]

      Array of {dns: 'hostname'} or {ip: 'address'} objects.

    • get serial(): string

      Serial number of the cert.

      Returns string

      Hex string.

    • get subject(): string

      Subject name of the cert.

      Returns string

      String of the form '/CN=localhost'.

    Methods

    • List all known keys.

      Returns AsyncGenerator<SecretEntry>

      Object with account name and pre-populated AsyncEntry for modifications.

    • Read the cert file and the key from the keychain.

      Parameters

      • opts: RequiredCommonCertOptions

        Options. Most important is dir.

      • name: string

        Base name of the files, escaped for use as filenames. No suffix or directory.

      • log: Logger

        Logger.

      • Optionalca: typeof SELF_SIGNED | KeyCert

        If known, the CA. Use SELF_SIGNED for the CA.

      Returns Promise<null | KeyCert>

      KeyCert, or null if not found.

    • Delete this key, if it isn't temporary.

      Parameters

      • Optionalopts: Required<CommonCertOptions>

        Options, of which temp is the most important.

      • Optionallog: Logger

        Logger.

      Returns Promise<void>

      Promise that completes when done deleting.

    • Verify the certificate with its issuer. If no CA, returns false.

      Returns boolean

      True if valid.

    • Save the cert file and key, unless this is temporary.

      Parameters

      Returns Promise<void>

      Promise that completes when writing is done.