Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add the interface for credential status manager #956

Merged
merged 20 commits into from
Aug 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e3f0ad6
feat: Adding the interface for credential status manager
italobb Jul 1, 2022
26fab23
fix: Updating plugin schemas
italobb Jul 1, 2022
fe47d3a
fix: missing library reference
italobb Jul 4, 2022
9750f72
Merge branch 'next' into feat/credentialRevocationApi
italobb Aug 4, 2022
efa8619
Update packages/core/src/types/ICredentialStatus.ts
italobb Aug 4, 2022
af2251f
Update packages/core/src/types/ICredentialStatus.ts
italobb Aug 4, 2022
cd07fb5
Update packages/core/src/types/ICredentialStatus.ts
italobb Aug 4, 2022
b3d7446
Update packages/core/src/types/ICredentialStatus.ts
italobb Aug 4, 2022
c095a5a
Update packages/core/src/types/ICredentialStatus.ts
italobb Aug 4, 2022
8f03222
Update packages/core/src/types/vc-data-model.ts
italobb Aug 4, 2022
efc7adb
Update packages/core/src/types/ICredentialStatus.ts
italobb Aug 4, 2022
c1baead
Merge branch 'feat/credentialRevocationApi' of github.com:uport-proje…
italobb Aug 4, 2022
a77d9b9
Update packages/core/src/types/ICredentialStatus.ts
italobb Aug 4, 2022
fc150b6
Update packages/core/src/types/ICredentialStatus.ts
italobb Aug 4, 2022
01a5cb2
fix: Removing CredentialStatusType
italobb Aug 4, 2022
c742da1
fix: Removing credentialStatusRead method
italobb Aug 4, 2022
956d007
Update packages/core/src/types/ICredentialStatus.ts
italobb Aug 8, 2022
d716027
fix: docs rebuilt
italobb Aug 8, 2022
6ae5a1b
fix: removing unused dependency
italobb Aug 8, 2022
3de66d6
Merge branch 'feat/credentialRevocationApi' of github.com:uport-proje…
italobb Aug 8, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"devDependencies": {
"@types/debug": "4.1.7",
"did-resolver": "3.2.2",
"credential-status": "^2.0.3",
"typescript": "4.7.3"
},
"files": [
Expand Down
78 changes: 78 additions & 0 deletions packages/core/src/types/ICredentialStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
export { DIDDocument, DIDResolutionOptions, DIDResolutionResult } from 'did-resolver'
import { IPluginMethodMap } from './IAgent'
import { CredentialStatus, 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 https://w3c-ccg.github.io/vc-status-list-2021/ | StatusList2021Entry
* @see https://w3c-ccg.github.io/vc-csl2017/ | CredentialStatusList2017
*
* @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}
*
* @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[]>
}
2 changes: 1 addition & 1 deletion packages/core/src/types/vc-data-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type CompactJWT = string
*
* @beta This API may change without a BREAKING CHANGE notice.
*/
export type IssuerType = { id: string; [x: string]: any } | string
export type IssuerType = { id: string;[x: string]: any } | string

/**
* The value of the credentialSubject property is defined as a set of objects that contain one or more properties that
Expand Down
17 changes: 15 additions & 2 deletions packages/credential-status/plugin.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
"type": "string"
},
"type": {
"type": "string"
"$ref": "#/components/schemas/CredentialStatusType"
}
},
"required": [
Expand All @@ -131,6 +131,10 @@
],
"description": "Used for the discovery of information about the current status of a verifiable credential, such as whether it is suspended or revoked. The precise contents of the credential status information is determined by the specific `credentialStatus` type definition, and varies depending on factors such as whether it is simple to implement or if it is privacy-enhancing.\n\nSee {@link https://www.w3.org/TR/vc-data-model/#status | Credential Status }"
},
"CredentialStatusType": {
"type": "string",
"description": "Expresses the credential status type (also referred to as the credential status method). It is expected that the value will provide enough information to determine the current status of the credential and that machine readable information needs to be retrievable from the URI. For example, the object could contain a link to an external document noting whether or not the credential is suspended or revoked."
},
"DIDDocument": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -368,6 +372,15 @@
"type",
"serviceEndpoint"
]
},
"CredentialStatusVerification": {
"type": "object",
"properties": {
"revoked": {
"type": "boolean"
}
},
"description": "Represents the result of a status check.\n\nImplementations should populate the `revoked` boolean property, but they can return additional metadata that is method specific."
}
},
"methods": {
Expand All @@ -377,7 +390,7 @@
"$ref": "#/components/schemas/ICheckCredentialStatusArgs"
},
"returnType": {
"$ref": "#/components/schemas/CredentialStatus"
"$ref": "#/components/schemas/CredentialStatusVerification"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/credential-status/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IAgentContext, IPluginMethodMap, VerifiableCredential } from '@veramo/core'
import { CredentialStatus } from 'credential-status'
import { CredentialStatus as CredentialStatusVerification } from 'credential-status'
import { DIDDocument } from 'did-resolver'

/**
Expand Down Expand Up @@ -44,5 +44,5 @@ export interface ICheckCredentialStatus extends IPluginMethodMap {
checkCredentialStatus(
args: ICheckCredentialStatusArgs,
context: IAgentContext<any>,
): Promise<CredentialStatus>
): Promise<CredentialStatusVerification>
}