Documentation ¶
Overview ¶
Package credential contains an in-memory credential storage implementation. It also contains a type that can be used to query for credentials using a presentation definition.
Package credential contains a type that can be used to query for credentials using a presentation definition. It also contains a credential storage implementation using in-memory storage only.
Index ¶
- type InMemoryDB
- type InputDescriptor
- type Inquirer
- type InquirerOpts
- type Schema
- type SchemaArray
- type Signer
- type StatusVerifier
- type StatusVerifierOpts
- type SubmissionRequirement
- func (s *SubmissionRequirement) Count() int
- func (s *SubmissionRequirement) DescriptorAtIndex(index int) *InputDescriptor
- func (s *SubmissionRequirement) DescriptorLen() int
- func (s *SubmissionRequirement) Max() int
- func (s *SubmissionRequirement) Min() int
- func (s *SubmissionRequirement) Name() string
- func (s *SubmissionRequirement) NestedRequirementAtIndex(index int) *SubmissionRequirement
- func (s *SubmissionRequirement) NestedRequirementLength() int
- func (s *SubmissionRequirement) Purpose() string
- func (s *SubmissionRequirement) Rule() string
- type SubmissionRequirementArray
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InMemoryDB ¶
type InMemoryDB struct {
// contains filtered or unexported fields
}
A InMemoryDB allows for credential storage and retrieval using in-memory storage only.
func (*InMemoryDB) Add ¶
func (p *InMemoryDB) Add(vc *verifiable.Credential) error
Add stores the given credential.
func (*InMemoryDB) Get ¶
func (p *InMemoryDB) Get(id string) (*verifiable.Credential, error)
Get returns a credential with the given id. An error is returned if no credential exists with the given id.
func (*InMemoryDB) GetAll ¶
func (p *InMemoryDB) GetAll() (*verifiable.CredentialsArray, error)
GetAll returns all stored credentials.
func (*InMemoryDB) Remove ¶
func (p *InMemoryDB) Remove(id string) error
Remove removes the credential with the matching id, if it exists.
type InputDescriptor ¶
type InputDescriptor struct { ID string Name string Purpose string MatchedVCs *verifiable.CredentialsArray // contains filtered or unexported fields }
InputDescriptor contains information about VCs that matched an input descriptor of presentation definition.
func (*InputDescriptor) Schemas ¶
func (i *InputDescriptor) Schemas() *SchemaArray
Schemas returns the Schemas from this InputDescriptor. If there are none, then nil is returned instead.
func (*InputDescriptor) TypeConstraint ¶
func (i *InputDescriptor) TypeConstraint() string
TypeConstraint returns the type constraint specified by this InputDescriptor, if any. If there is no type constraint specified, or if it's specified in an unexpected way, then an empty string is returned.
type Inquirer ¶
type Inquirer struct {
// contains filtered or unexported fields
}
Inquirer implements querying credentials using presentation definition.
func NewInquirer ¶
func NewInquirer(opts *InquirerOpts) (*Inquirer, error)
NewInquirer returns a new Inquirer.
func (*Inquirer) GetSubmissionRequirements ¶
func (c *Inquirer) GetSubmissionRequirements(query []byte, credentials *verifiable.CredentialsArray, ) (*SubmissionRequirementArray, error)
GetSubmissionRequirements returns information about VCs matching requirements.
type InquirerOpts ¶
type InquirerOpts struct {
// contains filtered or unexported fields
}
InquirerOpts contain all optionals arguments that can be passed into the NewInquirer function.
func NewInquirerOpts ¶
func NewInquirerOpts() *InquirerOpts
NewInquirerOpts returns a new InquirerOpts object.
func (*InquirerOpts) SetDIDResolver ¶
func (o *InquirerOpts) SetDIDResolver(didResolver api.DIDResolver) *InquirerOpts
SetDIDResolver sets the did resolver that required of some implementations of selective disclosure.
func (*InquirerOpts) SetDocumentLoader ¶
func (o *InquirerOpts) SetDocumentLoader(documentLoader api.LDDocumentLoader) *InquirerOpts
SetDocumentLoader sets the document loader to use. If no document loader is explicitly set, then a network-based loader will be used.
func (*InquirerOpts) SetHTTPTimeoutNanoseconds ¶
func (o *InquirerOpts) SetHTTPTimeoutNanoseconds(timeout int64) *InquirerOpts
SetHTTPTimeoutNanoseconds sets the timeout (in nanoseconds) for HTTP calls made by the default network-based document loader. This option is only used if no document loader was explicitly set via the SetDocumentLoader option. Passing in 0 will disable timeouts.
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
Schema represents a Schema from an InputDescriptor.
type SchemaArray ¶
type SchemaArray struct {
// contains filtered or unexported fields
}
SchemaArray represents an array of Schemas.
func (*SchemaArray) AtIndex ¶
func (s *SchemaArray) AtIndex(index int) *Schema
AtIndex returns the Schema at the given index. If the index passed in is out of bounds, or the underlying Schema object at that index is nil, then nil is returned.
func (*SchemaArray) Length ¶
func (s *SchemaArray) Length() int
Length returns the number of Schemas contained within this SchemaArray object.
type Signer ¶
type Signer struct {
// contains filtered or unexported fields
}
Signer issues self-signed credentials.
func NewSigner ¶
func NewSigner(didResolver api.DIDResolver, crypto api.Crypto) *Signer
NewSigner initializes a credential Signer for issuing self-signed credentials.
func (*Signer) Issue ¶
func (s *Signer) Issue(credential *verifiable.Credential, keyID string) (*verifiable.Credential, error)
Issue signs the given Verifiable Credential with the key identified by keyID, returning the signed VC.
type StatusVerifier ¶
type StatusVerifier struct {
// contains filtered or unexported fields
}
StatusVerifier verifies credential status.
func NewStatusVerifier ¶
func NewStatusVerifier(opts *StatusVerifierOpts) (*StatusVerifier, error)
NewStatusVerifier creates a credential status verifier. This StatusVerifier only supports HTTP resolution. To create a credential status verifier that also supports DID-URL resolution of Status Credentials, use NewStatusVerifierWithDIDResolver instead.
func NewStatusVerifierWithDIDResolver ¶
func NewStatusVerifierWithDIDResolver(didResolver api.DIDResolver, opts *StatusVerifierOpts, ) (*StatusVerifier, error)
NewStatusVerifierWithDIDResolver creates a credential status verifier with a DID resolver.
func (*StatusVerifier) Verify ¶
func (s *StatusVerifier) Verify(vc *verifiable.Credential) error
Verify verifies credential status.
type StatusVerifierOpts ¶
type StatusVerifierOpts struct {
// contains filtered or unexported fields
}
StatusVerifierOpts contains optional parameters for initializing a credential StatusVerifier.
func NewStatusVerifierOpts ¶
func NewStatusVerifierOpts() *StatusVerifierOpts
NewStatusVerifierOpts returns a StatusVerifierOpts object.
func (*StatusVerifierOpts) SetHTTPTimeoutNanoseconds ¶
func (o *StatusVerifierOpts) SetHTTPTimeoutNanoseconds(timeout int64) *StatusVerifierOpts
SetHTTPTimeoutNanoseconds sets the timeout (in nanoseconds) for HTTP calls. Passing in 0 will disable timeouts.
type SubmissionRequirement ¶
type SubmissionRequirement struct {
// contains filtered or unexported fields
}
SubmissionRequirement contains information about VCs that matched a presentation definition.
func (*SubmissionRequirement) Count ¶
func (s *SubmissionRequirement) Count() int
Count returns submission requirement Count.
func (*SubmissionRequirement) DescriptorAtIndex ¶
func (s *SubmissionRequirement) DescriptorAtIndex(index int) *InputDescriptor
DescriptorAtIndex returns the submission requirement InputDescriptor at the given index. If the index passed in is out of bounds, or the underlying InputDescriptor object at that index is nil, then nil is returned.
func (*SubmissionRequirement) DescriptorLen ¶
func (s *SubmissionRequirement) DescriptorLen() int
DescriptorLen returns submission requirement descriptor len.
func (*SubmissionRequirement) Max ¶
func (s *SubmissionRequirement) Max() int
Max returns submission requirement Max.
func (*SubmissionRequirement) Min ¶
func (s *SubmissionRequirement) Min() int
Min returns submission requirement Min.
func (*SubmissionRequirement) Name ¶
func (s *SubmissionRequirement) Name() string
Name returns submission requirement Name.
func (*SubmissionRequirement) NestedRequirementAtIndex ¶
func (s *SubmissionRequirement) NestedRequirementAtIndex(index int) *SubmissionRequirement
NestedRequirementAtIndex returns the nested submission requirement at the given index. If the index passed in is out of bounds, or the underlying matched submission requirement object at that index is nil, then nil is returned.
func (*SubmissionRequirement) NestedRequirementLength ¶
func (s *SubmissionRequirement) NestedRequirementLength() int
NestedRequirementLength returns submission requirement nested len.
func (*SubmissionRequirement) Purpose ¶
func (s *SubmissionRequirement) Purpose() string
Purpose returns submission requirement Purpose.
func (*SubmissionRequirement) Rule ¶
func (s *SubmissionRequirement) Rule() string
Rule returns submission requirement Rule.
type SubmissionRequirementArray ¶
type SubmissionRequirementArray struct {
// contains filtered or unexported fields
}
SubmissionRequirementArray wrapper around SubmissionRequirement array.
func (*SubmissionRequirementArray) AtIndex ¶
func (s *SubmissionRequirementArray) AtIndex(index int) *SubmissionRequirement
AtIndex returns the SubmissionRequirement at the given index. If the index passed in is out of bounds, or the underlying matched submission requirement object at that index is nil, then nil is returned.
func (*SubmissionRequirementArray) Len ¶
func (s *SubmissionRequirementArray) Len() int
Len returns len of wrapper array.