idv

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccreditationIncome       = "income"       // >$200K/yr individual, >$300K/yr joint
	AccreditationNetWorth     = "net_worth"    // >$1M excluding primary residence
	AccreditationProfessional = "professional" // Series 7, 65, or 82 license
	AccreditationEntity       = "entity"       // >$5M in assets
)

Accreditation methods (SEC Rule 501 of Regulation D).

View Source
const (
	AccreditationPending  = "pending"
	AccreditationApproved = "approved"
	AccreditationRejected = "rejected"
	AccreditationExpired  = "expired"
)

AccreditationStatus enumerates accreditation outcomes.

View Source
const (
	CheckIDV       = "idv"
	CheckSanctions = "sanctions"
	CheckPEP       = "pep"
)

CheckType enumerates the per-check types in a composite result.

View Source
const (
	CheckPassed  = "passed"
	CheckFailed  = "failed"
	CheckPending = "pending"
	CheckError   = "error"
)

CheckStatus enumerates per-check outcomes.

View Source
const (
	CompositeApproved = "approved"
	CompositeRejected = "rejected"
	CompositePending  = "pending"
	CompositeError    = "error"
)

CompositeStatus enumerates the overall verification outcome.

View Source
const (
	// DefaultAlibabaCloudEndpoint is the default endpoint for Alibaba Cloud ID verification service
	DefaultAlibabaCloudEndpoint = "cloudauth.cn-shanghai.aliyuncs.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccreditationRequest

type AccreditationRequest struct {
	UserID string `json:"user_id"`
	Method string `json:"method"` // income, net_worth, professional, entity

	// Income method
	AnnualIncome float64 `json:"annual_income,omitempty"`
	JointIncome  float64 `json:"joint_income,omitempty"`
	IncomeYears  int     `json:"income_years,omitempty"` // consecutive years

	// Net worth method
	NetWorth float64 `json:"net_worth,omitempty"`

	// Professional method
	LicenseType   string `json:"license_type,omitempty"` // series_7, series_65, series_82
	LicenseNumber string `json:"license_number,omitempty"`

	// Entity method
	EntityName   string  `json:"entity_name,omitempty"`
	EntityAssets float64 `json:"entity_assets,omitempty"`
}

AccreditationRequest is the JSON body for POST /v1/idv/accreditation.

type AccreditationResult

type AccreditationResult struct {
	UserID    string    `json:"user_id"`
	Method    string    `json:"method"`
	Status    string    `json:"status"`
	ExpiresAt time.Time `json:"expires_at"`
	Detail    string    `json:"detail,omitempty"`
}

AccreditationResult is the outcome of accredited investor verification.

type AlibabaCloudIdvProvider

type AlibabaCloudIdvProvider struct {
	ClientId     string
	ClientSecret string
	Endpoint     string
}

func NewAlibabaCloudIdvProvider

func NewAlibabaCloudIdvProvider(clientId string, clientSecret string, endpoint string) *AlibabaCloudIdvProvider

func (*AlibabaCloudIdvProvider) VerifyIdentity

func (provider *AlibabaCloudIdvProvider) VerifyIdentity(idCardType string, idCard string, realName string) (bool, error)

type CheckResult

type CheckResult struct {
	Type   string `json:"type"`
	Status string `json:"status"`
	Detail string `json:"detail,omitempty"`
}

CheckResult is a single sub-check in the composite verification.

type Handler

type Handler struct {
	Svc           *Service
	WebhookSecret string // HMAC-SHA256 secret for verifying provider callbacks
	BDWebhookURL  string // URL to fire kyc.approved/kyc.rejected to
}

Handler exposes IDV HTTP endpoints. It wraps the Service and provides the handler functions that are wired into the Beego router by the ApiController methods in controllers/idv_api.go.

func (*Handler) HandleGetStatus

func (h *Handler) HandleGetStatus(w http.ResponseWriter, r *http.Request)

HandleGetStatus processes GET /v1/idv/verify/{id}.

func (*Handler) HandleUploadDocuments

func (h *Handler) HandleUploadDocuments(w http.ResponseWriter, r *http.Request)

HandleUploadDocuments processes POST /v1/idv/verify/{id}/documents. Accepts multipart form data with supplementary document uploads.

func (*Handler) HandleVerifyAccreditation

func (h *Handler) HandleVerifyAccreditation(w http.ResponseWriter, r *http.Request)

HandleVerifyAccreditation processes POST /v1/idv/accreditation.

func (*Handler) HandleVerifyIdentity

func (h *Handler) HandleVerifyIdentity(w http.ResponseWriter, r *http.Request)

HandleVerifyIdentity processes POST /v1/idv/verify.

func (*Handler) HandleWebhook

func (h *Handler) HandleWebhook(w http.ResponseWriter, r *http.Request)

HandleWebhook processes POST /v1/idv/verify/webhook. Provider callbacks hit this endpoint; we verify the signature, update user KYC status, and fire a downstream webhook to the BD.

type IdvProvider

type IdvProvider interface {
	VerifyIdentity(idCardType string, idCard string, realName string) (bool, error)
}

IdvProvider is the sync identity verification interface used by IAM controllers. For async workflows (webhooks, redirect flows), use the compliance module directly.

func GetIdvProvider

func GetIdvProvider(typ string, clientId string, clientSecret string, endpoint string) IdvProvider

GetIdvProvider returns an IDV provider by type. Jumio, Onfido, and Plaid delegate to luxfi/compliance for the full verification workflow. Alibaba Cloud remains IAM-native (China-market specific).

type Service

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

Service orchestrates IDV, sanctions, and PEP checks.

func NewService

func NewService(amlURL string) *Service

NewService creates an IDV orchestration service.

func (*Service) CheckStatus

func (s *Service) CheckStatus(ctx context.Context, providerName, verificationID string) (*cidv.VerificationStatusResult, error)

CheckStatus queries a provider for the current status of a verification.

func (*Service) GetProvider

func (s *Service) GetProvider(name string) (cidv.Provider, bool)

GetProvider returns a registered provider by name.

func (*Service) HandleWebhook

func (s *Service) HandleWebhook(providerName string, body []byte, headers map[string]string) (*cidv.WebhookEvent, error)

HandleWebhook processes a provider webhook and returns the updated status.

func (*Service) RegisterProvider

func (s *Service) RegisterProvider(name string, p cidv.Provider)

RegisterProvider adds a named IDV provider.

func (*Service) Verify

func (s *Service) Verify(ctx context.Context, userID, org, providerName string, req *cidv.VerificationRequest) (*VerifyResult, error)

Verify runs the composite verification: IDV + sanctions screen + PEP check.

func (*Service) VerifyAccreditation

func (s *Service) VerifyAccreditation(userID, method string, req *AccreditationRequest) (*AccreditationResult, error)

VerifyAccreditation evaluates whether a user qualifies as an accredited investor.

type VerifyIdentityRequest

type VerifyIdentityRequest struct {
	UserID      string `json:"user_id"`
	Provider    string `json:"provider"`
	CallbackURL string `json:"callback_url,omitempty"`
	GivenName   string `json:"given_name,omitempty"`
	FamilyName  string `json:"family_name,omitempty"`
	DateOfBirth string `json:"date_of_birth,omitempty"`
	Email       string `json:"email,omitempty"`
	Country     string `json:"country,omitempty"`
	Workflow    string `json:"workflow,omitempty"`
}

VerifyIdentityRequest is the JSON body for POST /v1/idv/verify.

type VerifyIdentityResponse

type VerifyIdentityResponse struct {
	VerificationID string        `json:"verification_id"`
	Status         string        `json:"status"`
	RedirectURL    string        `json:"redirect_url,omitempty"`
	Checks         []CheckResult `json:"checks"`
}

VerifyIdentityResponse is returned from POST /v1/idv/verify.

type VerifyResult

type VerifyResult struct {
	VerificationID string        `json:"verification_id"`
	Status         string        `json:"status"`
	Provider       string        `json:"provider"`
	RedirectURL    string        `json:"redirect_url,omitempty"`
	Checks         []CheckResult `json:"checks"`
	CreatedAt      time.Time     `json:"created_at"`
}

VerifyResult is the composite outcome of IDV + sanctions + PEP.

type WebhookNotification

type WebhookNotification struct {
	Event          string `json:"event"`
	UserID         string `json:"user_id"`
	VerificationID string `json:"verification_id"`
	Status         string `json:"status"`
	Provider       string `json:"provider"`
}

WebhookNotification is the external event payload the BD receives.

Jump to

Keyboard shortcuts

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