libp2p/autotls/acme/api

    Dark Mode
Search:
Group by:
  Source   Edit

Types

ACMEApi = ref object of RootObj
  directory: Opt[ACMEDirectory]
  session: HttpSessionRef
  acmeServerURL*: Uri
  Source   Edit
ACMEAuthorizationsResponse = object
  challenges*: seq[ACMEChallenge]
  Source   Edit
ACMECertificateResponse = object
  rawCertificate*: string
  certificateExpiry*: DateTime
  Source   Edit
ACMEChallenge = object
  url*: string
  `type`*: ACMEChallengeType
  status*: ACMEChallengeStatus
  token*: ACMEChallengeToken
  Source   Edit
ACMEChallengeResponse = object
  status*: ACMEOrderStatus
  authorizations*: seq[Authorization]
  finalize*: string
  order*: string
  Source   Edit
ACMEChallengeResponseWrapper = object
  finalize*: string
  order*: string
  dns01*: ACMEChallenge
  Source   Edit
ACMEChallengeStatus {.pure.} = enum
  PENDING = "pending", PROCESSING = "processing", VALID = "valid",
  INVALID = "invalid"
  Source   Edit
ACMEChallengeToken = string
  Source   Edit
ACMEChallengeType {.pure.} = enum
  DNS01 = "dns-01", HTTP01 = "http-01", TLSALPN01 = "tls-alpn-01"
  Source   Edit
ACMECheckKind = enum
  ACMEOrderCheck, ACMEChallengeCheck
  Source   Edit
ACMECheckResponse = object
  case kind: ACMECheckKind
  of ACMEOrderCheck:
      orderStatus: ACMEOrderStatus

  of ACMEChallengeCheck:
      chalStatus: ACMEChallengeStatus

  retryAfter: Duration
  Source   Edit
ACMECompletedResponse = object
  url: string
  Source   Edit
ACMEDirectory = object
  newNonce*: string
  newOrder*: string
  newAccount*: string
  Source   Edit
ACMEFinalizeResponse = object
  status: ACMEOrderStatus
  Source   Edit
ACMEOrderResponse = object
  certificate: string
  expires: string
  Source   Edit
ACMEOrderStatus {.pure.} = enum
  PENDING = "pending", READY = "ready", PROCESSING = "processing",
  VALID = "valid", INVALID = "invalid"
  Source   Edit
ACMERegisterRequest = object
  termsOfServiceAgreed: bool
  contact: seq[Email]
  Source   Edit
ACMERegisterResponse = object
  kid*: Kid
  status*: ACMEAccountStatus
  Source   Edit
Authorization = string
  Source   Edit
Domain = string
  Source   Edit
HTTPResponse = object
  body*: JsonNode
  headers*: HttpTable
  Source   Edit
Kid = string
  Source   Edit
Nonce = string
  Source   Edit

Consts

LetsEncryptURL = "https://acme-v02.api.letsencrypt.org"
  Source   Edit
LetsEncryptURLStaging = "https://acme-staging-v02.api.letsencrypt.org"
  Source   Edit

Procs

proc certificateFinalized(self: ACMEApi; domain: Domain; finalize: Uri;
                          order: Uri; key: KeyPair; kid: Kid;
                          retries: int = DefaultFinalizeRetries): InternalRaisesFuture[
    bool, (ACMEError, CancelledError)] {.stackTrace: false, ...raises: [], gcsafe,
    tags: [RootEffect].}
  Source   Edit
proc checkCertFinalized(self: ACMEApi; order: Uri; key: KeyPair; kid: Kid;
                        retries: int = DefaultChalCompletedRetries): InternalRaisesFuture[
    bool, (ACMEError, CancelledError)] {.stackTrace: false, ...raises: [], gcsafe,
    tags: [RootEffect].}
  Source   Edit
proc checkChallengeCompleted(self: ACMEApi; checkURL: Uri; key: KeyPair;
                             kid: Kid;
                             retries: int = DefaultChalCompletedRetries): InternalRaisesFuture[
    bool, (ACMEError, CancelledError)] {.stackTrace: false, ...raises: [], gcsafe,
    tags: [RootEffect].}
  Source   Edit
proc close(self: ACMEApi): InternalRaisesFuture[void, (CancelledError,)] {.
    stackTrace: false, ...raises: [], gcsafe, tags: [RootEffect].}
  Source   Edit
proc completeChallenge(self: ACMEApi; chalURL: Uri; key: KeyPair; kid: Kid;
                       retries: int = DefaultChalCompletedRetries): InternalRaisesFuture[
    bool, (ACMEError, CancelledError)] {.stackTrace: false, ...raises: [], gcsafe,
    tags: [RootEffect].}
  Source   Edit
proc downloadCertificate(self: ACMEApi; order: Uri): InternalRaisesFuture[
    ACMECertificateResponse, (ACMEError, CancelledError)] {.stackTrace: false,
    ...raises: [], gcsafe, tags: [RootEffect].}
  Source   Edit
proc new(T: typedesc[ACMEApi]; acmeServerURL: Uri = parseUri(LetsEncryptURL)): ACMEApi
  Source   Edit
proc requestAuthorizations(self: ACMEApi; authorizations: seq[Authorization];
                           key: KeyPair; kid: Kid): InternalRaisesFuture[
    ACMEAuthorizationsResponse, (ACMEError, CancelledError)] {.
    stackTrace: false, ...raises: [], gcsafe, tags: [RootEffect].}
  Source   Edit
proc requestChallenge(self: ACMEApi; domains: seq[Domain]; key: KeyPair;
                      kid: Kid): InternalRaisesFuture[
    ACMEChallengeResponseWrapper, (ACMEError, CancelledError)] {.
    stackTrace: false, ...raises: [], gcsafe, tags: [RootEffect].}
  Source   Edit
proc requestCheck(self: ACMEApi; checkURL: Uri; checkKind: ACMECheckKind;
                  key: KeyPair; kid: Kid): InternalRaisesFuture[
    ACMECheckResponse, (ACMEError, CancelledError)] {.stackTrace: false,
    ...raises: [], gcsafe, tags: [RootEffect].}
  Source   Edit
proc requestFinalize(self: ACMEApi; domain: Domain; finalize: Uri; key: KeyPair;
                     kid: Kid): InternalRaisesFuture[ACMEFinalizeResponse,
    (ACMEError, CancelledError)] {.stackTrace: false, ...raises: [], gcsafe,
                                   tags: [RootEffect].}
  Source   Edit
proc requestGetOrder(self: ACMEApi; order: Uri): InternalRaisesFuture[
    ACMEOrderResponse, (ACMEError, CancelledError)] {.stackTrace: false,
    ...raises: [], gcsafe, tags: [RootEffect].}
  Source   Edit
proc requestNewOrder(self: ACMEApi; domains: seq[Domain]; key: KeyPair; kid: Kid): InternalRaisesFuture[
    ACMEChallengeResponse, (ACMEError, CancelledError)] {.stackTrace: false,
    ...raises: [], gcsafe, tags: [RootEffect].}
  Source   Edit
proc requestRegister(self: ACMEApi; key: KeyPair): InternalRaisesFuture[
    ACMERegisterResponse, (ACMEError, CancelledError)] {.stackTrace: false,
    ...raises: [], gcsafe, tags: [RootEffect].}
  Source   Edit
proc sendChallengeCompleted(self: ACMEApi; chalURL: Uri; key: KeyPair; kid: Kid): InternalRaisesFuture[
    ACMECompletedResponse, (ACMEError, CancelledError)] {.stackTrace: false,
    ...raises: [], gcsafe, tags: [RootEffect].}
  Source   Edit

Methods

method get(self: ACMEApi; uri: Uri): InternalRaisesFuture[HTTPResponse,
    (ACMEError, HttpError, CancelledError)] {.base, stackTrace: false,
    ...raises: [], gcsafe, tags: [RootEffect].}
  Source   Edit
method post(self: ACMEApi; uri: Uri; payload: string): InternalRaisesFuture[
    HTTPResponse, (ACMEError, HttpError, CancelledError)] {.base,
    stackTrace: false, ...raises: [], gcsafe, tags: [RootEffect].}
  Source   Edit
method requestNonce(self: ACMEApi): InternalRaisesFuture[Nonce,
    (ACMEError, CancelledError)] {.base, stackTrace: false, ...raises: [], gcsafe,
                                   tags: [RootEffect].}
  Source   Edit

Templates

template handleError(msg: string; body: untyped): untyped
  Source   Edit