Documentation ¶
Index ¶
- func CreateImageSlice(items []*Item) (result []media.Media, err error)
- type AgeVerification
- type DateAttribute
- func (a DateAttribute) Anchors() []*anchor.Anchor
- func (a DateAttribute) ContentType() string
- func (a DateAttribute) ID() *string
- func (a DateAttribute) Name() string
- func (a DateAttribute) Sources() []*anchor.Anchor
- func (a *DateAttribute) Value() *time.Time
- func (a DateAttribute) Verifiers() []*anchor.Anchor
- type Definition
- type DocumentDetails
- type DocumentDetailsAttribute
- func (a DocumentDetailsAttribute) Anchors() []*anchor.Anchor
- func (a DocumentDetailsAttribute) ContentType() string
- func (a DocumentDetailsAttribute) ID() *string
- func (a DocumentDetailsAttribute) Name() string
- func (a DocumentDetailsAttribute) Sources() []*anchor.Anchor
- func (attr *DocumentDetailsAttribute) Value() DocumentDetails
- func (a DocumentDetailsAttribute) Verifiers() []*anchor.Anchor
- type GenericAttribute
- func (a GenericAttribute) Anchors() []*anchor.Anchor
- func (a GenericAttribute) ContentType() string
- func (a GenericAttribute) ID() *string
- func (a GenericAttribute) Name() string
- func (a GenericAttribute) Sources() []*anchor.Anchor
- func (a *GenericAttribute) Value() interface{}
- func (a GenericAttribute) Verifiers() []*anchor.Anchor
- type ImageAttribute
- func (a ImageAttribute) Anchors() []*anchor.Anchor
- func (a ImageAttribute) ContentType() string
- func (a ImageAttribute) ID() *string
- func (a ImageAttribute) Name() string
- func (a ImageAttribute) Sources() []*anchor.Anchor
- func (a *ImageAttribute) Value() media.Media
- func (a ImageAttribute) Verifiers() []*anchor.Anchor
- type ImageSliceAttribute
- func (a ImageSliceAttribute) Anchors() []*anchor.Anchor
- func (a ImageSliceAttribute) ContentType() string
- func (a ImageSliceAttribute) ID() *string
- func (a ImageSliceAttribute) Name() string
- func (a ImageSliceAttribute) Sources() []*anchor.Anchor
- func (a *ImageSliceAttribute) Value() []media.Media
- func (a ImageSliceAttribute) Verifiers() []*anchor.Anchor
- type IssuanceDetails
- type Item
- type JSONAttribute
- func (a JSONAttribute) Anchors() []*anchor.Anchor
- func (a JSONAttribute) ContentType() string
- func (a JSONAttribute) ID() *string
- func (a JSONAttribute) Name() string
- func (a JSONAttribute) Sources() []*anchor.Anchor
- func (a *JSONAttribute) Value() map[string]interface{}
- func (a JSONAttribute) Verifiers() []*anchor.Anchor
- type MultiValueAttribute
- func (a MultiValueAttribute) Anchors() []*anchor.Anchor
- func (a MultiValueAttribute) ContentType() string
- func (a MultiValueAttribute) ID() *string
- func (a MultiValueAttribute) Name() string
- func (a MultiValueAttribute) Sources() []*anchor.Anchor
- func (a *MultiValueAttribute) Value() []*Item
- func (a MultiValueAttribute) Verifiers() []*anchor.Anchor
- type StringAttribute
- func (a StringAttribute) Anchors() []*anchor.Anchor
- func (a StringAttribute) ContentType() string
- func (a StringAttribute) ID() *string
- func (a StringAttribute) Name() string
- func (a StringAttribute) Sources() []*anchor.Anchor
- func (a *StringAttribute) Value() string
- func (a StringAttribute) Verifiers() []*anchor.Anchor
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AgeVerification ¶
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 NewAgeVerification ¶
func NewAgeVerification(attr *yotiprotoattr.Attribute) (verification AgeVerification, err error)
NewAgeVerification constructs an AgeVerification from a protobuffer
type DateAttribute ¶
type DateAttribute struct {
// contains filtered or unexported fields
}
DateAttribute is a Yoti attribute which returns a date as *time.Time for its value
func NewDate ¶
func NewDate(a *yotiprotoattr.Attribute) (*DateAttribute, error)
NewDate creates a new Date attribute
func (DateAttribute) Anchors ¶
Anchors are the metadata associated with an attribute. They describe how an attribute has been provided to Yoti (SOURCE Anchor) and how it has been verified (VERIFIER Anchor).
func (DateAttribute) ContentType ¶
func (a DateAttribute) ContentType() string
ContentType gets the attribute's content type description
func (DateAttribute) ID ¶ added in v3.6.0
func (a DateAttribute) ID() *string
ID gets the attribute ID
func (DateAttribute) Sources ¶
Sources returns the anchors which identify how and when an attribute value was acquired.
func (*DateAttribute) Value ¶
func (a *DateAttribute) Value() *time.Time
Value returns the value of the TimeAttribute as *time.Time
type Definition ¶
type Definition struct {
// contains filtered or unexported fields
}
Definition contains information about the attribute(s) issued by a third party.
func NewAttributeDefinition ¶
func NewAttributeDefinition(s string) Definition
NewAttributeDefinition returns a new AttributeDefinition
func (Definition) MarshalJSON ¶
func (a Definition) MarshalJSON() ([]byte, error)
MarshalJSON returns encoded json
Example ¶
exampleDefinition := NewAttributeDefinition("exampleDefinition") marshalledJSON, err := json.Marshal(exampleDefinition) if err != nil { fmt.Printf("error: %s", err.Error()) return } fmt.Println(string(marshalledJSON))
Output: {"name":"exampleDefinition"}
type DocumentDetails ¶
type DocumentDetails struct { DocumentType string IssuingCountry string DocumentNumber string ExpirationDate *time.Time IssuingAuthority string }
DocumentDetails represents information extracted from a document provided by the user
func (*DocumentDetails) Parse ¶
func (details *DocumentDetails) Parse(data string) error
Parse fills a DocumentDetails object from a raw string
Example ¶
raw := "PASSPORT GBR 1234567 2022-09-12" details := DocumentDetails{} err := details.Parse(raw) if err != nil { fmt.Printf("error: %s", err.Error()) return } fmt.Printf( "Document Type: %s, Issuing Country: %s, Document Number: %s, Expiration Date: %s", details.DocumentType, details.IssuingCountry, details.DocumentNumber, details.ExpirationDate, )
Output: Document Type: PASSPORT, Issuing Country: GBR, Document Number: 1234567, Expiration Date: 2022-09-12 00:00:00 +0000 UTC
type DocumentDetailsAttribute ¶
type DocumentDetailsAttribute struct {
// contains filtered or unexported fields
}
DocumentDetailsAttribute wraps a document details with anchor data
func NewDocumentDetails ¶
func NewDocumentDetails(a *yotiprotoattr.Attribute) (*DocumentDetailsAttribute, error)
NewDocumentDetails creates a DocumentDetailsAttribute which wraps a DocumentDetails with anchor data
Example ¶
proto := yotiprotoattr.Attribute{ Name: "exampleDocumentDetails", Value: []byte("PASSPORT GBR 1234567 2022-09-12"), ContentType: yotiprotoattr.ContentType_STRING, } attribute, err := NewDocumentDetails(&proto) if err != nil { fmt.Printf("error: %s", err.Error()) return } fmt.Printf( "Document Type: %s, With %d Anchors", attribute.Value().DocumentType, len(attribute.Anchors()), )
Output: Document Type: PASSPORT, With 0 Anchors
func (DocumentDetailsAttribute) Anchors ¶
Anchors are the metadata associated with an attribute. They describe how an attribute has been provided to Yoti (SOURCE Anchor) and how it has been verified (VERIFIER Anchor).
func (DocumentDetailsAttribute) ContentType ¶
func (a DocumentDetailsAttribute) ContentType() string
ContentType gets the attribute's content type description
func (DocumentDetailsAttribute) ID ¶ added in v3.6.0
func (a DocumentDetailsAttribute) ID() *string
ID gets the attribute ID
func (DocumentDetailsAttribute) Name ¶
func (a DocumentDetailsAttribute) Name() string
Name gets the attribute name
func (DocumentDetailsAttribute) Sources ¶
Sources returns the anchors which identify how and when an attribute value was acquired.
func (*DocumentDetailsAttribute) Value ¶
func (attr *DocumentDetailsAttribute) Value() DocumentDetails
Value returns the document details struct attached to this attribute
type GenericAttribute ¶
type GenericAttribute struct {
// contains filtered or unexported fields
}
GenericAttribute is a Yoti attribute which returns a generic value
func NewGeneric ¶
func NewGeneric(a *yotiprotoattr.Attribute) *GenericAttribute
NewGeneric creates a new generic attribute
func (GenericAttribute) Anchors ¶
Anchors are the metadata associated with an attribute. They describe how an attribute has been provided to Yoti (SOURCE Anchor) and how it has been verified (VERIFIER Anchor).
func (GenericAttribute) ContentType ¶
func (a GenericAttribute) ContentType() string
ContentType gets the attribute's content type description
func (GenericAttribute) ID ¶ added in v3.6.0
func (a GenericAttribute) ID() *string
ID gets the attribute ID
func (GenericAttribute) Sources ¶
Sources returns the anchors which identify how and when an attribute value was acquired.
func (*GenericAttribute) Value ¶
func (a *GenericAttribute) Value() interface{}
Value returns the value of the GenericAttribute as an interface
type ImageAttribute ¶
type ImageAttribute struct {
// contains filtered or unexported fields
}
ImageAttribute is a Yoti attribute which returns an image as its value
func NewImage ¶
func NewImage(a *yotiprotoattr.Attribute) (*ImageAttribute, error)
NewImage creates a new Image attribute
func (ImageAttribute) Anchors ¶
Anchors are the metadata associated with an attribute. They describe how an attribute has been provided to Yoti (SOURCE Anchor) and how it has been verified (VERIFIER Anchor).
func (ImageAttribute) ContentType ¶
func (a ImageAttribute) ContentType() string
ContentType gets the attribute's content type description
func (ImageAttribute) ID ¶ added in v3.6.0
func (a ImageAttribute) ID() *string
ID gets the attribute ID
func (ImageAttribute) Sources ¶
Sources returns the anchors which identify how and when an attribute value was acquired.
func (*ImageAttribute) Value ¶
func (a *ImageAttribute) Value() media.Media
Value returns the value of the ImageAttribute as media.Media
type ImageSliceAttribute ¶
type ImageSliceAttribute struct {
// contains filtered or unexported fields
}
ImageSliceAttribute is a Yoti attribute which returns a slice of images as its value
func NewImageSlice ¶
func NewImageSlice(a *yotiprotoattr.Attribute) (*ImageSliceAttribute, error)
NewImageSlice creates a new ImageSlice attribute
func (ImageSliceAttribute) Anchors ¶
Anchors are the metadata associated with an attribute. They describe how an attribute has been provided to Yoti (SOURCE Anchor) and how it has been verified (VERIFIER Anchor).
func (ImageSliceAttribute) ContentType ¶
func (a ImageSliceAttribute) ContentType() string
ContentType gets the attribute's content type description
func (ImageSliceAttribute) ID ¶ added in v3.6.0
func (a ImageSliceAttribute) ID() *string
ID gets the attribute ID
func (ImageSliceAttribute) Name ¶
func (a ImageSliceAttribute) Name() string
Name gets the attribute name
func (ImageSliceAttribute) Sources ¶
Sources returns the anchors which identify how and when an attribute value was acquired.
func (*ImageSliceAttribute) Value ¶
func (a *ImageSliceAttribute) Value() []media.Media
Value returns the value of the ImageSliceAttribute
type IssuanceDetails ¶
type IssuanceDetails struct {
// contains filtered or unexported fields
}
IssuanceDetails contains information about the attribute(s) issued by a third party
func ParseIssuanceDetails ¶
func ParseIssuanceDetails(thirdPartyAttributeBytes []byte) (*IssuanceDetails, error)
ParseIssuanceDetails takes the Third Party Attribute object and converts it into an IssuanceDetails struct
func (IssuanceDetails) Attributes ¶
func (i IssuanceDetails) Attributes() []Definition
Attributes information about the attributes the third party would like to issue.
func (IssuanceDetails) ExpiryDate ¶
func (i IssuanceDetails) ExpiryDate() *time.Time
ExpiryDate is the timestamp at which the request for the attribute value from third party will expire. Will be nil if not provided.
func (IssuanceDetails) Token ¶
func (i IssuanceDetails) Token() string
Token is the issuance token that can be used to retrieve the user's stored details. These details will be used to issue attributes on behalf of an organisation to that user.
type Item ¶
type Item struct { // ContentType is the content of the item. ContentType yotiprotoattr.ContentType // Value is the underlying data of the item. Value interface{} }
Item is a structure which contains information about an attribute value
type JSONAttribute ¶
type JSONAttribute struct {
// contains filtered or unexported fields
}
JSONAttribute is a Yoti attribute which returns an interface as its value
func NewJSON ¶
func NewJSON(a *yotiprotoattr.Attribute) (*JSONAttribute, error)
NewJSON creates a new JSON attribute
Example ¶
proto := yotiprotoattr.Attribute{ Name: "exampleJSON", Value: []byte(`{"foo":"bar"}`), ContentType: yotiprotoattr.ContentType_JSON, } attribute, err := NewJSON(&proto) if err != nil { fmt.Printf("error: %s", err.Error()) return } fmt.Println(attribute.Value())
Output: map[foo:bar]
func (JSONAttribute) Anchors ¶
Anchors are the metadata associated with an attribute. They describe how an attribute has been provided to Yoti (SOURCE Anchor) and how it has been verified (VERIFIER Anchor).
func (JSONAttribute) ContentType ¶
func (a JSONAttribute) ContentType() string
ContentType gets the attribute's content type description
func (JSONAttribute) ID ¶ added in v3.6.0
func (a JSONAttribute) ID() *string
ID gets the attribute ID
func (JSONAttribute) Sources ¶
Sources returns the anchors which identify how and when an attribute value was acquired.
func (*JSONAttribute) Value ¶
func (a *JSONAttribute) Value() map[string]interface{}
Value returns the value of the JSONAttribute as an interface.
type MultiValueAttribute ¶
type MultiValueAttribute struct {
// contains filtered or unexported fields
}
MultiValueAttribute is a Yoti attribute which returns a multi-valued attribute
func NewMultiValue ¶
func NewMultiValue(a *yotiprotoattr.Attribute) (*MultiValueAttribute, error)
NewMultiValue creates a new MultiValue attribute
func (MultiValueAttribute) Anchors ¶
Anchors are the metadata associated with an attribute. They describe how an attribute has been provided to Yoti (SOURCE Anchor) and how it has been verified (VERIFIER Anchor).
func (MultiValueAttribute) ContentType ¶
func (a MultiValueAttribute) ContentType() string
ContentType gets the attribute's content type description
func (MultiValueAttribute) ID ¶ added in v3.6.0
func (a MultiValueAttribute) ID() *string
ID gets the attribute ID
func (MultiValueAttribute) Name ¶
func (a MultiValueAttribute) Name() string
Name gets the attribute name
func (MultiValueAttribute) Sources ¶
Sources returns the anchors which identify how and when an attribute value was acquired.
func (*MultiValueAttribute) Value ¶
func (a *MultiValueAttribute) Value() []*Item
Value returns the value of the MultiValueAttribute as a string
type StringAttribute ¶
type StringAttribute struct {
// contains filtered or unexported fields
}
StringAttribute is a Yoti attribute which returns a string as its value
func NewString ¶
func NewString(a *yotiprotoattr.Attribute) *StringAttribute
NewString creates a new String attribute
func (StringAttribute) Anchors ¶
Anchors are the metadata associated with an attribute. They describe how an attribute has been provided to Yoti (SOURCE Anchor) and how it has been verified (VERIFIER Anchor).
func (StringAttribute) ContentType ¶
func (a StringAttribute) ContentType() string
ContentType gets the attribute's content type description
func (StringAttribute) ID ¶ added in v3.6.0
func (a StringAttribute) ID() *string
ID gets the attribute ID
func (StringAttribute) Sources ¶
Sources returns the anchors which identify how and when an attribute value was acquired.
func (*StringAttribute) Value ¶
func (a *StringAttribute) Value() string
Value returns the value of the StringAttribute as a string