Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type DeepLinkFactRequest
- type Delegation
- type Fact
- type FactGroup
- type FactRequest
- type FactRequestAsync
- type FactResponse
- type FactToIssue
- 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) Issue(selfID string, facts []FactToIssue, viewers []string) 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(auth bool, sub func(sender string, res *StandardResponse))
- func (s Service) WaitForResponse(cid string, exp time.Duration) (*QRFactResponse, error)
- type StandardResponse
Constants ¶
const FactAccountId = "account_id"
const FactAddress = "address"
const FactCountryOfIssuance = "country_of_issuance"
const FactDateOfBirth = "date_of_birth"
const FactDateOfExpiration = "date_of_expiration"
const FactDateOfIssuance = "date_of_issuance"
const FactDisplayName = "display_name"
const FactDocumentNumber = "document_number"
const FactEmailAddress = "email_address"
const FactGivenNames = "given_names"
const FactIssuingAuthority = "issuing_authority"
const FactLocation = "location"
const FactNationality = "nationality"
const FactNickname = "nickname"
const FactPhoto = "photo"
const FactPlaceOfBirth = "place_of_birth"
const FactSelfieVerification = "selfie_verification"
const FactSex = "sex"
const FactSurname = "surname"
const FactUnverifiedPhoneNumber = "unverified_phone_number"
const SourceDrivingLicense = "driving_license"
const SourceFacebook = "facebook"
const SourceIdentityCard = "identity_card"
const SourceLinkedin = "linkedin"
const SourceLive = "live"
const SourcePassport = "passport"
const SourceTwitter = "twitter"
const SourceUserSpecified = "user_specified"
Variables ¶
var ( 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") ErrInvalidSourceSpec = errors.New("internal error : invalid source spec") )
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") ErrEmptyFacts = errors.New("facts not provided") ErrEmptySource = errors.New("empty source provided") 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 FileInteractor *object.RemoteFileInteractor }
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 Auth bool }
DeepLinkFactRequest contains the details of the requested facts
type Delegation ¶
type Delegation struct { Subjects []string `json:"subjects"` Actions []string `json:"actions"` Effect string `json:"effect"` Resources []string `json:"resources"` Conditions []string `json:"conditions"` Description string `json:"description, omitempty"` }
func ParseDelegationCertificate ¶
func ParseDelegationCertificate(input string) (*Delegation, error)
func (*Delegation) Encode ¶
func (d *Delegation) Encode() (string, error)
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"` Issuers []string `json:"issuers,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 AllowedFor time.Duration Callback json.RawMessage Auth bool }
FactRequest specifies the parameters of an information request
type FactRequestAsync ¶
type FactRequestAsync struct { SelfID string Description string Facts []Fact Expiry time.Duration AllowedFor time.Duration CID string Callback json.RawMessage Auth bool }
FactRequestAsync specifies the parameters of an information requestAsync
type FactResponse ¶
FactResponse contains the details of the requested facts
type FactToIssue ¶
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 Auth bool }
QRFactRequest contains the details of the requested facts
type QRFactResponse ¶
type QRFactResponse struct { Responder string Facts []Fact Options map[string]string Accepted bool ConversationID string DeviceID string }
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) Issue ¶
func (s *Service) Issue(selfID string, facts []FactToIssue, viewers []string) error
Issues a fact to a specific user.
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(auth bool, sub func(sender string, res *StandardResponse))
Subscribe subscribes to fact request responses
func (Service) WaitForResponse ¶
WaitForResponse waits for completion of a fact request that was initiated by qr code
type StandardResponse ¶
type StandardResponse struct { ID string `json:"jti"` Type string `json:"typ"` Conversation string `json:"cid"` Issuer string `json:"iss"` Audience string `json:"aud"` Subject string `json:"sub"` IssuedAt time.Time `json:"iat"` ExpiresAt time.Time `json:"exp"` DeviceID string `json:"device_id"` Status string `json:"status"` Description string `json:"description"` Facts []Fact `json:"facts"` Auth bool `json:"auth"` }