DAHR API Reference

DAHR Class

The DAHR (Data Agnostic HTTPS Relay) class handles proxied HTTP requests with attestation. Each instance maintains its own session and provides attestation for requests made through the Demos network.

Methods

createDahr()

Creates a new DAHR instance:

const dahr = await demos.web2.createDahr(): Promise<Web2Proxy>

startProxy()

Makes a proxied request:

interface IStartProxyParams {
    url: string
    method: Web2Method
    options?: {
        headers?: OutgoingHttpHeaders                   
        payload?: any  
        authorization?: string 
    }
}

await dahr.startProxy(params)

Returns

All proxy requests return an IAttestationWithResponse:

interface IAttestationWithResponse {
    hash: string           // Request hash
    timestamp: number      // Attestation time
    identity: string       // Identity that created attestation
    signature: string      // Attestation signature
    valid: boolean         // Attestation validity
    web2Response: {        // The HTTP response
        status: number
        statusText: string
        headers: IncomingHttpHeaders
        data: any
    }
}

Last updated