Documentation
¶
Index ¶
- Variables
- type Config
- type DeepLinkFactRequest
- type Fact
- type FactRequest
- type FactRequestAsync
- type FactResponse
- type IntermediaryFactRequest
- type IntermediaryFactResponse
- type QRConfig
- type QRFactRequest
- type QRFactResponse
- type Service
- func (s Service) Attest(selfID string, facts []Fact) ([]json.RawMessage, error)
- func (s *Service) FactResponse(issuer, subject string, response []byte) ([]Fact, error)
- func (s Service) GenerateDeepLink(req *DeepLinkFactRequest) (string, error)
- func (s Service) GenerateQRCode(req *QRFactRequest) ([]byte, error)
- func (s Service) Request(req *FactRequest) (*FactResponse, error)
- func (s Service) RequestAsync(req *FactRequestAsync) error
- func (s Service) RequestViaIntermediary(req *IntermediaryFactRequest) (*IntermediaryFactResponse, error)
- func (s Service) Subscribe(sub func(sender string, res *QRFactResponse))
- func (s Service) WaitForResponse(cid string, exp time.Duration) (*QRFactResponse, error)
Constants ¶
This section is empty.
Variables ¶
var ( SourcePassport = "passport" SourceDrivingLicense = "driving_license" SourceUserSpecified = "user_specified" SourceIDCard = "identity_card" FactEmail = "email_address" FactPhone = "phone_number" FactDisplayName = "display_name" FactGivenNames = "given_names" FactSurname = "surname" FactSex = "sex" FactIssuingAuthority = "issuing_authority" FactNationality = "nationality" FactAddress = "address" FactPlaceOfBirth = "place_of_birth" FactDateOfBirth = "date_of_birth" FactDateOfIssuance = "date_of_issuance" FactDateOfExpiration = "date_of_expiration" FactValidFrom = "valid_from" FactValidTo = "valid_to" FactCategories = "categories" FactSortCode = "sort_code" FactCountryOfIssuance = "country_of_issuance" FactDocumentNumber = "document_number" OperatorEqual = "==" OperatorDifferent = "!=" OperatorGreaterOrEqualThan = ">=" OperatorLessOrEqualThan = "<=" OperatorGreaterThan = ">" OperatorLessThan = "<" RequestInformation = "identities.facts.query.req" ResponseInformation = "identities.facts.query.resp" StatusAccepted = "accepted" StatusRejected = "rejected" ErrFactEmptyName = errors.New("provided fact does not specify a name") ErrFactBadSource = errors.New("fact must specify one source") ErrFactInvalidSource = errors.New("provided fact does not specify a valid source") ErrFactInvalidOperator = errors.New("provided fact does not specify a valid operator") ErrFactInvalidFactToSource = errors.New("provided source does not support given fact") )
var ( ErrBadJSONPayload = errors.New("bad json payload") ErrResponseBadSignature = errors.New("bad response signature") ErrRequestTimeout = errors.New("request timeout") ErrMessageBadIssuer = errors.New("bad response issuer") ErrMessageBadSubject = errors.New("bad response subject") ErrMessageBadAudience = errors.New("bad response audience") ErrMessageBadStatus = errors.New("bad response status") ErrMessageExpired = errors.New("response has expired") ErrMessageIssuedTooSoon = errors.New("response was issued in the future") ErrStatusRejected = errors.New("fact request was rejected") ErrFactRequestBadIdentity = errors.New("fact request must specify a valid self id") ErrFactRequestBadFacts = errors.New("fact request must specify one or more facts") ErrFactQRRequestBadConversation = errors.New("fact qr request must specify a valid conversation id") ErrFactQRRequestBadFacts = errors.New("fact qr request must specify one or more facts") ErrFactResultMismatch = errors.New("fact has differing attested values") ErrFactNotAttested = errors.New("fact has attestations with empty or invalid values") ErrBadAttestationSubject = errors.New("attestation is not related to the responder") ErrMissingConversationID = errors.New("deep link request must specify a unique conversation id") ErrMissingCallback = errors.New("deep link request must specify a callback url") ErrFactRequestCID = errors.New("cid not provided") ErrSigningKeyInvalid = errors.New("signing key was invalid at the time the attestation was issued") ErrNotConnected = errors.New("you're not permitting connections from the specifed recipient") ErrNotEnoughCredits = errors.New("your credits have expired, please log in to the developer portal and top up your account") ServiceSelfIntermediary = "self_intermediary" )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { SelfID string DeviceID string KeyID string Environment string PrivateKey ed25519.PrivateKey Rest restTransport PKI pkiClient Messaging messagingClient }
Config stores all configuration needed by the fact service
type DeepLinkFactRequest ¶
type DeepLinkFactRequest struct { ConversationID string Description string Callback string Facts []Fact Expiry time.Duration }
DeepLinkFactRequest contains the details of the requested facts
type Fact ¶
type Fact struct { Fact string `json:"fact"` Sources []string `json:"sources,omitempty"` Origin string `json:"iss,omitempty"` Operator string `json:"operator,omitempty"` Attestations []json.RawMessage `json:"attestations,omitempty"` ExpectedValue string `json:"expected_value,omitempty"` AttestedValue string `json:"-"` // contains filtered or unexported fields }
Fact specific details about the fact
func (*Fact) AttestedValues ¶
AttestedValues returns all attested values for an attestations
type FactRequest ¶
type FactRequest struct { SelfID string Description string Facts []Fact Expiry time.Duration Callback json.RawMessage }
FactRequest specifies the parameters of an information request
type FactRequestAsync ¶
type FactRequestAsync struct { SelfID string Description string Facts []Fact Expiry time.Duration CID string Callback json.RawMessage }
FactRequestAsync specifies the parameters of an information requestAsync
type FactResponse ¶
FactResponse contains the details of the requested facts
type IntermediaryFactRequest ¶
type IntermediaryFactRequest struct { SelfID string Description string Intermediary string Facts []Fact Expiry time.Duration }
IntermediaryFactRequest specifies the paramters on an information request via an intermediary
type IntermediaryFactResponse ¶
type IntermediaryFactResponse struct {
Facts []Fact
}
IntermediaryFactResponse contains the details of the requested facts
type QRFactRequest ¶
type QRFactRequest struct { ConversationID string Description string Facts []Fact Options map[string]string Expiry time.Duration QRConfig QRConfig }
QRFactRequest contains the details of the requested facts
type QRFactResponse ¶
QRFactResponse contains the details of the requested facts
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles all fact operations
func NewService ¶
NewService creates a new client for interacting with facts
func (*Service) FactResponse ¶
FactResponse validate and process a fact response
func (Service) GenerateDeepLink ¶
func (s Service) GenerateDeepLink(req *DeepLinkFactRequest) (string, error)
GenerateDeepLink generates a qr code containing an fact request
func (Service) GenerateQRCode ¶
func (s Service) GenerateQRCode(req *QRFactRequest) ([]byte, error)
GenerateQRCode generates a qr code containing an fact request
func (Service) Request ¶
func (s Service) Request(req *FactRequest) (*FactResponse, error)
Request requests a fact from a given identity
func (Service) RequestAsync ¶
func (s Service) RequestAsync(req *FactRequestAsync) error
RequestAsync requests a fact from a given identity and does not wait for the response
func (Service) RequestViaIntermediary ¶
func (s Service) RequestViaIntermediary(req *IntermediaryFactRequest) (*IntermediaryFactResponse, error)
RequestViaIntermediary requests a fact from a given identity via a trusted intermediary. The intermediary verifies that the identity has a given fact and that it meets the requested requirements.
func (Service) Subscribe ¶
func (s Service) Subscribe(sub func(sender string, res *QRFactResponse))
Subscribe subscribes to fact request responses
func (Service) WaitForResponse ¶
WaitForResponse waits for completion of a fact request that was initiated by qr code