@sphereon/ssi-sdk.linked-vp 0.34.1-feature.SSISDK.82.linkedVP.325
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/dist/index.cjs +463 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +447 -0
- package/dist/index.d.ts +447 -0
- package/dist/index.js +442 -0
- package/dist/index.js.map +1 -0
- package/package.json +80 -0
- package/plugin.schema.json +183 -0
- package/src/__tests__/localAgent.test.ts +95 -0
- package/src/__tests__/shared/linkedVPManagerAgentLogic.ts +170 -0
- package/src/agent/LinkedVPManager.ts +221 -0
- package/src/index.ts +7 -0
- package/src/services/LinkedVPService.ts +84 -0
- package/src/types/ILinkedVPManager.ts +85 -0
- package/src/types/index.ts +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../plugin.schema.json","../src/agent/LinkedVPManager.ts","../src/services/LinkedVPService.ts","../src/types/ILinkedVPManager.ts"],"sourcesContent":["/**\n * @public\n */\nimport schema from '../plugin.schema.json'\nexport { schema }\nexport { LinkedVPManager, linkedVPManagerMethods } from './agent/LinkedVPManager'\nexport * from './types/ILinkedVPManager'\n","{\n \"ILinkedVPManager\": {\n \"components\": {\n \"schemas\": {\n \"GeneratePresentationArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"linkedVpId\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"linkedVpId\"\n ],\n \"additionalProperties\": false\n },\n \"LinkedVPPresentation\": {\n \"anyOf\": [\n {\n \"type\": \"string\"\n },\n {\n \"$ref\": \"#/components/schemas/Record<string,any>\"\n }\n ]\n },\n \"Record<string,any>\": {\n \"type\": \"object\"\n },\n \"GetServiceEntriesArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"tenantId\": {\n \"type\": \"string\"\n }\n },\n \"additionalProperties\": false\n },\n \"LinkedVPServiceEntry\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"type\": {\n \"type\": \"string\",\n \"const\": \"LinkedVerifiablePresentation\"\n },\n \"serviceEndpoint\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"id\",\n \"type\",\n \"serviceEndpoint\"\n ],\n \"additionalProperties\": false\n },\n \"HasLinkedVPEntryArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"linkedVpId\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"linkedVpId\"\n ],\n \"additionalProperties\": false\n },\n \"PublishCredentialArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"digitalCredentialId\": {\n \"type\": \"string\"\n },\n \"linkedVpId\": {\n \"type\": \"string\"\n },\n \"tenantId\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"digitalCredentialId\"\n ],\n \"additionalProperties\": false\n },\n \"LinkedVPEntry\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"linkedVpId\": {\n \"type\": \"string\"\n },\n \"tenantId\": {\n \"type\": \"string\"\n },\n \"linkedVpFrom\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n },\n \"createdAt\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n }\n },\n \"required\": [\n \"id\",\n \"linkedVpId\",\n \"createdAt\"\n ],\n \"additionalProperties\": false\n },\n \"UnpublishCredentialArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"linkedVpId\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"linkedVpId\"\n ],\n \"additionalProperties\": false\n }\n },\n \"methods\": {\n \"lvpGeneratePresentation\": {\n \"description\": \"Generate and return a Verifiable Presentation for a published LinkedVP This is the main endpoint handler for GET /linked-vp/\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/GeneratePresentationArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/LinkedVPPresentation\"\n }\n },\n \"lvpGetServiceEntries\": {\n \"description\": \"Get LinkedVP service entries for a DID to be added to a DID Document This is useful when generating DID Documents with toDidDocument\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/GetServiceEntriesArgs\"\n },\n \"returnType\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/LinkedVPServiceEntry\"\n }\n }\n },\n \"lvpHasEntry\": {\n \"description\": \"Check if a LinkedVP entry exists by linkedVpId\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/HasLinkedVPEntryArgs\"\n },\n \"returnType\": {\n \"type\": \"boolean\"\n }\n },\n \"lvpPublishCredential\": {\n \"description\": \"Publish a credential as a LinkedVP by adding it to the holder's DID Document\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/PublishCredentialArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/LinkedVPEntry\"\n }\n },\n \"lvpUnpublishCredential\": {\n \"description\": \"Unpublish a credential by removing its LinkedVP entry from the DID Document\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/UnpublishCredentialArgs\"\n },\n \"returnType\": {\n \"type\": \"boolean\"\n }\n }\n }\n }\n }\n}","import { DigitalCredential } from '@sphereon/ssi-sdk.data-store-types'\nimport { IAgentPlugin } from '@veramo/core'\nimport { IsNull, Not } from 'typeorm'\nimport { schema } from '../index'\nimport { createLinkedVPPresentation } from '../services/LinkedVPService'\nimport {\n GeneratePresentationArgs,\n GetServiceEntriesArgs,\n HasLinkedVPEntryArgs,\n ILinkedVPManager,\n LinkedVPEntry,\n LinkedVPPresentation,\n LinkedVPServiceEntry,\n PublishCredentialArgs,\n RequiredContext,\n UnpublishCredentialArgs,\n} from '../types'\n\n// Exposing the methods here for any REST implementation\nexport const linkedVPManagerMethods: Array<string> = [\n 'lvpPublishCredential',\n 'lvpUnpublishCredential',\n 'lvpHasEntry',\n 'lvpGetServiceEntries',\n 'lvpGeneratePresentation',\n]\n\n/**\n * {@inheritDoc ILinkedVPManager}\n */\nexport class LinkedVPManager implements IAgentPlugin {\n readonly schema = schema.ILinkedVPManager\n readonly methods: ILinkedVPManager = {\n lvpPublishCredential: this.lvpPublishCredential.bind(this),\n lvpUnpublishCredential: this.lvpUnpublishCredential.bind(this),\n lvpHasEntry: this.lvpHasEntry.bind(this),\n lvpGetServiceEntries: this.lvpGetServiceEntries.bind(this),\n lvpGeneratePresentation: this.lvpGeneratePresentation.bind(this),\n }\n\n private readonly holderDids: Record<string, string>\n\n constructor(options: { holderDids: Record<string, string> }) {\n this.holderDids = options.holderDids\n }\n\n private async lvpPublishCredential(args: PublishCredentialArgs, context: RequiredContext): Promise<LinkedVPEntry> {\n const { digitalCredentialId } = args\n\n const credential: DigitalCredential = await context.agent.crsGetCredential({ id: digitalCredentialId })\n\n if (credential.linkedVpId) {\n return Promise.reject(new Error(`Credential ${digitalCredentialId} is already published with linkedVpId ${credential.linkedVpId}`))\n }\n\n const linkedVpId = this.buildLinkedVpId(args.linkedVpId, credential.tenantId)\n\n await this.ensureLinkedVpIdUnique(linkedVpId, context, credential.tenantId)\n\n const publishedAt = new Date()\n await context.agent.crsUpdateCredential({\n id: digitalCredentialId,\n linkedVpId,\n linkedVpFrom: publishedAt,\n })\n\n return {\n id: credential.id,\n linkedVpId,\n tenantId: credential.tenantId,\n linkedVpFrom: publishedAt,\n createdAt: credential.createdAt,\n }\n }\n\n private async lvpUnpublishCredential(args: UnpublishCredentialArgs, context: RequiredContext): Promise<boolean> {\n const { linkedVpId } = args\n\n // Find credential by linkedVpId and tenantId\n const credentials = await context.agent.crsGetCredentials({\n filter: [{ linkedVpId }],\n })\n if (credentials.length === 0) {\n return Promise.reject(Error(`No credential found with linkedVpId ${linkedVpId}`))\n }\n\n const credential = credentials[0]\n await context.agent.crsUpdateCredential({\n id: credential.id,\n linkedVpId: undefined,\n linkedVpFrom: undefined,\n })\n\n return true\n }\n\n private async lvpHasEntry(args: HasLinkedVPEntryArgs, context: RequiredContext): Promise<boolean> {\n const { linkedVpId } = args\n\n try {\n const credentials = await context.agent.crsGetCredentials({\n filter: [{ linkedVpId }],\n })\n return credentials.length > 0\n } catch (error) {\n return false\n }\n }\n\n private async lvpGetServiceEntries(args: GetServiceEntriesArgs, context: RequiredContext): Promise<Array<LinkedVPServiceEntry>> {\n const { tenantId } = args\n\n // Get all published credentials (credentials with linkedVpId set)\n const filter: any = { linkedVpId: Not(IsNull()) }\n if (tenantId) {\n filter.tenantId = tenantId\n }\n\n const credentials = await context.agent.crsGetCredentials({\n filter: [filter],\n })\n\n return credentials\n .filter((cred) => cred.linkedVpId !== undefined && cred.linkedVpId !== null)\n .map((cred) => {\n const holderDidForEntry = this.getHolderDid(cred.tenantId)\n return this.credentialToServiceEntry(cred, holderDidForEntry)\n })\n }\n\n private async lvpGeneratePresentation(args: GeneratePresentationArgs, context: RequiredContext): Promise<LinkedVPPresentation> {\n const { linkedVpId } = args\n const tenantId = this.parseTenantFromLinkedVpId(linkedVpId)\n const holderDid = this.getHolderDid(tenantId)\n\n const uniqueCredentials = await context.agent.crsGetUniqueCredentials({\n filter: [\n {\n linkedVpId: args.linkedVpId,\n ...(tenantId && { tenantId }),\n },\n ],\n })\n if (uniqueCredentials.length === 0) {\n return Promise.reject(Error(`No published credentials found for linkedVpId ${linkedVpId}`))\n }\n\n // Generate the Verifiable Presentation with all published credentials\n return createLinkedVPPresentation(holderDid, uniqueCredentials, context.agent)\n }\n\n private getHolderDid(tenantId: string | undefined) {\n const holderDid = this.holderDids[tenantId ?? 'default']\n if (!holderDid) {\n throw Error(`No holder did supplied for tenant ${tenantId ?? 'default'}`)\n }\n return holderDid\n }\n\n private parseTenantFromLinkedVpId(linkedVpId: string): string | undefined {\n const idx = linkedVpId.lastIndexOf('@')\n return idx === -1 ? undefined : linkedVpId.substring(idx + 1)\n }\n\n private generateLinkedVpId(): string {\n return `lvp-${Date.now()}-${Math.random().toString(36).substring(2, 15)}`\n }\n\n private async ensureLinkedVpIdUnique(linkedVpId: string, context: RequiredContext, tenantId?: string): Promise<void> {\n const credentials = await context.agent.crsGetCredentials({\n filter: [{ linkedVpId, ...(tenantId && { tenantId }) }],\n })\n\n if (credentials.length > 0) {\n throw new Error(`LinkedVP ID ${linkedVpId} already exists${tenantId ? ` for tenant ${tenantId}` : ''}`)\n }\n }\n\n private buildLinkedVpId(linkedVpId: string | undefined, tenantId: string | undefined) {\n let finalLinkedVpId = linkedVpId || this.generateLinkedVpId()\n\n // Append tenantId if provided and not already present\n if (tenantId && tenantId !== '' && !finalLinkedVpId.includes('@')) {\n finalLinkedVpId = `${finalLinkedVpId}@${tenantId}`\n }\n return finalLinkedVpId\n }\n\n private getBaseUrlFromDid(holderDid: string): string {\n if (!holderDid.startsWith('did:web:')) {\n throw new Error(`Invalid DID: ${holderDid}, must be did:web`)\n }\n\n const withoutPrefix = holderDid.replace('did:web:', '') // example.com:tenants:tenant1\n const parts = withoutPrefix.split(':')\n const domain = parts.shift()! // example.com\n const path = parts.join('/') // tenants/tenant1\n\n return path\n ? `https://${domain}/${path}` // https://example.com/tenants/tenant1\n : `https://${domain}` // https://example.com\n }\n\n private buildServiceEndpoint(holderDid: string, linkedVpId: string): string {\n const baseUrl = this.getBaseUrlFromDid(holderDid)\n const cleanBaseUrl = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl\n return `${cleanBaseUrl}/linked-vp/${linkedVpId}`\n }\n\n private credentialToServiceEntry(credential: DigitalCredential, holderDid: string): LinkedVPServiceEntry {\n if (!credential.linkedVpId) {\n throw new Error(`Credential ${credential.id} does not have a linkedVpId`)\n }\n\n return {\n id: `${holderDid}#${credential.linkedVpId}`,\n type: 'LinkedVerifiablePresentation',\n serviceEndpoint: this.buildServiceEndpoint(holderDid, credential.linkedVpId),\n }\n }\n}\n","import { UniqueDigitalCredential } from '@sphereon/ssi-sdk.credential-store'\nimport { Loggers, OriginalVerifiableCredential, WrappedVerifiableCredential } from '@sphereon/ssi-types'\nimport type { PresentationPayload } from '@veramo/core'\nimport { W3CVerifiableCredential } from '@veramo/core/src/types/vc-data-model'\nimport { LOGGER_NAMESPACE, RequiredContext } from '../types'\n\nconst logger = Loggers.DEFAULT.get(LOGGER_NAMESPACE)\n\n/**\n * Extracts the original credential from various wrapper types\n */\nfunction extractOriginalCredential(\n credential: UniqueDigitalCredential | WrappedVerifiableCredential | OriginalVerifiableCredential,\n): OriginalVerifiableCredential {\n if (typeof credential === 'string') {\n return credential\n }\n\n if ('digitalCredential' in credential) {\n const udc = credential as UniqueDigitalCredential\n if (udc.originalVerifiableCredential) {\n return udc.originalVerifiableCredential\n }\n return udc.uniformVerifiableCredential as OriginalVerifiableCredential\n }\n\n if ('original' in credential) {\n return credential.original\n }\n\n return credential as OriginalVerifiableCredential\n}\n\n/**\n * Creates a Verifiable Presentation for LinkedVP publishing\n * Contains multiple credentials in a single JWT VP\n * No nonce or audience since this is for publishing, not responding to verification\n */\nexport async function createLinkedVPPresentation(\n holderDid: string,\n credentials: UniqueDigitalCredential[],\n agent: RequiredContext['agent'],\n): Promise<string | Record<string, any>> {\n if (credentials.length === 0) {\n return Promise.reject(Error('Cannot create LinkedVP presentation with zero credentials'))\n }\n\n logger.debug(`Creating LinkedVP presentation for ${holderDid} with ${credentials.length} credentials`)\n\n const identifier = await agent.identifierManagedGet({ identifier: holderDid })\n\n // Extract and prepare credentials\n const verifiableCredentials = credentials.map((credential) => {\n const original = extractOriginalCredential(credential)\n // Keep as-is if string (JWT), otherwise convert to object\n return typeof original === 'string' ? original : original\n })\n\n // Create VP structure\n const vpObject: PresentationPayload = {\n '@context': ['https://www.w3.org/2018/credentials/v1'],\n type: ['VerifiablePresentation'],\n holder: holderDid,\n verifiableCredential: verifiableCredentials as W3CVerifiableCredential[],\n }\n\n // Create and sign the VP as JWT\n const result = await agent.createVerifiablePresentation({\n presentation: vpObject,\n proofFormat: 'jwt',\n keyRef: identifier.kmsKeyRef || identifier.kid,\n })\n\n // Extract JWT from result\n if (typeof result === 'string') {\n return result\n }\n\n if (result.proof && 'jws' in result.proof) {\n return result.proof.jws\n }\n\n return Promise.reject(Error('Failed to create JWT VP - no JWT in result'))\n}\n","import { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution'\nimport { ICredentialStore } from '@sphereon/ssi-sdk.credential-store'\nimport { VcdmCredentialPlugin } from '@sphereon/ssi-sdk.credential-vcdm'\nimport { IAgentContext, IPluginMethodMap } from '@veramo/core'\nimport { IKeyManager } from '@veramo/core/src/types/IKeyManager'\n\nexport const LOGGER_NAMESPACE = 'sphereon:linked-vp'\n\nexport type LinkedVPPresentation = string | Record<string, any>\n\nexport interface ILinkedVPManager extends IPluginMethodMap {\n /**\n * Publish a credential as a LinkedVP by adding it to the holder's DID Document\n * @param args - Publication arguments including credential ID and scope configuration\n * @param context - Agent context\n */\n lvpPublishCredential(args: PublishCredentialArgs, context: RequiredContext): Promise<LinkedVPEntry>\n\n /**\n * Unpublish a credential by removing its LinkedVP entry from the DID Document\n * @param args - Unpublish arguments\n * @param context - Agent context\n */\n lvpUnpublishCredential(args: UnpublishCredentialArgs, context: RequiredContext): Promise<boolean>\n\n /**\n * Check if a LinkedVP entry exists by linkedVpId\n * @param args - Query arguments\n * @param context - Agent context\n */\n lvpHasEntry(args: HasLinkedVPEntryArgs, context: RequiredContext): Promise<boolean>\n\n /**\n * Get LinkedVP service entries for a DID to be added to a DID Document\n * This is useful when generating DID Documents with toDidDocument\n * @param args - Query arguments for the DID\n * @param context - Agent context\n */\n lvpGetServiceEntries(args: GetServiceEntriesArgs, context: RequiredContext): Promise<Array<LinkedVPServiceEntry>>\n\n /**\n * Generate and return a Verifiable Presentation for a published LinkedVP\n * This is the main endpoint handler for GET /linked-vp/{linkedVpId}\n * @param args - Generation arguments\n * @param context - Agent context\n */\n lvpGeneratePresentation(args: GeneratePresentationArgs, context: RequiredContext): Promise<LinkedVPPresentation>\n}\n\nexport type PublishCredentialArgs = {\n digitalCredentialId: string\n linkedVpId?: string // Optional: if not provided, will be auto-generated\n}\n\nexport type UnpublishCredentialArgs = {\n linkedVpId: string\n}\n\nexport type HasLinkedVPEntryArgs = {\n linkedVpId: string\n}\n\nexport type GetServiceEntriesArgs = {\n tenantId?: string\n}\n\nexport type GeneratePresentationArgs = {\n linkedVpId: string\n}\n\nexport type LinkedVPEntry = {\n id: string\n linkedVpId: string\n tenantId?: string\n linkedVpFrom?: Date\n createdAt: Date\n}\n\nexport type LinkedVPServiceEntry = {\n id: string\n type: 'LinkedVerifiablePresentation'\n serviceEndpoint: string\n}\n\nexport type RequiredContext = IAgentContext<IIdentifierResolution & ICredentialStore & IKeyManager & VcdmCredentialPlugin>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;ACAA;AAAA,EACE,kBAAoB;AAAA,IAClB,YAAc;AAAA,MACZ,SAAW;AAAA,QACT,0BAA4B;AAAA,UAC1B,MAAQ;AAAA,UACR,YAAc;AAAA,YACZ,YAAc;AAAA,cACZ,MAAQ;AAAA,YACV;AAAA,UACF;AAAA,UACA,UAAY;AAAA,YACV;AAAA,UACF;AAAA,UACA,sBAAwB;AAAA,QAC1B;AAAA,QACA,sBAAwB;AAAA,UACtB,OAAS;AAAA,YACP;AAAA,cACE,MAAQ;AAAA,YACV;AAAA,YACA;AAAA,cACE,MAAQ;AAAA,YACV;AAAA,UACF;AAAA,QACF;AAAA,QACA,sBAAsB;AAAA,UACpB,MAAQ;AAAA,QACV;AAAA,QACA,uBAAyB;AAAA,UACvB,MAAQ;AAAA,UACR,YAAc;AAAA,YACZ,UAAY;AAAA,cACV,MAAQ;AAAA,YACV;AAAA,UACF;AAAA,UACA,sBAAwB;AAAA,QAC1B;AAAA,QACA,sBAAwB;AAAA,UACtB,MAAQ;AAAA,UACR,YAAc;AAAA,YACZ,IAAM;AAAA,cACJ,MAAQ;AAAA,YACV;AAAA,YACA,MAAQ;AAAA,cACN,MAAQ;AAAA,cACR,OAAS;AAAA,YACX;AAAA,YACA,iBAAmB;AAAA,cACjB,MAAQ;AAAA,YACV;AAAA,UACF;AAAA,UACA,UAAY;AAAA,YACV;AAAA,YACA;AAAA,YACA;AA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ACtC;EAEQwB,yBAAyB5B,YAA+B8B,WAAyC;AACvG,QAAI,CAAC9B,WAAWI,YAAY;AAC1B,YAAM,IAAIG,MAAM,cAAcP,WAAWG,EAAE,6BAA6B;IAC1E;AAEA,WAAO;MACLA,IAAI,GAAG2B,SAAAA,IAAa9B,WAAWI,UAAU;MACzCuD,MAAM;MACNC,iBAAiB,KAAKN,qBAAqBxB,WAAW9B,WAAWI,UAAU;IAC7E;EACF;AACF;","names":["LOGGER_NAMESPACE","logger","Loggers","DEFAULT","get","LOGGER_NAMESPACE","extractOriginalCredential","credential","udc","originalVerifiableCredential","uniformVerifiableCredential","original","createLinkedVPPresentation","holderDid","credentials","agent","length","Promise","reject","Error","debug","identifier","identifierManagedGet","verifiableCredentials","map","vpObject","type","holder","verifiableCredential","result","createVerifiablePresentation","presentation","proofFormat","keyRef","kmsKeyRef","kid","proof","jws","linkedVPManagerMethods","LinkedVPManager","schema","ILinkedVPManager","methods","lvpPublishCredential","bind","lvpUnpublishCredential","lvpHasEntry","lvpGetServiceEntries","lvpGeneratePresentation","holderDids","options","args","context","digitalCredentialId","credential","agent","crsGetCredential","id","linkedVpId","Promise","reject","Error","buildLinkedVpId","tenantId","ensureLinkedVpIdUnique","publishedAt","Date","crsUpdateCredential","linkedVpFrom","createdAt","credentials","crsGetCredentials","filter","length","undefined","error","Not","IsNull","cred","map","holderDidForEntry","getHolderDid","credentialToServiceEntry","parseTenantFromLinkedVpId","holderDid","uniqueCredentials","crsGetUniqueCredentials","createLinkedVPPresentation","idx","lastIndexOf","substring","generateLinkedVpId","now","Math","random","toString","finalLinkedVpId","includes","getBaseUrlFromDid","startsWith","withoutPrefix","replace","parts","split","domain","shift","path","join","buildServiceEndpoint","baseUrl","cleanBaseUrl","endsWith","slice","type","serviceEndpoint"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
import { IPluginMethodMap, IAgentContext, IAgentPlugin } from '@veramo/core';
|
|
2
|
+
import { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution';
|
|
3
|
+
import { ICredentialStore } from '@sphereon/ssi-sdk.credential-store';
|
|
4
|
+
import { VcdmCredentialPlugin } from '@sphereon/ssi-sdk.credential-vcdm';
|
|
5
|
+
import { IKeyManager } from '@veramo/core/src/types/IKeyManager';
|
|
6
|
+
|
|
7
|
+
var ILinkedVPManager$1 = {
|
|
8
|
+
components: {
|
|
9
|
+
schemas: {
|
|
10
|
+
GeneratePresentationArgs: {
|
|
11
|
+
type: "object",
|
|
12
|
+
properties: {
|
|
13
|
+
linkedVpId: {
|
|
14
|
+
type: "string"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
required: [
|
|
18
|
+
"linkedVpId"
|
|
19
|
+
],
|
|
20
|
+
additionalProperties: false
|
|
21
|
+
},
|
|
22
|
+
LinkedVPPresentation: {
|
|
23
|
+
anyOf: [
|
|
24
|
+
{
|
|
25
|
+
type: "string"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
$ref: "#/components/schemas/Record<string,any>"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"Record<string,any>": {
|
|
33
|
+
type: "object"
|
|
34
|
+
},
|
|
35
|
+
GetServiceEntriesArgs: {
|
|
36
|
+
type: "object",
|
|
37
|
+
properties: {
|
|
38
|
+
tenantId: {
|
|
39
|
+
type: "string"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
additionalProperties: false
|
|
43
|
+
},
|
|
44
|
+
LinkedVPServiceEntry: {
|
|
45
|
+
type: "object",
|
|
46
|
+
properties: {
|
|
47
|
+
id: {
|
|
48
|
+
type: "string"
|
|
49
|
+
},
|
|
50
|
+
type: {
|
|
51
|
+
type: "string",
|
|
52
|
+
"const": "LinkedVerifiablePresentation"
|
|
53
|
+
},
|
|
54
|
+
serviceEndpoint: {
|
|
55
|
+
type: "string"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
required: [
|
|
59
|
+
"id",
|
|
60
|
+
"type",
|
|
61
|
+
"serviceEndpoint"
|
|
62
|
+
],
|
|
63
|
+
additionalProperties: false
|
|
64
|
+
},
|
|
65
|
+
HasLinkedVPEntryArgs: {
|
|
66
|
+
type: "object",
|
|
67
|
+
properties: {
|
|
68
|
+
linkedVpId: {
|
|
69
|
+
type: "string"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
required: [
|
|
73
|
+
"linkedVpId"
|
|
74
|
+
],
|
|
75
|
+
additionalProperties: false
|
|
76
|
+
},
|
|
77
|
+
PublishCredentialArgs: {
|
|
78
|
+
type: "object",
|
|
79
|
+
properties: {
|
|
80
|
+
digitalCredentialId: {
|
|
81
|
+
type: "string"
|
|
82
|
+
},
|
|
83
|
+
linkedVpId: {
|
|
84
|
+
type: "string"
|
|
85
|
+
},
|
|
86
|
+
tenantId: {
|
|
87
|
+
type: "string"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
required: [
|
|
91
|
+
"digitalCredentialId"
|
|
92
|
+
],
|
|
93
|
+
additionalProperties: false
|
|
94
|
+
},
|
|
95
|
+
LinkedVPEntry: {
|
|
96
|
+
type: "object",
|
|
97
|
+
properties: {
|
|
98
|
+
id: {
|
|
99
|
+
type: "string"
|
|
100
|
+
},
|
|
101
|
+
linkedVpId: {
|
|
102
|
+
type: "string"
|
|
103
|
+
},
|
|
104
|
+
tenantId: {
|
|
105
|
+
type: "string"
|
|
106
|
+
},
|
|
107
|
+
linkedVpFrom: {
|
|
108
|
+
type: "string",
|
|
109
|
+
format: "date-time"
|
|
110
|
+
},
|
|
111
|
+
createdAt: {
|
|
112
|
+
type: "string",
|
|
113
|
+
format: "date-time"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
required: [
|
|
117
|
+
"id",
|
|
118
|
+
"linkedVpId",
|
|
119
|
+
"createdAt"
|
|
120
|
+
],
|
|
121
|
+
additionalProperties: false
|
|
122
|
+
},
|
|
123
|
+
UnpublishCredentialArgs: {
|
|
124
|
+
type: "object",
|
|
125
|
+
properties: {
|
|
126
|
+
linkedVpId: {
|
|
127
|
+
type: "string"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
required: [
|
|
131
|
+
"linkedVpId"
|
|
132
|
+
],
|
|
133
|
+
additionalProperties: false
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
methods: {
|
|
137
|
+
lvpGeneratePresentation: {
|
|
138
|
+
description: "Generate and return a Verifiable Presentation for a published LinkedVP This is the main endpoint handler for GET /linked-vp/",
|
|
139
|
+
"arguments": {
|
|
140
|
+
$ref: "#/components/schemas/GeneratePresentationArgs"
|
|
141
|
+
},
|
|
142
|
+
returnType: {
|
|
143
|
+
$ref: "#/components/schemas/LinkedVPPresentation"
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
lvpGetServiceEntries: {
|
|
147
|
+
description: "Get LinkedVP service entries for a DID to be added to a DID Document This is useful when generating DID Documents with toDidDocument",
|
|
148
|
+
"arguments": {
|
|
149
|
+
$ref: "#/components/schemas/GetServiceEntriesArgs"
|
|
150
|
+
},
|
|
151
|
+
returnType: {
|
|
152
|
+
type: "array",
|
|
153
|
+
items: {
|
|
154
|
+
$ref: "#/components/schemas/LinkedVPServiceEntry"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
lvpHasEntry: {
|
|
159
|
+
description: "Check if a LinkedVP entry exists by linkedVpId",
|
|
160
|
+
"arguments": {
|
|
161
|
+
$ref: "#/components/schemas/HasLinkedVPEntryArgs"
|
|
162
|
+
},
|
|
163
|
+
returnType: {
|
|
164
|
+
type: "boolean"
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
lvpPublishCredential: {
|
|
168
|
+
description: "Publish a credential as a LinkedVP by adding it to the holder's DID Document",
|
|
169
|
+
"arguments": {
|
|
170
|
+
$ref: "#/components/schemas/PublishCredentialArgs"
|
|
171
|
+
},
|
|
172
|
+
returnType: {
|
|
173
|
+
$ref: "#/components/schemas/LinkedVPEntry"
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
lvpUnpublishCredential: {
|
|
177
|
+
description: "Unpublish a credential by removing its LinkedVP entry from the DID Document",
|
|
178
|
+
"arguments": {
|
|
179
|
+
$ref: "#/components/schemas/UnpublishCredentialArgs"
|
|
180
|
+
},
|
|
181
|
+
returnType: {
|
|
182
|
+
type: "boolean"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
var plugin_schema = {
|
|
189
|
+
ILinkedVPManager: ILinkedVPManager$1
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
declare const LOGGER_NAMESPACE = "sphereon:linked-vp";
|
|
193
|
+
type LinkedVPPresentation = string | Record<string, any>;
|
|
194
|
+
interface ILinkedVPManager extends IPluginMethodMap {
|
|
195
|
+
/**
|
|
196
|
+
* Publish a credential as a LinkedVP by adding it to the holder's DID Document
|
|
197
|
+
* @param args - Publication arguments including credential ID and scope configuration
|
|
198
|
+
* @param context - Agent context
|
|
199
|
+
*/
|
|
200
|
+
lvpPublishCredential(args: PublishCredentialArgs, context: RequiredContext): Promise<LinkedVPEntry>;
|
|
201
|
+
/**
|
|
202
|
+
* Unpublish a credential by removing its LinkedVP entry from the DID Document
|
|
203
|
+
* @param args - Unpublish arguments
|
|
204
|
+
* @param context - Agent context
|
|
205
|
+
*/
|
|
206
|
+
lvpUnpublishCredential(args: UnpublishCredentialArgs, context: RequiredContext): Promise<boolean>;
|
|
207
|
+
/**
|
|
208
|
+
* Check if a LinkedVP entry exists by linkedVpId
|
|
209
|
+
* @param args - Query arguments
|
|
210
|
+
* @param context - Agent context
|
|
211
|
+
*/
|
|
212
|
+
lvpHasEntry(args: HasLinkedVPEntryArgs, context: RequiredContext): Promise<boolean>;
|
|
213
|
+
/**
|
|
214
|
+
* Get LinkedVP service entries for a DID to be added to a DID Document
|
|
215
|
+
* This is useful when generating DID Documents with toDidDocument
|
|
216
|
+
* @param args - Query arguments for the DID
|
|
217
|
+
* @param context - Agent context
|
|
218
|
+
*/
|
|
219
|
+
lvpGetServiceEntries(args: GetServiceEntriesArgs, context: RequiredContext): Promise<Array<LinkedVPServiceEntry>>;
|
|
220
|
+
/**
|
|
221
|
+
* Generate and return a Verifiable Presentation for a published LinkedVP
|
|
222
|
+
* This is the main endpoint handler for GET /linked-vp/{linkedVpId}
|
|
223
|
+
* @param args - Generation arguments
|
|
224
|
+
* @param context - Agent context
|
|
225
|
+
*/
|
|
226
|
+
lvpGeneratePresentation(args: GeneratePresentationArgs, context: RequiredContext): Promise<LinkedVPPresentation>;
|
|
227
|
+
}
|
|
228
|
+
type PublishCredentialArgs = {
|
|
229
|
+
digitalCredentialId: string;
|
|
230
|
+
linkedVpId?: string;
|
|
231
|
+
};
|
|
232
|
+
type UnpublishCredentialArgs = {
|
|
233
|
+
linkedVpId: string;
|
|
234
|
+
};
|
|
235
|
+
type HasLinkedVPEntryArgs = {
|
|
236
|
+
linkedVpId: string;
|
|
237
|
+
};
|
|
238
|
+
type GetServiceEntriesArgs = {
|
|
239
|
+
tenantId?: string;
|
|
240
|
+
};
|
|
241
|
+
type GeneratePresentationArgs = {
|
|
242
|
+
linkedVpId: string;
|
|
243
|
+
};
|
|
244
|
+
type LinkedVPEntry = {
|
|
245
|
+
id: string;
|
|
246
|
+
linkedVpId: string;
|
|
247
|
+
tenantId?: string;
|
|
248
|
+
linkedVpFrom?: Date;
|
|
249
|
+
createdAt: Date;
|
|
250
|
+
};
|
|
251
|
+
type LinkedVPServiceEntry = {
|
|
252
|
+
id: string;
|
|
253
|
+
type: 'LinkedVerifiablePresentation';
|
|
254
|
+
serviceEndpoint: string;
|
|
255
|
+
};
|
|
256
|
+
type RequiredContext = IAgentContext<IIdentifierResolution & ICredentialStore & IKeyManager & VcdmCredentialPlugin>;
|
|
257
|
+
|
|
258
|
+
declare const linkedVPManagerMethods: Array<string>;
|
|
259
|
+
/**
|
|
260
|
+
* {@inheritDoc ILinkedVPManager}
|
|
261
|
+
*/
|
|
262
|
+
declare class LinkedVPManager implements IAgentPlugin {
|
|
263
|
+
readonly schema: {
|
|
264
|
+
components: {
|
|
265
|
+
schemas: {
|
|
266
|
+
GeneratePresentationArgs: {
|
|
267
|
+
type: string;
|
|
268
|
+
properties: {
|
|
269
|
+
linkedVpId: {
|
|
270
|
+
type: string;
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
required: string[];
|
|
274
|
+
additionalProperties: boolean;
|
|
275
|
+
};
|
|
276
|
+
LinkedVPPresentation: {
|
|
277
|
+
anyOf: ({
|
|
278
|
+
type: string;
|
|
279
|
+
$ref?: undefined;
|
|
280
|
+
} | {
|
|
281
|
+
$ref: string;
|
|
282
|
+
type?: undefined;
|
|
283
|
+
})[];
|
|
284
|
+
};
|
|
285
|
+
"Record<string,any>": {
|
|
286
|
+
type: string;
|
|
287
|
+
};
|
|
288
|
+
GetServiceEntriesArgs: {
|
|
289
|
+
type: string;
|
|
290
|
+
properties: {
|
|
291
|
+
tenantId: {
|
|
292
|
+
type: string;
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
additionalProperties: boolean;
|
|
296
|
+
};
|
|
297
|
+
LinkedVPServiceEntry: {
|
|
298
|
+
type: string;
|
|
299
|
+
properties: {
|
|
300
|
+
id: {
|
|
301
|
+
type: string;
|
|
302
|
+
};
|
|
303
|
+
type: {
|
|
304
|
+
type: string;
|
|
305
|
+
const: string;
|
|
306
|
+
};
|
|
307
|
+
serviceEndpoint: {
|
|
308
|
+
type: string;
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
required: string[];
|
|
312
|
+
additionalProperties: boolean;
|
|
313
|
+
};
|
|
314
|
+
HasLinkedVPEntryArgs: {
|
|
315
|
+
type: string;
|
|
316
|
+
properties: {
|
|
317
|
+
linkedVpId: {
|
|
318
|
+
type: string;
|
|
319
|
+
};
|
|
320
|
+
};
|
|
321
|
+
required: string[];
|
|
322
|
+
additionalProperties: boolean;
|
|
323
|
+
};
|
|
324
|
+
PublishCredentialArgs: {
|
|
325
|
+
type: string;
|
|
326
|
+
properties: {
|
|
327
|
+
digitalCredentialId: {
|
|
328
|
+
type: string;
|
|
329
|
+
};
|
|
330
|
+
linkedVpId: {
|
|
331
|
+
type: string;
|
|
332
|
+
};
|
|
333
|
+
tenantId: {
|
|
334
|
+
type: string;
|
|
335
|
+
};
|
|
336
|
+
};
|
|
337
|
+
required: string[];
|
|
338
|
+
additionalProperties: boolean;
|
|
339
|
+
};
|
|
340
|
+
LinkedVPEntry: {
|
|
341
|
+
type: string;
|
|
342
|
+
properties: {
|
|
343
|
+
id: {
|
|
344
|
+
type: string;
|
|
345
|
+
};
|
|
346
|
+
linkedVpId: {
|
|
347
|
+
type: string;
|
|
348
|
+
};
|
|
349
|
+
tenantId: {
|
|
350
|
+
type: string;
|
|
351
|
+
};
|
|
352
|
+
linkedVpFrom: {
|
|
353
|
+
type: string;
|
|
354
|
+
format: string;
|
|
355
|
+
};
|
|
356
|
+
createdAt: {
|
|
357
|
+
type: string;
|
|
358
|
+
format: string;
|
|
359
|
+
};
|
|
360
|
+
};
|
|
361
|
+
required: string[];
|
|
362
|
+
additionalProperties: boolean;
|
|
363
|
+
};
|
|
364
|
+
UnpublishCredentialArgs: {
|
|
365
|
+
type: string;
|
|
366
|
+
properties: {
|
|
367
|
+
linkedVpId: {
|
|
368
|
+
type: string;
|
|
369
|
+
};
|
|
370
|
+
};
|
|
371
|
+
required: string[];
|
|
372
|
+
additionalProperties: boolean;
|
|
373
|
+
};
|
|
374
|
+
};
|
|
375
|
+
methods: {
|
|
376
|
+
lvpGeneratePresentation: {
|
|
377
|
+
description: string;
|
|
378
|
+
arguments: {
|
|
379
|
+
$ref: string;
|
|
380
|
+
};
|
|
381
|
+
returnType: {
|
|
382
|
+
$ref: string;
|
|
383
|
+
};
|
|
384
|
+
};
|
|
385
|
+
lvpGetServiceEntries: {
|
|
386
|
+
description: string;
|
|
387
|
+
arguments: {
|
|
388
|
+
$ref: string;
|
|
389
|
+
};
|
|
390
|
+
returnType: {
|
|
391
|
+
type: string;
|
|
392
|
+
items: {
|
|
393
|
+
$ref: string;
|
|
394
|
+
};
|
|
395
|
+
};
|
|
396
|
+
};
|
|
397
|
+
lvpHasEntry: {
|
|
398
|
+
description: string;
|
|
399
|
+
arguments: {
|
|
400
|
+
$ref: string;
|
|
401
|
+
};
|
|
402
|
+
returnType: {
|
|
403
|
+
type: string;
|
|
404
|
+
};
|
|
405
|
+
};
|
|
406
|
+
lvpPublishCredential: {
|
|
407
|
+
description: string;
|
|
408
|
+
arguments: {
|
|
409
|
+
$ref: string;
|
|
410
|
+
};
|
|
411
|
+
returnType: {
|
|
412
|
+
$ref: string;
|
|
413
|
+
};
|
|
414
|
+
};
|
|
415
|
+
lvpUnpublishCredential: {
|
|
416
|
+
description: string;
|
|
417
|
+
arguments: {
|
|
418
|
+
$ref: string;
|
|
419
|
+
};
|
|
420
|
+
returnType: {
|
|
421
|
+
type: string;
|
|
422
|
+
};
|
|
423
|
+
};
|
|
424
|
+
};
|
|
425
|
+
};
|
|
426
|
+
};
|
|
427
|
+
readonly methods: ILinkedVPManager;
|
|
428
|
+
private readonly holderDids;
|
|
429
|
+
constructor(options: {
|
|
430
|
+
holderDids: Record<string, string>;
|
|
431
|
+
});
|
|
432
|
+
private lvpPublishCredential;
|
|
433
|
+
private lvpUnpublishCredential;
|
|
434
|
+
private lvpHasEntry;
|
|
435
|
+
private lvpGetServiceEntries;
|
|
436
|
+
private lvpGeneratePresentation;
|
|
437
|
+
private getHolderDid;
|
|
438
|
+
private parseTenantFromLinkedVpId;
|
|
439
|
+
private generateLinkedVpId;
|
|
440
|
+
private ensureLinkedVpIdUnique;
|
|
441
|
+
private buildLinkedVpId;
|
|
442
|
+
private getBaseUrlFromDid;
|
|
443
|
+
private buildServiceEndpoint;
|
|
444
|
+
private credentialToServiceEntry;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
export { type GeneratePresentationArgs, type GetServiceEntriesArgs, type HasLinkedVPEntryArgs, type ILinkedVPManager, LOGGER_NAMESPACE, type LinkedVPEntry, LinkedVPManager, type LinkedVPPresentation, type LinkedVPServiceEntry, type PublishCredentialArgs, type RequiredContext, type UnpublishCredentialArgs, linkedVPManagerMethods, plugin_schema as schema };
|