package
0.0.2-beta
Repository: https://github.com/dfns/dfns-sdk-go.git
Documentation: pkg.go.dev

# README

dfnsapiclient

import "github.com/dfns/dfns-sdk-go/dfnsapiclient"

Index

func CreateDfnsAPIClient

func CreateDfnsAPIClient(options *DfnsAPIOptions) *http.Client

CreateDfnsAPIClient creates a new HTTP client with integrated DFNS authentication capabilities. The client automatically adds all required authentication headers to outgoing requests and, if necessary, performs challenge signature exchanges. Special care should be taken when configuring the HTTP transport layer to ensure that any customizations do not interfere with the authentication mechanism. Removing required headers or altering the behavior of the transport could disrupt the authentication process.

Example usage:

options := NewDfnsAPIOptions(config, signer)

client := CreateDfnsAPIClient(options)

resp, err := client.Post("https://api.example.com/resource", ....)
if err != nil {
    log.Fatal(err)
}

defer resp.Body.Close()
// Process response...

type DfnsAPIConfig

DfnsAPIConfig defines the configuration options to connect the DFNS API.

type DfnsAPIConfig struct {
    // The application ID for authentication
    AppID string
    // The authentication token
    AuthToken *string
    // The base URL of the DFNS API
    BaseURL string
}

type DfnsAPIOptions

DfnsAPIOptions contains all the information needed for authentication with DFNS.

type DfnsAPIOptions struct {
    // Configuration to connect the DFNS API
    *DfnsAPIConfig
    // The credential signer for signing user actions
    Signer credentials.ICredentialSigner
}

func NewDfnsAPIOptions

func NewDfnsAPIOptions(config *DfnsAPIConfig, signer credentials.ICredentialSigner) (*DfnsAPIOptions, error)

NewDfnsAPIOptions creates a new DfnsApiOptions instance with the provided parameters.

Generated by gomarkdoc