diff --git a/__tests__/shared/credentialStatus.ts b/__tests__/shared/credentialStatus.ts index 5763d966e..4dcda0b9b 100644 --- a/__tests__/shared/credentialStatus.ts +++ b/__tests__/shared/credentialStatus.ts @@ -40,7 +40,7 @@ const checkStatus = async (credential: any): Promise => { throw new Error('Invalid state.') } - return revoked ? { revoked } : {} + return { revoked } } export default (testContext: { diff --git a/packages/core/plugin.schema.json b/packages/core/plugin.schema.json index f070a43fb..4491ee45f 100644 --- a/packages/core/plugin.schema.json +++ b/packages/core/plugin.schema.json @@ -3164,8 +3164,8 @@ }, "save": { "type": "boolean", - "description": "Optional. If set to `true`, the message will be saved using\n {@link IDataStore.dataStoreSaveMessage | dataStoreSaveMessage } \n

", - "deprecated": "Please call {@link IDataStore.dataStoreSaveMessage | dataStoreSaveMessage()} after handling the\nmessage and determining that it must be saved." + "description": "Optional. If set to `true`, the message will be saved using\n {@link @veramo/core#IDataStore.dataStoreSaveMessage | dataStoreSaveMessage } \n

", + "deprecated": "Please call {@link @veramo/core#IDataStore.dataStoreSaveMessage | dataStoreSaveMessage()} after\nhandling the message and determining that it must be saved." } }, "required": [ @@ -3872,6 +3872,9 @@ "type": "boolean" } }, + "required": [ + "revoked" + ], "description": "Represents the result of a status check.\n\nImplementations MUST populate the `revoked` boolean property, but they can return additional metadata that is method specific." } }, diff --git a/packages/core/src/types/IDIDManager.ts b/packages/core/src/types/IDIDManager.ts index 351237350..a31b4e747 100644 --- a/packages/core/src/types/IDIDManager.ts +++ b/packages/core/src/types/IDIDManager.ts @@ -335,13 +335,13 @@ export interface IDIDManager extends IPluginMethodMap { ): Promise /** - * Updates the DID document of a managed {@link IIdentifier | DID}. + * Updates the DID document of a managed {@link @veramo/core#IIdentifier | DID}. * @param args - the arguments necessary for the update. The options are specific for each DID provider. * @param context - *RESERVED* This is filled by the framework when the method is called. This method's execution context requires an `agent` that has * {@link @veramo/core#IKeyManager} methods. */ - didManagerUpdate(args: IDIDManagerUpdateArgs, context: IAgentContext): Promise + didManagerUpdate(args: IDIDManagerUpdateArgs, context: IAgentContext): Promise /** * Imports identifier diff --git a/packages/core/src/types/IMessageHandler.ts b/packages/core/src/types/IMessageHandler.ts index d3e1810fa..82902ce6c 100644 --- a/packages/core/src/types/IMessageHandler.ts +++ b/packages/core/src/types/IMessageHandler.ts @@ -19,10 +19,10 @@ export interface IHandleMessageArgs { /** * Optional. If set to `true`, the message will be saved using - * {@link IDataStore.dataStoreSaveMessage | dataStoreSaveMessage} + * {@link @veramo/core#IDataStore.dataStoreSaveMessage | dataStoreSaveMessage} *

- * @deprecated Please call {@link IDataStore.dataStoreSaveMessage | dataStoreSaveMessage()} after handling the - * message and determining that it must be saved. + * @deprecated Please call {@link @veramo/core#IDataStore.dataStoreSaveMessage | dataStoreSaveMessage()} after + * handling the message and determining that it must be saved. */ save?: boolean } @@ -36,7 +36,7 @@ export interface IMessageHandler extends IPluginMethodMap { * Parses a raw message. * * After the message is parsed, you can decide if it should be saved, and pass the result to - * {@link IDataStore.dataStoreSaveMessage | dataStoreSaveMessage()} to save it. + * {@link @veramo/core#IDataStore.dataStoreSaveMessage | dataStoreSaveMessage()} to save it. * * @param args - The `raw` message to be handled along with optional `metadata` about the origin. * @param context - Execution context. Requires agent with {@link @veramo/core#IDataStore} methods diff --git a/packages/core/src/types/vc-data-model.ts b/packages/core/src/types/vc-data-model.ts index 4b0821b87..f1ea0c706 100644 --- a/packages/core/src/types/vc-data-model.ts +++ b/packages/core/src/types/vc-data-model.ts @@ -61,7 +61,7 @@ export type CredentialStatusReference = { * @beta This API may change without a BREAKING CHANGE notice. */ export type CredentialStatus = { - revoked?: boolean + revoked: boolean [x: string]: any } diff --git a/packages/credential-eip712/plugin.schema.json b/packages/credential-eip712/plugin.schema.json index 4a5b503a4..6f4de52f8 100644 --- a/packages/credential-eip712/plugin.schema.json +++ b/packages/credential-eip712/plugin.schema.json @@ -47,7 +47,7 @@ "$ref": "#/components/schemas/DateType" }, "credentialStatus": { - "$ref": "#/components/schemas/CredentialStatus" + "$ref": "#/components/schemas/CredentialStatusReference" }, "id": { "type": "string" @@ -75,7 +75,7 @@ "type": "string" } ], - "description": "The issuer of a Credential or the holder of a Presentation.\n\nThe value of the issuer property MUST be either a URI or an object containing an id property. It is RECOMMENDED that the URI in the issuer or its id be one which, if de-referenced, results in a document containing machine-readable information about the issuer that can be used to verify the information expressed in the credential.\n\nSee {@link https://www.w3.org/TR/vc-data-model/#issuer | Issuer data model }" + "description": "The issuer of a {@link VerifiableCredential } or the holder of a {@link VerifiablePresentation } .\n\nThe value of the issuer property MUST be either a URI or an object containing an id property. It is RECOMMENDED that the URI in the issuer or its id be one which, if de-referenced, results in a document containing machine-readable information about the issuer that can be used to verify the information expressed in the credential.\n\nSee {@link https://www.w3.org/TR/vc-data-model/#issuer | Issuer data model }" }, "CredentialSubject": { "type": "object", @@ -90,7 +90,7 @@ "type": "string", "description": "Represents an issuance or expiration date for Credentials / Presentations. This is used as input when creating them." }, - "CredentialStatus": { + "CredentialStatusReference": { "type": "object", "properties": { "id": { @@ -151,7 +151,7 @@ "type": "string" }, "credentialStatus": { - "$ref": "#/components/schemas/CredentialStatus" + "$ref": "#/components/schemas/CredentialStatusReference" }, "id": { "type": "string" @@ -173,7 +173,7 @@ "type": "string" } }, - "description": "A proof property of a Verifiable Credential or Presentation" + "description": "A proof property of a {@link VerifiableCredential } or {@link VerifiablePresentation }" }, "ICreateVerifiablePresentationEIP712Args": { "type": "object", diff --git a/packages/credential-ld/plugin.schema.json b/packages/credential-ld/plugin.schema.json index b6df74bb1..97528e09e 100644 --- a/packages/credential-ld/plugin.schema.json +++ b/packages/credential-ld/plugin.schema.json @@ -47,7 +47,7 @@ "$ref": "#/components/schemas/DateType" }, "credentialStatus": { - "$ref": "#/components/schemas/CredentialStatus" + "$ref": "#/components/schemas/CredentialStatusReference" }, "id": { "type": "string" @@ -75,7 +75,7 @@ "type": "string" } ], - "description": "The issuer of a Credential or the holder of a Presentation.\n\nThe value of the issuer property MUST be either a URI or an object containing an id property. It is RECOMMENDED that the URI in the issuer or its id be one which, if de-referenced, results in a document containing machine-readable information about the issuer that can be used to verify the information expressed in the credential.\n\nSee {@link https://www.w3.org/TR/vc-data-model/#issuer | Issuer data model }" + "description": "The issuer of a {@link VerifiableCredential } or the holder of a {@link VerifiablePresentation } .\n\nThe value of the issuer property MUST be either a URI or an object containing an id property. It is RECOMMENDED that the URI in the issuer or its id be one which, if de-referenced, results in a document containing machine-readable information about the issuer that can be used to verify the information expressed in the credential.\n\nSee {@link https://www.w3.org/TR/vc-data-model/#issuer | Issuer data model }" }, "CredentialSubject": { "type": "object", @@ -90,7 +90,7 @@ "type": "string", "description": "Represents an issuance or expiration date for Credentials / Presentations. This is used as input when creating them." }, - "CredentialStatus": { + "CredentialStatusReference": { "type": "object", "properties": { "id": { @@ -151,7 +151,7 @@ "type": "string" }, "credentialStatus": { - "$ref": "#/components/schemas/CredentialStatus" + "$ref": "#/components/schemas/CredentialStatusReference" }, "id": { "type": "string" @@ -173,7 +173,7 @@ "type": "string" } }, - "description": "A proof property of a Verifiable Credential or Presentation" + "description": "A proof property of a {@link VerifiableCredential } or {@link VerifiablePresentation }" }, "ICreateVerifiablePresentationLDArgs": { "type": "object", diff --git a/packages/credential-status/package.json b/packages/credential-status/package.json index bc5b3d9a6..10cfc0a8d 100644 --- a/packages/credential-status/package.json +++ b/packages/credential-status/package.json @@ -8,11 +8,6 @@ "build": "tsc", "extract-api": "yarn veramo dev extract-api" }, - "veramo": { - "pluginInterfaces": { - "ICheckCredentialStatus": "./src/types.ts" - } - }, "dependencies": { "@veramo/core": "^3.1.0", "@veramo/utils": "^3.1.0", diff --git a/packages/credential-status/src/__tests__/credential-status.test.ts b/packages/credential-status/src/__tests__/credential-status.test.ts index f2d5d9d08..a9973ab6e 100644 --- a/packages/credential-status/src/__tests__/credential-status.test.ts +++ b/packages/credential-status/src/__tests__/credential-status.test.ts @@ -19,7 +19,7 @@ describe('@veramo/credential-status', () => { it('should check the credential status', async () => { expect.assertions(3) - const expectedResult = {} + const expectedResult = { revoked: false } const checkStatus = jest.fn(async () => expectedResult) const agent = createAgent({ plugins: [ @@ -41,7 +41,7 @@ describe('@veramo/credential-status', () => { it('should check the credential status using DID resolver to get the issuer doc', async () => { expect.assertions(4) - const expectedResult = {} + const expectedResult = { revoked: false } const checkStatus = jest.fn(async () => expectedResult) const fakeResolver: Resolvable = { resolve: jest.fn( diff --git a/packages/credential-status/src/credential-status.ts b/packages/credential-status/src/credential-status.ts index b6ccdcbe4..5e7e728bf 100644 --- a/packages/credential-status/src/credential-status.ts +++ b/packages/credential-status/src/credential-status.ts @@ -1,11 +1,12 @@ import { + CredentialStatus, IAgentContext, IAgentPlugin, ICheckCredentialStatusArgs, ICredentialStatusVerifier, IResolver, } from '@veramo/core' -import { extractIssuer, resolveDidOrThrow } from '@veramo/utils' +import { extractIssuer, isDefined, resolveDidOrThrow } from '@veramo/utils' import { Status, StatusMethod } from 'credential-status' /** @@ -43,6 +44,17 @@ export class CredentialStatusPlugin implements IAgentPlugin { const issuerDid = extractIssuer(args.credential) didDoc = await resolveDidOrThrow(issuerDid, context) } - return this.status.checkStatus(args.credential, didDoc) + const statusCheck: CredentialStatus = (await this.status.checkStatus( + args.credential, + didDoc, + )) as CredentialStatus + if (!isDefined(statusCheck.revoked)) { + throw new Error( + `invalid_result: 'revoked' property missing. The Credential Status verification resulted in an ambiguous result: ${JSON.stringify( + statusCheck, + )}`, + ) + } + return statusCheck } } diff --git a/packages/credential-w3c/plugin.schema.json b/packages/credential-w3c/plugin.schema.json index 4cda7fd2b..c2ac48bdb 100644 --- a/packages/credential-w3c/plugin.schema.json +++ b/packages/credential-w3c/plugin.schema.json @@ -12,7 +12,7 @@ "save": { "type": "boolean", "description": "If this parameter is true, the resulting VerifiablePresentation is sent to the\n {@link @veramo/core#IDataStore | storage plugin } to be saved.", - "deprecated": "Please call {@link IDataStore.dataStoreSaveVerifiableCredential | dataStoreSaveVerifiableCredential()}to save the credential after creating it." + "deprecated": "Please call\n{@link @veramo/core#IDataStore.dataStoreSaveVerifiableCredential | dataStoreSaveVerifiableCredential()} to save\nthe credential after creating it." }, "proofFormat": { "$ref": "#/components/schemas/ProofFormat", @@ -61,7 +61,7 @@ "$ref": "#/components/schemas/DateType" }, "credentialStatus": { - "$ref": "#/components/schemas/CredentialStatus" + "$ref": "#/components/schemas/CredentialStatusReference" }, "id": { "type": "string" @@ -89,7 +89,7 @@ "type": "string" } ], - "description": "The issuer of a Credential or the holder of a Presentation.\n\nThe value of the issuer property MUST be either a URI or an object containing an id property. It is RECOMMENDED that the URI in the issuer or its id be one which, if de-referenced, results in a document containing machine-readable information about the issuer that can be used to verify the information expressed in the credential.\n\nSee {@link https://www.w3.org/TR/vc-data-model/#issuer | Issuer data model }" + "description": "The issuer of a {@link VerifiableCredential } or the holder of a {@link VerifiablePresentation } .\n\nThe value of the issuer property MUST be either a URI or an object containing an id property. It is RECOMMENDED that the URI in the issuer or its id be one which, if de-referenced, results in a document containing machine-readable information about the issuer that can be used to verify the information expressed in the credential.\n\nSee {@link https://www.w3.org/TR/vc-data-model/#issuer | Issuer data model }" }, "CredentialSubject": { "type": "object", @@ -104,7 +104,7 @@ "type": "string", "description": "Represents an issuance or expiration date for Credentials / Presentations. This is used as input when creating them." }, - "CredentialStatus": { + "CredentialStatusReference": { "type": "object", "properties": { "id": { @@ -174,7 +174,7 @@ "type": "string" }, "credentialStatus": { - "$ref": "#/components/schemas/CredentialStatus" + "$ref": "#/components/schemas/CredentialStatusReference" }, "id": { "type": "string" @@ -196,7 +196,7 @@ "type": "string" } }, - "description": "A proof property of a Verifiable Credential or Presentation" + "description": "A proof property of a {@link VerifiableCredential } or {@link VerifiablePresentation }" }, "ICreateVerifiablePresentationArgs": { "type": "object", @@ -208,7 +208,7 @@ "save": { "type": "boolean", "description": "If this parameter is true, the resulting VerifiablePresentation is sent to the\n {@link @veramo/core#IDataStore | storage plugin } to be saved.

", - "deprecated": "Please call\n{@link IDataStore.dataStoreSaveVerifiablePresentation | dataStoreSaveVerifiablePresentation()} to save the\ncredential after creating it." + "deprecated": "Please call\n{@link @veramo/core#IDataStore.dataStoreSaveVerifiablePresentation | dataStoreSaveVerifiablePresentation()} to\nsave the credential after creating it." }, "challenge": { "type": "string", diff --git a/packages/credential-w3c/src/action-handler.ts b/packages/credential-w3c/src/action-handler.ts index 012208fbc..2c2451b5e 100644 --- a/packages/credential-w3c/src/action-handler.ts +++ b/packages/credential-w3c/src/action-handler.ts @@ -78,8 +78,8 @@ export interface ICreateVerifiablePresentationArgs { * {@link @veramo/core#IDataStore | storage plugin} to be saved. *

* @deprecated Please call - * {@link IDataStore.dataStoreSaveVerifiablePresentation | dataStoreSaveVerifiablePresentation()} to save the - * credential after creating it. + * {@link @veramo/core#IDataStore.dataStoreSaveVerifiablePresentation | dataStoreSaveVerifiablePresentation()} to + * save the credential after creating it. */ save?: boolean @@ -134,8 +134,9 @@ export interface ICreateVerifiableCredentialArgs { * If this parameter is true, the resulting VerifiablePresentation is sent to the * {@link @veramo/core#IDataStore | storage plugin} to be saved. * - * @deprecated Please call {@link IDataStore.dataStoreSaveVerifiableCredential | dataStoreSaveVerifiableCredential()} - * to save the credential after creating it. + * @deprecated Please call + * {@link @veramo/core#IDataStore.dataStoreSaveVerifiableCredential | dataStoreSaveVerifiableCredential()} to save + * the credential after creating it. */ save?: boolean diff --git a/packages/did-comm/plugin.schema.json b/packages/did-comm/plugin.schema.json index 284aa46bc..a75f239db 100644 --- a/packages/did-comm/plugin.schema.json +++ b/packages/did-comm/plugin.schema.json @@ -344,7 +344,7 @@ "type": "string" }, "credentialStatus": { - "$ref": "#/components/schemas/CredentialStatus" + "$ref": "#/components/schemas/CredentialStatusReference" }, "id": { "type": "string" @@ -366,7 +366,7 @@ "type": "string" } }, - "description": "A proof property of a Verifiable Credential or Presentation" + "description": "A proof property of a {@link VerifiableCredential } or {@link VerifiablePresentation }" }, "IssuerType": { "anyOf": [ @@ -385,7 +385,7 @@ "type": "string" } ], - "description": "The issuer of a Credential or the holder of a Presentation.\n\nThe value of the issuer property MUST be either a URI or an object containing an id property. It is RECOMMENDED that the URI in the issuer or its id be one which, if de-referenced, results in a document containing machine-readable information about the issuer that can be used to verify the information expressed in the credential.\n\nSee {@link https://www.w3.org/TR/vc-data-model/#issuer | Issuer data model }" + "description": "The issuer of a {@link VerifiableCredential } or the holder of a {@link VerifiablePresentation } .\n\nThe value of the issuer property MUST be either a URI or an object containing an id property. It is RECOMMENDED that the URI in the issuer or its id be one which, if de-referenced, results in a document containing machine-readable information about the issuer that can be used to verify the information expressed in the credential.\n\nSee {@link https://www.w3.org/TR/vc-data-model/#issuer | Issuer data model }" }, "CredentialSubject": { "type": "object", @@ -396,7 +396,7 @@ }, "description": "The value of the credentialSubject property is defined as a set of objects that contain one or more properties that are each related to a subject of the verifiable credential. Each object MAY contain an id.\n\nSee {@link https://www.w3.org/TR/vc-data-model/#credential-subject | Credential Subject }" }, - "CredentialStatus": { + "CredentialStatusReference": { "type": "object", "properties": { "id": { diff --git a/packages/kms-web3/api-extractor.json b/packages/kms-web3/api-extractor.json new file mode 100644 index 000000000..409d7f16c --- /dev/null +++ b/packages/kms-web3/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "apiReport": { + "enabled": true, + "reportFolder": "./api", + "reportTempFolder": "./api" + }, + + "docModel": { + "enabled": true, + "apiJsonFilePath": "./api/.api.json" + }, + + "dtsRollup": { + "enabled": false + }, + "mainEntryPointFilePath": "/build/index.d.ts" +} diff --git a/packages/kms-web3/package.json b/packages/kms-web3/package.json index 9aee45527..166b8e621 100644 --- a/packages/kms-web3/package.json +++ b/packages/kms-web3/package.json @@ -5,7 +5,8 @@ "main": "build/index.js", "types": "build/index.d.ts", "scripts": { - "build": "tsc" + "build": "tsc", + "extract-api": "yarn veramo dev extract-api" }, "dependencies": { "@ethersproject/providers": "^5.6.8", diff --git a/packages/kms-web3/src/web3-key-management-system.ts b/packages/kms-web3/src/web3-key-management-system.ts index 988f64ae2..d38ef2bf2 100644 --- a/packages/kms-web3/src/web3-key-management-system.ts +++ b/packages/kms-web3/src/web3-key-management-system.ts @@ -4,7 +4,7 @@ import { AbstractKeyManagementSystem, Eip712Payload } from '@veramo/key-manager' import { toUtf8String } from '@ethersproject/strings' /** - * This is a {@link @veramo/keyManager#AbstractKeyManagementSystem | KMS} implementation that uses the addresses of a + * This is a {@link @veramo/key-manager#AbstractKeyManagementSystem | KMS} implementation that uses the addresses of a * web3 wallet as key identifiers, and calls the respective wallet for signing operations. * @beta */ diff --git a/packages/selective-disclosure/plugin.schema.json b/packages/selective-disclosure/plugin.schema.json index 9f33fe713..7766f6576 100644 --- a/packages/selective-disclosure/plugin.schema.json +++ b/packages/selective-disclosure/plugin.schema.json @@ -112,7 +112,7 @@ "type": "string" } }, - "description": "A proof property of a Verifiable Credential or Presentation" + "description": "A proof property of a {@link VerifiableCredential } or {@link VerifiablePresentation }" }, "W3CVerifiableCredential": { "anyOf": [ @@ -170,7 +170,7 @@ "type": "string" }, "credentialStatus": { - "$ref": "#/components/schemas/CredentialStatus" + "$ref": "#/components/schemas/CredentialStatusReference" }, "id": { "type": "string" @@ -202,7 +202,7 @@ "type": "string" } ], - "description": "The issuer of a Credential or the holder of a Presentation.\n\nThe value of the issuer property MUST be either a URI or an object containing an id property. It is RECOMMENDED that the URI in the issuer or its id be one which, if de-referenced, results in a document containing machine-readable information about the issuer that can be used to verify the information expressed in the credential.\n\nSee {@link https://www.w3.org/TR/vc-data-model/#issuer | Issuer data model }" + "description": "The issuer of a {@link VerifiableCredential } or the holder of a {@link VerifiablePresentation } .\n\nThe value of the issuer property MUST be either a URI or an object containing an id property. It is RECOMMENDED that the URI in the issuer or its id be one which, if de-referenced, results in a document containing machine-readable information about the issuer that can be used to verify the information expressed in the credential.\n\nSee {@link https://www.w3.org/TR/vc-data-model/#issuer | Issuer data model }" }, "CredentialSubject": { "type": "object", @@ -213,7 +213,7 @@ }, "description": "The value of the credentialSubject property is defined as a set of objects that contain one or more properties that are each related to a subject of the verifiable credential. Each object MAY contain an id.\n\nSee {@link https://www.w3.org/TR/vc-data-model/#credential-subject | Credential Subject }" }, - "CredentialStatus": { + "CredentialStatusReference": { "type": "object", "properties": { "id": {