Documentation ¶
Index ¶
- Constants
- Variables
- type ActivityDetails
- type AgeVerification
- type AmlAddress
- type AmlProfile
- type AmlResult
- type ApplicationProfile
- func (p ApplicationProfile) ApplicationLogo() *attribute.ImageAttribute
- func (p ApplicationProfile) ApplicationName() *attribute.StringAttribute
- func (p ApplicationProfile) ApplicationReceiptBgColor() *attribute.StringAttribute
- func (p ApplicationProfile) ApplicationURL() *attribute.StringAttribute
- func (p ApplicationProfile) GetAttribute(attributeName string) *attribute.GenericAttribute
- func (p ApplicationProfile) GetImageAttribute(attributeName string) *attribute.ImageAttribute
- func (p ApplicationProfile) GetJSONAttribute(attributeName string) (*attribute.JSONAttribute, error)
- func (p ApplicationProfile) GetStringAttribute(attributeName string) *attribute.StringAttribute
- type AttributeTypedeprecated
- type AttributeValuedeprecated
- type Client
- func (client *Client) GetActivityDetails(token string) (ActivityDetails, []string)
- func (client *Client) GetSdkID() string
- func (client *Client) GetUserProfile(token string) (userProfile UserProfile, firstError error)deprecated
- func (client *Client) OverrideAPIURL(apiURL string)
- func (client *Client) PerformAmlCheck(amlProfile AmlProfile) (amlResult AmlResult, err error)
- type DynamicPolicy
- type DynamicPolicyBuilder
- func (b *DynamicPolicyBuilder) Build() DynamicPolicy
- func (b *DynamicPolicyBuilder) New() *DynamicPolicyBuilder
- func (b *DynamicPolicyBuilder) WithAgeDerivedAttribute(derivation string, options ...interface{}) *DynamicPolicyBuilder
- func (b *DynamicPolicyBuilder) WithAgeOver(age int, options ...interface{}) *DynamicPolicyBuilder
- func (b *DynamicPolicyBuilder) WithAgeUnder(age int, options ...interface{}) *DynamicPolicyBuilder
- func (b *DynamicPolicyBuilder) WithDateOfBirth(options ...interface{}) *DynamicPolicyBuilder
- func (b *DynamicPolicyBuilder) WithEmail(options ...interface{}) *DynamicPolicyBuilder
- func (b *DynamicPolicyBuilder) WithFamilyName(options ...interface{}) *DynamicPolicyBuilder
- func (b *DynamicPolicyBuilder) WithFullName(options ...interface{}) *DynamicPolicyBuilder
- func (b *DynamicPolicyBuilder) WithGender(options ...interface{}) *DynamicPolicyBuilder
- func (b *DynamicPolicyBuilder) WithGivenNames(options ...interface{}) *DynamicPolicyBuilder
- func (b *DynamicPolicyBuilder) WithNationality(options ...interface{}) *DynamicPolicyBuilder
- func (b *DynamicPolicyBuilder) WithPhoneNumber(options ...interface{}) *DynamicPolicyBuilder
- func (b *DynamicPolicyBuilder) WithPinAuth() *DynamicPolicyBuilder
- func (b *DynamicPolicyBuilder) WithPostalAddress(options ...interface{}) *DynamicPolicyBuilder
- func (b *DynamicPolicyBuilder) WithSelfie(options ...interface{}) *DynamicPolicyBuilder
- func (b *DynamicPolicyBuilder) WithSelfieAuth() *DynamicPolicyBuilder
- func (b *DynamicPolicyBuilder) WithStructuredPostalAddress(options ...interface{}) *DynamicPolicyBuilder
- func (b *DynamicPolicyBuilder) WithWantedAttribute(attribute WantedAttribute) *DynamicPolicyBuilder
- func (b *DynamicPolicyBuilder) WithWantedAttributeByName(name string, options ...interface{}) *DynamicPolicyBuilder
- func (b *DynamicPolicyBuilder) WithWantedAuthType(wantedAuthType int) *DynamicPolicyBuilder
- func (b *DynamicPolicyBuilder) WithWantedRememberMe() *DynamicPolicyBuilder
- type DynamicScenario
- type DynamicScenarioBuilder
- func (builder *DynamicScenarioBuilder) Build() DynamicScenario
- func (builder *DynamicScenarioBuilder) New() *DynamicScenarioBuilder
- func (builder *DynamicScenarioBuilder) WithCallbackEndpoint(endpoint string) *DynamicScenarioBuilder
- func (builder *DynamicScenarioBuilder) WithExtension(extension interface{}) *DynamicScenarioBuilder
- func (builder *DynamicScenarioBuilder) WithPolicy(policy DynamicPolicy) *DynamicScenarioBuilder
- type HttpClient
- type Imagedeprecated
- func (image *Image) GetContentType() stringdeprecated
- func (image *Image) URL() stringdeprecated
- type ImageTypedeprecated
- type Profile
- func (p Profile) Address() *attribute.StringAttribute
- func (p Profile) AgeVerifications() (out []AgeVerification, err error)
- func (p Profile) DateOfBirth() (*attribute.TimeAttribute, error)
- func (p Profile) DocumentDetails() (*attribute.DocumentDetailsAttribute, error)
- func (p Profile) DocumentImages() (*attribute.ImageSliceAttribute, error)
- func (p Profile) EmailAddress() *attribute.StringAttribute
- func (p Profile) FamilyName() *attribute.StringAttribute
- func (p Profile) FullName() *attribute.StringAttribute
- func (p Profile) Gender() *attribute.StringAttribute
- func (p Profile) GetAttribute(attributeName string) *attribute.GenericAttribute
- func (p Profile) GetImageAttribute(attributeName string) *attribute.ImageAttribute
- func (p Profile) GetJSONAttribute(attributeName string) (*attribute.JSONAttribute, error)
- func (p Profile) GetStringAttribute(attributeName string) *attribute.StringAttribute
- func (p Profile) GivenNames() *attribute.StringAttribute
- func (p Profile) MobileNumber() *attribute.StringAttribute
- func (p Profile) Nationality() *attribute.StringAttribute
- func (p Profile) Selfie() *attribute.ImageAttribute
- func (p Profile) StructuredPostalAddress() (*attribute.JSONAttribute, error)
- type ShareURL
- type SourceConstraint
- type SourceConstraintBuilder
- func (b *SourceConstraintBuilder) Build() SourceConstraint
- func (b *SourceConstraintBuilder) New() *SourceConstraintBuilder
- func (b *SourceConstraintBuilder) WithAnchor(anchor WantedAnchor) *SourceConstraintBuilder
- func (b *SourceConstraintBuilder) WithAnchorByValue(value, subtype string) *SourceConstraintBuilder
- func (b *SourceConstraintBuilder) WithDrivingLicence(subtype string) *SourceConstraintBuilder
- func (b *SourceConstraintBuilder) WithNationalID(subtype string) *SourceConstraintBuilder
- func (b *SourceConstraintBuilder) WithPasscard(subtype string) *SourceConstraintBuilder
- func (b *SourceConstraintBuilder) WithPassport(subtype string) *SourceConstraintBuilder
- func (b *SourceConstraintBuilder) WithSoftPreference(soft bool) *SourceConstraintBuilder
- type UserProfiledeprecated
- type WantedAnchor
- type WantedAnchorBuilder
- type WantedAttribute
- type WantedAttributeBuilder
- func (builder *WantedAttributeBuilder) Build() WantedAttribute
- func (builder *WantedAttributeBuilder) New() *WantedAttributeBuilder
- func (builder *WantedAttributeBuilder) WithAcceptSelfAsserted(accept bool) *WantedAttributeBuilder
- func (builder *WantedAttributeBuilder) WithConstraint(constraint constraintInterface) *WantedAttributeBuilder
- func (builder *WantedAttributeBuilder) WithDerivation(derivation string) *WantedAttributeBuilder
- func (builder *WantedAttributeBuilder) WithName(name string) *WantedAttributeBuilder
Examples ¶
- CreateShareURL
- DynamicPolicyBuilder
- DynamicPolicyBuilder.WithAgeOver
- DynamicPolicyBuilder.WithFamilyName
- DynamicPolicyBuilder.WithFullName
- DynamicPolicyBuilder.WithSelfie
- DynamicPolicyBuilder.WithSelfieAuth
- DynamicPolicyBuilder.WithWantedRememberMe
- DynamicScenarioBuilder
- DynamicScenarioBuilder.WithExtension
- DynamicScenarioBuilder.WithPolicy
- SourceConstraint
- SourceConstraintBuilder.WithDrivingLicence
- SourceConstraintBuilder.WithNationalID
- SourceConstraintBuilder.WithPasscard
- SourceConstraintBuilder.WithPassport
- WantedAnchorBuilder
- WantedAttributeBuilder.WithAcceptSelfAsserted
- WantedAttributeBuilder.WithConstraint
- WantedAttributeBuilder.WithDerivation
- WantedAttributeBuilder.WithName
Constants ¶
const ( AttrConstApplicationName = "application_name" AttrConstApplicationURL = "application_url" AttrConstApplicationLogo = "application_logo" AttrConstApplicationReceiptBGColor = "application_receipt_bgcolor" )
Attribute names for application attributes
const ( // HTTPMethodPost Post HTTP method HTTPMethodPost = "POST" // HTTPMethodGet Get HTTP method HTTPMethodGet = "GET" // HTTPMethodPut Put HTTP method HTTPMethodPut = "PUT" // HTTPMethodPatch Patch HTTP method HTTPMethodPatch = "PATCH" )
Deprecated will be removed in v3.0.0 Use http method constants from net/http
const ( AnchorDrivingLicenceConst = "DRIVING_LICENCE" AnchorPassportConst = "PASSPORT" AnchorNationalIDConst = "NATIONAL_ID" AnchorPassCardConst = "PASS_CARD" )
Anchor name constants
const ( AttrConstSelfie = "selfie" AttrConstGivenNames = "given_names" AttrConstFamilyName = "family_name" AttrConstFullName = "full_name" AttrConstMobileNumber = "phone_number" AttrConstEmailAddress = "email_address" AttrConstDateOfBirth = "date_of_birth" AttrConstAddress = "postal_address" AttrConstStructuredPostalAddress = "structured_postal_address" AttrConstGender = "gender" AttrConstNationality = "nationality" AttrConstDocumentImages = "document_images" AttrConstDocumentDetails = "document_details" AttrConstAgeOver = "age_over:%d" AttrConstAgeUnder = "age_under:%d" )
Attribute names for user profile attributes
Variables ¶
var ( // ErrProfileNotFound profile was not found during activity retrieval for the provided one time use token ErrProfileNotFound = errors.New("ProfileNotFound") // ErrFailure there was a failure during activity retrieval ErrFailure = errors.New("Failure") // ErrSharingFailure there was a failure when sharing ErrSharingFailure = errors.New("SharingFailure") )
var ( // DefaultHTTPErrorMessages maps HTTP error status codes to format strings // to create useful error messages. -1 is used to specify a default message // that can be used if an error code is not explicitly defined DefaultHTTPErrorMessages = map[int]string{ -1: defaultUnknownErrorMessageConst, } )
var ( // by the Share URL API ShareURLHTTPErrorMessages = map[int]string{ 400: "JSON is incorrect, contains invalid data: %[2]s", 404: "Application was not found: %[2]s", } )
Functions ¶
This section is empty.
Types ¶
type ActivityDetails ¶
type ActivityDetails struct { UserProfile Profile ApplicationProfile ApplicationProfile // contains filtered or unexported fields }
ActivityDetails represents the result of an activity between a user and the application.
func (ActivityDetails) ExtraData ¶ added in v2.7.0
func (a ActivityDetails) ExtraData() *share.ExtraData
ExtraData represents extra pieces information on the receipt
func (ActivityDetails) ParentRememberMeID ¶
func (a ActivityDetails) ParentRememberMeID() string
ParentRememberMeID is a unique, stable identifier for a user in the context of an organisation. You can use it to identify returning users. This value is consistent for a given user across different applications belonging to a single organisation.
func (ActivityDetails) ReceiptID ¶ added in v2.6.0
func (a ActivityDetails) ReceiptID() string
ReceiptID identifies a completed activity
func (ActivityDetails) RememberMeID ¶
func (a ActivityDetails) RememberMeID() string
RememberMeID is a unique, stable identifier for a user in the context of an application. You can use it to identify returning users. This value will be different for the same user in different applications.
func (ActivityDetails) Timestamp ¶ added in v2.6.0
func (a ActivityDetails) Timestamp() string
Timestamp is the Time and date of the sharing activity
type AgeVerification ¶ added in v2.7.0
type AgeVerification struct { Age int CheckType string Result bool Attribute *yotiprotoattr.Attribute }
AgeVerification encapsulates the result of a single age verification as part of a share
func (AgeVerification) New ¶ added in v2.7.0
func (AgeVerification) New(attr *yotiprotoattr.Attribute) (value AgeVerification, err error)
New constructs an AgeVerification from a protobuffer
type AmlAddress ¶
AmlAddress Address for Anti Money Laundering (AML) purposes
type AmlProfile ¶
type AmlProfile struct { GivenNames string `json:"given_names"` FamilyName string `json:"family_name"` Address AmlAddress `json:"address"` SSN string `json:"ssn"` }
AmlProfile User profile for Anti Money Laundering (AML) checks
type AmlResult ¶
type AmlResult struct { OnFraudList bool `json:"on_fraud_list"` OnPEPList bool `json:"on_pep_list"` OnWatchList bool `json:"on_watch_list"` }
AmlResult Result of Anti Money Laundering (AML) check for a particular user
func GetAmlResult ¶
GetAmlResult Parses AML result from response
func GetAmlResultFromResponse
deprecated
type ApplicationProfile ¶ added in v2.6.0
type ApplicationProfile struct {
// contains filtered or unexported fields
}
ApplicationProfile is the profile of an application with convenience methods to access well-known attributes.
func (ApplicationProfile) ApplicationLogo ¶ added in v2.6.0
func (p ApplicationProfile) ApplicationLogo() *attribute.ImageAttribute
ApplicationLogo is the logo of the application that will be displayed to those users that perform a share with it.
func (ApplicationProfile) ApplicationName ¶ added in v2.6.0
func (p ApplicationProfile) ApplicationName() *attribute.StringAttribute
ApplicationName is the name of the application
func (ApplicationProfile) ApplicationReceiptBgColor ¶ added in v2.6.0
func (p ApplicationProfile) ApplicationReceiptBgColor() *attribute.StringAttribute
ApplicationReceiptBgColor is the background colour that will be displayed on each receipt the user gets as a result of a share with the application.
func (ApplicationProfile) ApplicationURL ¶ added in v2.6.0
func (p ApplicationProfile) ApplicationURL() *attribute.StringAttribute
ApplicationURL is the URL where the application is available at
func (ApplicationProfile) GetAttribute ¶ added in v2.6.0
func (p ApplicationProfile) GetAttribute(attributeName string) *attribute.GenericAttribute
GetAttribute retrieve an attribute by name on the Yoti profile. Will return nil if attribute is not present.
func (ApplicationProfile) GetImageAttribute ¶ added in v2.6.0
func (p ApplicationProfile) GetImageAttribute(attributeName string) *attribute.ImageAttribute
GetImageAttribute retrieves an image attribute by name. Will return nil if attribute is not present.
func (ApplicationProfile) GetJSONAttribute ¶ added in v2.6.0
func (p ApplicationProfile) GetJSONAttribute(attributeName string) (*attribute.JSONAttribute, error)
GetJSONAttribute retrieves a JSON attribute by name. Will return nil if attribute is not present.
func (ApplicationProfile) GetStringAttribute ¶ added in v2.6.0
func (p ApplicationProfile) GetStringAttribute(attributeName string) *attribute.StringAttribute
GetStringAttribute retrieves a string attribute by name. Will return nil if attribute is not present.
type AttributeType
deprecated
type AttributeType int
Deprecated: AttributeType format of the attribute
const ( // AttributeTypeDate date format AttributeTypeDate AttributeType = 1 + iota // AttributeTypeText text format AttributeTypeText // AttributeTypeJPEG JPEG format AttributeTypeJPEG // AttributeTypePNG PNG fornmat AttributeTypePNG // AttributeTypeJSON JSON fornmat AttributeTypeJSON )
type AttributeValue
deprecated
type AttributeValue struct { // Type represents the format of the piece of user data, whether it is a date, a piece of text or a picture // // Note the potential values for this variable are stored in constants with names beginning with // 'AttributeType'. These include: // yoti.AttributeTypeDate // yoti.AttributeTypeText // yoti.AttributeTypeJPEG // yoti.AttributeTypePNG // yoti.AttributeTypeJSON Type AttributeType Value []byte }
Deprecated: Will be removed in v3.0.0, values here will be available on Attribute objects. AttributeValue represents a small piece of information about a Yoti user such as a photo of the user or the user's date of birth.
func (AttributeValue) GetContentType
deprecated
func (val AttributeValue) GetContentType() (result string)
Deprecated: Will be removed in v3.0.0, use GetMIMEType() instead. GetContentType returns the MIME type of this piece of Yoti user information. For more information see: https://en.wikipedia.org/wiki/Media_type
type Client ¶
type Client struct { // SdkID represents the SDK ID and NOT the App ID. This can be found in the integration section of your // application hub at https://hub.yoti.com/ SdkID string // Key should be the security key given to you by yoti (see: security keys section of // https://hub.yoti.com) for more information about how to load your key from a file see: // https://github.com/getyoti/yoti-go-sdk/blob/master/README.md Key []byte // contains filtered or unexported fields }
Client represents a client that can communicate with yoti and return information about Yoti users.
func (*Client) GetActivityDetails ¶
func (client *Client) GetActivityDetails(token string) (ActivityDetails, []string)
GetActivityDetails requests information about a Yoti user using the one time use token generated by the Yoti login process. It returns the outcome of the request. If the request was successful it will include the users details, otherwise it will specify a reason the request failed.
func (*Client) GetSdkID ¶ added in v2.6.0
GetSdkID gets the Client SDK ID attached to this client instance
func (*Client) GetUserProfile
deprecated
func (client *Client) GetUserProfile(token string) (userProfile UserProfile, firstError error)
Deprecated: Will be removed in v3.0.0. Use `GetActivityDetails` instead. GetUserProfile requests information about a Yoti user using the one time use token generated by the Yoti login process. It returns the outcome of the request. If the request was successful it will include the users details, otherwise it will specify a reason the request failed.
func (*Client) OverrideAPIURL ¶ added in v2.6.0
OverrideAPIURL overrides the default API URL for this Yoti Client
func (*Client) PerformAmlCheck ¶
func (client *Client) PerformAmlCheck(amlProfile AmlProfile) (amlResult AmlResult, err error)
PerformAmlCheck performs an Anti Money Laundering Check (AML) for a particular user. Returns three boolean values: 'OnPEPList', 'OnWatchList' and 'OnFraudList'.
type DynamicPolicy ¶ added in v2.6.0
type DynamicPolicy struct {
// contains filtered or unexported fields
}
DynamicPolicy represents a dynamic policy for a share
func (*DynamicPolicy) MarshalJSON ¶ added in v2.6.0
func (policy *DynamicPolicy) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding
type DynamicPolicyBuilder ¶ added in v2.6.0
type DynamicPolicyBuilder struct {
// contains filtered or unexported fields
}
DynamicPolicyBuilder constructs a json payload specifying the dynamic policy for a dynamic scenario
Example ¶
policy := (&DynamicPolicyBuilder{}).New().WithFullName(). WithPinAuth().WithWantedRememberMe().Build() data, _ := policy.MarshalJSON() fmt.Println(string(data))
Output: {"wanted":[{"name":"full_name"}],"wanted_auth_types":[2],"wanted_remember_me":true}
func (*DynamicPolicyBuilder) Build ¶ added in v2.6.0
func (b *DynamicPolicyBuilder) Build() DynamicPolicy
Build constructs a dynamic policy object
func (*DynamicPolicyBuilder) New ¶ added in v2.6.0
func (b *DynamicPolicyBuilder) New() *DynamicPolicyBuilder
New initializes a DynamicPolicyBuilder
func (*DynamicPolicyBuilder) WithAgeDerivedAttribute ¶ added in v2.6.0
func (b *DynamicPolicyBuilder) WithAgeDerivedAttribute(derivation string, options ...interface{}) *DynamicPolicyBuilder
WithAgeDerivedAttribute is a helper method for setting age based derivations Prefer to use WithAgeOver and WithAgeUnder instead of using this directly
func (*DynamicPolicyBuilder) WithAgeOver ¶ added in v2.6.0
func (b *DynamicPolicyBuilder) WithAgeOver(age int, options ...interface{}) *DynamicPolicyBuilder
WithAgeOver sets this dynamic policy as requesting whether the user is older than a certain age
Example ¶
constraint := (&SourceConstraintBuilder{}).New().WithDrivingLicence("").Build() policy := (&DynamicPolicyBuilder{}).New().WithAgeOver(18, constraint).Build() data, _ := policy.attributes[0].MarshalJSON() fmt.Println(string(data))
Output: {"name":"date_of_birth","derivation":"age_over:18","constraints":[{"type":"SOURCE","preferred_sources":{"anchors":[{"name":"DRIVING_LICENCE","sub_type":""}],"soft_preference":false}}]}
func (*DynamicPolicyBuilder) WithAgeUnder ¶ added in v2.6.0
func (b *DynamicPolicyBuilder) WithAgeUnder(age int, options ...interface{}) *DynamicPolicyBuilder
WithAgeUnder sets this dynamic policy as requesting whether the user is younger than a certain age
func (*DynamicPolicyBuilder) WithDateOfBirth ¶ added in v2.6.0
func (b *DynamicPolicyBuilder) WithDateOfBirth(options ...interface{}) *DynamicPolicyBuilder
WithDateOfBirth adds the date of birth attribute
func (*DynamicPolicyBuilder) WithEmail ¶ added in v2.6.0
func (b *DynamicPolicyBuilder) WithEmail(options ...interface{}) *DynamicPolicyBuilder
WithEmail adds the email address attribute
func (*DynamicPolicyBuilder) WithFamilyName ¶ added in v2.6.0
func (b *DynamicPolicyBuilder) WithFamilyName(options ...interface{}) *DynamicPolicyBuilder
WithFamilyName adds the family name attribute
Example ¶
policy := (&DynamicPolicyBuilder{}).New().WithFamilyName().Build() data, _ := policy.attributes[0].MarshalJSON() fmt.Println(string(data))
Output: {"name":"family_name"}
func (*DynamicPolicyBuilder) WithFullName ¶ added in v2.6.0
func (b *DynamicPolicyBuilder) WithFullName(options ...interface{}) *DynamicPolicyBuilder
WithFullName adds the full name attribute
Example ¶
constraint := (&SourceConstraintBuilder{}).New().WithPassport("").Build() policy := (&DynamicPolicyBuilder{}).New().WithFullName(&constraint).Build() json, _ := policy.MarshalJSON() fmt.Println(string(json))
Output: {"wanted":[{"name":"full_name","constraints":[{"type":"SOURCE","preferred_sources":{"anchors":[{"name":"PASSPORT","sub_type":""}],"soft_preference":false}}]}],"wanted_auth_types":[],"wanted_remember_me":false}
func (*DynamicPolicyBuilder) WithGender ¶ added in v2.6.0
func (b *DynamicPolicyBuilder) WithGender(options ...interface{}) *DynamicPolicyBuilder
WithGender adds the gender attribute
func (*DynamicPolicyBuilder) WithGivenNames ¶ added in v2.6.0
func (b *DynamicPolicyBuilder) WithGivenNames(options ...interface{}) *DynamicPolicyBuilder
WithGivenNames adds the given names attribute
func (*DynamicPolicyBuilder) WithNationality ¶ added in v2.6.0
func (b *DynamicPolicyBuilder) WithNationality(options ...interface{}) *DynamicPolicyBuilder
WithNationality adds the nationality attribute
func (*DynamicPolicyBuilder) WithPhoneNumber ¶ added in v2.6.0
func (b *DynamicPolicyBuilder) WithPhoneNumber(options ...interface{}) *DynamicPolicyBuilder
WithPhoneNumber adds the phone number attribute
func (*DynamicPolicyBuilder) WithPinAuth ¶ added in v2.6.0
func (b *DynamicPolicyBuilder) WithPinAuth() *DynamicPolicyBuilder
WithPinAuth sets this dynamic policy as requiring PIN authentication
func (*DynamicPolicyBuilder) WithPostalAddress ¶ added in v2.6.0
func (b *DynamicPolicyBuilder) WithPostalAddress(options ...interface{}) *DynamicPolicyBuilder
WithPostalAddress adds the postal address attribute
func (*DynamicPolicyBuilder) WithSelfie ¶ added in v2.6.0
func (b *DynamicPolicyBuilder) WithSelfie(options ...interface{}) *DynamicPolicyBuilder
WithSelfie adds the selfie attribute
Example ¶
policy := (&DynamicPolicyBuilder{}).New().WithSelfie().Build() data, _ := policy.attributes[0].MarshalJSON() fmt.Println(string(data))
Output: {"name":"selfie"}
func (*DynamicPolicyBuilder) WithSelfieAuth ¶ added in v2.6.0
func (b *DynamicPolicyBuilder) WithSelfieAuth() *DynamicPolicyBuilder
WithSelfieAuth sets this dynamic policy as requiring Selfie-based authentication
Example ¶
policy := (&DynamicPolicyBuilder{}).New().WithSelfieAuth().Build() data, _ := policy.MarshalJSON() fmt.Println(string(data))
Output: {"wanted":[],"wanted_auth_types":[1],"wanted_remember_me":false}
func (*DynamicPolicyBuilder) WithStructuredPostalAddress ¶ added in v2.6.0
func (b *DynamicPolicyBuilder) WithStructuredPostalAddress(options ...interface{}) *DynamicPolicyBuilder
WithStructuredPostalAddress adds the structured postal address attribute
func (*DynamicPolicyBuilder) WithWantedAttribute ¶ added in v2.6.0
func (b *DynamicPolicyBuilder) WithWantedAttribute(attribute WantedAttribute) *DynamicPolicyBuilder
WithWantedAttribute adds an attribute from WantedAttributeBuilder to the policy
func (*DynamicPolicyBuilder) WithWantedAttributeByName ¶ added in v2.6.0
func (b *DynamicPolicyBuilder) WithWantedAttributeByName(name string, options ...interface{}) *DynamicPolicyBuilder
WithWantedAttributeByName adds an attribute by its name. This is not the preferred way of adding an attribute - instead use the other methods below
func (*DynamicPolicyBuilder) WithWantedAuthType ¶ added in v2.6.0
func (b *DynamicPolicyBuilder) WithWantedAuthType(wantedAuthType int) *DynamicPolicyBuilder
WithWantedAuthType sets this dynamic policy as requiring a specific authentication type
func (*DynamicPolicyBuilder) WithWantedRememberMe ¶ added in v2.6.0
func (b *DynamicPolicyBuilder) WithWantedRememberMe() *DynamicPolicyBuilder
WithWantedRememberMe sets the Policy as requiring a "Remember Me ID"
Example ¶
policy := (&DynamicPolicyBuilder{}).New().WithWantedRememberMe().Build() data, _ := policy.MarshalJSON() fmt.Println(string(data))
Output: {"wanted":[],"wanted_auth_types":[],"wanted_remember_me":true}
type DynamicScenario ¶ added in v2.6.0
type DynamicScenario struct {
// contains filtered or unexported fields
}
DynamicScenario represents a dynamic scenario
func (DynamicScenario) MarshalJSON ¶ added in v2.6.0
func (scenario DynamicScenario) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding
type DynamicScenarioBuilder ¶ added in v2.6.0
type DynamicScenarioBuilder struct {
// contains filtered or unexported fields
}
DynamicScenarioBuilder builds a dynamic scenario
Example ¶
scenario := (&DynamicScenarioBuilder{}).New().Build() data, _ := scenario.MarshalJSON() fmt.Println(string(data))
Output: {"policy":{"wanted":[],"wanted_auth_types":[],"wanted_remember_me":false},"extensions":[],"callback_endpoint":""}
func (*DynamicScenarioBuilder) Build ¶ added in v2.6.0
func (builder *DynamicScenarioBuilder) Build() DynamicScenario
Build constructs the DynamicScenario
func (*DynamicScenarioBuilder) New ¶ added in v2.6.0
func (builder *DynamicScenarioBuilder) New() *DynamicScenarioBuilder
New initializes the state of a DynamicScenarioBuilder before its use
func (*DynamicScenarioBuilder) WithCallbackEndpoint ¶ added in v2.6.0
func (builder *DynamicScenarioBuilder) WithCallbackEndpoint(endpoint string) *DynamicScenarioBuilder
WithCallbackEndpoint sets the callback URL
func (*DynamicScenarioBuilder) WithExtension ¶ added in v2.6.0
func (builder *DynamicScenarioBuilder) WithExtension(extension interface{}) *DynamicScenarioBuilder
WithExtension adds an extension to the scenario
Example ¶
policy := (&DynamicPolicyBuilder{}).New().WithFullName().Build() extension := (&extension.TransactionalFlowExtensionBuilder{}).New(). WithContent("Transactional Flow Extension"). Build() scenario := (&DynamicScenarioBuilder{}).New().WithExtension(extension).WithPolicy(policy).Build() data, _ := scenario.MarshalJSON() fmt.Println(string(data))
Output: {"policy":{"wanted":[{"name":"full_name"}],"wanted_auth_types":[],"wanted_remember_me":false},"extensions":[{"type":"TRANSACTIONAL_FLOW","content":"Transactional Flow Extension"}],"callback_endpoint":""}
func (*DynamicScenarioBuilder) WithPolicy ¶ added in v2.6.0
func (builder *DynamicScenarioBuilder) WithPolicy(policy DynamicPolicy) *DynamicScenarioBuilder
WithPolicy attaches a DynamicPolicy to the DynamicScenario
Example ¶
policy := (&DynamicPolicyBuilder{}).New().WithEmail().WithPinAuth().Build() scenario := (&DynamicScenarioBuilder{}).New().WithPolicy(policy).WithCallbackEndpoint("/foo").Build() data, _ := scenario.MarshalJSON() fmt.Println(string(data))
Output: {"policy":{"wanted":[{"name":"email_address"}],"wanted_auth_types":[2],"wanted_remember_me":false},"extensions":[],"callback_endpoint":"/foo"}
type HttpClient ¶ added in v2.8.0
HttpClient is a mockable HTTP Client Interface
type Image
deprecated
Deprecated: Will be removed in v3.0.0 - use attribute.Image instead. ImageType struct containing the type of the image and the data in bytes.
func (*Image) GetContentType
deprecated
Deprecated: Will be removed in v3.0.0, please use image.GetMIMEType instead. GetContentType returns the MIME type of this piece of Yoti user information. For more information see: https://en.wikipedia.org/wiki/Media_type
type ImageType
deprecated
type Profile ¶
type Profile struct {
// contains filtered or unexported fields
}
Profile represents the details retrieved for a particular user. Consists of Yoti attributes: a small piece of information about a Yoti user such as a photo of the user or the user's date of birth.
func (Profile) Address ¶
func (p Profile) Address() *attribute.StringAttribute
Address represents the user's address. Will be nil if not provided by Yoti.
func (Profile) AgeVerifications ¶ added in v2.7.0
func (p Profile) AgeVerifications() (out []AgeVerification, err error)
AgeVerifications returns a list of age verifications for the user. Will be em empty slice if not provided by Yoti.
func (Profile) DateOfBirth ¶
func (p Profile) DateOfBirth() (*attribute.TimeAttribute, error)
DateOfBirth represents the user's date of birth. Will be nil if not provided by Yoti. Has an err value which will be filled if there is an error parsing the date.
func (Profile) DocumentDetails ¶ added in v2.6.0
func (p Profile) DocumentDetails() (*attribute.DocumentDetailsAttribute, error)
DocumentDetails represents information extracted from a document provided by the user. Will be nil if not provided by Yoti.
func (Profile) DocumentImages ¶
func (p Profile) DocumentImages() (*attribute.ImageSliceAttribute, error)
DocumentImages returns a slice of document images cropped from the image in the capture page. There can be multiple images as per the number of regions in the capture in this attribute. Will be nil if not provided by Yoti.
func (Profile) EmailAddress ¶
func (p Profile) EmailAddress() *attribute.StringAttribute
EmailAddress represents the user's verified email address. Will be nil if not provided by Yoti.
func (Profile) FamilyName ¶
func (p Profile) FamilyName() *attribute.StringAttribute
FamilyName corresponds to primary name in passport, and surname in English. Will be nil if not provided by Yoti.
func (Profile) FullName ¶
func (p Profile) FullName() *attribute.StringAttribute
FullName represents the user's full name. If family_name/given_names are present, the value will be equal to the string 'given_names + " " family_name'. Will be nil if not provided by Yoti.
func (Profile) Gender ¶
func (p Profile) Gender() *attribute.StringAttribute
Gender corresponds to the gender in the registered document; the value will be one of the strings "MALE", "FEMALE", "TRANSGENDER" or "OTHER". Will be nil if not provided by Yoti.
func (Profile) GetAttribute ¶
func (p Profile) GetAttribute(attributeName string) *attribute.GenericAttribute
GetAttribute retrieve an attribute by name on the Yoti profile. Will return nil if attribute is not present.
func (Profile) GetImageAttribute ¶ added in v2.6.0
func (p Profile) GetImageAttribute(attributeName string) *attribute.ImageAttribute
GetImageAttribute retrieves an image attribute by name. Will return nil if attribute is not present.
func (Profile) GetJSONAttribute ¶ added in v2.6.0
func (p Profile) GetJSONAttribute(attributeName string) (*attribute.JSONAttribute, error)
GetJSONAttribute retrieves a JSON attribute by name. Will return nil if attribute is not present.
func (Profile) GetStringAttribute ¶ added in v2.6.0
func (p Profile) GetStringAttribute(attributeName string) *attribute.StringAttribute
GetStringAttribute retrieves a string attribute by name. Will return nil if attribute is not present.
func (Profile) GivenNames ¶
func (p Profile) GivenNames() *attribute.StringAttribute
GivenNames corresponds to secondary names in passport, and first/middle names in English. Will be nil if not provided by Yoti.
func (Profile) MobileNumber ¶
func (p Profile) MobileNumber() *attribute.StringAttribute
MobileNumber represents the user's mobile phone number, as verified at registration time. The value will be a number in E.164 format (i.e. '+' for international prefix and no spaces, e.g. "+447777123456"). Will be nil if not provided by Yoti.
func (Profile) Nationality ¶
func (p Profile) Nationality() *attribute.StringAttribute
Nationality corresponds to the nationality in the passport. The value is an ISO-3166-1 alpha-3 code with ICAO9303 (passport) extensions. Will be nil if not provided by Yoti.
func (Profile) Selfie ¶
func (p Profile) Selfie() *attribute.ImageAttribute
Selfie is a photograph of the user. Will be nil if not provided by Yoti.
func (Profile) StructuredPostalAddress ¶
func (p Profile) StructuredPostalAddress() (*attribute.JSONAttribute, error)
StructuredPostalAddress represents the user's address in a JSON format. Will be nil if not provided by Yoti. This can be accessed as a map[string]string{} using a type assertion, e.g.: structuredPostalAddress := structuredPostalAddressAttribute.Value().(map[string]string{})
type ShareURL ¶ added in v2.6.0
type ShareURL struct {}
ShareURL contains a dynamic share QR code
func CreateShareURL ¶ added in v2.6.0
func CreateShareURL(client clientInterface, scenario *DynamicScenario) (share ShareURL, err error)
CreateShareURL creates a QR code for a dynamic scenario
type SourceConstraint ¶ added in v2.6.0
type SourceConstraint struct {
// contains filtered or unexported fields
}
SourceConstraint describes a requirement or preference for a particular set of anchors
Example ¶
drivingLicence := (&WantedAnchorBuilder{}).New().WithValue("DRIVING_LICENCE").Build() sourceConstraint := (&SourceConstraintBuilder{}).New(). WithAnchor(drivingLicence). WithSoftPreference(true). Build() json, _ := sourceConstraint.MarshalJSON() fmt.Println("SourceConstraint:", string(json))
Output: SourceConstraint: {"type":"SOURCE","preferred_sources":{"anchors":[{"name":"DRIVING_LICENCE","sub_type":""}],"soft_preference":true}}
func (*SourceConstraint) MarshalJSON ¶ added in v2.6.0
func (constraint *SourceConstraint) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding
type SourceConstraintBuilder ¶ added in v2.6.0
type SourceConstraintBuilder struct {
// contains filtered or unexported fields
}
SourceConstraintBuilder builds a source constraint
func (*SourceConstraintBuilder) Build ¶ added in v2.6.0
func (b *SourceConstraintBuilder) Build() SourceConstraint
Build builds a SourceConstraint
func (*SourceConstraintBuilder) New ¶ added in v2.6.0
func (b *SourceConstraintBuilder) New() *SourceConstraintBuilder
New initialises a SourceConstraintBuilder
func (*SourceConstraintBuilder) WithAnchor ¶ added in v2.6.0
func (b *SourceConstraintBuilder) WithAnchor(anchor WantedAnchor) *SourceConstraintBuilder
WithAnchor adds an anchor to the preference list
func (*SourceConstraintBuilder) WithAnchorByValue ¶ added in v2.6.0
func (b *SourceConstraintBuilder) WithAnchorByValue(value, subtype string) *SourceConstraintBuilder
WithAnchorByValue is a helper method which builds an anchor and adds it to the source constraint
func (*SourceConstraintBuilder) WithDrivingLicence ¶ added in v2.6.0
func (b *SourceConstraintBuilder) WithDrivingLicence(subtype string) *SourceConstraintBuilder
WithDrivingLicence adds a Driving Licence anchor
Example ¶
sourceConstraint := (&SourceConstraintBuilder{}).New(). WithDrivingLicence(""). Build() json, _ := sourceConstraint.MarshalJSON() fmt.Println(string(json))
Output: {"type":"SOURCE","preferred_sources":{"anchors":[{"name":"DRIVING_LICENCE","sub_type":""}],"soft_preference":false}}
func (*SourceConstraintBuilder) WithNationalID ¶ added in v2.6.0
func (b *SourceConstraintBuilder) WithNationalID(subtype string) *SourceConstraintBuilder
WithNationalID adds a national ID anchor
Example ¶
sourceConstraint := (&SourceConstraintBuilder{}).New(). WithNationalID(""). Build() json, _ := sourceConstraint.MarshalJSON() fmt.Println(string(json))
Output: {"type":"SOURCE","preferred_sources":{"anchors":[{"name":"NATIONAL_ID","sub_type":""}],"soft_preference":false}}
func (*SourceConstraintBuilder) WithPasscard ¶ added in v2.6.0
func (b *SourceConstraintBuilder) WithPasscard(subtype string) *SourceConstraintBuilder
WithPasscard adds a passcard anchor
Example ¶
sourceConstraint := (&SourceConstraintBuilder{}).New(). WithPasscard(""). Build() json, _ := sourceConstraint.MarshalJSON() fmt.Println(string(json))
Output: {"type":"SOURCE","preferred_sources":{"anchors":[{"name":"PASS_CARD","sub_type":""}],"soft_preference":false}}
func (*SourceConstraintBuilder) WithPassport ¶ added in v2.6.0
func (b *SourceConstraintBuilder) WithPassport(subtype string) *SourceConstraintBuilder
WithPassport adds a passport anchor
Example ¶
sourceConstraint := (&SourceConstraintBuilder{}).New(). WithPassport(""). Build() json, _ := sourceConstraint.MarshalJSON() fmt.Println(string(json))
Output: {"type":"SOURCE","preferred_sources":{"anchors":[{"name":"PASSPORT","sub_type":""}],"soft_preference":false}}
func (*SourceConstraintBuilder) WithSoftPreference ¶ added in v2.6.0
func (b *SourceConstraintBuilder) WithSoftPreference(soft bool) *SourceConstraintBuilder
WithSoftPreference sets this constraint as a 'soft requirement' if the parameter is true, and a hard requirement if it is false.
type UserProfile
deprecated
type UserProfile struct { // ID is a unique identifier Yoti assigns to your user, but only for your app. // If the same user logs into your app again, you get the same id. // If she/he logs into another application, Yoti will assign a different id for that app. ID string // Selfie is a photograph of the user. This will be nil if not provided by Yoti Selfie *Image // GivenNames represents the user's given names. This will be an empty string if not provided by Yoti GivenNames string // Family represents the user's family name. This will be an empty string if not provided by Yoti FamilyName string // Full name represents the user's full name. This will be an empty string if not provided by Yoti FullName string // MobileNumber represents the user's mobile phone number. This will be an empty string if not provided by Yoti MobileNumber string // EmailAddress represents the user's email address. This will be an empty string if not provided by Yoti EmailAddress string // DateOfBirth represents the user's date of birth. This will be nil if not provided by Yoti DateOfBirth *time.Time // IsAgeVerified represents the result of the age verification check on the user. The bool will be true if they passed, false if they failed, and nil if there was no check IsAgeVerified *bool // Address represents the user's address. This will be an empty string if not provided by Yoti Address string // StructuredPostalAddress represents the user's address in a JSON format. This will be empty if not provided by Yoti StructuredPostalAddress interface{} // Gender represents the user's gender. This will be an empty string if not provided by Yoti Gender string // Nationality represents the user's nationality. This will be an empty string if not provided by Yoti Nationality string // OtherAttributes is a map of any other information about the user provided by Yoti. The key will be the name // of the piece of information, and the keys associated value will be the piece of information itself. OtherAttributes map[string]AttributeValue }
Deprecated: Will be removed in v3.0.0. Use `Profile` instead. UserProfile represents the details retrieved for a particular
type WantedAnchor ¶ added in v2.6.0
type WantedAnchor struct {
// contains filtered or unexported fields
}
WantedAnchor specifies a preferred anchor for a user's details
func (*WantedAnchor) MarshalJSON ¶ added in v2.6.0
func (a *WantedAnchor) MarshalJSON() ([]byte, error)
MarshalJSON ...
type WantedAnchorBuilder ¶ added in v2.6.0
type WantedAnchorBuilder struct {
// contains filtered or unexported fields
}
WantedAnchorBuilder describes a desired anchor for user profile data
Example ¶
aadhaarAnchor := (&WantedAnchorBuilder{}).New(). WithValue("NATIONAL_ID"). WithSubType("AADHAAR"). Build() aadhaarJSON, _ := aadhaarAnchor.MarshalJSON() fmt.Println("Aadhaar:", string(aadhaarJSON))
Output: Aadhaar: {"name":"NATIONAL_ID","sub_type":"AADHAAR"}
func (*WantedAnchorBuilder) Build ¶ added in v2.6.0
func (b *WantedAnchorBuilder) Build() WantedAnchor
Build constructs the anchor from the builder's specification
func (*WantedAnchorBuilder) New ¶ added in v2.6.0
func (b *WantedAnchorBuilder) New() *WantedAnchorBuilder
New initialises a WantedAnchorBuilder before use
func (*WantedAnchorBuilder) WithSubType ¶ added in v2.6.0
func (b *WantedAnchorBuilder) WithSubType(subType string) *WantedAnchorBuilder
WithSubType sets the anchors subtype
func (*WantedAnchorBuilder) WithValue ¶ added in v2.6.0
func (b *WantedAnchorBuilder) WithValue(name string) *WantedAnchorBuilder
WithValue sets the anchor's name
type WantedAttribute ¶ added in v2.6.0
type WantedAttribute struct {
// contains filtered or unexported fields
}
WantedAttribute represents a wanted attribute in a dynamic sharing policy
func (*WantedAttribute) MarshalJSON ¶ added in v2.6.0
func (attr *WantedAttribute) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding
type WantedAttributeBuilder ¶ added in v2.6.0
type WantedAttributeBuilder struct {
// contains filtered or unexported fields
}
WantedAttributeBuilder generates the payload for specifying a single wanted attribute as part of a dynamic scenario
func (*WantedAttributeBuilder) Build ¶ added in v2.6.0
func (builder *WantedAttributeBuilder) Build() WantedAttribute
Build generates the wanted attribute's specification
func (*WantedAttributeBuilder) New ¶ added in v2.6.0
func (builder *WantedAttributeBuilder) New() *WantedAttributeBuilder
New initialises the internal state of a WantedAttributeBuilder so that it can be used
func (*WantedAttributeBuilder) WithAcceptSelfAsserted ¶ added in v2.6.0
func (builder *WantedAttributeBuilder) WithAcceptSelfAsserted(accept bool) *WantedAttributeBuilder
WithAcceptSelfAsserted enables self-asserted user details such as from Aadhar
Example ¶
attribute := (&WantedAttributeBuilder{}).New().WithName("attr").WithAcceptSelfAsserted(true).Build() json, _ := attribute.MarshalJSON() fmt.Println(string(json))
Output: {"name":"attr","accept_self_asserted":true}
func (*WantedAttributeBuilder) WithConstraint ¶ added in v2.6.0
func (builder *WantedAttributeBuilder) WithConstraint(constraint constraintInterface) *WantedAttributeBuilder
WithConstraint adds a constraint to a wanted attribute
Example ¶
constraint := (&SourceConstraintBuilder{}).New().Build() attribute := (&WantedAttributeBuilder{}).New().WithName("attr").WithConstraint(&constraint).Build() json, _ := attribute.MarshalJSON() fmt.Println(string(json))
Output: {"name":"attr","constraints":[{"type":"SOURCE","preferred_sources":{"anchors":[],"soft_preference":false}}]}
func (*WantedAttributeBuilder) WithDerivation ¶ added in v2.6.0
func (builder *WantedAttributeBuilder) WithDerivation(derivation string) *WantedAttributeBuilder
WithDerivation sets the derivation
Example ¶
attribute := (&WantedAttributeBuilder{}).New().WithDerivation("TEST DERIVATION").Build() fmt.Println(attribute.derivation)
Output: TEST DERIVATION
func (*WantedAttributeBuilder) WithName ¶ added in v2.6.0
func (builder *WantedAttributeBuilder) WithName(name string) *WantedAttributeBuilder
WithName sets the name of the wanted attribute
Example ¶
builder := (&WantedAttributeBuilder{}).New().WithName("TEST NAME") attribute := builder.Build() fmt.Println(attribute.name)
Output: TEST NAME
Source Files ¶
- activitydetails.go
- activityerrors.go
- age_verifications.go
- aml.go
- applicationprofile.go
- baseprofile.go
- conversion.go
- crypto.go
- dataobjects.go
- dynamicpolicybuilder.go
- dynamicscenariobuilder.go
- endpoint.go
- httpclient.go
- httprequester.go
- image.go
- receiptparser.go
- shareurl.go
- sourceconstraint.go
- validate.go
- wantedanchorbuilder.go
- wantedattributebuilder.go
- yotiattributevalue.go
- yoticlient.go
- yotiprofile.go
- yotiuserprofile.go