attribute

package
v2.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Examples

Constants

View Source
const (
	// ImageTypeJpeg JPEG format
	ImageTypeJpeg string = "jpeg"
	// ImageTypePng PNG format
	ImageTypePng string = "png"
)

Variables

This section is empty.

Functions

func GetMIMEType

func GetMIMEType(imageType string) string

GetMIMEType returns the MIME type of this piece of Yoti user information. For more information see: https://en.wikipedia.org/wiki/Media_type

func UnmarshallJSON

func UnmarshallJSON(byteValue []byte) (result interface{}, err error)

UnmarshallJSON unmarshalls JSON into an interface

Types

type AttributeDefinition added in v2.7.0

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

AttributeDefinition contains information about the attribute(s) issued by a third party.

func NewAttributeDefinition added in v2.7.0

func NewAttributeDefinition(s string) AttributeDefinition

NewAttributeDefinition returns a new AttributeDefinition

func (AttributeDefinition) MarshalJSON added in v2.7.0

func (a AttributeDefinition) MarshalJSON() ([]byte, error)

MarshalJSON returns encoded json

func (AttributeDefinition) Name added in v2.7.0

func (a AttributeDefinition) Name() string

Name of the attribute to be issued.

type DocumentDetails added in v2.6.0

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 added in v2.6.0

func (details *DocumentDetails) Parse(data string) (err 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 {
	panic(err)
}
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 added in v2.6.0

type DocumentDetailsAttribute struct {
	*yotiprotoattr.Attribute
	// contains filtered or unexported fields
}

DocumentDetailsAttribute wraps a document details with anchor data

func NewDocumentDetails added in v2.6.0

func NewDocumentDetails(a *yotiprotoattr.Attribute) (*DocumentDetailsAttribute, error)

NewDocumentDetails creates a DocumentDetailsAttribute which wraps a DocumentDetails with anchor data

func (*DocumentDetailsAttribute) Anchors added in v2.6.0

func (attr *DocumentDetailsAttribute) Anchors() []*anchor.Anchor

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) Sources added in v2.6.0

func (attr *DocumentDetailsAttribute) Sources() []*anchor.Anchor

Sources returns the anchors which identify how and when an attribute value was acquired.

func (*DocumentDetailsAttribute) Value added in v2.6.0

Value returns the document details struct attached to this attribute

func (*DocumentDetailsAttribute) Verifiers added in v2.6.0

func (attr *DocumentDetailsAttribute) Verifiers() []*anchor.Anchor

Verifiers returns the anchors which identify how and when an attribute value was verified by another provider.

type GenericAttribute

type GenericAttribute struct {
	*yotiprotoattr.Attribute
	// contains filtered or unexported fields
}

GenericAttribute is a Yoti attribute which returns a generic value

func NewGeneric

NewGeneric creates a new generic attribute

func (*GenericAttribute) Anchors

func (a *GenericAttribute) Anchors() []*anchor.Anchor

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) Sources

func (a *GenericAttribute) Sources() []*anchor.Anchor

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

func (*GenericAttribute) Verifiers

func (a *GenericAttribute) Verifiers() []*anchor.Anchor

Verifiers returns the anchors which identify how and when an attribute value was verified by another provider.

type Image

type Image struct {
	Type string
	Data []byte
}

Image format of the image and the image data

func CreateImageSlice

func CreateImageSlice(items []*Item) (result []*Image)

CreateImageSlice takes a slice of Items, and converts them into a slice of images

func ParseImageValue

func ParseImageValue(contentType yotiprotoattr.ContentType, byteValue []byte) (*Image, error)

ParseImageValue wraps image data into an image struct

func (*Image) Base64URL

func (image *Image) Base64URL() string

Base64URL is the Image encoded as a base64 URL

type ImageAttribute

type ImageAttribute struct {
	*yotiprotoattr.Attribute
	// contains filtered or unexported fields
}

ImageAttribute is a Yoti attribute which returns an image as its value

func NewImage

NewImage creates a new Image attribute

func (*ImageAttribute) Anchors

func (a *ImageAttribute) Anchors() []*anchor.Anchor

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) Sources

func (a *ImageAttribute) Sources() []*anchor.Anchor

Sources returns the anchors which identify how and when an attribute value was acquired.

func (*ImageAttribute) Value

func (a *ImageAttribute) Value() *Image

Value returns the value of the ImageAttribute as *Image

func (*ImageAttribute) Verifiers

func (a *ImageAttribute) Verifiers() []*anchor.Anchor

Verifiers returns the anchors which identify how and when an attribute value was verified by another provider.

type ImageSliceAttribute

type ImageSliceAttribute struct {
	*yotiprotoattr.Attribute
	// 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

func (a *ImageSliceAttribute) Anchors() []*anchor.Anchor

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) Sources

func (a *ImageSliceAttribute) Sources() []*anchor.Anchor

Sources returns the anchors which identify how and when an attribute value was acquired.

func (*ImageSliceAttribute) Value

func (a *ImageSliceAttribute) Value() []*Image

Value returns the value of the ImageSliceAttribute as a string

func (*ImageSliceAttribute) Verifiers

func (a *ImageSliceAttribute) Verifiers() []*anchor.Anchor

Verifiers returns the anchors which identify how and when an attribute value was verified by another provider.

type IssuanceDetails added in v2.7.0

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

IssuanceDetails contains information about the attribute(s) issued by a third party

func ParseIssuanceDetails added in v2.7.0

func ParseIssuanceDetails(thirdPartyAttributeBytes []byte) (*IssuanceDetails, error)

ParseIssuanceDetails takes the Third Party Attribute object and converts it into an IssuanceDetails struct

func (IssuanceDetails) Attributes added in v2.7.0

func (i IssuanceDetails) Attributes() []AttributeDefinition

Attributes information about the attributes the third party would like to issue.

func (IssuanceDetails) ExpiryDate added in v2.7.0

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 added in v2.7.0

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 {
	// contains filtered or unexported fields
}

Item is a structure which contains information about an attribute value

func (*Item) GetContentType

func (item *Item) GetContentType() yotiprotoattr.ContentType

GetContentType returns the content type of the item.

func (*Item) GetValue

func (item *Item) GetValue() interface{}

GetValue returns the underlying data of the item

type JSONAttribute

type JSONAttribute struct {
	*yotiprotoattr.Attribute // Value returns the value of a JSON attribute in the form of an interface
	// contains filtered or unexported fields
}

JSONAttribute is a Yoti attribute which returns an interface as its value

func NewJSON

NewJSON creates a new JSON attribute

func (*JSONAttribute) Anchors

func (a *JSONAttribute) Anchors() []*anchor.Anchor

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) Sources

func (a *JSONAttribute) Sources() []*anchor.Anchor

Sources returns the anchors which identify how and when an attribute value was acquired.

func (*JSONAttribute) Value

func (a *JSONAttribute) Value() interface{}

Value returns the value of the JSONAttribute as an interface.

func (*JSONAttribute) Verifiers

func (a *JSONAttribute) Verifiers() []*anchor.Anchor

Verifiers returns the anchors which identify how and when an attribute value was verified by another provider.

type MultiValueAttribute

type MultiValueAttribute struct {
	*yotiprotoattr.Attribute
	// 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

func (a *MultiValueAttribute) Anchors() []*anchor.Anchor

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) Sources

func (a *MultiValueAttribute) Sources() []*anchor.Anchor

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

func (*MultiValueAttribute) Verifiers

func (a *MultiValueAttribute) Verifiers() []*anchor.Anchor

Verifiers returns the anchors which identify how and when an attribute value was verified by another provider.

type StringAttribute

type StringAttribute struct {
	*yotiprotoattr.Attribute
	// contains filtered or unexported fields
}

StringAttribute is a Yoti attribute which returns a string as its value

func NewString

NewString creates a new String attribute

func (*StringAttribute) Anchors

func (a *StringAttribute) Anchors() []*anchor.Anchor

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) Sources

func (a *StringAttribute) Sources() []*anchor.Anchor

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

func (*StringAttribute) Verifiers

func (a *StringAttribute) Verifiers() []*anchor.Anchor

Verifiers returns the anchors which identify how and when an attribute value was verified by another provider.

type TimeAttribute

type TimeAttribute struct {
	*yotiprotoattr.Attribute
	// contains filtered or unexported fields
}

TimeAttribute is a Yoti attribute which returns a time as its value

func NewTime

NewTime creates a new Time attribute

func (*TimeAttribute) Anchors

func (a *TimeAttribute) Anchors() []*anchor.Anchor

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 (*TimeAttribute) Sources

func (a *TimeAttribute) Sources() []*anchor.Anchor

Sources returns the anchors which identify how and when an attribute value was acquired.

func (*TimeAttribute) Value

func (a *TimeAttribute) Value() *time.Time

Value returns the value of the TimeAttribute as *time.Time

func (*TimeAttribute) Verifiers

func (a *TimeAttribute) Verifiers() []*anchor.Anchor

Verifiers returns the anchors which identify how and when an attribute value was verified by another provider.

Jump to

Keyboard shortcuts

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