Documentation ¶
Index ¶
- type BatchCreateCredentialsRequest
- type BatchCreateCredentialsResponse
- type BatchUpdateCredentialStatusRequest
- type BatchUpdateCredentialStatusResponse
- type CreateCredentialRequest
- type CreateCredentialResponse
- type DeleteCredentialRequest
- type GetCredentialRequest
- type GetCredentialResponse
- type GetCredentialStatusListRequest
- type GetCredentialStatusListResponse
- type GetCredentialStatusRequest
- type GetCredentialStatusResponse
- type ListCredentialByIssuerRequest
- type ListCredentialBySchemaRequest
- type ListCredentialBySubjectRequest
- type ListCredentialsResponse
- type Service
- func (s Service) BatchCreateCredentials(ctx context.Context, batchRequest BatchCreateCredentialsRequest) (*BatchCreateCredentialsResponse, error)
- func (s Service) BatchUpdateCredentialStatus(ctx context.Context, batchRequest BatchUpdateCredentialStatusRequest) (*BatchUpdateCredentialStatusResponse, error)
- func (s Service) Config() config.CredentialServiceConfig
- func (s Service) CreateCredential(ctx context.Context, request CreateCredentialRequest) (*CreateCredentialResponse, error)
- func (s Service) DeleteCredential(ctx context.Context, request DeleteCredentialRequest) error
- func (s Service) GetCredential(ctx context.Context, request GetCredentialRequest) (*GetCredentialResponse, error)
- func (s Service) GetCredentialStatus(ctx context.Context, request GetCredentialStatusRequest) (*GetCredentialStatusResponse, error)
- func (s Service) GetCredentialStatusList(ctx context.Context, request GetCredentialStatusListRequest) (*GetCredentialStatusListResponse, error)
- func (s Service) ListCredentials(ctx context.Context, filter filtering.Filter, request pagination.PageRequest) (*ListCredentialsResponse, error)
- func (s Service) Status() framework.Status
- func (s Service) Type() framework.Type
- func (s Service) UpdateCredentialStatus(ctx context.Context, request UpdateCredentialStatusRequest) (*UpdateCredentialStatusResponse, error)
- func (s Service) VerifyCredential(ctx context.Context, request VerifyCredentialRequest) (*VerifyCredentialResponse, error)
- type Status
- type StatusListCredentialMetadata
- type StatusListIndex
- type Storage
- func (cs *Storage) CreateStatusListCredentialTx(ctx context.Context, tx storage.Tx, request StoreCredentialRequest, ...) (int, error)
- func (cs *Storage) DeleteCredential(ctx context.Context, id string) error
- func (cs *Storage) DeleteStatusListCredential(ctx context.Context, id string) error
- func (cs *Storage) GetCredential(ctx context.Context, id string) (*StoredCredential, error)
- func (cs *Storage) GetCredentialsByIssuerAndSchema(ctx context.Context, issuer string, schema string) ([]StoredCredential, error)
- func (cs *Storage) GetNextStatusListRandomIndex(ctx context.Context, slcMetadata StatusListCredentialMetadata) (int, error)
- func (cs *Storage) GetStatusListCredential(ctx context.Context, id string) (*StoredCredential, error)
- func (cs *Storage) GetStatusListCredentialKeyData(ctx context.Context, issuer string, schema string, ...) (*StoredCredential, error)
- func (cs *Storage) GetStatusListCredentialWatchKey(issuer, schema, statusPurpose string) storage.WatchKey
- func (cs *Storage) GetStatusListCredentialsByIssuerSchemaPurpose(ctx context.Context, issuer string, schema string, ...) ([]StoredCredential, error)
- func (cs *Storage) GetStatusListCurrentIndexWatchKey(issuer, schema, statusPurpose string) storage.WatchKey
- func (cs *Storage) GetStatusListIndexPoolWatchKey(issuer, schema, statusPurpose string) storage.WatchKey
- func (cs *Storage) IncrementStatusListIndexTx(ctx context.Context, tx storage.Tx, slcMetadata StatusListCredentialMetadata) error
- func (cs *Storage) ListCredentials(ctx context.Context, filter filtering.Filter, page *common.Page) (*StoredCredentials, error)
- func (cs *Storage) StoreCredentialTx(ctx context.Context, tx storage.Tx, request StoreCredentialRequest) error
- func (cs *Storage) StoreStatusListCredentialTx(ctx context.Context, tx storage.Tx, request StoreCredentialRequest, ...) error
- func (cs *Storage) WriteMany(ctx context.Context, writeContexts []WriteContext) error
- type StoreCredentialRequest
- type StoredCredential
- func (sc *StoredCredential) FilterVariablesMap() map[string]any
- func (sc *StoredCredential) GetStatusPurpose() string
- func (sc *StoredCredential) HasCredentialStatus() bool
- func (sc *StoredCredential) HasDataIntegrityCredential() bool
- func (sc *StoredCredential) HasJWTCredential() bool
- func (sc *StoredCredential) IsValid() bool
- type StoredCredentials
- type UpdateCredentialStatusRequest
- type UpdateCredentialStatusResponse
- type VerifyCredentialRequest
- type VerifyCredentialResponse
- type WriteContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchCreateCredentialsRequest ¶
type BatchCreateCredentialsRequest struct {
Requests []CreateCredentialRequest
}
type BatchCreateCredentialsResponse ¶
type BatchCreateCredentialsResponse struct {
Credentials []credential.Container
}
type BatchUpdateCredentialStatusRequest ¶
type BatchUpdateCredentialStatusRequest struct {
Requests []UpdateCredentialStatusRequest `json:"requests"`
}
type BatchUpdateCredentialStatusResponse ¶
type BatchUpdateCredentialStatusResponse struct {
CredentialStatuses []Status `json:"credentialStatuses"`
}
type CreateCredentialRequest ¶
type CreateCredentialRequest struct { Issuer string `json:"issuer" validate:"required"` // Fully qualified verification method ID to determine the private key used for signing this credential. For example // `did:ion:EiDpQBo_nEfuLVeppgmPVQNEhtrnZLWFsB9ziZUuaKCJ3Q#83526c36-136c-423b-a57a-f190b83ae531`. FullyQualifiedVerificationMethodID string `json:"issuerVerificationMethodId" validate:"required"` Subject string `json:"subject" validate:"required"` // A context is optional. If not present, we'll apply default, required context values. Context string `json:"context,omitempty"` // A schema ID is optional. If present, we'll attempt to look it up and validate the data against it. SchemaID string `json:"schemaId,omitempty"` Data map[string]any `json:"data,omitempty"` Expiry string `json:"expiry,omitempty"` Revocable bool `json:"revocable,omitempty"` Suspendable bool `json:"suspendable,omitempty"` Evidence []any `json:"evidence,omitempty"` }
func (CreateCredentialRequest) IsValid ¶
func (csr CreateCredentialRequest) IsValid() error
type CreateCredentialResponse ¶
type CreateCredentialResponse struct {
credential.Container `json:"credential,omitempty"`
}
CreateCredentialResponse holds a resulting credential from credential creation, which is an XOR type: containing either a Data Integrity Proofed credential or a VC-JWT representation.
type DeleteCredentialRequest ¶
type DeleteCredentialRequest struct {
ID string `json:"id" validate:"required"`
}
type GetCredentialRequest ¶
type GetCredentialRequest struct {
ID string `json:"id" validate:"required"`
}
type GetCredentialResponse ¶
type GetCredentialResponse struct {
credential.Container `json:"credential,omitempty"`
}
type GetCredentialStatusListRequest ¶
type GetCredentialStatusListRequest struct {
ID string `json:"id" validate:"required"`
}
type GetCredentialStatusListResponse ¶
type GetCredentialStatusListResponse struct {
credential.Container `json:"credential,omitempty"`
}
type GetCredentialStatusRequest ¶
type GetCredentialStatusRequest struct {
ID string `json:"id" validate:"required"`
}
type ListCredentialByIssuerRequest ¶
type ListCredentialByIssuerRequest struct {
Issuer string `json:"issuer" validate:"required"`
}
type ListCredentialBySchemaRequest ¶
type ListCredentialBySchemaRequest struct {
Schema string `json:"schema" validate:"required"`
}
type ListCredentialBySubjectRequest ¶
type ListCredentialBySubjectRequest struct {
Subject string `json:"subject" validate:"required"`
}
type ListCredentialsResponse ¶
type ListCredentialsResponse struct { Credentials []credential.Container `json:"credentials,omitempty"` NextPageToken string `json:"nextPageToken,omitempty"` }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewCredentialService ¶
func NewCredentialService(config config.CredentialServiceConfig, s storage.ServiceStorage, keyStore *keystore.Service, didResolver resolution.Resolver, schema *schema.Service) (*Service, error)
func (Service) BatchCreateCredentials ¶
func (s Service) BatchCreateCredentials(ctx context.Context, batchRequest BatchCreateCredentialsRequest) (*BatchCreateCredentialsResponse, error)
func (Service) BatchUpdateCredentialStatus ¶
func (s Service) BatchUpdateCredentialStatus(ctx context.Context, batchRequest BatchUpdateCredentialStatusRequest) (*BatchUpdateCredentialStatusResponse, error)
func (Service) Config ¶
func (s Service) Config() config.CredentialServiceConfig
func (Service) CreateCredential ¶
func (s Service) CreateCredential(ctx context.Context, request CreateCredentialRequest) (*CreateCredentialResponse, error)
func (Service) DeleteCredential ¶
func (s Service) DeleteCredential(ctx context.Context, request DeleteCredentialRequest) error
func (Service) GetCredential ¶
func (s Service) GetCredential(ctx context.Context, request GetCredentialRequest) (*GetCredentialResponse, error)
func (Service) GetCredentialStatus ¶
func (s Service) GetCredentialStatus(ctx context.Context, request GetCredentialStatusRequest) (*GetCredentialStatusResponse, error)
func (Service) GetCredentialStatusList ¶
func (s Service) GetCredentialStatusList(ctx context.Context, request GetCredentialStatusListRequest) (*GetCredentialStatusListResponse, error)
func (Service) ListCredentials ¶
func (s Service) ListCredentials(ctx context.Context, filter filtering.Filter, request pagination.PageRequest) (*ListCredentialsResponse, error)
func (Service) UpdateCredentialStatus ¶
func (s Service) UpdateCredentialStatus(ctx context.Context, request UpdateCredentialStatusRequest) (*UpdateCredentialStatusResponse, error)
func (Service) VerifyCredential ¶
func (s Service) VerifyCredential(ctx context.Context, request VerifyCredentialRequest) (*VerifyCredentialResponse, error)
VerifyCredential does three levels of verification on a credential: 1. Makes sure the credential has a valid signature 2. Makes sure the credential has is not expired 3. Makes sure the credential complies with the VC Data Model 4. If the credential has a schema, makes sure its data complies with the schema LATER: Makes sure the credential has not been revoked, other checks.
type StatusListCredentialMetadata ¶
type StatusListCredentialMetadata struct {
// contains filtered or unexported fields
}
type StatusListIndex ¶
type StatusListIndex struct {
Index int `json:"index"`
}
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func NewCredentialStorage ¶
func NewCredentialStorage(db storage.ServiceStorage) (*Storage, error)
func (*Storage) CreateStatusListCredentialTx ¶
func (cs *Storage) CreateStatusListCredentialTx(ctx context.Context, tx storage.Tx, request StoreCredentialRequest, slcMetadata StatusListCredentialMetadata) (int, error)
CreateStatusListCredentialTx creates a new status list credential with the provided metadata and stores it in the database as a transaction. The function generates a unique random number and stores it along with the metadata in the database and then returns it
func (*Storage) DeleteCredential ¶
func (*Storage) DeleteStatusListCredential ¶
func (*Storage) GetCredential ¶
func (*Storage) GetCredentialsByIssuerAndSchema ¶
func (cs *Storage) GetCredentialsByIssuerAndSchema(ctx context.Context, issuer string, schema string) ([]StoredCredential, error)
GetCredentialsByIssuerAndSchema gets all credentials stored with a prefix key containing the issuer value The method is greedy, meaning if multiple values are found...and some fail during processing, we will return only the successful values and log an error for the failures.
func (*Storage) GetNextStatusListRandomIndex ¶
func (*Storage) GetStatusListCredential ¶
func (*Storage) GetStatusListCredentialKeyData ¶
func (cs *Storage) GetStatusListCredentialKeyData(ctx context.Context, issuer string, schema string, statusPurpose statussdk.StatusPurpose) (*StoredCredential, error)
func (*Storage) GetStatusListCredentialWatchKey ¶
func (*Storage) GetStatusListCredentialsByIssuerSchemaPurpose ¶
func (cs *Storage) GetStatusListCredentialsByIssuerSchemaPurpose(ctx context.Context, issuer string, schema string, statusPurpose statussdk.StatusPurpose) ([]StoredCredential, error)
func (*Storage) GetStatusListCurrentIndexWatchKey ¶
func (*Storage) GetStatusListIndexPoolWatchKey ¶
func (*Storage) IncrementStatusListIndexTx ¶
func (*Storage) ListCredentials ¶
func (*Storage) StoreCredentialTx ¶
func (*Storage) StoreStatusListCredentialTx ¶
func (cs *Storage) StoreStatusListCredentialTx(ctx context.Context, tx storage.Tx, request StoreCredentialRequest, slcMetadata StatusListCredentialMetadata) error
type StoreCredentialRequest ¶
type StoredCredential ¶
type StoredCredential struct { // This Key is generated by the storage module upon first write. Key string `json:"key"` // ID of the credential that identifies it within ssi service. LocalCredentialID string `json:"LocalCredentialId"` // only one of these fields should be present Credential *credential.VerifiableCredential `json:"credential,omitempty"` CredentialJWT *keyaccess.JWT `json:"token,omitempty"` Issuer string `json:"issuer"` FullyQualifiedVerificationMethodID string `json:"fullyQualifiedVerificationMethodId"` Subject string `json:"subject"` Schema string `json:"schema"` IssuanceDate string `json:"issuanceDate"` Revoked bool `json:"revoked"` Suspended bool `json:"suspended"` }
func (*StoredCredential) FilterVariablesMap ¶
func (sc *StoredCredential) FilterVariablesMap() map[string]any
func (*StoredCredential) GetStatusPurpose ¶
func (sc *StoredCredential) GetStatusPurpose() string
func (*StoredCredential) HasCredentialStatus ¶
func (sc *StoredCredential) HasCredentialStatus() bool
func (*StoredCredential) HasDataIntegrityCredential ¶
func (sc *StoredCredential) HasDataIntegrityCredential() bool
func (*StoredCredential) HasJWTCredential ¶
func (sc *StoredCredential) HasJWTCredential() bool
func (*StoredCredential) IsValid ¶
func (sc *StoredCredential) IsValid() bool
type StoredCredentials ¶
type StoredCredentials struct { StoredCredentials []StoredCredential NextPageToken string }
type UpdateCredentialStatusResponse ¶
type UpdateCredentialStatusResponse struct {
Status
}
type VerifyCredentialRequest ¶
type VerifyCredentialRequest struct { DataIntegrityCredential *credential.VerifiableCredential `json:"credential,omitempty"` CredentialJWT *keyaccess.JWT `json:"credentialJwt,omitempty"` }
func (VerifyCredentialRequest) IsValid ¶
func (vcr VerifyCredentialRequest) IsValid() error
IsValid checks if the request is valid, meaning there is at least one data integrity (with proof) OR jwt credential, but not both
type WriteContext ¶
type WriteContext struct {
// contains filtered or unexported fields
}