-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(credential-status): rename plugin interfaces and methods
fixes #981
- Loading branch information
Showing
18 changed files
with
878 additions
and
573 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,13 @@ | ||
export { DIDDocument, DIDResolutionOptions, DIDResolutionResult } from 'did-resolver' | ||
import { IPluginMethodMap } from './IAgent' | ||
import { CredentialStatus, VerifiableCredential } from './vc-data-model' | ||
import { ICredentialStatusVerifier } from './ICredentialStatusVerifier' | ||
import { ICredentialStatusManager } from './ICredentialStatusManager' | ||
|
||
/** | ||
* The arguments expected by a plugin that implements a credential status type/method | ||
* in order to change the status of an issued verifiable credential. | ||
* | ||
* Each credential status type has its own specific parameters according to their spec. | ||
* | ||
* @see https://w3c-ccg.github.io/vc-status-list-2021/ | StatusList2021Entry | ||
* @see https://w3c-ccg.github.io/vc-csl2017/ | CredentialStatusList2017 | ||
* Veramo plugin interface for plugins implementing both the {@link ICredentialStatusManager | manager} and the | ||
* {@link ICredentialStatusVerifier | verifier} aspects of Credential Status flow. | ||
* | ||
* @beta | ||
*/ | ||
interface CredentialStatusUpdateOptions { [x: string]: any } | ||
|
||
/** | ||
* Input arguments for {@link ICredentialStatus.credentialStatusUpdate | credentialStatusUpdate} | ||
* @beta | ||
*/ | ||
export interface CredentialStatusUpdateArgs { | ||
/** | ||
* The verifiable credential whose status will be updated. | ||
*/ | ||
vc: VerifiableCredential | ||
|
||
/** | ||
* Credential status strategy options that will be passed to the method specific manager. | ||
* | ||
* @see: https://www.w3.org/TR/vc-data-model/#status | ||
*/ | ||
options?: CredentialStatusUpdateOptions | ||
} | ||
|
||
/** | ||
* Arguments for generating a `credentialStatus` property for a {@link VerifiableCredential}. | ||
* @see {@link ICredentialStatus.credentialStatusGenerate} | ||
* @see {@link https://www.w3.org/TR/vc-data-model/#status | credentialStatus} data model | ||
* @see {@link @veramo/credential-status#CredentialStatusPlugin | CredentialStatusPlugin} | ||
* | ||
* @beta | ||
*/ | ||
export interface CredentialStatusGenerateArgs { | ||
/** | ||
* The credential status type (aka credential status method) to be used in the `credentialStatus` generation. | ||
*/ | ||
type: string | ||
} | ||
|
||
/** | ||
* Credential status manager interface | ||
* @beta | ||
*/ | ||
export interface ICredentialStatus extends IPluginMethodMap { | ||
/** | ||
* Changes the status of an existing verifiable credential. | ||
* Commonly used to revoke an existent credential. | ||
* | ||
* @param args - Input arguments for updating the status or revoking a credential | ||
* @beta | ||
*/ | ||
credentialStatusUpdate(args: CredentialStatusUpdateArgs): Promise<any> | ||
|
||
/** | ||
* Generates a `credentialStatus` property for a future credential, not yet signed. | ||
* | ||
* This method is used during the creation of a VC in order to make the VC capable of | ||
* having its status updated later, allowing it to be revoked later by instance. | ||
* | ||
* @param args - Input arguments for generating the `credentialStatus` field of a new credential | ||
* @beta | ||
*/ | ||
credentialStatusGenerate(args: CredentialStatusGenerateArgs): Promise<CredentialStatus> | ||
|
||
/** | ||
* List all the credential status types (methods) available in the current agent instance. | ||
*/ | ||
credentialStatusTypes(): Promise<string[]> | ||
} | ||
export type ICredentialStatus = ICredentialStatusVerifier & ICredentialStatusManager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
export { DIDDocument, DIDResolutionOptions, DIDResolutionResult } from 'did-resolver' | ||
import { IPluginMethodMap } from './IAgent' | ||
import { CredentialStatusReference, VerifiableCredential } from './vc-data-model' | ||
|
||
/** | ||
* The arguments expected by a plugin that implements a credential status type/method | ||
* in order to change the status of an issued verifiable credential. | ||
* | ||
* Each credential status type has its own specific parameters according to their spec. | ||
* | ||
* @see {@link https://w3c-ccg.github.io/vc-status-list-2021/ | StatusList2021Entry } | ||
* @see {@link https://w3c-ccg.github.io/vc-csl2017/ | CredentialStatusList2017 } | ||
* @see {@link https://www.w3.org/TR/vc-data-model/#status | credential status data model } | ||
* | ||
* @beta | ||
*/ | ||
interface CredentialStatusUpdateOptions { | ||
[x: string]: any | ||
} | ||
|
||
/** | ||
* Input arguments for {@link ICredentialStatusManager.credentialStatusUpdate | credentialStatusUpdate} | ||
* @beta | ||
*/ | ||
export interface CredentialStatusUpdateArgs { | ||
/** | ||
* The verifiable credential whose status will be updated. | ||
*/ | ||
vc: VerifiableCredential | ||
|
||
/** | ||
* Options that will be forwarded to the credentialStatus method specific manager. | ||
* | ||
* @see {@link https://www.w3.org/TR/vc-data-model/#status} | ||
*/ | ||
options?: CredentialStatusUpdateOptions | ||
} | ||
|
||
/** | ||
* Arguments for generating a `credentialStatus` property for a {@link VerifiableCredential}. | ||
* @see {@link ICredentialStatusManager.credentialStatusGenerate | credentialStatusGenerate} | ||
* | ||
* @beta | ||
*/ | ||
export interface CredentialStatusGenerateArgs { | ||
/** | ||
* The credential status type (aka credential status method) to be used in the `credentialStatus` generation. | ||
*/ | ||
type: string | ||
|
||
/** | ||
* Any other options will be forwarded to the credentialStatus method driver | ||
*/ | ||
[x: string]: any | ||
} | ||
|
||
/** | ||
* Credential status manager interface | ||
* @beta | ||
*/ | ||
export interface ICredentialStatusManager extends IPluginMethodMap { | ||
/** | ||
* Changes the status of an existing {@link VerifiableCredential}. | ||
* Commonly used to revoke an existing credential. | ||
* | ||
* @param args - Input arguments for updating the status(revoking) a credential | ||
* @beta | ||
*/ | ||
credentialStatusUpdate(args: CredentialStatusUpdateArgs): Promise<any> | ||
|
||
/** | ||
* Generates a `credentialStatus` property for a future credential, not yet signed. | ||
* | ||
* This method is used during the creation of a {@link VerifiableCredential} in order to make it capable of | ||
* having its status updated later (to be revoked). | ||
* | ||
* @param args - Input arguments for generating the `credentialStatus` field of a new credential | ||
* @beta | ||
*/ | ||
credentialStatusGenerate(args: CredentialStatusGenerateArgs): Promise<CredentialStatusReference> | ||
|
||
/** | ||
* List all the credential status types (methods) available in the current agent instance. | ||
*/ | ||
credentialStatusTypes(): Promise<Array<string>> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.