README
¶
Yoti Go SDK
Welcome to the Yoti Go SDK. This repo contains the tools and step by step instructions you need to quickly integrate your Go back-end with Yoti so that your users can share their identity details with your application in a secure and trusted way.
Table of Contents
-
An Architectural view - High level overview of integration
-
Installing the SDK - How to install our SDK
-
SDK Project import - How to install the SDK to your project
-
Configuration - How to initialise your configuration
-
Profile Retrieval - How to retrieve a Yoti profile using the one time use token
-
Handling users - How to manage users
-
AML Integration - How to integrate with Yoti's AML (Anti Money Laundering) service
-
Running the tests - Attributes defined
-
Running the example - Attributes defined
-
API Coverage - Attributes defined
-
Support - Please feel free to reach out
An Architectural View
Before you start your integration, here is a bit of background on how the integration works. To integrate your application with Yoti, your back-end must expose a GET endpoint that Yoti will use to forward tokens. The endpoint is configured in the Yoti Hub where you create/update your application. For more information on how to create an application please see integration steps.
The image below shows how your application back-end and Yoti integrate into the context of a Login flow. Yoti SDK carries out for you steps 6, 7 ,8 and the profile decryption in step 9.
Yoti also allows you to enable user details verification from your mobile app by means of the Android (TBA) and iOS (TBA) SDKs. In that scenario, your Yoti-enabled mobile app is playing both the role of the browser and the Yoti app. Your back-end doesn't need to handle these cases in a significantly different way. You might just decide to handle the User-Agent
header in order to provide different responses for desktop and mobile clients.
Requirements
Supported Go Versions:
- 1.9.7+
Installing the SDK
As of version 2.4.0, modules are used. This means it's not necessary to get a copy or fetch all dependencies as instructed below, as the Go toolchain will fetch them as necessary. You can simply add a require github.com/getyoti/yoti-go-sdk/v2
to go.mod.
To download and install the Yoti SDK and its dependencies, run the following command from your terminal:
go get "github.com/getyoti/yoti-go-sdk/v2"
SDK Project import
You can reference the project URL by adding the following import:
import "github.com/getyoti/yoti-go-sdk/v2"
Configuration
The YotiClient is the SDK entry point. To initialise it you need include the following snippet inside your endpoint initialisation section:
sdkID := "your-sdk-id";
key, err := ioutil.ReadFile("path/to/your-application-pem-file.pem")
if err != nil {
// handle key load error
}
client := yoti.Client{
SdkID: sdkID,
Key: key}
Where:
-
sdkID
is the SDK identifier generated by Yoti Hub in the Key tab when you create your app. Note this is not your Application Identifier which is needed by your client-side code. -
path/to/your-application-pem-file.pem
is the path to the application pem file. It can be downloaded from the Keys tab in the Yoti Hub.
Please do not open the pem file as this might corrupt the key and you will need to create a new application.
Keeping your settings and access keys outside your repository is highly recommended. You can use gems like godotenv to manage environment variables more easily.
Profile Retrieval
When your application receives a one time use token via the exposed endpoint (it will be assigned to a query string parameter named token
), you can easily retrieve the activity details by adding the following to your endpoint handler:
activityDetails, errStrings := client.GetActivityDetails(yotiOneTimeUseToken)
if len(errStrings) != 0 {
// handle unhappy path
}
Profile
You can then get the user profile from the activityDetails struct:
var rememberMeID string = activityDetails.RememberMeID()
var parentRememberMeID string = activityDetails.ParentRememberMeID()
var userProfile yoti.Profile = activityDetails.UserProfile
var selfie = userProfile.Selfie().Value()
var givenNames string = userProfile.GivenNames().Value()
var familyName string = userProfile.FamilyName().Value()
var fullName string = userProfile.FullName().Value()
var mobileNumber string = userProfile.MobileNumber().Value()
var emailAddress string = userProfile.EmailAddress().Value()
var address string = userProfile.Address().Value()
var gender string = userProfile.Gender().Value()
var nationality string = userProfile.Nationality().Value()
var dateOfBirth *time.Time
dobAttr, err := userProfile.DateOfBirth()
if err != nil {
// handle error
} else {
dateOfBirth = dobAttr.Value()
}
var structuredPostalAddress map[string]interface{}
structuredPostalAddressAttribute, err := userProfile.StructuredPostalAddress()
if err != nil {
// handle error
} else {
structuredPostalAddress := structuredPostalAddressAttribute.Value().(map[string]interface{})
}
If you have chosen Verify Condition on the Yoti Hub with the age condition of "Over 18", you can retrieve the user information with the generic .GetAttribute method, which requires the result to be cast to the original type:
userProfile.GetAttribute("age_over:18").Value().(string)
GetAttribute returns an interface, the value can be acquired through a type assertion.
Anchors, Sources and Verifiers
An Anchor
represents how a given Attribute has been sourced or verified. These values are created and signed whenever a Profile Attribute is created, or verified with an external party.
For example, an attribute value that was sourced from a Passport might have the following values:
Anchor property |
Example value |
---|---|
type | SOURCE |
value | PASSPORT |
subType | OCR |
signedTimestamp | 2017-10-31, 19:45:59.123789 |
Similarly, an attribute verified against the data held by an external party will have an Anchor
of type VERIFIER, naming the party that verified it.
From each attribute you can retrieve the Anchors
, and subsets Sources
and Verifiers
(all as []*anchor.Anchor
) as follows:
givenNamesAnchors := userProfile.GivenNames().Anchors()
givenNamesSources := userProfile.GivenNames().Sources()
givenNamesVerifiers := userProfile.GivenNames().Verifiers()
You can also retrieve further properties from these respective anchors in the following way:
var givenNamesFirstAnchor *anchor.Anchor = givenNamesAnchors[0]
var anchorType anchor.Type = givenNamesFirstAnchor.Type()
var signedTimestamp *time.Time = givenNamesFirstAnchor.SignedTimestamp().Timestamp()
var subType string = givenNamesFirstAnchor.SubType()
var value []string = givenNamesFirstAnchor.Value()
Handling Users
When you retrieve the user profile, you receive a user ID generated by Yoti exclusively for your application. This means that if the same individual logs into another app, Yoti will assign her/him a different ID. You can use this ID to verify whether (for your application) the retrieved profile identifies a new or an existing user. Here is an example of how this works:
activityDetails, err := client.GetActivityDetails(yotiOneTimeUseToken)
if err == nil {
user := YourUserSearchFunction(activityDetails.RememberMeID())
if user != nil {
// handle login
} else {
// handle registration
}
} else {
// handle unhappy path
}
Where yourUserSearchFunction
is a piece of logic in your app that is supposed to find a user, given a RememberMeID.
No matter if the user is a new or an existing one, Yoti will always provide her/his profile, so you don't necessarily need to store it.
The profile
object provides a set of attributes corresponding to user attributes. Whether the attributes are present or not depends on the settings you have applied to your app on Yoti Hub.
Running the Tests
You can run the unit tests for this project by executing the following commands inside the repository folder
go get -t
go test
AML Integration
Yoti provides an AML (Anti Money Laundering) check service to allow a deeper KYC process to prevent fraud. This is a chargeable service, so please contact sdksupport@yoti.com for more information.
Yoti will provide a boolean result on the following checks:
- PEP list - Verify against Politically Exposed Persons list
- Fraud list - Verify against US Social Security Administration Fraud (SSN Fraud) list
- Watch list - Verify against watch lists from the Office of Foreign Assets Control
To use this functionality you must ensure your application is assigned to your Organisation in the Yoti Hub - please see here for further information.
For the AML check you will need to provide the following:
- Data provided by Yoti (please ensure you have selected the Given name(s) and Family name attributes from the Data tab in the Yoti Hub)
- Given name(s)
- Family name
- Data that must be collected from the user:
- Country of residence (must be an ISO 3166 3-letter code)
- Social Security Number (US citizens only)
- Postcode/Zip code (US citizens only)
Consent
Performing an AML check on a person requires their consent. You must ensure you have user consent before using this service.
Code Example
Given a YotiClient initialised with your SDK ID and KeyPair (see Client Initialisation) performing an AML check is a straightforward case of providing basic profile data.
givenNames := "Edward Richard George"
familyName := "Heath"
amlAddress := yoti.AmlAddress{
Country: "GBR"}
amlProfile := yoti.AmlProfile{
GivenNames: givenNames,
FamilyName: familyName,
Address: amlAddress}
result, err := client.PerformAmlCheck(amlProfile)
log.Printf(
"AML Result for %s %s:",
givenNames,
familyName)
log.Printf(
"On PEP list: %s",
strconv.FormatBool(result.OnPEPList))
log.Printf(
"On Fraud list: %s",
strconv.FormatBool(result.OnFraudList))
log.Printf(
"On Watch list: %s",
strconv.FormatBool(result.OnWatchList))
}
Additionally, an example AML application is provided in the examples folder.
- Rename the .env.example file to
.env
and fill in the required configuration values (mentioned in the Configuration section) - Change directory to the aml example folder:
cd examples/aml
- Install the dependencies with
go get
- Start the example with
go run main.go
Running the Profile Example
The profile retrieval example can be found in the examples folder.
- Change directory to the profile example folder:
cd examples/profile
- On the Yoti Hub:
- Set the application domain of your app to
localhost:8080
- Set the scenario callback URL to
/profile
- Set the application domain of your app to
- Rename the .env.example file to
.env
and fill in the required configuration values (mentioned in the Configuration section) - Install the dependencies with
go get
- Start the server with
go run main.go certificatehelper.go
Visiting https://localhost:8080/
should show a Yoti Connect button
API Coverage
- Activity Details
- Remember Me ID
RememberMeID()
- Parent Remember Me ID
ParentRememberMeID()
- User Profile
UserProfile
- Selfie
Selfie()
- Selfie Base64 URL
Selfie().Value().Base64URL()
- Given Names
GivenNames()
- Family Name
FamilyName()
- Full Name
FullName()
- Mobile Number
MobileNumber()
- Email Address
EmailAddress()
- Date of Birth
DateOfBirth()
- Postal Address
Address()
- Structured Postal Address
StructuredPostalAddress()
- Gender
Gender()
- Nationality
Nationality()
- Selfie
- Remember Me ID
Support
For any questions or support please email sdksupport@yoti.com. Please provide the following to get you up and working as quickly as possible:
- Computer type
- OS version
- Version of Go being used
- Screenshot
Once we have answered your question we may contact you again to discuss Yoti products and services. If you’d prefer us not to do this, please let us know when you e-mail.
References
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 to permit testing
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 shared age verifications
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
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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