Keeta LogoKeeta Logo@keetanetwork/keetanet-client
    Preparing search index...
    Index

    Constructors

    • Parameters

      • input:
            | string
            | Buffer
            | ArrayBuffer
            | Certificate
            | {
                $hash: CertificateHashString;
                issuer: string;
                issuerDN: { name: string; value: string }[];
                notAfter: string;
                notBefore: string;
                serial: string;
                subject: string;
                subjectDN: { name: string; value: string }[];
                subjectPublicKey:
                    | Secp256K1PublicKeyString
                    | Secp256R1PublicKeyString
                    | ED25519PublicKeyString;
            } & {
                $binary?: string;
                $chain?: undefined;
                baseExtensions?: {} & {
                    authorityKeyIdentifier?: {
                        contains: string;
                        type: "context";
                        value: 0;
                    } & {};
                    basicConstraints?: [ca: boolean, pathLenConstraint?: null | string];
                    keyUsage?: KeyUsage;
                    subjectKeyIdentifier?: string;
                };
            }
      • Optionaloptions: CertificateOptions

      Returns Certificate

    Properties

    baseExtensions?: {
        authorityKeyIdentifier?: { contains: Buffer; type: "context"; value: 0 };
        basicConstraints?: [ca: boolean, pathLenConstraint?: bigint];
        keyUsage?: KeyUsage;
        subjectKeyIdentifier?: Buffer;
    }

    Basic Extensions

    Type declaration

    • OptionalauthorityKeyIdentifier?: { contains: Buffer; type: "context"; value: 0 }

      Authority Key Identifier

    • OptionalbasicConstraints?: [ca: boolean, pathLenConstraint?: bigint]

      Basic Constraints

    • OptionalkeyUsage?: KeyUsage

      Defines the purpose of the key

    • OptionalsubjectKeyIdentifier?: Buffer

      Subject Key Identifier

    chain?: Certificate[]

    Chain, if a store is provided

    issuer: string

    The Issuer DN of the certificate as a string --- for informational purposes only

    issuerDN: { name: string; value: string }[]

    The Issuer DN of the certificate --- for informational purposes only

    issuerDNSet: ASN1Set[]

    The complete IssuerDN

    moment: null | Date

    The moment at which the certificate was validated

    notAfter: Date

    The timestamp at which the certificate expires

    notBefore: Date

    The timestamp at which the certificate becomes valid

    serial: bigint

    The serial number of the certificate

    subject: string

    The Subject DN of the certificate as a string --- for informational purposes only

    subjectDN: { name: string; value: string }[]

    The Subject DN of the certificate --- for informational purposes only

    subjectDNSet: ASN1Set[]

    The complete SubjectDN

    subjectPublicKey: Account

    The Subject of the certificate as a KeetaNet Account, derived from the public key in the certificate

    Builder: typeof CertificateBuilder = CertificateBuilder

    The Certificate Builder

    Bundle: typeof CertificateBundle = CertificateBundle

    The certificate bundle

    Hash: typeof CertificateHash = CertificateHash

    The certificate hash information

    Accessors

    • get trusted(): boolean

      If this certificate can be trusted to have been validated to a trusted Root CA

      Returns boolean

    Methods

    • Asserts provided certificates can construct a valid graph with no loops or orphans, and that all provided certificates can reach the root, or current certificate

      Parameters

      • certificates: Set<Certificate>

        Additional intermediate certificates to verify

      Returns undefined | true

    • Assert that the certificate is valid at a given moment

      Parameters

      • Optionalmoment: null | Date

      Returns void

    • Check if the certificate is issued by a given issuer

      Parameters

      Returns boolean

    • Check if the certificate is issued by a given issuer

      Parameters

      Returns { issued: true } | { issued: false; reason: string }

    • Check if the certificate is valid at a given moment

      Parameters

      • Optionalmoment: null | Date

      Returns boolean

    • Check if the certificate is valid at a given moment

      Parameters

      • Optionalmoment: null | Date
      • Optionalreason: false

      Returns boolean

    • Check if the certificate is valid at a given moment

      Parameters

      • Optionalmoment: null | Date
      • Optionalreason: true

      Returns { valid: true } | { reason: string; valid: false }

    • Compare the certificate with another certificate and return true if they are the same

      Parameters

      Returns boolean

    • Finalize construction of the certificate -- if this method is replaced in a subclass, remember to call it at the end of the subclass constructor or the certificate will not be fully constructed

      Returns void

    • Get the extensions present in the certificate -- this is the raw extensions as they were parsed from the certificate, and may contain extensions that are not processed by this class.

      Returns
          | undefined
          | (
              | [id: ASN1OID, critical: boolean, value: Buffer]
              | [id: ASN1OID, value: Buffer]
          )[]

    • Verifies that a certificate is self-signed

      Returns boolean

    • Process an extension -- returns true if the extension was processed

      This is intended to be overridden by subclasses for processing custom extensions

      Parameters

      • id: string
      • value: ArrayBuffer

      Returns boolean

    • Process remaining extensions

      Returns void

    • Get the certificate as a DER encoded ArrayBuffer

      Returns ArrayBuffer

    • Get a JSON representation of the certificate

      Parameters

      Returns {
          $hash: CertificateHashString;
          issuer: string;
          issuerDN: { name: string; value: string }[];
          notAfter: string;
          notBefore: string;
          serial: string;
          subject: string;
          subjectDN: { name: string; value: string }[];
          subjectPublicKey:
              | Secp256K1PublicKeyString
              | Secp256R1PublicKeyString
              | ED25519PublicKeyString;
      } & {
          $binary?: string;
          $chain?: undefined;
          baseExtensions?: {} & {
              authorityKeyIdentifier?: {
                  contains: string;
                  type: "context";
                  value: 0;
              } & {};
              basicConstraints?: [ca: boolean, pathLenConstraint?: null | string];
              keyUsage?: KeyUsage;
              subjectKeyIdentifier?: string;
          };
      }

    • Get the certificate as a PEM encoded string

      Returns string

    • The string representation of the certificate is a PEM encoded certificate -- this misses some of the internal details like chain and verified, but is usually what someone wants to see when they call toString()

      Returns string

    • Is a certificate object?

      Parameters

      • value: unknown

      Returns value is Certificate

    • Verify that a given chain meets the depth requirements

      Parameters

      Returns { valid: true } | { reason: string; valid: false }