mati

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEventNotSpecifiedToParse   = errors.New("no Event specified to parse")
	ErrInvalidHTTPMethod          = errors.New("invalid HTTP Method")
	ErrMissingEventKeyHeader      = errors.New("missing X-Event-Key Header")
	ErrMissingMatiSignatureHeader = errors.New("missing X-Mati-Signature Header")
	ErrEventNotFound              = errors.New("event not defined to be parsed")
	ErrParsingPayload             = errors.New("error parsing payload")
	ErrHMACVerificationFailed     = errors.New("HMAC verification failed")
)
View Source
var Options = WebhookOptions{}

Options is a namespace var for configuration options

Functions

This section is empty.

Types

type Event

type Event string
const (
	VeificationStartedEvent          Event = "verification_started"
	VerificationInputsCompletedEvent Event = "verification_inputs_completed"
	StepCompletedEvent               Event = "step_completed"
	VerificationUpdatedEvent         Event = "verification_updated"
	VerificationCompletedEvent       Event = "verification_completed"
)

type Option

type Option func(*Webhook) error

Option is a configuration option for the webhook

type StepCompletedPayload

type StepCompletedPayload struct {
	Resource string `json:"resource"`
	Step     struct {
		Status int    `json:"status"`
		ID     string `json:"id"`
		Data   struct {
			PhoneNumber string `json:"phoneNumber"`
			CountryCode string `json:"countryCode"`
			DialingCode int    `json:"dialingCode"`
		} `json:"data"`
		Error interface{} `json:"error"`
	} `json:"step"`
	EventName string    `json:"eventName"`
	FlowID    string    `json:"flowId"`
	Timestamp time.Time `json:"timestamp"`
}

type VerificationCompletedPayload

type VerificationCompletedPayload struct {
	Resource          string `json:"resource"`
	DeviceFingerprint struct {
		Ua      string `json:"ua"`
		Browser struct {
			Name    string `json:"name"`
			Version string `json:"version"`
			Major   string `json:"major"`
		} `json:"browser"`
		Engine struct {
			Name    string `json:"name"`
			Version string `json:"version"`
		} `json:"engine"`
		Os struct {
			Name    string `json:"name"`
			Version string `json:"version"`
		} `json:"os"`
		CPU struct {
			Architecture string `json:"architecture"`
		} `json:"cpu"`
		App struct {
			Platform string `json:"platform"`
			Version  string `json:"version"`
		} `json:"app"`
		IP                  string `json:"ip"`
		VpnDetectionEnabled bool   `json:"vpnDetectionEnabled"`
	} `json:"deviceFingerprint"`
	IdentityStatus string `json:"identityStatus"`
	Details        struct {
		IsDocumentExpired struct {
			Data struct {
			} `json:"data"`
		} `json:"isDocumentExpired"`
	} `json:"details"`
	MatiDashboardURL string    `json:"matiDashboardUrl"`
	Status           string    `json:"status"`
	EventName        string    `json:"eventName"`
	FlowID           string    `json:"flowId"`
	Timestamp        time.Time `json:"timestamp"`
}

type VerificationInputsCompletedPayload

type VerificationInputsCompletedPayload struct {
	Resource  string    `json:"resource"`
	EventName string    `json:"eventName"`
	FlowID    string    `json:"flowId"`
	Timestamp time.Time `json:"timestamp"`
}

type VerificationStartedPayload

type VerificationStartedPayload struct {
	Resource  string    `json:"resource"`
	EventName string    `json:"eventName"`
	FlowID    string    `json:"flowId"`
	Timestamp time.Time `json:"timestamp"`
}

type VerificationUpdatedPayload

type VerificationUpdatedPayload struct {
	Resource          string `json:"resource"`
	DeviceFingerprint struct {
		Ua      string `json:"ua"`
		Browser struct {
			Name    string `json:"name"`
			Version string `json:"version"`
			Major   string `json:"major"`
		} `json:"browser"`
		Engine struct {
			Name    string `json:"name"`
			Version string `json:"version"`
		} `json:"engine"`
		Os struct {
			Name    string `json:"name"`
			Version string `json:"version"`
		} `json:"os"`
		CPU struct {
			Architecture string `json:"architecture"`
		} `json:"cpu"`
		App struct {
			Platform string `json:"platform"`
			Version  string `json:"version"`
		} `json:"app"`
		IP                  string `json:"ip"`
		VpnDetectionEnabled bool   `json:"vpnDetectionEnabled"`
	} `json:"deviceFingerprint"`
	IdentityStatus   string    `json:"identityStatus"`
	MatiDashboardURL string    `json:"matiDashboardUrl"`
	Status           string    `json:"status"`
	EventName        string    `json:"eventName"`
	FlowID           string    `json:"flowId"`
	Timestamp        time.Time `json:"timestamp"`
}

type Webhook

type Webhook struct {
	// contains filtered or unexported fields
}

Webhook instance contains all methods needed to process events

func New

func New(options ...Option) (*Webhook, error)

New creates and returns a WebHook instance denoted by the Provider type

func (Webhook) Parse

func (hook Webhook) Parse(r *http.Request, events ...Event) (interface{}, error)

Parse verifies and parses the events specified and returns the payload object or an error

type WebhookOptions

type WebhookOptions struct{}

WebhookOptions is a namespace for configuration option methods

func (WebhookOptions) Secret

func (WebhookOptions) Secret(secret string) Option

Secret registers the GitHub secret

Jump to

Keyboard shortcuts

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