From 9cabc028de4fd9422bbc3fb04e63b124b9a749d8 Mon Sep 17 00:00:00 2001 From: "aegir[bot]" Date: Wed, 11 Dec 2024 18:23:04 +0000 Subject: [PATCH] docs: update documentation [skip ci] --- classes/auth.ClientAuth.html | 6 +++--- classes/auth.ServerAuth.html | 4 ++-- classes/well_known_handler.WellKnownHandler.html | 4 ++-- functions/index.http-1.html | 2 +- functions/index.httpCustomServer.html | 2 +- functions/ping.sendPing.html | 2 +- functions/ping.servePing.html | 2 +- interfaces/auth.AuthenticateServerOptions.html | 6 +++--- interfaces/auth.AuthenticatedFetchOptions.html | 8 ++++---- interfaces/auth.HttpHandler.html | 2 +- interfaces/auth.ServerAuthOps.html | 4 ++-- interfaces/auth.TokenInfo.html | 4 ++-- interfaces/index.CustomHTTPHandlerInit.html | 4 ++-- interfaces/index.FetchComponents.html | 4 ++-- interfaces/index.HTTP.html | 4 ++-- interfaces/index.HTTPInit.html | 4 ++-- interfaces/index.HTTPWithCustomHandler.html | 4 ++-- modules/auth.html | 2 +- modules/index.html | 2 +- modules/ping.html | 2 +- modules/well_known_handler.html | 2 +- types/well_known_handler.ProtocolID.html | 2 +- types/well_known_handler.ProtosMap.html | 2 +- variables/auth.HTTPPeerIDAuthProto.html | 2 +- variables/auth.PeerIDAuthScheme.html | 2 +- variables/index.WELL_KNOWN_PROTOCOLS.html | 2 +- variables/ping.PING_PROTOCOL_ID.html | 2 +- 27 files changed, 43 insertions(+), 43 deletions(-) diff --git a/classes/auth.ClientAuth.html b/classes/auth.ClientAuth.html index 9092676..8750cb5 100644 --- a/classes/auth.ClientAuth.html +++ b/classes/auth.ClientAuth.html @@ -1,4 +1,4 @@ -ClientAuth | @libp2p/http-fetch

Constructors

constructor +ClientAuth | @libp2p/http-fetch

Constructors

Properties

tokenTTL: number = ...
tokens: Map<string, TokenInfo> = ...

Methods

  • authenticatedFetch is like fetch, but it also handles HTTP Peer ID +

Constructors

Properties

tokenTTL: number = ...
tokens: Map<string, TokenInfo> = ...

Methods

  • authenticatedFetch is like fetch, but it also handles HTTP Peer ID authentication with the server.

    If we have not seen the server before, verifyPeer will be called to check if we want to make the request to the server with the given peer id. This happens after we've authenticated the server.

    -

    Parameters

    Returns Promise<Response & {
        peer: PeerId;
    }>

  • Parameters

    • hostname: string

    Returns undefined | string

  • Parameters

    • hostname: string

    Returns undefined | {
        authorization: string;
        peer: PeerId;
    }

\ No newline at end of file +

Parameters

Returns Promise<Response & {
    peer: PeerId;
}>

\ No newline at end of file diff --git a/classes/auth.ServerAuth.html b/classes/auth.ServerAuth.html index 33a8024..a0aa7bc 100644 --- a/classes/auth.ServerAuth.html +++ b/classes/auth.ServerAuth.html @@ -1,4 +1,4 @@ -ServerAuth | @libp2p/http-fetch

Constructors

constructor +ServerAuth | @libp2p/http-fetch

Constructors

Properties

Constructors

Properties

httpHandler: HttpHandler = ...
logger?: Logger
tokenTTL: number = ...
validHostname: ((hostname) => boolean)

Type declaration

    • (hostname): boolean
    • Parameters

      • hostname: string

      Returns boolean

Methods

\ No newline at end of file +

Constructors

Properties

httpHandler: HttpHandler = ...
logger?: Logger
tokenTTL: number = ...
validHostname: ((hostname) => boolean)

Type declaration

    • (hostname): boolean
    • Parameters

      • hostname: string

      Returns boolean

Methods

\ No newline at end of file diff --git a/classes/well_known_handler.WellKnownHandler.html b/classes/well_known_handler.WellKnownHandler.html index f3eb91c..48d425a 100644 --- a/classes/well_known_handler.WellKnownHandler.html +++ b/classes/well_known_handler.WellKnownHandler.html @@ -1,5 +1,5 @@ -WellKnownHandler | @libp2p/http-fetch

Constructors

constructor +WellKnownHandler | @libp2p/http-fetch

Constructors

Properties

myWellKnownProtos: ProtosMap = {}

Methods

\ No newline at end of file +

Constructors

Properties

myWellKnownProtos: ProtosMap = {}

Methods

\ No newline at end of file diff --git a/functions/index.http-1.html b/functions/index.http-1.html index 215b872..cd0f786 100644 --- a/functions/index.http-1.html +++ b/functions/index.http-1.html @@ -1,3 +1,3 @@ http | @libp2p/http-fetch
  • Create an HTTP service that provides a fetch implementation and a way to register custom HTTP handlers.

    Parameters

    • init: HTTPInit = {}

      Options to configure the HTTP service.

      -

    Returns ((components) => HTTP)

\ No newline at end of file +

Returns ((components) => HTTP)

\ No newline at end of file diff --git a/functions/index.httpCustomServer.html b/functions/index.httpCustomServer.html index 9c86156..aecd4d6 100644 --- a/functions/index.httpCustomServer.html +++ b/functions/index.httpCustomServer.html @@ -1,4 +1,4 @@ httpCustomServer | @libp2p/http-fetch
\ No newline at end of file +

Returns ((components) => HTTP & HTTPWithCustomHandler)

\ No newline at end of file diff --git a/functions/ping.sendPing.html b/functions/ping.sendPing.html index 1a46dd0..37320db 100644 --- a/functions/ping.sendPing.html +++ b/functions/ping.sendPing.html @@ -1,4 +1,4 @@ sendPing | @libp2p/http-fetch
\ No newline at end of file +

Returns Promise<void>

\ No newline at end of file diff --git a/functions/ping.servePing.html b/functions/ping.servePing.html index c89f37a..f9947eb 100644 --- a/functions/ping.servePing.html +++ b/functions/ping.servePing.html @@ -1,4 +1,4 @@ servePing | @libp2p/http-fetch
\ No newline at end of file +
\ No newline at end of file diff --git a/interfaces/auth.AuthenticateServerOptions.html b/interfaces/auth.AuthenticateServerOptions.html index c6a2998..280676c 100644 --- a/interfaces/auth.AuthenticateServerOptions.html +++ b/interfaces/auth.AuthenticateServerOptions.html @@ -1,9 +1,9 @@ -AuthenticateServerOptions | @libp2p/http-fetch

Interface AuthenticateServerOptions

interface AuthenticateServerOptions {
    fetch?: {
        (input, init?): Promise<Response>;
        (input, init?): Promise<Response>;
        (input, init?): Promise<Response>;
    };
    hostname?: string;
    signal?: AbortSignal;
}

Hierarchy

Properties

fetch? +AuthenticateServerOptions | @libp2p/http-fetch

Interface AuthenticateServerOptions

interface AuthenticateServerOptions {
    fetch?: {
        (input, init?): Promise<Response>;
        (input, init?): Promise<Response>;
        (input, init?): Promise<Response>;
    };
    hostname?: string;
    signal?: AbortSignal;
}

Hierarchy

Properties

fetch?: {
    (input, init?): Promise<Response>;
    (input, init?): Promise<Response>;
    (input, init?): Promise<Response>;
}

The Fetch implementation to use

Type declaration

Default

globalThis.fetch
 
-
hostname?: string

The hostname to use - by default this will be extracted from the .host +

hostname?: string

The hostname to use - by default this will be extracted from the .host property of authEndpointURI

-
signal?: AbortSignal
\ No newline at end of file +
signal?: AbortSignal
\ No newline at end of file diff --git a/interfaces/auth.AuthenticatedFetchOptions.html b/interfaces/auth.AuthenticatedFetchOptions.html index eb9672f..328e81a 100644 --- a/interfaces/auth.AuthenticatedFetchOptions.html +++ b/interfaces/auth.AuthenticatedFetchOptions.html @@ -1,4 +1,4 @@ -AuthenticatedFetchOptions | @libp2p/http-fetch

Interface AuthenticatedFetchOptions

interface AuthenticatedFetchOptions {
    body?: null | BodyInit;
    cache?: RequestCache;
    credentials?: RequestCredentials;
    fetch?: {
        (input, init?): Promise<Response>;
        (input, init?): Promise<Response>;
        (input, init?): Promise<Response>;
    };
    headers?: HeadersInit;
    hostname?: string;
    integrity?: string;
    keepalive?: boolean;
    method?: string;
    mode?: RequestMode;
    priority?: RequestPriority;
    redirect?: RequestRedirect;
    referrer?: string;
    referrerPolicy?: ReferrerPolicy;
    signal?: null | AbortSignal;
    window?: null;
    verifyPeer?(peerId, options): boolean | Promise<boolean>;
}

Hierarchy

  • RequestInit
    • AuthenticatedFetchOptions

Properties

body? +AuthenticatedFetchOptions | @libp2p/http-fetch

Interface AuthenticatedFetchOptions

interface AuthenticatedFetchOptions {
    body?: null | BodyInit;
    cache?: RequestCache;
    credentials?: RequestCredentials;
    fetch?: {
        (input, init?): Promise<Response>;
        (input, init?): Promise<Response>;
        (input, init?): Promise<Response>;
    };
    headers?: HeadersInit;
    hostname?: string;
    integrity?: string;
    keepalive?: boolean;
    method?: string;
    mode?: RequestMode;
    priority?: RequestPriority;
    redirect?: RequestRedirect;
    referrer?: string;
    referrerPolicy?: ReferrerPolicy;
    signal?: null | AbortSignal;
    window?: null;
    verifyPeer?(peerId, options): boolean | Promise<boolean>;
}

Hierarchy

  • RequestInit
    • AuthenticatedFetchOptions

Properties

body? cache? credentials? fetch? @@ -21,10 +21,10 @@
fetch?: {
    (input, init?): Promise<Response>;
    (input, init?): Promise<Response>;
    (input, init?): Promise<Response>;
}

The Fetch implementation to use

Type declaration

Default

globalThis.fetch
 
-
headers?: HeadersInit

A Headers object, an object literal, or an array of two-item arrays to set request's headers.

+
headers?: HeadersInit

A Headers object, an object literal, or an array of two-item arrays to set request's headers.

hostname?: string

The hostname to use - by default this will be extracted from the .host property of authEndpointURI

-
integrity?: string

A cryptographic hash of the resource to be fetched by request. Sets request's integrity.

+
integrity?: string

A cryptographic hash of the resource to be fetched by request. Sets request's integrity.

keepalive?: boolean

A boolean to set request's keepalive.

method?: string

A string to set request's method.

mode?: RequestMode

A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request's mode.

@@ -36,4 +36,4 @@

Methods

  • A function to verify the peer ID of the server. This function will be called after the server has authenticated itself. If the function returns false, the request will be aborted.

    -

    Parameters

    Returns boolean | Promise<boolean>

\ No newline at end of file +

Parameters

Returns boolean | Promise<boolean>

\ No newline at end of file diff --git a/interfaces/auth.HttpHandler.html b/interfaces/auth.HttpHandler.html index 68171b3..77db8a5 100644 --- a/interfaces/auth.HttpHandler.html +++ b/interfaces/auth.HttpHandler.html @@ -1 +1 @@ -HttpHandler | @libp2p/http-fetch
interface HttpHandler ((req) => Promise<Response>)
\ No newline at end of file +HttpHandler | @libp2p/http-fetch
interface HttpHandler ((req) => Promise<Response>)
\ No newline at end of file diff --git a/interfaces/auth.ServerAuthOps.html b/interfaces/auth.ServerAuthOps.html index 9a3d3ef..eadf206 100644 --- a/interfaces/auth.ServerAuthOps.html +++ b/interfaces/auth.ServerAuthOps.html @@ -1,3 +1,3 @@ -ServerAuthOps | @libp2p/http-fetch
interface ServerAuthOps {
    logger?: Logger;
    tokenTTL?: number;
}

Properties

logger? +ServerAuthOps | @libp2p/http-fetch
interface ServerAuthOps {
    logger?: Logger;
    tokenTTL?: number;
}

Properties

Properties

logger?: Logger
tokenTTL?: number
\ No newline at end of file +

Properties

logger?: Logger
tokenTTL?: number
\ No newline at end of file diff --git a/interfaces/auth.TokenInfo.html b/interfaces/auth.TokenInfo.html index 67825e0..c25cf0c 100644 --- a/interfaces/auth.TokenInfo.html +++ b/interfaces/auth.TokenInfo.html @@ -1,4 +1,4 @@ -TokenInfo | @libp2p/http-fetch
interface TokenInfo {
    bearer: string;
    creationTime: Date;
    peer: PeerId;
}

Properties

bearer +TokenInfo | @libp2p/http-fetch
interface TokenInfo {
    bearer: string;
    creationTime: Date;
    peer: PeerId;
}

Properties

bearer: string
creationTime: Date
peer: PeerId
\ No newline at end of file +

Properties

bearer: string
creationTime: Date
peer: PeerId
\ No newline at end of file diff --git a/interfaces/index.CustomHTTPHandlerInit.html b/interfaces/index.CustomHTTPHandlerInit.html index 295ed09..a0abd21 100644 --- a/interfaces/index.CustomHTTPHandlerInit.html +++ b/interfaces/index.CustomHTTPHandlerInit.html @@ -1,2 +1,2 @@ -CustomHTTPHandlerInit | @libp2p/http-fetch

Interface CustomHTTPHandlerInit

interface CustomHTTPHandlerInit {
    customHTTPHandler(req): Promise<Response>;
}

Methods

\ No newline at end of file +CustomHTTPHandlerInit | @libp2p/http-fetch

Interface CustomHTTPHandlerInit

interface CustomHTTPHandlerInit {
    customHTTPHandler(req): Promise<Response>;
}

Methods

\ No newline at end of file diff --git a/interfaces/index.FetchComponents.html b/interfaces/index.FetchComponents.html index 6c51ac4..f19cced 100644 --- a/interfaces/index.FetchComponents.html +++ b/interfaces/index.FetchComponents.html @@ -1,4 +1,4 @@ -FetchComponents | @libp2p/http-fetch
interface FetchComponents {
    connectionManager: ConnectionManager;
    logger: ComponentLogger;
    registrar: Registrar;
}

Properties

connectionManager +FetchComponents | @libp2p/http-fetch
interface FetchComponents {
    connectionManager: ConnectionManager;
    logger: ComponentLogger;
    registrar: Registrar;
}

Properties

connectionManager: ConnectionManager
registrar: Registrar
\ No newline at end of file +

Properties

connectionManager: ConnectionManager
registrar: Registrar
\ No newline at end of file diff --git a/interfaces/index.HTTP.html b/interfaces/index.HTTP.html index fe5bc10..58541d6 100644 --- a/interfaces/index.HTTP.html +++ b/interfaces/index.HTTP.html @@ -1,6 +1,6 @@ HTTP | @libp2p/http-fetch

HTTP service interface.

-
interface HTTP {
    fetch(request, requestInit?): Promise<Response>;
    getPeerMeta(peer): Promise<ProtosMap>;
    handleHTTPProtocol(protocol, path, handler): void;
    prefixForProtocol(peer, protocol): Promise<string>;
}

Methods

interface HTTP {
    fetch(request, requestInit?): Promise<Response>;
    getPeerMeta(peer): Promise<ProtosMap>;
    handleHTTPProtocol(protocol, path, handler): void;
    prefixForProtocol(peer, protocol): Promise<string>;
}

Methods

\ No newline at end of file +

Methods

\ No newline at end of file diff --git a/interfaces/index.HTTPInit.html b/interfaces/index.HTTPInit.html index 22f70c8..9a934f8 100644 --- a/interfaces/index.HTTPInit.html +++ b/interfaces/index.HTTPInit.html @@ -1,4 +1,4 @@ HTTPInit | @libp2p/http-fetch

Options to configure the HTTP service.

Only required if you want to specify a custom fetch implementation. Or provide one if your environment does not have a global fetch.

-
interface HTTPInit {
    fetch?(request): Promise<Response>;
}

Methods

Methods

\ No newline at end of file +
interface HTTPInit {
    fetch?(request): Promise<Response>;
}

Methods

Methods

\ No newline at end of file diff --git a/interfaces/index.HTTPWithCustomHandler.html b/interfaces/index.HTTPWithCustomHandler.html index 6027d4d..aabeb90 100644 --- a/interfaces/index.HTTPWithCustomHandler.html +++ b/interfaces/index.HTTPWithCustomHandler.html @@ -1,3 +1,3 @@ -HTTPWithCustomHandler | @libp2p/http-fetch

Interface HTTPWithCustomHandler

interface HTTPWithCustomHandler {
    registerProtocol(protocol, path): void;
    serveWellKnownProtocols(req): Promise<Response>;
}

Methods

registerProtocol +HTTPWithCustomHandler | @libp2p/http-fetch

Interface HTTPWithCustomHandler

interface HTTPWithCustomHandler {
    registerProtocol(protocol, path): void;
    serveWellKnownProtocols(req): Promise<Response>;
}

Methods

  • Parameters

    • protocol: string
    • path: string

    Returns void

\ No newline at end of file +

Methods

  • Parameters

    • protocol: string
    • path: string

    Returns void

\ No newline at end of file diff --git a/modules/auth.html b/modules/auth.html index 92bb46d..a71c480 100644 --- a/modules/auth.html +++ b/modules/auth.html @@ -1,4 +1,4 @@ -auth | @libp2p/http-fetch

Index

Classes

ClientAuth +auth | @libp2p/http-fetch

Index

Classes

Interfaces

AuthenticateServerOptions AuthenticatedFetchOptions diff --git a/modules/index.html b/modules/index.html index 716e089..524c6ef 100644 --- a/modules/index.html +++ b/modules/index.html @@ -5,7 +5,7 @@

Example

See the examples/ for full examples of how to use the HTTP service.

import { createLibp2p } from 'libp2p'
import { http } from '@libp2p/http-fetch'

const node = await createLibp2p({
// other options ...
services: {
http: http()
}
})

await node.start()

// Make an http request to a libp2p peer
let resp = await node.services.http.fetch('multiaddr:/dns4/localhost/tcp/1234')
// Or a traditional HTTP request
resp = await node.services.http.fetch('multiaddr:/dns4/example.com/tcp/443/tls/http')
// And of course, you can use the fetch API as you normally would
resp = await node.services.http.fetch('https://example.com')

// This gives you the accessibility of the fetch API with the flexibility of using a p2p network.
-

Index

Interfaces

Index

Interfaces

CustomHTTPHandlerInit FetchComponents HTTP HTTPInit diff --git a/modules/ping.html b/modules/ping.html index 30ebf41..bd596eb 100644 --- a/modules/ping.html +++ b/modules/ping.html @@ -1,4 +1,4 @@ -ping | @libp2p/http-fetch

Index

Variables

PING_PROTOCOL_ID +ping | @libp2p/http-fetch

Index

Variables

Functions

\ No newline at end of file diff --git a/modules/well_known_handler.html b/modules/well_known_handler.html index bc24595..2bb8d3d 100644 --- a/modules/well_known_handler.html +++ b/modules/well_known_handler.html @@ -1,4 +1,4 @@ -well-known-handler | @libp2p/http-fetch

Module well-known-handler

References

WELL_KNOWN_PROTOCOLS +well-known-handler | @libp2p/http-fetch

Module well-known-handler

References

Classes

Type Aliases

ProtocolID ProtosMap diff --git a/types/well_known_handler.ProtocolID.html b/types/well_known_handler.ProtocolID.html index d16d609..b5b6b17 100644 --- a/types/well_known_handler.ProtocolID.html +++ b/types/well_known_handler.ProtocolID.html @@ -1 +1 @@ -ProtocolID | @libp2p/http-fetch
ProtocolID: string
\ No newline at end of file +ProtocolID | @libp2p/http-fetch
ProtocolID: string
\ No newline at end of file diff --git a/types/well_known_handler.ProtosMap.html b/types/well_known_handler.ProtosMap.html index d102bc9..b3250d5 100644 --- a/types/well_known_handler.ProtosMap.html +++ b/types/well_known_handler.ProtosMap.html @@ -1 +1 @@ -ProtosMap | @libp2p/http-fetch
ProtosMap: Record<ProtocolID, {
    path: string;
}>

Type declaration

  • path: string
\ No newline at end of file +ProtosMap | @libp2p/http-fetch
ProtosMap: Record<ProtocolID, {
    path: string;
}>

Type declaration

  • path: string
\ No newline at end of file diff --git a/variables/auth.HTTPPeerIDAuthProto.html b/variables/auth.HTTPPeerIDAuthProto.html index 08a96d4..96860f8 100644 --- a/variables/auth.HTTPPeerIDAuthProto.html +++ b/variables/auth.HTTPPeerIDAuthProto.html @@ -1 +1 @@ -HTTPPeerIDAuthProto | @libp2p/http-fetch

Variable HTTPPeerIDAuthProtoConst

HTTPPeerIDAuthProto: "/http-peer-id-auth/1.0.0" = '/http-peer-id-auth/1.0.0'
\ No newline at end of file +HTTPPeerIDAuthProto | @libp2p/http-fetch

Variable HTTPPeerIDAuthProtoConst

HTTPPeerIDAuthProto: "/http-peer-id-auth/1.0.0" = '/http-peer-id-auth/1.0.0'
\ No newline at end of file diff --git a/variables/auth.PeerIDAuthScheme.html b/variables/auth.PeerIDAuthScheme.html index ffe3561..71952ca 100644 --- a/variables/auth.PeerIDAuthScheme.html +++ b/variables/auth.PeerIDAuthScheme.html @@ -1 +1 @@ -PeerIDAuthScheme | @libp2p/http-fetch

Variable PeerIDAuthSchemeConst

PeerIDAuthScheme: "libp2p-PeerID" = 'libp2p-PeerID'
\ No newline at end of file +PeerIDAuthScheme | @libp2p/http-fetch

Variable PeerIDAuthSchemeConst

PeerIDAuthScheme: "libp2p-PeerID" = 'libp2p-PeerID'
\ No newline at end of file diff --git a/variables/index.WELL_KNOWN_PROTOCOLS.html b/variables/index.WELL_KNOWN_PROTOCOLS.html index 94b674e..081261a 100644 --- a/variables/index.WELL_KNOWN_PROTOCOLS.html +++ b/variables/index.WELL_KNOWN_PROTOCOLS.html @@ -1 +1 @@ -WELL_KNOWN_PROTOCOLS | @libp2p/http-fetch

Variable WELL_KNOWN_PROTOCOLSConst

WELL_KNOWN_PROTOCOLS: "/.well-known/libp2p/protocols" = '/.well-known/libp2p/protocols'
\ No newline at end of file +WELL_KNOWN_PROTOCOLS | @libp2p/http-fetch

Variable WELL_KNOWN_PROTOCOLSConst

WELL_KNOWN_PROTOCOLS: "/.well-known/libp2p/protocols" = '/.well-known/libp2p/protocols'
\ No newline at end of file diff --git a/variables/ping.PING_PROTOCOL_ID.html b/variables/ping.PING_PROTOCOL_ID.html index 0f4c29c..7c1c0e6 100644 --- a/variables/ping.PING_PROTOCOL_ID.html +++ b/variables/ping.PING_PROTOCOL_ID.html @@ -1 +1 @@ -PING_PROTOCOL_ID | @libp2p/http-fetch

Variable PING_PROTOCOL_IDConst

PING_PROTOCOL_ID: "/http-ping/1" = '/http-ping/1'
\ No newline at end of file +PING_PROTOCOL_ID | @libp2p/http-fetch

Variable PING_PROTOCOL_IDConst

PING_PROTOCOL_ID: "/http-ping/1" = '/http-ping/1'
\ No newline at end of file