Documentation
¶
Overview ¶
Package revocation is a generated GoMock package.
Index ¶
- Constants
- Variables
- type MockStatusList2021Issuer
- func (m *MockStatusList2021Issuer) Credential(ctx context.Context, issuer did.DID, page int) (*vc.VerifiableCredential, error)
- func (m *MockStatusList2021Issuer) EXPECT() *MockStatusList2021IssuerMockRecorder
- func (m *MockStatusList2021Issuer) Entry(ctx context.Context, issuer did.DID, purpose StatusPurpose) (*StatusList2021Entry, error)
- func (m *MockStatusList2021Issuer) GetRevocation(credentialID ssi.URI) (*Revocation, error)
- func (m *MockStatusList2021Issuer) Revoke(ctx context.Context, credentialID ssi.URI, entry StatusList2021Entry) error
- type MockStatusList2021IssuerMockRecorder
- func (mr *MockStatusList2021IssuerMockRecorder) Credential(ctx, issuer, page any) *gomock.Call
- func (mr *MockStatusList2021IssuerMockRecorder) Entry(ctx, issuer, purpose any) *gomock.Call
- func (mr *MockStatusList2021IssuerMockRecorder) GetRevocation(credentialID any) *gomock.Call
- func (mr *MockStatusList2021IssuerMockRecorder) Revoke(ctx, credentialID, entry any) *gomock.Call
- type MockStatusList2021Verifier
- type MockStatusList2021VerifierMockRecorder
- type ResolveKeyFn
- type Revocation
- type SignFn
- type StatusList2021
- func (cs *StatusList2021) Credential(ctx context.Context, issuerDID did.DID, page int) (*vc.VerifiableCredential, error)
- func (cs *StatusList2021) Entry(ctx context.Context, issuer did.DID, purpose StatusPurpose) (*StatusList2021Entry, error)
- func (cs *StatusList2021) GetRevocation(credentialID ssi.URI) (*Revocation, error)
- func (cs *StatusList2021) Revoke(ctx context.Context, credentialID ssi.URI, entry StatusList2021Entry) error
- func (cs *StatusList2021) Verify(credentialToVerify vc.VerifiableCredential) error
- type StatusList2021CredentialSubject
- type StatusList2021Entry
- type StatusList2021Issuer
- type StatusList2021Verifier
- type StatusPurpose
- type VerifySignFn
Constants ¶
const ( // StatusList2021CredentialType is the type of StatusList2021Credential StatusList2021CredentialType = "StatusList2021Credential" // StatusList2021CredentialSubjectType is the credentialSubject.type in a StatusList2021Credential StatusList2021CredentialSubjectType = "StatusList2021" // StatusList2021EntryType is the credentialStatus.type StatusList2021EntryType = "StatusList2021Entry" )
const (
StatusPurposeRevocation = "revocation"
)
Variables ¶
var ErrIndexNotInBitstring = errors.New("index not in status list")
var StatusList2021ContextURI = ssi.MustParseURI(jsonld.W3cStatusList2021Context)
Functions ¶
This section is empty.
Types ¶
type MockStatusList2021Issuer ¶
type MockStatusList2021Issuer struct {
// contains filtered or unexported fields
}
MockStatusList2021Issuer is a mock of StatusList2021Issuer interface.
func NewMockStatusList2021Issuer ¶
func NewMockStatusList2021Issuer(ctrl *gomock.Controller) *MockStatusList2021Issuer
NewMockStatusList2021Issuer creates a new mock instance.
func (*MockStatusList2021Issuer) Credential ¶
func (m *MockStatusList2021Issuer) Credential(ctx context.Context, issuer did.DID, page int) (*vc.VerifiableCredential, error)
Credential mocks base method.
func (*MockStatusList2021Issuer) EXPECT ¶
func (m *MockStatusList2021Issuer) EXPECT() *MockStatusList2021IssuerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockStatusList2021Issuer) Entry ¶
func (m *MockStatusList2021Issuer) Entry(ctx context.Context, issuer did.DID, purpose StatusPurpose) (*StatusList2021Entry, error)
Entry mocks base method.
func (*MockStatusList2021Issuer) GetRevocation ¶
func (m *MockStatusList2021Issuer) GetRevocation(credentialID ssi.URI) (*Revocation, error)
GetRevocation mocks base method.
func (*MockStatusList2021Issuer) Revoke ¶
func (m *MockStatusList2021Issuer) Revoke(ctx context.Context, credentialID ssi.URI, entry StatusList2021Entry) error
Revoke mocks base method.
type MockStatusList2021IssuerMockRecorder ¶
type MockStatusList2021IssuerMockRecorder struct {
// contains filtered or unexported fields
}
MockStatusList2021IssuerMockRecorder is the mock recorder for MockStatusList2021Issuer.
func (*MockStatusList2021IssuerMockRecorder) Credential ¶
func (mr *MockStatusList2021IssuerMockRecorder) Credential(ctx, issuer, page any) *gomock.Call
Credential indicates an expected call of Credential.
func (*MockStatusList2021IssuerMockRecorder) Entry ¶
func (mr *MockStatusList2021IssuerMockRecorder) Entry(ctx, issuer, purpose any) *gomock.Call
Entry indicates an expected call of Entry.
func (*MockStatusList2021IssuerMockRecorder) GetRevocation ¶
func (mr *MockStatusList2021IssuerMockRecorder) GetRevocation(credentialID any) *gomock.Call
GetRevocation indicates an expected call of GetRevocation.
type MockStatusList2021Verifier ¶
type MockStatusList2021Verifier struct {
// contains filtered or unexported fields
}
MockStatusList2021Verifier is a mock of StatusList2021Verifier interface.
func NewMockStatusList2021Verifier ¶
func NewMockStatusList2021Verifier(ctrl *gomock.Controller) *MockStatusList2021Verifier
NewMockStatusList2021Verifier creates a new mock instance.
func (*MockStatusList2021Verifier) EXPECT ¶
func (m *MockStatusList2021Verifier) EXPECT() *MockStatusList2021VerifierMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockStatusList2021Verifier) Verify ¶
func (m *MockStatusList2021Verifier) Verify(credentialToVerify vc.VerifiableCredential) error
Verify mocks base method.
type MockStatusList2021VerifierMockRecorder ¶
type MockStatusList2021VerifierMockRecorder struct {
// contains filtered or unexported fields
}
MockStatusList2021VerifierMockRecorder is the mock recorder for MockStatusList2021Verifier.
type ResolveKeyFn ¶
type ResolveKeyFn func(issuerDID did.DID, at *time.Time, relationType resolver.RelationType) (string, crypto.PublicKey, error)
ResolveKeyFn resolves the key used SignFn to sign the StatusList2021Credential. The vcr.issuer injects its keyResolver.ResolveAssertionKey here.
type Revocation ¶
type Revocation struct {
// Purpose is the reason for the revocation (e.g., "revocation", "suspension")
Purpose string
// RevokedAt is the time when the credential was revoked (Unix timestamp)
RevokedAt time.Time
}
Revocation contains information about a revoked credential.
type SignFn ¶
type SignFn func(ctx context.Context, unsignedCredential vc.VerifiableCredential, kid string) (*vc.VerifiableCredential, error)
SignFn signs a VC according to the specified format. The vcr.issuer injects its signVC method here.
type StatusList2021 ¶
type StatusList2021 struct {
VerifySignature VerifySignFn // injected by verifier
Sign SignFn // injected by issuer, context must contain an audit log
ResolveKey ResolveKeyFn // injected by issuer
// contains filtered or unexported fields
}
StatusList2021 implements the W3C Verifiable Credentials Status List v2021 draft specification. https://www.w3.org/TR/2023/WD-vc-status-list-20230427/ VerifySignature and Sign methods are used to verify and sign StatusList2021Credentials
func NewStatusList2021 ¶
func NewStatusList2021(db *gorm.DB, client core.HTTPRequestDoer, baseURL string) *StatusList2021
NewStatusList2021 returns a StatusList2021 without a Sign or VerifySignature method. The URL in the credential will be constructed as follows using the given base URL: <baseURL>/statuslist/<did>/<page>
func (*StatusList2021) Credential ¶
func (cs *StatusList2021) Credential(ctx context.Context, issuerDID did.DID, page int) (*vc.VerifiableCredential, error)
func (*StatusList2021) Entry ¶
func (cs *StatusList2021) Entry(ctx context.Context, issuer did.DID, purpose StatusPurpose) (*StatusList2021Entry, error)
func (*StatusList2021) GetRevocation ¶
func (cs *StatusList2021) GetRevocation(credentialID ssi.URI) (*Revocation, error)
GetRevocation checks if the credential, issued locally, was revoked. Returns the revocation information if the credential is revoked, or nil if not revoked. Returns an error if the database query fails.
func (*StatusList2021) Revoke ¶
func (cs *StatusList2021) Revoke(ctx context.Context, credentialID ssi.URI, entry StatusList2021Entry) error
func (*StatusList2021) Verify ¶
func (cs *StatusList2021) Verify(credentialToVerify vc.VerifiableCredential) error
Verify StatusList2021 returns a types.ErrRevoked when the credentialStatus contains a 'StatusList2021Entry' that can be resolved and lists the credential as 'revoked' Other credentialStatus type/statusPurpose are ignored. Verification may fail with other non-standardized errors.
type StatusList2021CredentialSubject ¶
type StatusList2021CredentialSubject struct {
// ID for the credential subject
ID string `json:"id"`
// Type MUST be "StatusList2021Credential"
Type string `json:"type"`
// StatusPurpose defines the reason credentials are listed. ('revocation', 'suspension')
StatusPurpose string `json:"statusPurpose"`
// EncodedList is the GZIP-compressed [RFC1952], base-64 encoded [RFC4648] bitstring values for the associated range
// of verifiable credential status values. The uncompressed bitstring MUST be at least 16KB in size.
EncodedList string `json:"encodedList"`
}
StatusList2021CredentialSubject of a StatusList2021Credential
type StatusList2021Entry ¶
type StatusList2021Entry struct {
// ID is expected to be a URL that identifies the status information associated with the verifiable credential.
// It MUST NOT be the URL for the status list, which is in StatusListCredential.
ID string `json:"id,omitempty"`
// Type MUST be "StatusList2021Entry"
Type string `json:"type,omitempty"`
// StatusPurpose indicates what it means if the VerifiableCredential is on the list.
// The value is arbitrary, with predefined values `revocation` and `suspension`.
// This value must match credentialSubject.statusPurpose value in the VerifiableCredential.
StatusPurpose string `json:"statusPurpose,omitempty"`
// StatusListIndex is an arbitrary size integer greater than or equal to 0, expressed as a string.
// The value identifies the position in the bitstring of the corresponding StatusListCredential.
StatusListIndex string `json:"statusListIndex,omitempty"`
// StatusListCredential property MUST be a URL to the StatusList2021Credential.
// When the URL is dereferenced, the resulting verifiable credential's type MUST include the "StatusList2021Credential".
StatusListCredential string `json:"statusListCredential,omitempty"`
}
StatusList2021Entry is the "credentialStatus" property used by issuers to enable VerifiableCredential status information.
func (StatusList2021Entry) Validate ¶
func (e StatusList2021Entry) Validate() error
Validate returns an error if the contents of the StatusList2021Entry violate the spec.
type StatusList2021Issuer ¶
type StatusList2021Issuer interface {
// Credential provides a valid StatusList2021Credential with subject ID derived from the issuer and page.
// It returns the last issued StatusList2021Credential if it is still valid or issues a new StatusList2021Credential.
Credential(ctx context.Context, issuer did.DID, page int) (*vc.VerifiableCredential, error)
// Entry creates a StatusList2021Entry that can be added to the credentialStatus of a VC.
// The corresponding StatusList2021Credential will have a gap in the bitstring if the returned entry does not make it into a VC.
// If the entry belongs to a new StatusList2021Credential, an empty StatusList2021Credential is issued and stored.
Entry(ctx context.Context, issuer did.DID, purpose StatusPurpose) (*StatusList2021Entry, error)
// Revoke by adding the StatusList2021Entry to the list of revocations, and updates the relevant StatusList2021Credential.
// The credentialID allows reverse search of revocations, its issuer is NOT verified against the entry issuer or VC.
// Returns types.ErrRevoked if already revoked, or types.ErrNotFound when the entry.StatusListCredential is unknown.
Revoke(ctx context.Context, credentialID ssi.URI, entry StatusList2021Entry) error
// GetRevocation checks if the credential, issued locally, was revoked.
// Returns the revocation information if the credential is revoked, or nil if not revoked.
// Returns an error if the database query fails.
GetRevocation(credentialID ssi.URI) (*Revocation, error)
}
StatusList2021Issuer is the issuer side of StatusList2021
type StatusList2021Verifier ¶
type StatusList2021Verifier interface {
// Verify returns a types.ErrRevoked when the credentialStatus contains a 'StatusList2021Entry' that can be resolved and lists the credential as 'revoked'
// Other credentialStatus type/statusPurpose are ignored. Verification may fail with other non-standardized errors.
Verify(credentialToVerify vc.VerifiableCredential) error
}
StatusList2021Verifier is the verifier side of StatusList2021
type StatusPurpose ¶
type StatusPurpose string
type VerifySignFn ¶
type VerifySignFn func(credentialToVerify vc.VerifiableCredential, validateAt *time.Time) error
VerifySignFn verifies the signature on VC. The vcr.verifier injects its VerifySignature method here.