libp2p/peeridauth/client

    Dark Mode
Search:
Group by:
  Source   Edit

Types

BearerToken = object
  token*: string
  expires*: Opt[DateTime]
  Source   Edit
PeerIDAuthAuthenticationResponse = object
  challengeClient*: PeerIDAuthChallenge
  opaque*: PeerIDAuthOpaque
  serverPubkey*: PublicKey
  Source   Edit
PeerIDAuthChallenge = string
  Source   Edit
PeerIDAuthClient = ref object of RootObj
  session: HttpSessionRef
  rng: ref HmacDrbgContext
  Source   Edit
PeerIDAuthError = object of LPError
  Source   Edit
PeerIDAuthOpaque = string
  Source   Edit
PeerIDAuthResponse = object
  status*: int
  headers*: HttpTable
  body*: seq[byte]
  Source   Edit
PeerIDAuthSignature = string
  Source   Edit

Consts

PeerIDAuthPrefix = "libp2p-PeerID"
  Source   Edit

Procs

proc checkSignature(serverSig: PeerIDAuthSignature; serverPublicKey: PublicKey;
                    challengeServer: PeerIDAuthChallenge;
                    clientPublicKey: PublicKey; hostname: string): bool {.
    ...raises: [PeerIDAuthError], raises: [], tags: [RootEffect].}
  Source   Edit
proc close(self: PeerIDAuthClient): InternalRaisesFuture[void, (CancelledError,)] {.
    stackTrace: false, ...raises: [], gcsafe, raises: [], raises: [],
    tags: [RootEffect].}
  Source   Edit
proc new(T: typedesc[PeerIDAuthClient]; rng: ref HmacDrbgContext = newRng()): PeerIDAuthClient {.
    ...raises: [].}
  Source   Edit
proc pubkeyBytes(pubkey: PublicKey): seq[byte] {....raises: [PeerIDAuthError],
    raises: [], tags: [].}
  Source   Edit
proc requestAuthentication(self: PeerIDAuthClient; uri: Uri): InternalRaisesFuture[
    PeerIDAuthAuthenticationResponse, (PeerIDAuthError, CancelledError)] {.
    stackTrace: false, ...raises: [], gcsafe, raises: [], raises: [],
    tags: [RootEffect].}
  Source   Edit
proc requestAuthorization(self: PeerIDAuthClient; peerInfo: PeerInfo; uri: Uri;
                          challengeClient: PeerIDAuthChallenge;
                          challengeServer: PeerIDAuthChallenge;
                          serverPubkey: PublicKey; opaque: PeerIDAuthOpaque;
                          payload: auto): InternalRaisesFuture[
    PeerIDAuthAuthorizationResponse, (PeerIDAuthError, CancelledError)] {.
    stackTrace: false, ...raises: [], gcsafe, raises: [], raises: [].}
  Source   Edit
proc send(self: PeerIDAuthClient; uri: Uri; peerInfo: PeerInfo; payload: auto;
          bearer: Opt[BearerToken] = Opt.none(BearerToken)): InternalRaisesFuture[
    (BearerToken, PeerIDAuthResponse), (PeerIDAuthError, CancelledError)] {.
    stackTrace: false, ...raises: [], gcsafe, raises: [], raises: [].}
  Source   Edit

Methods

method get(self: PeerIDAuthClient; uri: Uri): InternalRaisesFuture[
    PeerIDAuthResponse, (PeerIDAuthError, HttpError, CancelledError)] {.base,
    stackTrace: false, ...raises: [], gcsafe, raises: [], raises: [],
    tags: [RootEffect].}
  Source   Edit
method post(self: PeerIDAuthClient; uri: Uri; payload: string;
            authHeader: string): InternalRaisesFuture[PeerIDAuthResponse,
    (HttpError, CancelledError)] {.base, stackTrace: false, ...raises: [], gcsafe,
                                   raises: [], raises: [], tags: [RootEffect].}
  Source   Edit