thirdfactor

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 14 Imported by: 0

README

ThirdFactor Go

go get github.com/thirdfactorai/thirdfactor-go@v0.1.0
import thirdfactor "github.com/thirdfactorai/thirdfactor-go"

client, err := thirdfactor.New(os.Getenv("THIRDFACTOR_API_KEY"))
session, err := client.CreateSession(ctx, map[string]any{
    "vendor_data": "user-42",
    "callback_url": "https://example.com/kyc/done",
}, "kyc-user-42")

Use thirdfactor.ConstructEvent with the untouched request bytes to verify and decode webhooks.

Documentation

Index

Constants

View Source
const Version = "0.1.0"

Variables

This section is empty.

Functions

func ConstructEvent

func ConstructEvent(rawBody []byte, signature, secret string, tolerance time.Duration) (map[string]any, error)

func VerifySignature

func VerifySignature(rawBody []byte, signature, secret string, tolerance time.Duration, now time.Time) bool

Types

type APIError

type APIError struct {
	Status    int
	Body      any
	RequestID string
}

func (*APIError) Error

func (e *APIError) Error() string

type Client

type Client struct {
	APIKey     string
	BaseURL    string
	HTTPClient *http.Client
}

func New

func New(apiKey string) (*Client, error)

func (*Client) CreateSession

func (c *Client) CreateSession(ctx context.Context, params map[string]any, idempotencyKey string) (map[string]any, error)

func (*Client) Request

func (c *Client) Request(ctx context.Context, method, path string, body any, query url.Values, headers http.Header, result any) error

func (*Client) RetrieveApplication

func (c *Client) RetrieveApplication(ctx context.Context, id string) (map[string]any, error)

func (*Client) RetrieveSession

func (c *Client) RetrieveSession(ctx context.Context, id string) (map[string]any, error)

func (*Client) SessionDecision

func (c *Client) SessionDecision(ctx context.Context, id string) (map[string]any, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL