Documentation ¶
Overview ¶
Package irmaclient implements an IRMA client, that can manage and use IRMA attributes. It (de)serializes them from/to storage, acts as the client in the IRMA protocol (see https://credentials.github.io/protocols/irma-protocol), and also in the IRMA keyshare protocol (see http://credentials.github.io/protocols/keyshare-protocol).
Index ¶
- Constants
- Variables
- type ChangePinHandler
- type Client
- func (client *Client) Attributes(id irma.CredentialTypeIdentifier, counter int) (attributes *irma.AttributeList)
- func (client *Client) Candidates(discon irma.AttributeDisCon) (candidates [][]*irma.AttributeIdentifier, ...)
- func (client *Client) CheckSatisfiability(condiscon irma.AttributeConDisCon) (candidates [][][]*irma.AttributeIdentifier, missing MissingAttributes)
- func (client *Client) ConfigurationUpdated(downloaded *irma.IrmaIdentifierSet) error
- func (client *Client) ConstructCredentials(msg []*gabi.IssueSignatureMessage, request *irma.IssuanceRequest, ...) error
- func (client *Client) CredentialInfoList() irma.CredentialInfoList
- func (client *Client) EnrolledSchemeManagers() []irma.SchemeManagerIdentifier
- func (client *Client) IssuanceProofBuilders(request *irma.IssuanceRequest, choice *irma.DisclosureChoice) (gabi.ProofBuilderList, irma.DisclosedAttributeIndices, *big.Int, error)
- func (client *Client) IssueCommitments(request *irma.IssuanceRequest, choice *irma.DisclosureChoice) (*irma.IssueCommitmentMessage, gabi.ProofBuilderList, error)
- func (client *Client) KeyshareChangePin(manager irma.SchemeManagerIdentifier, oldPin string, newPin string)
- func (client *Client) KeyshareEnroll(manager irma.SchemeManagerIdentifier, email *string, pin string, lang string)
- func (client *Client) KeyshareRemove(manager irma.SchemeManagerIdentifier) error
- func (client *Client) KeyshareRemoveAll() error
- func (client *Client) KeyshareVerifyPin(pin string, schemeid irma.SchemeManagerIdentifier) (bool, int, int, error)
- func (client *Client) LoadLogsBefore(beforeIndex uint64, max int) ([]*LogEntry, error)
- func (client *Client) LoadNewestLogs(max int) ([]*LogEntry, error)
- func (client *Client) NewSession(sessionrequest string, handler Handler) SessionDismisser
- func (client *Client) ProofBuilders(choice *irma.DisclosureChoice, request irma.SessionRequest) (gabi.ProofBuilderList, irma.DisclosedAttributeIndices, *atum.Timestamp, error)
- func (client *Client) Proofs(choice *irma.DisclosureChoice, request irma.SessionRequest) (*irma.Disclosure, *atum.Timestamp, error)
- func (client *Client) RemoveAllCredentials() error
- func (client *Client) RemoveCredential(id irma.CredentialTypeIdentifier, index int) error
- func (client *Client) RemoveCredentialByHash(hash string) error
- func (client *Client) SetCrashReportingPreference(enable bool)
- func (client *Client) UnenrolledSchemeManagers() []irma.SchemeManagerIdentifier
- type ClientHandler
- type Handler
- type KeyshareHandler
- type KeysharePinRequestor
- type LogEntry
- func (entry *LogEntry) GetDisclosedCredentials(conf *irma.Configuration) ([][]*irma.DisclosedAttribute, error)
- func (entry *LogEntry) GetIssuedCredentials(conf *irma.Configuration) (list irma.CredentialInfoList, err error)
- func (entry *LogEntry) GetSignedMessage() (abs *irma.SignedMessage, err error)
- func (entry *LogEntry) SessionRequest() (irma.SessionRequest, error)
- type MissingAttribute
- type MissingAttributes
- type PermissionHandler
- type PinHandler
- type Preferences
- type SessionDismisser
Constants ¶
const ActionRemoval = irma.Action("removal")
Variables ¶
var SentryDSN = ""
SentryDSN should be set in the init() function Setting it to an empty string means no crash reports
Functions ¶
This section is empty.
Types ¶
type ChangePinHandler ¶
type Client ¶
type Client struct { // Other state Preferences Preferences Configuration *irma.Configuration // contains filtered or unexported fields }
func New ¶
func New( storagePath string, irmaConfigurationPath string, androidStoragePath string, handler ClientHandler, ) (*Client, error)
New creates a new Client that uses the directory specified by storagePath for (de)serializing itself. irmaConfigurationPath is the path to a (possibly readonly) folder containing irma_configuration; androidStoragePath is an optional path to the files of the old android app (specify "" if you do not want to parse the old android app files), and handler is used for informing the user of new stuff, and when a enrollment to a keyshare server needs to happen. The client returned by this function has been fully deserialized and is ready for use.
NOTE: It is the responsibility of the caller that there exists a (properly protected) directory at storagePath!
func (*Client) Attributes ¶
func (client *Client) Attributes(id irma.CredentialTypeIdentifier, counter int) (attributes *irma.AttributeList)
Attributes returns the attribute list of the requested credential, or nil if we do not have it.
func (*Client) Candidates ¶
func (client *Client) Candidates(discon irma.AttributeDisCon) ( candidates [][]*irma.AttributeIdentifier, missing map[int]map[int]MissingAttribute, )
Candidates returns attributes present in this client that satisfy the specified attribute disjunction. It returns a list of candidate attribute sets, each of which would satisfy the specified disjunction. If the disjunction cannot be satisfied by the attributes that the client currently posesses (ie. len(candidates) == 0), then the second return parameter lists the missing attributes that would be necessary to satisfy the disjunction.
func (*Client) CheckSatisfiability ¶
func (client *Client) CheckSatisfiability(condiscon irma.AttributeConDisCon) ( candidates [][][]*irma.AttributeIdentifier, missing MissingAttributes, )
CheckSatisfiability checks if this client has the required attributes to satisfy the specifed disjunction list. If not, the unsatisfiable disjunctions are returned.
func (*Client) ConfigurationUpdated ¶ added in v0.3.0
ConfigurationUpdated should be run after Configuration.Download(). For any credential type in the updated scheme to which new attributes were added, this function sets the value of these new attributes to 0 in all instances that the client currently has of this credential type.
func (*Client) ConstructCredentials ¶
func (client *Client) ConstructCredentials(msg []*gabi.IssueSignatureMessage, request *irma.IssuanceRequest, builders gabi.ProofBuilderList) error
ConstructCredentials constructs and saves new credentials using the specified issuance signature messages and credential builders.
func (*Client) CredentialInfoList ¶
func (client *Client) CredentialInfoList() irma.CredentialInfoList
CredentialInfoList returns a list of information of all contained credentials.
func (*Client) EnrolledSchemeManagers ¶
func (client *Client) EnrolledSchemeManagers() []irma.SchemeManagerIdentifier
func (*Client) IssuanceProofBuilders ¶
func (client *Client) IssuanceProofBuilders(request *irma.IssuanceRequest, choice *irma.DisclosureChoice, ) (gabi.ProofBuilderList, irma.DisclosedAttributeIndices, *big.Int, error)
IssuanceProofBuilders constructs a list of proof builders in the issuance protocol for the future credentials as well as possibly any disclosed attributes, and generates a nonce against which the issuer's proof of knowledge must verify.
func (*Client) IssueCommitments ¶
func (client *Client) IssueCommitments(request *irma.IssuanceRequest, choice *irma.DisclosureChoice, ) (*irma.IssueCommitmentMessage, gabi.ProofBuilderList, error)
IssueCommitments computes issuance commitments, along with disclosure proofs specified by choice, and also returns the credential builders which will become the new credentials upon combination with the issuer's signature.
func (*Client) KeyshareChangePin ¶
func (*Client) KeyshareEnroll ¶
func (client *Client) KeyshareEnroll(manager irma.SchemeManagerIdentifier, email *string, pin string, lang string)
KeyshareEnroll attempts to enroll at the keyshare server of the specified scheme manager.
func (*Client) KeyshareRemove ¶
KeyshareRemove unenrolls the keyshare server of the specified scheme manager.
func (*Client) KeyshareRemoveAll ¶
KeyshareRemoveAll removes all keyshare server registrations.
func (*Client) KeyshareVerifyPin ¶
func (client *Client) KeyshareVerifyPin(pin string, schemeid irma.SchemeManagerIdentifier) (bool, int, int, error)
KeyshareVerifyPin verifies the specified PIN at the keyshare server, returning if it succeeded; if not, how many tries are left, or for how long the user is blocked. If an error is returned it is of type *irma.SessionError.
func (*Client) LoadLogsBefore ¶ added in v0.4.0
LoadLogsBefore returns the log entries of past events that took place before log entry with ID 'beforeIndex' (sorted from new to old, the result length is limited to max).
func (*Client) LoadNewestLogs ¶ added in v0.4.0
LoadNewestLogs returns the log entries of latest past events (sorted from new to old, the result length is limited to max).
func (*Client) NewSession ¶
func (client *Client) NewSession(sessionrequest string, handler Handler) SessionDismisser
NewSession starts a new IRMA session, given (along with a handler to pass feedback to) a session request. When the request is not suitable to start an IRMA session from, it calls the Failure method of the specified Handler.
func (*Client) ProofBuilders ¶
func (client *Client) ProofBuilders(choice *irma.DisclosureChoice, request irma.SessionRequest, ) (gabi.ProofBuilderList, irma.DisclosedAttributeIndices, *atum.Timestamp, error)
ProofBuilders constructs a list of proof builders for the specified attribute choice.
func (*Client) Proofs ¶
func (client *Client) Proofs(choice *irma.DisclosureChoice, request irma.SessionRequest) (*irma.Disclosure, *atum.Timestamp, error)
Proofs computes disclosure proofs containing the attributes specified by choice.
func (*Client) RemoveAllCredentials ¶
RemoveAllCredentials removes all credentials.
func (*Client) RemoveCredential ¶
RemoveCredential removes the specified credential.
func (*Client) RemoveCredentialByHash ¶
RemoveCredentialByHash removes the specified credential.
func (*Client) SetCrashReportingPreference ¶
SetCrashReportingPreference toggles whether or not crash reports should be sent to Sentry. Has effect only after restarting.
func (*Client) UnenrolledSchemeManagers ¶
func (client *Client) UnenrolledSchemeManagers() []irma.SchemeManagerIdentifier
type ClientHandler ¶
type ClientHandler interface { KeyshareHandler ChangePinHandler UpdateConfiguration(new *irma.IrmaIdentifierSet) UpdateAttributes() }
ClientHandler informs the user that the configuration or the list of attributes that this client uses has been updated.
type Handler ¶
type Handler interface { StatusUpdate(action irma.Action, status irma.Status) Success(result string) Cancelled() Failure(err *irma.SessionError) UnsatisfiableRequest(request irma.SessionRequest, ServerName irma.TranslatedString, missing MissingAttributes) RequestIssuancePermission(request *irma.IssuanceRequest, candidates [][][]*irma.AttributeIdentifier, ServerName irma.TranslatedString, callback PermissionHandler) RequestVerificationPermission(request *irma.DisclosureRequest, candidates [][][]*irma.AttributeIdentifier, ServerName irma.TranslatedString, callback PermissionHandler) RequestSignaturePermission(request *irma.SignatureRequest, candidates [][][]*irma.AttributeIdentifier, ServerName irma.TranslatedString, callback PermissionHandler) RequestSchemeManagerPermission(manager *irma.SchemeManager, callback func(proceed bool)) RequestPin(remainingAttempts int, callback PinHandler) }
A Handler contains callbacks for communication to the user.
type KeyshareHandler ¶
type KeyshareHandler interface {}
KeyshareHandler is used for asking the user for his email address and PIN, for enrolling at a keyshare server.
type KeysharePinRequestor ¶
type KeysharePinRequestor interface {
}KeysharePinRequestor is used to asking the user for his PIN.
type LogEntry ¶
type LogEntry struct { // General info ID uint64 Type irma.Action Time irma.Timestamp // Time at which the session was completed // Credential removal Removed map[irma.CredentialTypeIdentifier][]irma.TranslatedString `json:",omitempty"` // Signature sessions SignedMessage []byte `json:",omitempty"` Timestamp *atum.Timestamp `json:",omitempty"` SignedMessageLDContext string `json:",omitempty"` // Issuance sessions IssueCommitment *irma.IssueCommitmentMessage `json:",omitempty"` // All session types ServerName irma.TranslatedString `json:",omitempty"` Version *irma.ProtocolVersion `json:",omitempty"` Disclosure *irma.Disclosure `json:",omitempty"` Request json.RawMessage `json:",omitempty"` // Message that started the session // contains filtered or unexported fields }
LogEntry is a log entry of a past event.
func (*LogEntry) GetDisclosedCredentials ¶
func (entry *LogEntry) GetDisclosedCredentials(conf *irma.Configuration) ([][]*irma.DisclosedAttribute, error)
GetDisclosedCredentials gets the list of disclosed credentials for a log entry
func (*LogEntry) GetIssuedCredentials ¶
func (entry *LogEntry) GetIssuedCredentials(conf *irma.Configuration) (list irma.CredentialInfoList, err error)
GetIssuedCredentials gets the list of issued credentials for a log entry
func (*LogEntry) GetSignedMessage ¶
GetSignedMessage gets the signed for a log entry
func (*LogEntry) SessionRequest ¶
type MissingAttribute ¶ added in v0.3.0
type MissingAttribute irma.AttributeRequest
MissingAttribute is an irma.AttributeRequest that is satisfied by none of the client's attributes (with Go's default JSON marshaler instead of that of irma.AttributeRequest).
type MissingAttributes ¶ added in v0.3.0
type MissingAttributes map[int]map[int]map[int]MissingAttribute
MissingAttributes contains all attribute requests that the client cannot satisfy with its current attributes.
type PermissionHandler ¶
type PermissionHandler func(proceed bool, choice *irma.DisclosureChoice)
PermissionHandler is a callback for providing permission for an IRMA session and specifying the attributes to be disclosed.
type PinHandler ¶
PinHandler is used to provide the user's PIN code.
type Preferences ¶
type Preferences struct {
EnableCrashReporting bool
}
type SessionDismisser ¶
type SessionDismisser interface {
Dismiss()
}
SessionDismisser can dismiss the current IRMA session.