@sphereon/ssi-sdk.data-store-types 0.36.1-feature.SSISDK.82.and.SSISDK.70.35 → 0.36.1-next.11

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/contact/AbstractContactStore.ts","../src/digitalCredential/AbstractDigitalCredentialStore.ts","../src/issuanceBranding/AbstractIssuanceBrandingStore.ts","../src/eventLogger/AbstractEventLoggerStore.ts","../src/machineState/IAbstractMachineStateStore.ts","../src/presentationDefinition/AbstractPDStore.ts","../src/types/contact/contact.ts","../src/types/digitalCredential/enums.ts","../src/utils/MappingUtils.ts"],"sourcesContent":["// import {PartyCorrelationType} from \"@sphereon/ssi-sdk.core\";\n\nexport { AbstractContactStore } from './contact/AbstractContactStore'\nexport { AbstractDigitalCredentialStore } from './digitalCredential/AbstractDigitalCredentialStore'\nexport { AbstractIssuanceBrandingStore } from './issuanceBranding/AbstractIssuanceBrandingStore'\nexport { AbstractEventLoggerStore } from './eventLogger/AbstractEventLoggerStore'\nexport { IAbstractMachineStateStore } from './machineState/IAbstractMachineStateStore'\nexport { AbstractPDStore } from './presentationDefinition/AbstractPDStore'\n\nexport * from './types'\nexport * from './utils/MappingUtils'\n","import {\n AddElectronicAddressArgs,\n AddIdentityArgs,\n AddPartyArgs,\n AddPartyTypeArgs,\n AddPhysicalAddressArgs,\n AddRelationshipArgs,\n ElectronicAddress,\n GetElectronicAddressArgs,\n GetElectronicAddressesArgs,\n GetIdentitiesArgs,\n GetIdentityArgs,\n GetPartiesArgs,\n GetPartyArgs,\n GetPartyTypeArgs,\n GetPartyTypesArgs,\n GetPhysicalAddressArgs,\n GetPhysicalAddressesArgs,\n GetRelationshipArgs,\n GetRelationshipsArgs,\n Identity,\n Party,\n PartyRelationship,\n PartyType,\n PhysicalAddress,\n RemoveElectronicAddressArgs,\n RemoveIdentityArgs,\n RemovePartyArgs,\n RemovePartyTypeArgs,\n RemovePhysicalAddressArgs,\n RemoveRelationshipArgs,\n UpdateElectronicAddressArgs,\n UpdateIdentityArgs,\n UpdatePartyArgs,\n UpdatePartyTypeArgs,\n UpdatePhysicalAddressArgs,\n UpdateRelationshipArgs,\n} from '../types'\n\nexport abstract class AbstractContactStore {\n abstract getParty(args: GetPartyArgs): Promise<Party>\n abstract getParties(args?: GetPartiesArgs): Promise<Array<Party>>\n abstract addParty(args: AddPartyArgs): Promise<Party>\n abstract updateParty(args: UpdatePartyArgs): Promise<Party>\n abstract removeParty(args: RemovePartyArgs): Promise<void>\n abstract getIdentity(args: GetIdentityArgs): Promise<Identity>\n abstract getIdentities(args?: GetIdentitiesArgs): Promise<Array<Identity>>\n abstract addIdentity(args: AddIdentityArgs): Promise<Identity>\n abstract updateIdentity(args: UpdateIdentityArgs): Promise<Identity>\n abstract removeIdentity(args: RemoveIdentityArgs): Promise<void>\n abstract getRelationship(args: GetRelationshipArgs): Promise<PartyRelationship>\n abstract getRelationships(args?: GetRelationshipsArgs): Promise<Array<PartyRelationship>>\n abstract addRelationship(args: AddRelationshipArgs): Promise<PartyRelationship>\n abstract updateRelationship(args: UpdateRelationshipArgs): Promise<PartyRelationship>\n abstract removeRelationship(args: RemoveRelationshipArgs): Promise<void>\n abstract getPartyType(args: GetPartyTypeArgs): Promise<PartyType>\n abstract getPartyTypes(args?: GetPartyTypesArgs): Promise<Array<PartyType>>\n abstract addPartyType(args: AddPartyTypeArgs): Promise<PartyType>\n abstract updatePartyType(args: UpdatePartyTypeArgs): Promise<PartyType>\n abstract removePartyType(args: RemovePartyTypeArgs): Promise<void>\n abstract getElectronicAddress(args: GetElectronicAddressArgs): Promise<ElectronicAddress>\n abstract getElectronicAddresses(args?: GetElectronicAddressesArgs): Promise<Array<ElectronicAddress>>\n abstract addElectronicAddress(args: AddElectronicAddressArgs): Promise<ElectronicAddress>\n abstract updateElectronicAddress(args: UpdateElectronicAddressArgs): Promise<ElectronicAddress>\n abstract removeElectronicAddress(args: RemoveElectronicAddressArgs): Promise<void>\n abstract getPhysicalAddress(args: GetPhysicalAddressArgs): Promise<PhysicalAddress>\n abstract getPhysicalAddresses(args?: GetPhysicalAddressesArgs): Promise<Array<PhysicalAddress>>\n abstract addPhysicalAddress(args: AddPhysicalAddressArgs): Promise<PhysicalAddress>\n abstract updatePhysicalAddress(args: UpdatePhysicalAddressArgs): Promise<PhysicalAddress>\n abstract removePhysicalAddress(args: RemovePhysicalAddressArgs): Promise<void>\n}\n","import {\n AddCredentialArgs,\n DigitalCredential,\n GetCredentialArgs,\n GetCredentialsArgs,\n GetCredentialsResponse,\n RemoveCredentialArgs,\n UpdateCredentialArgs,\n UpdateCredentialStateArgs,\n} from '../types'\n\nexport abstract class AbstractDigitalCredentialStore {\n abstract getCredential(args: GetCredentialArgs): Promise<DigitalCredential>\n\n abstract getCredentials(args?: GetCredentialsArgs): Promise<GetCredentialsResponse>\n\n abstract addCredential(args: AddCredentialArgs): Promise<DigitalCredential>\n\n abstract updateCredential(args: UpdateCredentialArgs): Promise<DigitalCredential>\n\n abstract updateCredentialState(args: UpdateCredentialStateArgs): Promise<DigitalCredential>\n\n abstract removeCredential(args: RemoveCredentialArgs): Promise<boolean>\n}\n","import type {\n IAddCredentialBrandingArgs,\n IAddCredentialLocaleBrandingArgs,\n IAddIssuerBrandingArgs,\n IAddIssuerLocaleBrandingArgs,\n ICredentialBranding,\n ICredentialLocaleBranding,\n IGetCredentialBrandingArgs,\n IGetCredentialLocaleBrandingArgs,\n IGetIssuerBrandingArgs,\n IGetIssuerLocaleBrandingArgs,\n IIssuerBranding,\n IIssuerLocaleBranding,\n IRemoveCredentialBrandingArgs,\n IRemoveCredentialLocaleBrandingArgs,\n IRemoveIssuerBrandingArgs,\n IRemoveIssuerLocaleBrandingArgs,\n IUpdateCredentialBrandingArgs,\n IUpdateCredentialLocaleBrandingArgs,\n IUpdateIssuerBrandingArgs,\n IUpdateIssuerLocaleBrandingArgs,\n} from '../types'\n\nexport abstract class AbstractIssuanceBrandingStore {\n public abstract addCredentialBranding(args: IAddCredentialBrandingArgs): Promise<ICredentialBranding>\n public abstract getCredentialBranding(args?: IGetCredentialBrandingArgs): Promise<Array<ICredentialBranding>>\n public abstract updateCredentialBranding(args: IUpdateCredentialBrandingArgs): Promise<ICredentialBranding>\n public abstract removeCredentialBranding(args: IRemoveCredentialBrandingArgs): Promise<void>\n public abstract addCredentialLocaleBranding(args: IAddCredentialLocaleBrandingArgs): Promise<ICredentialBranding>\n public abstract getCredentialLocaleBranding(args?: IGetCredentialLocaleBrandingArgs): Promise<Array<ICredentialLocaleBranding>>\n public abstract updateCredentialLocaleBranding(args: IUpdateCredentialLocaleBrandingArgs): Promise<ICredentialLocaleBranding>\n public abstract removeCredentialLocaleBranding(args: IRemoveCredentialLocaleBrandingArgs): Promise<void>\n public abstract addIssuerBranding(args: IAddIssuerBrandingArgs): Promise<IIssuerBranding>\n public abstract getIssuerBranding(args?: IGetIssuerBrandingArgs): Promise<Array<IIssuerBranding>>\n public abstract updateIssuerBranding(args: IUpdateIssuerBrandingArgs): Promise<IIssuerBranding>\n public abstract removeIssuerBranding(args: IRemoveIssuerBrandingArgs): Promise<void>\n public abstract addIssuerLocaleBranding(args: IAddIssuerLocaleBrandingArgs): Promise<IIssuerBranding>\n public abstract getIssuerLocaleBranding(args?: IGetIssuerLocaleBrandingArgs): Promise<Array<IIssuerLocaleBranding>>\n public abstract updateIssuerLocaleBranding(args: IUpdateIssuerLocaleBrandingArgs): Promise<IIssuerLocaleBranding>\n public abstract removeIssuerLocaleBranding(args: IRemoveIssuerLocaleBrandingArgs): Promise<void>\n}\n","import type { ActivityLoggingEvent, AuditLoggingEvent } from '@sphereon/ssi-sdk.core'\nimport type { GetActivityEventsArgs, GetAuditEventsArgs, StoreActivityEventArgs, StoreAuditEventArgs } from '../types'\n\nexport abstract class AbstractEventLoggerStore {\n abstract getAuditEvents(args: GetAuditEventsArgs): Promise<Array<AuditLoggingEvent>>\n abstract getActivityEvents(args: GetActivityEventsArgs): Promise<Array<ActivityLoggingEvent>>\n abstract storeAuditEvent(args: StoreAuditEventArgs): Promise<AuditLoggingEvent>\n abstract storeActivityEvent(args: StoreActivityEventArgs): Promise<ActivityLoggingEvent>\n}\n","import type {\n StoreMachineStateDeleteExpiredArgs,\n StoreMachineStateDeleteArgs,\n StoreMachineStatesFindActiveArgs,\n StoreFindMachineStatesArgs,\n StoreMachineStatePersistArgs,\n StoreMachineStateInfo,\n StoreMachineStateGetArgs,\n} from '../types'\n\n/**\n * Represents an abstract class for storing machine states.\n * This class provides methods for persisting, retrieving, and deleting machine states.\n *\n * @interface\n */\nexport abstract class IAbstractMachineStateStore {\n /**\n * Persists the machine state.\n *\n * @param {StoreMachineStatePersistArgs} state - The object containing the machine state to persist.\n * @return {Promise<StoreMachineStateInfo>} - A Promise that resolves to the information about the persisted machine state.\n */\n abstract persistMachineState(state: StoreMachineStatePersistArgs): Promise<StoreMachineStateInfo>\n\n /**\n * Finds active machine states based on the given arguments.\n *\n * @param {StoreMachineStatesFindActiveArgs} args - The arguments for finding active machine states.\n * @return {Promise<Array<StoreMachineStateInfo>>} - A promise that resolves with an array of active machine states.\n */\n abstract findActiveMachineStates(args: StoreMachineStatesFindActiveArgs): Promise<Array<StoreMachineStateInfo>>\n\n /**\n * Retrieves the state of a particular machine.\n *\n * @param {StoreMachineStateGetArgs} args - The arguments for retrieving the machine state.\n * @returns {Promise<StoreMachineStateInfo>} - A promise that resolves to the machine state information.\n */\n abstract getMachineState(args: StoreMachineStateGetArgs): Promise<StoreMachineStateInfo>\n\n /**\n * Finds the machine states based on the given arguments.\n *\n * @param {StoreFindMachineStatesArgs} [args] - The arguments to filter the machine states.\n * @returns {Promise<Array<StoreMachineStateInfo>>} - A promise that resolves to an array of machine state information.\n */\n abstract findMachineStates(args?: StoreFindMachineStatesArgs): Promise<Array<StoreMachineStateInfo>>\n\n /**\n * Deletes a machine state.\n *\n * @param {StoreMachineStateDeleteArgs} args - The arguments for deleting the machine state.\n * @return {Promise<boolean>} - A promise that resolves to a boolean indicating if the machine state was successfully deleted or not.\n */\n abstract deleteMachineState(args: StoreMachineStateDeleteArgs): Promise<boolean>\n\n /**\n * Deletes expired machine states from the database.\n *\n * @param {StoreMachineStateDeleteExpiredArgs} args - The arguments for deleting expired machine states.\n * @return {Promise<number>} - A promise that resolves to the number of deleted machine states.\n */\n abstract deleteExpiredMachineStates(args: StoreMachineStateDeleteExpiredArgs): Promise<number>\n}\n","import type {\n GetDefinitionArgs,\n GetDefinitionsArgs,\n DeleteDefinitionArgs,\n DcqlQueryItem,\n AddDefinitionArgs,\n UpdateDefinitionArgs,\n DeleteDefinitionsArgs,\n} from '../types'\n\nexport abstract class AbstractPDStore {\n abstract hasDefinition(args: GetDefinitionArgs): Promise<boolean>\n abstract hasDefinitions(args: GetDefinitionsArgs): Promise<boolean>\n abstract getDefinition(args: GetDefinitionArgs): Promise<DcqlQueryItem>\n abstract getDefinitions(args: GetDefinitionsArgs): Promise<Array<DcqlQueryItem>>\n abstract addDefinition(args: AddDefinitionArgs): Promise<DcqlQueryItem>\n abstract updateDefinition(args: UpdateDefinitionArgs): Promise<DcqlQueryItem>\n abstract deleteDefinition(args: DeleteDefinitionArgs): Promise<void>\n abstract deleteDefinitions(args: DeleteDefinitionsArgs): Promise<number>\n}\n","import { ManagedIdentifierOptsOrResult } from '@sphereon/ssi-sdk-ext.identifier-resolution'\nimport { IIdentifier } from '@veramo/core'\nimport { IIssuerLocaleBranding } from '../issuanceBranding/issuanceBranding'\nimport { CredentialRole } from '@sphereon/ssi-types'\n\nexport type MetadataTypes = string | number | Date | boolean | undefined\n\nexport interface IMetadataEntity {\n // TODO move to types\n label: string\n stringValue?: string\n numberValue?: number\n dateValue?: Date\n boolValue?: boolean\n}\n\nexport type Party = {\n id: string\n uri?: string\n roles: Array<CredentialRole>\n ownerId?: string\n tenantId?: string\n identities: Array<Identity>\n electronicAddresses: Array<ElectronicAddress>\n physicalAddresses: Array<PhysicalAddress>\n contact: Contact\n partyType: PartyType\n /**\n * TODO: Integrate branding logic here in the future. What we should do is make the issuance branding plugin part of the contact-manager and retrieve any branding there is.\n *\n * Currently, we are only defining the branding type within the SDK without implementing the associated logic. This is because:\n * 1. We are combining two types from the SSI-SDK to create a new type that will be used across multiple places in the wallets (web & mobile).\n * 2. While it makes sense to have this combined type in the SDK, the logic to support database connections for these types is complex. The types belong to different modules, and we don't use them together currently.\n * 3. Implementing the full logic now would require significant changes and cross-module interactions, which we don't have the time to address at present.\n *\n * For now, we are defining the type here and will use it in the mobile wallet has the logic for it. This is a temporary solution until we have the resources to integrate the branding logic fully.\n */\n branding?: IIssuerLocaleBranding\n relationships: Array<PartyRelationship>\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedParty = Omit<\n Party,\n | 'id'\n | 'identities'\n | 'electronicAddresses'\n | 'physicalAddresses'\n | 'contact'\n | 'roles'\n | 'partyType'\n | 'relationships'\n | 'createdAt'\n | 'lastUpdatedAt'\n> & {\n identities?: Array<NonPersistedIdentity>\n electronicAddresses?: Array<NonPersistedElectronicAddress>\n physicalAddresses?: Array<NonPersistedPhysicalAddress>\n contact: NonPersistedContact\n partyType: NonPersistedPartyType\n relationships?: Array<NonPersistedPartyRelationship>\n}\nexport type PartialParty = Partial<\n Omit<Party, 'identities' | 'electronicAddresses' | 'physicalAddresses' | 'contact' | 'partyType' | 'relationships'>\n> & {\n identities?: PartialIdentity\n electronicAddresses?: PartialElectronicAddress\n physicalAddresses?: PartialPhysicalAddress\n contact?: PartialContact\n partyType?: PartialPartyType\n relationships?: PartialPartyRelationship\n}\n\nexport type Identity = {\n id: string\n alias: string\n ownerId?: string\n tenantId?: string\n origin: IdentityOrigin\n roles: Array<CredentialRole>\n identifier: CorrelationIdentifier\n connection?: Connection\n metadata?: Array<MetadataItem<MetadataTypes>>\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedIdentity = Omit<Identity, 'id' | 'identifier' | 'connection' | 'metadata' | 'origin' | 'createdAt' | 'lastUpdatedAt'> & {\n origin: IdentityOrigin\n identifier: NonPersistedCorrelationIdentifier\n connection?: NonPersistedConnection\n metadata?: Array<NonPersistedMetadataItem<MetadataTypes>>\n}\nexport type PartialIdentity = Partial<Omit<Identity, 'identifier' | 'connection' | 'metadata' | 'origin' | 'roles'>> & {\n identifier?: PartialCorrelationIdentifier\n connection?: PartialConnection\n metadata?: PartialMetadataItem<MetadataTypes> // Usage: FindIdentityArgs = Array<PartialIdentity>\n origin?: IdentityOrigin\n roles?: CredentialRole\n partyId?: string\n}\n\nexport type MetadataItem<T extends MetadataTypes> = {\n id: string\n label: string\n value: T\n}\n\nexport type NonPersistedMetadataItem<T extends MetadataTypes> = Omit<MetadataItem<T>, 'id'>\nexport type PartialMetadataItem<T extends MetadataTypes> = Partial<MetadataItem<T>>\n\nexport type CorrelationIdentifier = {\n id: string\n ownerId?: string\n tenantId?: string\n type: CorrelationIdentifierType\n correlationId: string\n}\nexport type NonPersistedCorrelationIdentifier = Omit<CorrelationIdentifier, 'id'>\nexport type PartialCorrelationIdentifier = Partial<CorrelationIdentifier>\n\nexport type Connection = {\n id: string\n ownerId?: string\n tenantId?: string\n type: ConnectionType\n config: ConnectionConfig\n}\nexport type NonPersistedConnection = Omit<Connection, 'id' | 'config'> & {\n config: NonPersistedConnectionConfig\n}\nexport type PartialConnection = Partial<Omit<Connection, 'config'>> & {\n config: PartialConnectionConfig\n}\n\nexport type OpenIdConfig = {\n id: string\n clientId: string\n clientSecret: string\n ownerId?: string\n tenantId?: string\n scopes: Array<string>\n issuer: string\n redirectUrl: string\n dangerouslyAllowInsecureHttpRequests: boolean\n clientAuthMethod: 'basic' | 'post' | undefined\n}\nexport type NonPersistedOpenIdConfig = Omit<OpenIdConfig, 'id'>\nexport type PartialOpenIdConfig = Partial<OpenIdConfig>\n\nexport type DidAuthConfig = {\n id: string\n idOpts: ManagedIdentifierOptsOrResult\n stateId: string\n ownerId?: string\n tenantId?: string\n redirectUrl: string\n sessionId: string\n}\nexport type NonPersistedDidAuthConfig = Omit<DidAuthConfig, 'id'>\nexport type PartialDidAuthConfig = Partial<Omit<DidAuthConfig, 'identifier'>> & {\n identifier: Partial<IIdentifier> // TODO, we need to create partials for sub types in IIdentifier\n}\n\nexport type ConnectionConfig = OpenIdConfig | DidAuthConfig\nexport type NonPersistedConnectionConfig = NonPersistedDidAuthConfig | NonPersistedOpenIdConfig\nexport type PartialConnectionConfig = PartialOpenIdConfig | PartialDidAuthConfig\n\nexport type NaturalPerson = {\n id: string\n firstName: string\n lastName: string\n middleName?: string\n displayName: string\n metadata?: Array<MetadataItem<MetadataTypes>>\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\n\nexport type NonPersistedNaturalPerson = Omit<NaturalPerson, 'id' | 'createdAt' | 'lastUpdatedAt'>\n\nexport type PartialNaturalPerson = Partial<Omit<NaturalPerson, 'metadata'>> & {\n metadata?: PartialMetadataItem<MetadataTypes>\n}\n\nexport type Organization = {\n id: string\n legalName: string\n displayName: string\n metadata?: Array<MetadataItem<MetadataTypes>>\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedOrganization = Omit<Organization, 'id' | 'createdAt' | 'lastUpdatedAt'>\nexport type PartialOrganization = Partial<Omit<Organization, 'metadata'>> & {\n metadata?: PartialMetadataItem<MetadataTypes>\n}\n\nexport type Contact = NaturalPerson | Organization\nexport type NonPersistedContact = NonPersistedNaturalPerson | NonPersistedOrganization\nexport type PartialContact = PartialNaturalPerson | PartialOrganization\n\nexport type PartyType = {\n id: string\n type: PartyTypeType\n origin: PartyOrigin\n name: string\n tenantId: string\n description?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedPartyType = Omit<PartyType, 'id' | 'createdAt' | 'lastUpdatedAt'> & {\n id?: string\n}\nexport type PartialPartyType = Partial<PartyType>\n\nexport type PartyRelationship = {\n id: string\n leftId: string\n rightId: string\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedPartyRelationship = Omit<PartyRelationship, 'id' | 'createdAt' | 'lastUpdatedAt'>\nexport type PartialPartyRelationship = Partial<PartyRelationship>\n\nexport type ElectronicAddress = {\n id: string\n type: ElectronicAddressType\n electronicAddress: string\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedElectronicAddress = Omit<ElectronicAddress, 'id' | 'createdAt' | 'lastUpdatedAt'>\nexport type PartialElectronicAddress = Partial<ElectronicAddress> & {\n partyId?: string\n}\n\nexport type PhysicalAddress = {\n id: string\n type: PhysicalAddressType\n streetName: string\n streetNumber: string\n postalCode: string\n cityName: string\n provinceName: string\n countryCode: string\n buildingName?: string\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedPhysicalAddress = Omit<PhysicalAddress, 'id' | 'createdAt' | 'lastUpdatedAt'>\nexport type PartialPhysicalAddress = Partial<PhysicalAddress> & {\n partyId?: string\n}\n\nexport type ElectronicAddressType = 'email' | 'phone'\n\nexport type PhysicalAddressType = 'home' | 'visit' | 'postal'\n\nexport enum ConnectionType {\n OPENID_CONNECT = 'OIDC',\n SIOPv2 = 'SIOPv2',\n SIOPv2_OpenID4VP = 'SIOPv2+OpenID4VP',\n}\n\nexport enum CorrelationIdentifierType {\n DID = 'did',\n URL = 'url',\n}\n\nexport enum PartyTypeType {\n NATURAL_PERSON = 'naturalPerson',\n ORGANIZATION = 'organization',\n}\n\nexport enum PartyOrigin {\n INTERNAL = 'INTERNAL',\n EXTERNAL = 'EXTERNAL',\n}\n\nexport enum IdentityOrigin {\n INTERNAL = 'INTERNAL',\n EXTERNAL = 'EXTERNAL',\n}\n","export enum DocumentType {\n VC = 'VC',\n VP = 'VP',\n P = 'P',\n C = 'C',\n}\n\nexport enum RegulationType {\n PID = 'PID',\n QEAA = 'QEAA',\n EAA = 'EAA',\n NON_REGULATED = 'NON_REGULATED',\n}\n\nexport enum CredentialDocumentFormat {\n JSON_LD = 'JSON_LD',\n JWT = 'JWT',\n SD_JWT = 'SD_JWT',\n MSO_MDOC = 'MSO_MDOC',\n}\n\nexport namespace CredentialDocumentFormat {\n export function fromSpecValue(credentialFormat: string) {\n const format = credentialFormat.toLowerCase()\n if (format.includes('sd')) {\n return CredentialDocumentFormat.SD_JWT\n } else if (format.includes('ldp')) {\n return CredentialDocumentFormat.JSON_LD\n } else if (format.includes('mso') || credentialFormat.includes('mdoc')) {\n return CredentialDocumentFormat.MSO_MDOC\n } else if (format.includes('jwt_')) {\n return CredentialDocumentFormat.JWT\n } else {\n throw Error(`Could not map format ${format} to known format`)\n }\n }\n\n export function toSpecValue(documentFormat: CredentialDocumentFormat, documentType: DocumentType) {\n switch (documentFormat) {\n case CredentialDocumentFormat.SD_JWT:\n return 'dc+sd-jwt'\n case CredentialDocumentFormat.MSO_MDOC:\n return 'mso_mdoc'\n case CredentialDocumentFormat.JSON_LD:\n return documentType === DocumentType.C || documentType === DocumentType.VC ? 'ldp_vc' : 'ldp_vp'\n case CredentialDocumentFormat.JWT:\n return documentType === DocumentType.C || documentType === DocumentType.VC ? 'jwt_vc_json' : 'jwt_vp_json'\n }\n }\n}\n\nexport enum CredentialCorrelationType {\n DID = 'DID',\n X509_SAN = 'X509_SAN',\n KID = 'KID',\n URL = 'URL',\n}\n\nexport enum CredentialStateType {\n REVOKED = 'REVOKED',\n VERIFIED = 'VERIFIED',\n EXPIRED = 'EXPIRED',\n}\n","import { CredentialMapper, ObjectUtils } from '@sphereon/ssi-types'\n\nfunction isHex(input: string) {\n return input.match(/^([0-9A-Fa-f])+$/g) !== null\n}\n\nexport function ensureRawDocument(input: string | object): string {\n if (typeof input === 'string') {\n if (isHex(input) || ObjectUtils.isBase64(input)) {\n // mso_mdoc\n return input\n } else if (CredentialMapper.isJwtEncoded(input) || CredentialMapper.isSdJwtEncoded(input)) {\n return input\n }\n throw Error('Unknown input to be mapped as rawDocument')\n }\n\n try {\n return JSON.stringify(input)\n } catch (e) {\n throw new Error(`Can't stringify to a raw credential: ${input}`)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;ACuCO,IAAeA,uBAAf,MAAeA;EAAtB,OAAsBA;;;AA+BtB;;;AC3DO,IAAeC,iCAAf,MAAeA;EAAtB,OAAsBA;;;AAYtB;;;ACAO,IAAeC,gCAAf,MAAeA;EAAtB,OAAsBA;;;AAiBtB;;;ACrCO,IAAeC,2BAAf,MAAeA;EAAtB,OAAsBA;;;AAKtB;;;ACQO,IAAeC,6BAAf,MAAeA;EANtB,OAMsBA;;;AAgDtB;;;ACtDO,IAAeC,kBAAf,MAAeA;EAAtB,OAAsBA;;;AAStB;;;AC2PO,IAAKC,iBAAAA,0BAAAA,iBAAAA;;;;SAAAA;;AAML,IAAKC,4BAAAA,0BAAAA,4BAAAA;;;SAAAA;;AAKL,IAAKC,gBAAAA,0BAAAA,gBAAAA;;;SAAAA;;AAKL,IAAKC,cAAAA,0BAAAA,cAAAA;;;SAAAA;;AAKL,IAAKC,iBAAAA,0BAAAA,iBAAAA;;;SAAAA;;;;ACnSL,IAAKC,eAAAA,0BAAAA,eAAAA;;;;;SAAAA;;AAOL,IAAKC,iBAAAA,0BAAAA,iBAAAA;;;;;SAAAA;;AAOL,IAAKC,2BAAAA,0BAAAA,2BAAAA;;;;;SAAAA;;UAOKA,2BAAAA;AACR,WAASC,cAAcC,kBAAwB;AACpD,UAAMC,SAASD,iBAAiBE,YAAW;AAC3C,QAAID,OAAOE,SAAS,IAAA,GAAO;AACzB,aAAA;IACF,WAAWF,OAAOE,SAAS,KAAA,GAAQ;AACjC,aAAA;IACF,WAAWF,OAAOE,SAAS,KAAA,KAAUH,iBAAiBG,SAAS,MAAA,GAAS;AACtE,aAAA;IACF,WAAWF,OAAOE,SAAS,MAAA,GAAS;AAClC,aAAA;IACF,OAAO;AACL,YAAMC,MAAM,wBAAwBH,MAAAA,kBAAwB;IAC9D;EACF;AAbgBF;4BAAAA,gBAAAA;AAeT,WAASM,YAAYC,gBAA0CC,cAA0B;AAC9F,YAAQD,gBAAAA;MACN,KAAA;AACE,eAAO;MACT,KAAA;AACE,eAAO;MACT,KAAA;AACE,eAAOC,iBAAAA,OAAmCA,iBAAAA,OAAmC,WAAW;MAC1F,KAAA;AACE,eAAOA,iBAAAA,OAAmCA,iBAAAA,OAAmC,gBAAgB;IACjG;EACF;AAXgBF;4BAAAA,cAAAA;AAYlB,GA5BiBP,6BAAAA,2BAAAA,CAAAA,EAAAA;AA8BV,IAAKU,4BAAAA,0BAAAA,4BAAAA;;;;;SAAAA;;AAOL,IAAKC,sBAAAA,0BAAAA,sBAAAA;;;;SAAAA;;;;AC1DZ,uBAA8C;AAE9C,SAASC,MAAMC,OAAa;AAC1B,SAAOA,MAAMC,MAAM,mBAAA,MAAyB;AAC9C;AAFSF;AAIF,SAASG,kBAAkBF,OAAsB;AACtD,MAAI,OAAOA,UAAU,UAAU;AAC7B,QAAID,MAAMC,KAAAA,KAAUG,6BAAYC,SAASJ,KAAAA,GAAQ;AAE/C,aAAOA;IACT,WAAWK,kCAAiBC,aAAaN,KAAAA,KAAUK,kCAAiBE,eAAeP,KAAAA,GAAQ;AACzF,aAAOA;IACT;AACA,UAAMQ,MAAM,2CAAA;EACd;AAEA,MAAI;AACF,WAAOC,KAAKC,UAAUV,KAAAA;EACxB,SAASW,GAAG;AACV,UAAM,IAAIH,MAAM,wCAAwCR,KAAAA,EAAO;EACjE;AACF;AAhBgBE;","names":["AbstractContactStore","AbstractDigitalCredentialStore","AbstractIssuanceBrandingStore","AbstractEventLoggerStore","IAbstractMachineStateStore","AbstractPDStore","ConnectionType","CorrelationIdentifierType","PartyTypeType","PartyOrigin","IdentityOrigin","DocumentType","RegulationType","CredentialDocumentFormat","fromSpecValue","credentialFormat","format","toLowerCase","includes","Error","toSpecValue","documentFormat","documentType","CredentialCorrelationType","CredentialStateType","isHex","input","match","ensureRawDocument","ObjectUtils","isBase64","CredentialMapper","isJwtEncoded","isSdJwtEncoded","Error","JSON","stringify","e"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/contact/AbstractContactStore.ts","../src/digitalCredential/AbstractDigitalCredentialStore.ts","../src/issuanceBranding/AbstractIssuanceBrandingStore.ts","../src/eventLogger/AbstractEventLoggerStore.ts","../src/machineState/IAbstractMachineStateStore.ts","../src/presentationDefinition/AbstractPDStore.ts","../src/types/contact/contact.ts","../src/types/digitalCredential/enums.ts","../src/utils/MappingUtils.ts"],"sourcesContent":["// import {PartyCorrelationType} from \"@sphereon/ssi-sdk.core\";\n\nexport { AbstractContactStore } from './contact/AbstractContactStore'\nexport { AbstractDigitalCredentialStore } from './digitalCredential/AbstractDigitalCredentialStore'\nexport { AbstractIssuanceBrandingStore } from './issuanceBranding/AbstractIssuanceBrandingStore'\nexport { AbstractEventLoggerStore } from './eventLogger/AbstractEventLoggerStore'\nexport { IAbstractMachineStateStore } from './machineState/IAbstractMachineStateStore'\nexport { AbstractPDStore } from './presentationDefinition/AbstractPDStore'\n\nexport * from './types'\nexport * from './utils/MappingUtils'\n","import {\n AddElectronicAddressArgs,\n AddIdentityArgs,\n AddPartyArgs,\n AddPartyTypeArgs,\n AddPhysicalAddressArgs,\n AddRelationshipArgs,\n ElectronicAddress,\n GetElectronicAddressArgs,\n GetElectronicAddressesArgs,\n GetIdentitiesArgs,\n GetIdentityArgs,\n GetPartiesArgs,\n GetPartyArgs,\n GetPartyTypeArgs,\n GetPartyTypesArgs,\n GetPhysicalAddressArgs,\n GetPhysicalAddressesArgs,\n GetRelationshipArgs,\n GetRelationshipsArgs,\n Identity,\n Party,\n PartyRelationship,\n PartyType,\n PhysicalAddress,\n RemoveElectronicAddressArgs,\n RemoveIdentityArgs,\n RemovePartyArgs,\n RemovePartyTypeArgs,\n RemovePhysicalAddressArgs,\n RemoveRelationshipArgs,\n UpdateElectronicAddressArgs,\n UpdateIdentityArgs,\n UpdatePartyArgs,\n UpdatePartyTypeArgs,\n UpdatePhysicalAddressArgs,\n UpdateRelationshipArgs,\n} from '../types'\n\nexport abstract class AbstractContactStore {\n abstract getParty(args: GetPartyArgs): Promise<Party>\n abstract getParties(args?: GetPartiesArgs): Promise<Array<Party>>\n abstract addParty(args: AddPartyArgs): Promise<Party>\n abstract updateParty(args: UpdatePartyArgs): Promise<Party>\n abstract removeParty(args: RemovePartyArgs): Promise<void>\n abstract getIdentity(args: GetIdentityArgs): Promise<Identity>\n abstract getIdentities(args?: GetIdentitiesArgs): Promise<Array<Identity>>\n abstract addIdentity(args: AddIdentityArgs): Promise<Identity>\n abstract updateIdentity(args: UpdateIdentityArgs): Promise<Identity>\n abstract removeIdentity(args: RemoveIdentityArgs): Promise<void>\n abstract getRelationship(args: GetRelationshipArgs): Promise<PartyRelationship>\n abstract getRelationships(args?: GetRelationshipsArgs): Promise<Array<PartyRelationship>>\n abstract addRelationship(args: AddRelationshipArgs): Promise<PartyRelationship>\n abstract updateRelationship(args: UpdateRelationshipArgs): Promise<PartyRelationship>\n abstract removeRelationship(args: RemoveRelationshipArgs): Promise<void>\n abstract getPartyType(args: GetPartyTypeArgs): Promise<PartyType>\n abstract getPartyTypes(args?: GetPartyTypesArgs): Promise<Array<PartyType>>\n abstract addPartyType(args: AddPartyTypeArgs): Promise<PartyType>\n abstract updatePartyType(args: UpdatePartyTypeArgs): Promise<PartyType>\n abstract removePartyType(args: RemovePartyTypeArgs): Promise<void>\n abstract getElectronicAddress(args: GetElectronicAddressArgs): Promise<ElectronicAddress>\n abstract getElectronicAddresses(args?: GetElectronicAddressesArgs): Promise<Array<ElectronicAddress>>\n abstract addElectronicAddress(args: AddElectronicAddressArgs): Promise<ElectronicAddress>\n abstract updateElectronicAddress(args: UpdateElectronicAddressArgs): Promise<ElectronicAddress>\n abstract removeElectronicAddress(args: RemoveElectronicAddressArgs): Promise<void>\n abstract getPhysicalAddress(args: GetPhysicalAddressArgs): Promise<PhysicalAddress>\n abstract getPhysicalAddresses(args?: GetPhysicalAddressesArgs): Promise<Array<PhysicalAddress>>\n abstract addPhysicalAddress(args: AddPhysicalAddressArgs): Promise<PhysicalAddress>\n abstract updatePhysicalAddress(args: UpdatePhysicalAddressArgs): Promise<PhysicalAddress>\n abstract removePhysicalAddress(args: RemovePhysicalAddressArgs): Promise<void>\n}\n","import {\n AddCredentialArgs,\n DigitalCredential,\n GetCredentialArgs,\n GetCredentialsArgs,\n GetCredentialsResponse,\n RemoveCredentialArgs,\n UpdateCredentialStateArgs,\n} from '../types'\n\nexport abstract class AbstractDigitalCredentialStore {\n abstract getCredential(args: GetCredentialArgs): Promise<DigitalCredential>\n\n abstract getCredentials(args?: GetCredentialsArgs): Promise<GetCredentialsResponse>\n\n abstract addCredential(args: AddCredentialArgs): Promise<DigitalCredential>\n\n abstract updateCredentialState(args: UpdateCredentialStateArgs): Promise<DigitalCredential>\n\n abstract removeCredential(args: RemoveCredentialArgs): Promise<boolean>\n}\n","import type {\n IAddCredentialBrandingArgs,\n IAddCredentialLocaleBrandingArgs,\n IAddIssuerBrandingArgs,\n IAddIssuerLocaleBrandingArgs,\n ICredentialBranding,\n ICredentialLocaleBranding,\n IGetCredentialBrandingArgs,\n IGetCredentialLocaleBrandingArgs,\n IGetIssuerBrandingArgs,\n IGetIssuerLocaleBrandingArgs,\n IIssuerBranding,\n IIssuerLocaleBranding,\n IRemoveCredentialBrandingArgs,\n IRemoveCredentialLocaleBrandingArgs,\n IRemoveIssuerBrandingArgs,\n IRemoveIssuerLocaleBrandingArgs,\n IUpdateCredentialBrandingArgs,\n IUpdateCredentialLocaleBrandingArgs,\n IUpdateIssuerBrandingArgs,\n IUpdateIssuerLocaleBrandingArgs,\n} from '../types'\n\nexport abstract class AbstractIssuanceBrandingStore {\n public abstract addCredentialBranding(args: IAddCredentialBrandingArgs): Promise<ICredentialBranding>\n public abstract getCredentialBranding(args?: IGetCredentialBrandingArgs): Promise<Array<ICredentialBranding>>\n public abstract updateCredentialBranding(args: IUpdateCredentialBrandingArgs): Promise<ICredentialBranding>\n public abstract removeCredentialBranding(args: IRemoveCredentialBrandingArgs): Promise<void>\n public abstract addCredentialLocaleBranding(args: IAddCredentialLocaleBrandingArgs): Promise<ICredentialBranding>\n public abstract getCredentialLocaleBranding(args?: IGetCredentialLocaleBrandingArgs): Promise<Array<ICredentialLocaleBranding>>\n public abstract updateCredentialLocaleBranding(args: IUpdateCredentialLocaleBrandingArgs): Promise<ICredentialLocaleBranding>\n public abstract removeCredentialLocaleBranding(args: IRemoveCredentialLocaleBrandingArgs): Promise<void>\n public abstract addIssuerBranding(args: IAddIssuerBrandingArgs): Promise<IIssuerBranding>\n public abstract getIssuerBranding(args?: IGetIssuerBrandingArgs): Promise<Array<IIssuerBranding>>\n public abstract updateIssuerBranding(args: IUpdateIssuerBrandingArgs): Promise<IIssuerBranding>\n public abstract removeIssuerBranding(args: IRemoveIssuerBrandingArgs): Promise<void>\n public abstract addIssuerLocaleBranding(args: IAddIssuerLocaleBrandingArgs): Promise<IIssuerBranding>\n public abstract getIssuerLocaleBranding(args?: IGetIssuerLocaleBrandingArgs): Promise<Array<IIssuerLocaleBranding>>\n public abstract updateIssuerLocaleBranding(args: IUpdateIssuerLocaleBrandingArgs): Promise<IIssuerLocaleBranding>\n public abstract removeIssuerLocaleBranding(args: IRemoveIssuerLocaleBrandingArgs): Promise<void>\n}\n","import type { ActivityLoggingEvent, AuditLoggingEvent } from '@sphereon/ssi-sdk.core'\nimport type { GetActivityEventsArgs, GetAuditEventsArgs, StoreActivityEventArgs, StoreAuditEventArgs } from '../types'\n\nexport abstract class AbstractEventLoggerStore {\n abstract getAuditEvents(args: GetAuditEventsArgs): Promise<Array<AuditLoggingEvent>>\n abstract getActivityEvents(args: GetActivityEventsArgs): Promise<Array<ActivityLoggingEvent>>\n abstract storeAuditEvent(args: StoreAuditEventArgs): Promise<AuditLoggingEvent>\n abstract storeActivityEvent(args: StoreActivityEventArgs): Promise<ActivityLoggingEvent>\n}\n","import type {\n StoreMachineStateDeleteExpiredArgs,\n StoreMachineStateDeleteArgs,\n StoreMachineStatesFindActiveArgs,\n StoreFindMachineStatesArgs,\n StoreMachineStatePersistArgs,\n StoreMachineStateInfo,\n StoreMachineStateGetArgs,\n} from '../types'\n\n/**\n * Represents an abstract class for storing machine states.\n * This class provides methods for persisting, retrieving, and deleting machine states.\n *\n * @interface\n */\nexport abstract class IAbstractMachineStateStore {\n /**\n * Persists the machine state.\n *\n * @param {StoreMachineStatePersistArgs} state - The object containing the machine state to persist.\n * @return {Promise<StoreMachineStateInfo>} - A Promise that resolves to the information about the persisted machine state.\n */\n abstract persistMachineState(state: StoreMachineStatePersistArgs): Promise<StoreMachineStateInfo>\n\n /**\n * Finds active machine states based on the given arguments.\n *\n * @param {StoreMachineStatesFindActiveArgs} args - The arguments for finding active machine states.\n * @return {Promise<Array<StoreMachineStateInfo>>} - A promise that resolves with an array of active machine states.\n */\n abstract findActiveMachineStates(args: StoreMachineStatesFindActiveArgs): Promise<Array<StoreMachineStateInfo>>\n\n /**\n * Retrieves the state of a particular machine.\n *\n * @param {StoreMachineStateGetArgs} args - The arguments for retrieving the machine state.\n * @returns {Promise<StoreMachineStateInfo>} - A promise that resolves to the machine state information.\n */\n abstract getMachineState(args: StoreMachineStateGetArgs): Promise<StoreMachineStateInfo>\n\n /**\n * Finds the machine states based on the given arguments.\n *\n * @param {StoreFindMachineStatesArgs} [args] - The arguments to filter the machine states.\n * @returns {Promise<Array<StoreMachineStateInfo>>} - A promise that resolves to an array of machine state information.\n */\n abstract findMachineStates(args?: StoreFindMachineStatesArgs): Promise<Array<StoreMachineStateInfo>>\n\n /**\n * Deletes a machine state.\n *\n * @param {StoreMachineStateDeleteArgs} args - The arguments for deleting the machine state.\n * @return {Promise<boolean>} - A promise that resolves to a boolean indicating if the machine state was successfully deleted or not.\n */\n abstract deleteMachineState(args: StoreMachineStateDeleteArgs): Promise<boolean>\n\n /**\n * Deletes expired machine states from the database.\n *\n * @param {StoreMachineStateDeleteExpiredArgs} args - The arguments for deleting expired machine states.\n * @return {Promise<number>} - A promise that resolves to the number of deleted machine states.\n */\n abstract deleteExpiredMachineStates(args: StoreMachineStateDeleteExpiredArgs): Promise<number>\n}\n","import type {\n GetDefinitionArgs,\n GetDefinitionsArgs,\n DeleteDefinitionArgs,\n DcqlQueryItem,\n AddDefinitionArgs,\n UpdateDefinitionArgs,\n DeleteDefinitionsArgs,\n} from '../types'\n\nexport abstract class AbstractPDStore {\n abstract hasDefinition(args: GetDefinitionArgs): Promise<boolean>\n abstract hasDefinitions(args: GetDefinitionsArgs): Promise<boolean>\n abstract getDefinition(args: GetDefinitionArgs): Promise<DcqlQueryItem>\n abstract getDefinitions(args: GetDefinitionsArgs): Promise<Array<DcqlQueryItem>>\n abstract addDefinition(args: AddDefinitionArgs): Promise<DcqlQueryItem>\n abstract updateDefinition(args: UpdateDefinitionArgs): Promise<DcqlQueryItem>\n abstract deleteDefinition(args: DeleteDefinitionArgs): Promise<void>\n abstract deleteDefinitions(args: DeleteDefinitionsArgs): Promise<number>\n}\n","import { ManagedIdentifierOptsOrResult } from '@sphereon/ssi-sdk-ext.identifier-resolution'\nimport { IIdentifier } from '@veramo/core'\nimport { IIssuerLocaleBranding } from '../issuanceBranding/issuanceBranding'\nimport { CredentialRole } from '@sphereon/ssi-types'\n\nexport type MetadataTypes = string | number | Date | boolean | undefined\n\nexport interface IMetadataEntity {\n // TODO move to types\n label: string\n stringValue?: string\n numberValue?: number\n dateValue?: Date\n boolValue?: boolean\n}\n\nexport type Party = {\n id: string\n uri?: string\n roles: Array<CredentialRole>\n ownerId?: string\n tenantId?: string\n identities: Array<Identity>\n electronicAddresses: Array<ElectronicAddress>\n physicalAddresses: Array<PhysicalAddress>\n contact: Contact\n partyType: PartyType\n /**\n * TODO: Integrate branding logic here in the future. What we should do is make the issuance branding plugin part of the contact-manager and retrieve any branding there is.\n *\n * Currently, we are only defining the branding type within the SDK without implementing the associated logic. This is because:\n * 1. We are combining two types from the SSI-SDK to create a new type that will be used across multiple places in the wallets (web & mobile).\n * 2. While it makes sense to have this combined type in the SDK, the logic to support database connections for these types is complex. The types belong to different modules, and we don't use them together currently.\n * 3. Implementing the full logic now would require significant changes and cross-module interactions, which we don't have the time to address at present.\n *\n * For now, we are defining the type here and will use it in the mobile wallet has the logic for it. This is a temporary solution until we have the resources to integrate the branding logic fully.\n */\n branding?: IIssuerLocaleBranding\n relationships: Array<PartyRelationship>\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedParty = Omit<\n Party,\n | 'id'\n | 'identities'\n | 'electronicAddresses'\n | 'physicalAddresses'\n | 'contact'\n | 'roles'\n | 'partyType'\n | 'relationships'\n | 'createdAt'\n | 'lastUpdatedAt'\n> & {\n identities?: Array<NonPersistedIdentity>\n electronicAddresses?: Array<NonPersistedElectronicAddress>\n physicalAddresses?: Array<NonPersistedPhysicalAddress>\n contact: NonPersistedContact\n partyType: NonPersistedPartyType\n relationships?: Array<NonPersistedPartyRelationship>\n}\nexport type PartialParty = Partial<\n Omit<Party, 'identities' | 'electronicAddresses' | 'physicalAddresses' | 'contact' | 'partyType' | 'relationships'>\n> & {\n identities?: PartialIdentity\n electronicAddresses?: PartialElectronicAddress\n physicalAddresses?: PartialPhysicalAddress\n contact?: PartialContact\n partyType?: PartialPartyType\n relationships?: PartialPartyRelationship\n}\n\nexport type Identity = {\n id: string\n alias: string\n ownerId?: string\n tenantId?: string\n origin: IdentityOrigin\n roles: Array<CredentialRole>\n identifier: CorrelationIdentifier\n connection?: Connection\n metadata?: Array<MetadataItem<MetadataTypes>>\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedIdentity = Omit<Identity, 'id' | 'identifier' | 'connection' | 'metadata' | 'origin' | 'createdAt' | 'lastUpdatedAt'> & {\n origin: IdentityOrigin\n identifier: NonPersistedCorrelationIdentifier\n connection?: NonPersistedConnection\n metadata?: Array<NonPersistedMetadataItem<MetadataTypes>>\n}\nexport type PartialIdentity = Partial<Omit<Identity, 'identifier' | 'connection' | 'metadata' | 'origin' | 'roles'>> & {\n identifier?: PartialCorrelationIdentifier\n connection?: PartialConnection\n metadata?: PartialMetadataItem<MetadataTypes> // Usage: FindIdentityArgs = Array<PartialIdentity>\n origin?: IdentityOrigin\n roles?: CredentialRole\n partyId?: string\n}\n\nexport type MetadataItem<T extends MetadataTypes> = {\n id: string\n label: string\n value: T\n}\n\nexport type NonPersistedMetadataItem<T extends MetadataTypes> = Omit<MetadataItem<T>, 'id'>\nexport type PartialMetadataItem<T extends MetadataTypes> = Partial<MetadataItem<T>>\n\nexport type CorrelationIdentifier = {\n id: string\n ownerId?: string\n tenantId?: string\n type: CorrelationIdentifierType\n correlationId: string\n}\nexport type NonPersistedCorrelationIdentifier = Omit<CorrelationIdentifier, 'id'>\nexport type PartialCorrelationIdentifier = Partial<CorrelationIdentifier>\n\nexport type Connection = {\n id: string\n ownerId?: string\n tenantId?: string\n type: ConnectionType\n config: ConnectionConfig\n}\nexport type NonPersistedConnection = Omit<Connection, 'id' | 'config'> & {\n config: NonPersistedConnectionConfig\n}\nexport type PartialConnection = Partial<Omit<Connection, 'config'>> & {\n config: PartialConnectionConfig\n}\n\nexport type OpenIdConfig = {\n id: string\n clientId: string\n clientSecret: string\n ownerId?: string\n tenantId?: string\n scopes: Array<string>\n issuer: string\n redirectUrl: string\n dangerouslyAllowInsecureHttpRequests: boolean\n clientAuthMethod: 'basic' | 'post' | undefined\n}\nexport type NonPersistedOpenIdConfig = Omit<OpenIdConfig, 'id'>\nexport type PartialOpenIdConfig = Partial<OpenIdConfig>\n\nexport type DidAuthConfig = {\n id: string\n idOpts: ManagedIdentifierOptsOrResult\n stateId: string\n ownerId?: string\n tenantId?: string\n redirectUrl: string\n sessionId: string\n}\nexport type NonPersistedDidAuthConfig = Omit<DidAuthConfig, 'id'>\nexport type PartialDidAuthConfig = Partial<Omit<DidAuthConfig, 'identifier'>> & {\n identifier: Partial<IIdentifier> // TODO, we need to create partials for sub types in IIdentifier\n}\n\nexport type ConnectionConfig = OpenIdConfig | DidAuthConfig\nexport type NonPersistedConnectionConfig = NonPersistedDidAuthConfig | NonPersistedOpenIdConfig\nexport type PartialConnectionConfig = PartialOpenIdConfig | PartialDidAuthConfig\n\nexport type NaturalPerson = {\n id: string\n firstName: string\n lastName: string\n middleName?: string\n displayName: string\n metadata?: Array<MetadataItem<MetadataTypes>>\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\n\nexport type NonPersistedNaturalPerson = Omit<NaturalPerson, 'id' | 'createdAt' | 'lastUpdatedAt'>\n\nexport type PartialNaturalPerson = Partial<Omit<NaturalPerson, 'metadata'>> & {\n metadata?: PartialMetadataItem<MetadataTypes>\n}\n\nexport type Organization = {\n id: string\n legalName: string\n displayName: string\n metadata?: Array<MetadataItem<MetadataTypes>>\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedOrganization = Omit<Organization, 'id' | 'createdAt' | 'lastUpdatedAt'>\nexport type PartialOrganization = Partial<Omit<Organization, 'metadata'>> & {\n metadata?: PartialMetadataItem<MetadataTypes>\n}\n\nexport type Contact = NaturalPerson | Organization\nexport type NonPersistedContact = NonPersistedNaturalPerson | NonPersistedOrganization\nexport type PartialContact = PartialNaturalPerson | PartialOrganization\n\nexport type PartyType = {\n id: string\n type: PartyTypeType\n origin: PartyOrigin\n name: string\n tenantId: string\n description?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedPartyType = Omit<PartyType, 'id' | 'createdAt' | 'lastUpdatedAt'> & {\n id?: string\n}\nexport type PartialPartyType = Partial<PartyType>\n\nexport type PartyRelationship = {\n id: string\n leftId: string\n rightId: string\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedPartyRelationship = Omit<PartyRelationship, 'id' | 'createdAt' | 'lastUpdatedAt'>\nexport type PartialPartyRelationship = Partial<PartyRelationship>\n\nexport type ElectronicAddress = {\n id: string\n type: ElectronicAddressType\n electronicAddress: string\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedElectronicAddress = Omit<ElectronicAddress, 'id' | 'createdAt' | 'lastUpdatedAt'>\nexport type PartialElectronicAddress = Partial<ElectronicAddress> & {\n partyId?: string\n}\n\nexport type PhysicalAddress = {\n id: string\n type: PhysicalAddressType\n streetName: string\n streetNumber: string\n postalCode: string\n cityName: string\n provinceName: string\n countryCode: string\n buildingName?: string\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedPhysicalAddress = Omit<PhysicalAddress, 'id' | 'createdAt' | 'lastUpdatedAt'>\nexport type PartialPhysicalAddress = Partial<PhysicalAddress> & {\n partyId?: string\n}\n\nexport type ElectronicAddressType = 'email' | 'phone'\n\nexport type PhysicalAddressType = 'home' | 'visit' | 'postal'\n\nexport enum ConnectionType {\n OPENID_CONNECT = 'OIDC',\n SIOPv2 = 'SIOPv2',\n SIOPv2_OpenID4VP = 'SIOPv2+OpenID4VP',\n}\n\nexport enum CorrelationIdentifierType {\n DID = 'did',\n URL = 'url',\n}\n\nexport enum PartyTypeType {\n NATURAL_PERSON = 'naturalPerson',\n ORGANIZATION = 'organization',\n}\n\nexport enum PartyOrigin {\n INTERNAL = 'INTERNAL',\n EXTERNAL = 'EXTERNAL',\n}\n\nexport enum IdentityOrigin {\n INTERNAL = 'INTERNAL',\n EXTERNAL = 'EXTERNAL',\n}\n","export enum DocumentType {\n VC = 'VC',\n VP = 'VP',\n P = 'P',\n C = 'C',\n}\n\nexport enum RegulationType {\n PID = 'PID',\n QEAA = 'QEAA',\n EAA = 'EAA',\n NON_REGULATED = 'NON_REGULATED',\n}\n\nexport enum CredentialDocumentFormat {\n JSON_LD = 'JSON_LD',\n JWT = 'JWT',\n SD_JWT = 'SD_JWT',\n MSO_MDOC = 'MSO_MDOC',\n}\n\nexport namespace CredentialDocumentFormat {\n export function fromSpecValue(credentialFormat: string) {\n const format = credentialFormat.toLowerCase()\n if (format.includes('sd')) {\n return CredentialDocumentFormat.SD_JWT\n } else if (format.includes('ldp')) {\n return CredentialDocumentFormat.JSON_LD\n } else if (format.includes('mso') || credentialFormat.includes('mdoc')) {\n return CredentialDocumentFormat.MSO_MDOC\n } else if (format.includes('jwt_')) {\n return CredentialDocumentFormat.JWT\n } else {\n throw Error(`Could not map format ${format} to known format`)\n }\n }\n\n export function toSpecValue(documentFormat: CredentialDocumentFormat, documentType: DocumentType) {\n switch (documentFormat) {\n case CredentialDocumentFormat.SD_JWT:\n return 'dc+sd-jwt'\n case CredentialDocumentFormat.MSO_MDOC:\n return 'mso_mdoc'\n case CredentialDocumentFormat.JSON_LD:\n return documentType === DocumentType.C || documentType === DocumentType.VC ? 'ldp_vc' : 'ldp_vp'\n case CredentialDocumentFormat.JWT:\n return documentType === DocumentType.C || documentType === DocumentType.VC ? 'jwt_vc_json' : 'jwt_vp_json'\n }\n }\n}\n\nexport enum CredentialCorrelationType {\n DID = 'DID',\n X509_SAN = 'X509_SAN',\n KID = 'KID',\n URL = 'URL',\n}\n\nexport enum CredentialStateType {\n REVOKED = 'REVOKED',\n VERIFIED = 'VERIFIED',\n EXPIRED = 'EXPIRED',\n}\n","import { CredentialMapper, ObjectUtils } from '@sphereon/ssi-types'\n\nfunction isHex(input: string) {\n return input.match(/^([0-9A-Fa-f])+$/g) !== null\n}\nexport function ensureRawDocument(input: string | object): string {\n if (typeof input === 'string') {\n if (isHex(input) || ObjectUtils.isBase64(input)) {\n // mso_mdoc\n return input\n } else if (CredentialMapper.isJwtEncoded(input) || CredentialMapper.isSdJwtEncoded(input)) {\n return input\n }\n throw Error('Unknown input to be mapped as rawDocument')\n }\n\n try {\n return JSON.stringify(input)\n } catch (e) {\n throw new Error(`Can't stringify to a raw credential: ${input}`)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;ACuCO,IAAeA,uBAAf,MAAeA;EAAtB,OAAsBA;;;AA+BtB;;;AC5DO,IAAeC,iCAAf,MAAeA;EAAtB,OAAsBA;;;AAUtB;;;ACGO,IAAeC,gCAAf,MAAeA;EAAtB,OAAsBA;;;AAiBtB;;;ACrCO,IAAeC,2BAAf,MAAeA;EAAtB,OAAsBA;;;AAKtB;;;ACQO,IAAeC,6BAAf,MAAeA;EANtB,OAMsBA;;;AAgDtB;;;ACtDO,IAAeC,kBAAf,MAAeA;EAAtB,OAAsBA;;;AAStB;;;AC2PO,IAAKC,iBAAAA,0BAAAA,iBAAAA;;;;SAAAA;;AAML,IAAKC,4BAAAA,0BAAAA,4BAAAA;;;SAAAA;;AAKL,IAAKC,gBAAAA,0BAAAA,gBAAAA;;;SAAAA;;AAKL,IAAKC,cAAAA,0BAAAA,cAAAA;;;SAAAA;;AAKL,IAAKC,iBAAAA,0BAAAA,iBAAAA;;;SAAAA;;;;ACnSL,IAAKC,eAAAA,0BAAAA,eAAAA;;;;;SAAAA;;AAOL,IAAKC,iBAAAA,0BAAAA,iBAAAA;;;;;SAAAA;;AAOL,IAAKC,2BAAAA,0BAAAA,2BAAAA;;;;;SAAAA;;UAOKA,2BAAAA;AACR,WAASC,cAAcC,kBAAwB;AACpD,UAAMC,SAASD,iBAAiBE,YAAW;AAC3C,QAAID,OAAOE,SAAS,IAAA,GAAO;AACzB,aAAA;IACF,WAAWF,OAAOE,SAAS,KAAA,GAAQ;AACjC,aAAA;IACF,WAAWF,OAAOE,SAAS,KAAA,KAAUH,iBAAiBG,SAAS,MAAA,GAAS;AACtE,aAAA;IACF,WAAWF,OAAOE,SAAS,MAAA,GAAS;AAClC,aAAA;IACF,OAAO;AACL,YAAMC,MAAM,wBAAwBH,MAAAA,kBAAwB;IAC9D;EACF;AAbgBF;4BAAAA,gBAAAA;AAeT,WAASM,YAAYC,gBAA0CC,cAA0B;AAC9F,YAAQD,gBAAAA;MACN,KAAA;AACE,eAAO;MACT,KAAA;AACE,eAAO;MACT,KAAA;AACE,eAAOC,iBAAAA,OAAmCA,iBAAAA,OAAmC,WAAW;MAC1F,KAAA;AACE,eAAOA,iBAAAA,OAAmCA,iBAAAA,OAAmC,gBAAgB;IACjG;EACF;AAXgBF;4BAAAA,cAAAA;AAYlB,GA5BiBP,6BAAAA,2BAAAA,CAAAA,EAAAA;AA8BV,IAAKU,4BAAAA,0BAAAA,4BAAAA;;;;;SAAAA;;AAOL,IAAKC,sBAAAA,0BAAAA,sBAAAA;;;;SAAAA;;;;AC1DZ,uBAA8C;AAE9C,SAASC,MAAMC,OAAa;AAC1B,SAAOA,MAAMC,MAAM,mBAAA,MAAyB;AAC9C;AAFSF;AAGF,SAASG,kBAAkBF,OAAsB;AACtD,MAAI,OAAOA,UAAU,UAAU;AAC7B,QAAID,MAAMC,KAAAA,KAAUG,6BAAYC,SAASJ,KAAAA,GAAQ;AAE/C,aAAOA;IACT,WAAWK,kCAAiBC,aAAaN,KAAAA,KAAUK,kCAAiBE,eAAeP,KAAAA,GAAQ;AACzF,aAAOA;IACT;AACA,UAAMQ,MAAM,2CAAA;EACd;AAEA,MAAI;AACF,WAAOC,KAAKC,UAAUV,KAAAA;EACxB,SAASW,GAAG;AACV,UAAM,IAAIH,MAAM,wCAAwCR,KAAAA,EAAO;EACjE;AACF;AAhBgBE;","names":["AbstractContactStore","AbstractDigitalCredentialStore","AbstractIssuanceBrandingStore","AbstractEventLoggerStore","IAbstractMachineStateStore","AbstractPDStore","ConnectionType","CorrelationIdentifierType","PartyTypeType","PartyOrigin","IdentityOrigin","DocumentType","RegulationType","CredentialDocumentFormat","fromSpecValue","credentialFormat","format","toLowerCase","includes","Error","toSpecValue","documentFormat","documentType","CredentialCorrelationType","CredentialStateType","isHex","input","match","ensureRawDocument","ObjectUtils","isBase64","CredentialMapper","isJwtEncoded","isSdJwtEncoded","Error","JSON","stringify","e"]}
package/dist/index.d.cts CHANGED
@@ -700,6 +700,45 @@ declare enum CredentialStateType {
700
700
  EXPIRED = "EXPIRED"
701
701
  }
702
702
 
703
+ /**
704
+ * DigitalCredential
705
+ *
706
+ * @public
707
+ */
708
+ type DigitalCredential = {
709
+ id: string;
710
+ parentId?: string;
711
+ documentType: DocumentType;
712
+ documentFormat: CredentialDocumentFormat;
713
+ credentialRole: CredentialRole;
714
+ regulationType: RegulationType;
715
+ rawDocument: string;
716
+ uniformDocument: string;
717
+ credentialId?: string;
718
+ hash: string;
719
+ kmsKeyRef?: string;
720
+ identifierMethod?: string;
721
+ issuerCorrelationType: CredentialCorrelationType;
722
+ subjectCorrelationType?: CredentialCorrelationType;
723
+ rpCorrelationType?: CredentialCorrelationType;
724
+ isIssuerSigned?: boolean;
725
+ issuerCorrelationId: string;
726
+ subjectCorrelationId?: string;
727
+ rpCorrelationId?: string;
728
+ verifiedState?: CredentialStateType;
729
+ tenantId?: string;
730
+ createdAt: Date;
731
+ presentedAt?: Date;
732
+ lastUpdatedAt: Date;
733
+ validUntil?: Date;
734
+ validFrom?: Date;
735
+ verifiedAt?: Date;
736
+ revokedAt?: Date;
737
+ };
738
+ type NonPersistedDigitalCredential = Omit<DigitalCredential, 'id' | 'regulationType'> & {
739
+ regulationType?: RegulationType;
740
+ };
741
+
703
742
  type GetCredentialArgs = {
704
743
  id: string;
705
744
  } | {
@@ -727,9 +766,6 @@ type AddCredentialArgs = {
727
766
  issuerCorrelationId: string;
728
767
  subjectCorrelationId?: string;
729
768
  credentialRole: CredentialRole;
730
- linkedVpId?: string;
731
- linkedVpFrom?: Date;
732
- linkedVpUntil?: Date;
733
769
  tenantId?: string;
734
770
  state?: CredentialStateType;
735
771
  verifiedAt?: Date;
@@ -744,52 +780,8 @@ type UpdateCredentialStateArgs = GetCredentialArgs & {
744
780
  verifiedAt?: Date;
745
781
  revokedAt?: Date;
746
782
  };
747
- type UpdateCredentialArgs = GetCredentialArgs & Partial<Omit<DigitalCredential, 'id' | 'hash' | 'createdAt' | 'lastUpdatedAt'>>;
748
783
  type RemoveCredentialArgs = GetCredentialArgs;
749
784
 
750
- /**
751
- * DigitalCredential
752
- *
753
- * @public
754
- */
755
- type DigitalCredential = {
756
- id: string;
757
- parentId?: string;
758
- documentType: DocumentType;
759
- documentFormat: CredentialDocumentFormat;
760
- credentialRole: CredentialRole;
761
- regulationType: RegulationType;
762
- rawDocument: string;
763
- uniformDocument: string;
764
- credentialId?: string;
765
- hash: string;
766
- kmsKeyRef?: string;
767
- identifierMethod?: string;
768
- issuerCorrelationType: CredentialCorrelationType;
769
- subjectCorrelationType?: CredentialCorrelationType;
770
- rpCorrelationType?: CredentialCorrelationType;
771
- isIssuerSigned?: boolean;
772
- issuerCorrelationId: string;
773
- subjectCorrelationId?: string;
774
- rpCorrelationId?: string;
775
- verifiedState?: CredentialStateType;
776
- tenantId?: string;
777
- linkedVpId?: string;
778
- linkedVpFrom?: Date;
779
- linkedVpUntil?: Date;
780
- createdAt: Date;
781
- presentedAt?: Date;
782
- lastUpdatedAt: Date;
783
- validUntil?: Date;
784
- validFrom?: Date;
785
- verifiedAt?: Date;
786
- revokedAt?: Date;
787
- };
788
- type NonPersistedDigitalCredential = Omit<DigitalCredential, 'id' | 'regulationType'> & {
789
- regulationType?: RegulationType;
790
- };
791
- type UpdateCredentialArgsWithoutIdentifier = Omit<UpdateCredentialArgs, 'id' | 'hash'>;
792
-
793
785
  declare abstract class AbstractContactStore {
794
786
  abstract getParty(args: GetPartyArgs): Promise<Party>;
795
787
  abstract getParties(args?: GetPartiesArgs): Promise<Array<Party>>;
@@ -827,7 +819,6 @@ declare abstract class AbstractDigitalCredentialStore {
827
819
  abstract getCredential(args: GetCredentialArgs): Promise<DigitalCredential>;
828
820
  abstract getCredentials(args?: GetCredentialsArgs): Promise<GetCredentialsResponse>;
829
821
  abstract addCredential(args: AddCredentialArgs): Promise<DigitalCredential>;
830
- abstract updateCredential(args: UpdateCredentialArgs): Promise<DigitalCredential>;
831
822
  abstract updateCredentialState(args: UpdateCredentialStateArgs): Promise<DigitalCredential>;
832
823
  abstract removeCredential(args: RemoveCredentialArgs): Promise<boolean>;
833
824
  }
@@ -922,4 +913,4 @@ declare abstract class AbstractPDStore {
922
913
 
923
914
  declare function ensureRawDocument(input: string | object): string;
924
915
 
925
- export { AbstractContactStore, AbstractDigitalCredentialStore, AbstractEventLoggerStore, AbstractIssuanceBrandingStore, AbstractPDStore, type AddCredentialArgs, type AddDefinitionArgs, type AddElectronicAddressArgs, type AddIdentityArgs, type AddPartyArgs, type AddPartyTypeArgs, type AddPhysicalAddressArgs, type AddRelationshipArgs, type Connection, type ConnectionConfig, ConnectionType, type Contact, type CorrelationIdentifier, CorrelationIdentifierType, CredentialCorrelationType, CredentialDocumentFormat, CredentialStateType, type DcqlQueryItem, type DcqlQueryItemFilter, type DeleteDefinitionArgs, type DeleteDefinitionsArgs, type DidAuthConfig, type DigitalCredential, DocumentType, type ElectronicAddress, type ElectronicAddressType, type FindActivityLoggingEventArgs, type FindAuditLoggingEventArgs, type FindCredentialBrandingArgs, type FindCredentialLocaleBrandingArgs, type FindDcqlQueryArgs, type FindDigitalCredentialArgs, type FindElectronicAddressArgs, type FindIdentityArgs, type FindIssuerBrandingArgs, type FindIssuerLocaleBrandingArgs, type FindMachineStatesFilterArgs, type FindPartyArgs, type FindPartyTypeArgs, type FindPhysicalAddressArgs, type FindRelationshipArgs, type GetActivityEventsArgs, type GetAuditEventsArgs, type GetCredentialArgs, type GetCredentialsArgs, type GetCredentialsResponse, type GetDefinitionArgs, type GetDefinitionsArgs, type GetElectronicAddressArgs, type GetElectronicAddressesArgs, type GetIdentitiesArgs, type GetIdentityArgs, type GetPartiesArgs, type GetPartyArgs, type GetPartyTypeArgs, type GetPartyTypesArgs, type GetPhysicalAddressArgs, type GetPhysicalAddressesArgs, type GetRelationshipArgs, type GetRelationshipsArgs, type HasDefinitionArgs, type HasDefinitionsArgs, IAbstractMachineStateStore, type IAddCredentialBrandingArgs, type IAddCredentialLocaleBrandingArgs, type IAddIssuerBrandingArgs, type IAddIssuerLocaleBrandingArgs, type IBackgroundAttributes, type IBasicBackgroundAttributes, type IBasicCredentialBranding, type IBasicCredentialClaim, type IBasicCredentialLocaleBranding, type IBasicImageAttributes, type IBasicImageDimensions, type IBasicIssuerBranding, type IBasicIssuerLocaleBranding, type IBasicTextAttributes, type ICredentialBranding, type ICredentialBrandingFilter, type ICredentialClaim, type ICredentialLocaleBranding, type ICredentialLocaleBrandingFilter, type IGetCredentialBrandingArgs, type IGetCredentialLocaleBrandingArgs, type IGetIssuerBrandingArgs, type IGetIssuerLocaleBrandingArgs, type IImageAttributes, type IImageDimensions, type IIssuerBranding, type IIssuerBrandingFilter, type IIssuerLocaleBranding, type IIssuerLocaleBrandingFilter, type ILocaleBranding, type IMetadataEntity, type IPartialBackgroundAttributes, type IPartialCredentialBranding, type IPartialCredentialClaim, type IPartialCredentialLocaleBranding, type IPartialImageAttributes, type IPartialImageDimensions, type IPartialIssuerBranding, type IPartialIssuerLocaleBranding, type IPartialTextAttributes, type IRemoveCredentialBrandingArgs, type IRemoveCredentialLocaleBrandingArgs, type IRemoveIssuerBrandingArgs, type IRemoveIssuerLocaleBrandingArgs, type ITextAttributes, type IUpdateCredentialBrandingArgs, type IUpdateCredentialLocaleBrandingArgs, type IUpdateIssuerBrandingArgs, type IUpdateIssuerLocaleBrandingArgs, type Identity, IdentityOrigin, type ImportDcqlQueryItem, type MetadataItem, type MetadataTypes, type NaturalPerson, type NonPersistedActivityLoggingEvent, type NonPersistedAuditLoggingEvent, type NonPersistedConnection, type NonPersistedConnectionConfig, type NonPersistedContact, type NonPersistedCorrelationIdentifier, type NonPersistedDcqlQueryItem, type NonPersistedDidAuthConfig, type NonPersistedDigitalCredential, type NonPersistedElectronicAddress, type NonPersistedIdentity, type NonPersistedMetadataItem, type NonPersistedNaturalPerson, type NonPersistedOpenIdConfig, type NonPersistedOrganization, type NonPersistedParty, type NonPersistedPartyRelationship, type NonPersistedPartyType, type NonPersistedPhysicalAddress, type OpenIdConfig, type Organization, type PartialConnection, type PartialConnectionConfig, type PartialContact, type PartialCorrelationIdentifier, type PartialDcqlQueryItem, type PartialDidAuthConfig, type PartialElectronicAddress, type PartialIdentity, type PartialMetadataItem, type PartialNaturalPerson, type PartialOpenIdConfig, type PartialOrganization, type PartialParty, type PartialPartyRelationship, type PartialPartyType, type PartialPhysicalAddress, type Party, PartyOrigin, type PartyRelationship, type PartyType, PartyTypeType, type PhysicalAddress, type PhysicalAddressType, RegulationType, type RemoveCredentialArgs, type RemoveElectronicAddressArgs, type RemoveIdentityArgs, type RemovePartyArgs, type RemovePartyTypeArgs, type RemovePhysicalAddressArgs, type RemoveRelationshipArgs, type StoreActivityEventArgs, type StoreAuditEventArgs, type StoreFindMachineStatesArgs, type StoreMachineStateDeleteArgs, type StoreMachineStateDeleteExpiredArgs, type StoreMachineStateGetArgs, type StoreMachineStateInfo, type StoreMachineStatePersistArgs, type StoreMachineStatesFindActiveArgs, type UpdateCredentialArgs, type UpdateCredentialArgsWithoutIdentifier, type UpdateCredentialStateArgs, type UpdateDefinitionArgs, type UpdateElectronicAddressArgs, type UpdateIdentityArgs, type UpdatePartyArgs, type UpdatePartyTypeArgs, type UpdatePhysicalAddressArgs, type UpdateRelationshipArgs, type ValidationConstraint, ensureRawDocument };
916
+ export { AbstractContactStore, AbstractDigitalCredentialStore, AbstractEventLoggerStore, AbstractIssuanceBrandingStore, AbstractPDStore, type AddCredentialArgs, type AddDefinitionArgs, type AddElectronicAddressArgs, type AddIdentityArgs, type AddPartyArgs, type AddPartyTypeArgs, type AddPhysicalAddressArgs, type AddRelationshipArgs, type Connection, type ConnectionConfig, ConnectionType, type Contact, type CorrelationIdentifier, CorrelationIdentifierType, CredentialCorrelationType, CredentialDocumentFormat, CredentialStateType, type DcqlQueryItem, type DcqlQueryItemFilter, type DeleteDefinitionArgs, type DeleteDefinitionsArgs, type DidAuthConfig, type DigitalCredential, DocumentType, type ElectronicAddress, type ElectronicAddressType, type FindActivityLoggingEventArgs, type FindAuditLoggingEventArgs, type FindCredentialBrandingArgs, type FindCredentialLocaleBrandingArgs, type FindDcqlQueryArgs, type FindDigitalCredentialArgs, type FindElectronicAddressArgs, type FindIdentityArgs, type FindIssuerBrandingArgs, type FindIssuerLocaleBrandingArgs, type FindMachineStatesFilterArgs, type FindPartyArgs, type FindPartyTypeArgs, type FindPhysicalAddressArgs, type FindRelationshipArgs, type GetActivityEventsArgs, type GetAuditEventsArgs, type GetCredentialArgs, type GetCredentialsArgs, type GetCredentialsResponse, type GetDefinitionArgs, type GetDefinitionsArgs, type GetElectronicAddressArgs, type GetElectronicAddressesArgs, type GetIdentitiesArgs, type GetIdentityArgs, type GetPartiesArgs, type GetPartyArgs, type GetPartyTypeArgs, type GetPartyTypesArgs, type GetPhysicalAddressArgs, type GetPhysicalAddressesArgs, type GetRelationshipArgs, type GetRelationshipsArgs, type HasDefinitionArgs, type HasDefinitionsArgs, IAbstractMachineStateStore, type IAddCredentialBrandingArgs, type IAddCredentialLocaleBrandingArgs, type IAddIssuerBrandingArgs, type IAddIssuerLocaleBrandingArgs, type IBackgroundAttributes, type IBasicBackgroundAttributes, type IBasicCredentialBranding, type IBasicCredentialClaim, type IBasicCredentialLocaleBranding, type IBasicImageAttributes, type IBasicImageDimensions, type IBasicIssuerBranding, type IBasicIssuerLocaleBranding, type IBasicTextAttributes, type ICredentialBranding, type ICredentialBrandingFilter, type ICredentialClaim, type ICredentialLocaleBranding, type ICredentialLocaleBrandingFilter, type IGetCredentialBrandingArgs, type IGetCredentialLocaleBrandingArgs, type IGetIssuerBrandingArgs, type IGetIssuerLocaleBrandingArgs, type IImageAttributes, type IImageDimensions, type IIssuerBranding, type IIssuerBrandingFilter, type IIssuerLocaleBranding, type IIssuerLocaleBrandingFilter, type ILocaleBranding, type IMetadataEntity, type IPartialBackgroundAttributes, type IPartialCredentialBranding, type IPartialCredentialClaim, type IPartialCredentialLocaleBranding, type IPartialImageAttributes, type IPartialImageDimensions, type IPartialIssuerBranding, type IPartialIssuerLocaleBranding, type IPartialTextAttributes, type IRemoveCredentialBrandingArgs, type IRemoveCredentialLocaleBrandingArgs, type IRemoveIssuerBrandingArgs, type IRemoveIssuerLocaleBrandingArgs, type ITextAttributes, type IUpdateCredentialBrandingArgs, type IUpdateCredentialLocaleBrandingArgs, type IUpdateIssuerBrandingArgs, type IUpdateIssuerLocaleBrandingArgs, type Identity, IdentityOrigin, type ImportDcqlQueryItem, type MetadataItem, type MetadataTypes, type NaturalPerson, type NonPersistedActivityLoggingEvent, type NonPersistedAuditLoggingEvent, type NonPersistedConnection, type NonPersistedConnectionConfig, type NonPersistedContact, type NonPersistedCorrelationIdentifier, type NonPersistedDcqlQueryItem, type NonPersistedDidAuthConfig, type NonPersistedDigitalCredential, type NonPersistedElectronicAddress, type NonPersistedIdentity, type NonPersistedMetadataItem, type NonPersistedNaturalPerson, type NonPersistedOpenIdConfig, type NonPersistedOrganization, type NonPersistedParty, type NonPersistedPartyRelationship, type NonPersistedPartyType, type NonPersistedPhysicalAddress, type OpenIdConfig, type Organization, type PartialConnection, type PartialConnectionConfig, type PartialContact, type PartialCorrelationIdentifier, type PartialDcqlQueryItem, type PartialDidAuthConfig, type PartialElectronicAddress, type PartialIdentity, type PartialMetadataItem, type PartialNaturalPerson, type PartialOpenIdConfig, type PartialOrganization, type PartialParty, type PartialPartyRelationship, type PartialPartyType, type PartialPhysicalAddress, type Party, PartyOrigin, type PartyRelationship, type PartyType, PartyTypeType, type PhysicalAddress, type PhysicalAddressType, RegulationType, type RemoveCredentialArgs, type RemoveElectronicAddressArgs, type RemoveIdentityArgs, type RemovePartyArgs, type RemovePartyTypeArgs, type RemovePhysicalAddressArgs, type RemoveRelationshipArgs, type StoreActivityEventArgs, type StoreAuditEventArgs, type StoreFindMachineStatesArgs, type StoreMachineStateDeleteArgs, type StoreMachineStateDeleteExpiredArgs, type StoreMachineStateGetArgs, type StoreMachineStateInfo, type StoreMachineStatePersistArgs, type StoreMachineStatesFindActiveArgs, type UpdateCredentialStateArgs, type UpdateDefinitionArgs, type UpdateElectronicAddressArgs, type UpdateIdentityArgs, type UpdatePartyArgs, type UpdatePartyTypeArgs, type UpdatePhysicalAddressArgs, type UpdateRelationshipArgs, type ValidationConstraint, ensureRawDocument };
package/dist/index.d.ts CHANGED
@@ -700,6 +700,45 @@ declare enum CredentialStateType {
700
700
  EXPIRED = "EXPIRED"
701
701
  }
702
702
 
703
+ /**
704
+ * DigitalCredential
705
+ *
706
+ * @public
707
+ */
708
+ type DigitalCredential = {
709
+ id: string;
710
+ parentId?: string;
711
+ documentType: DocumentType;
712
+ documentFormat: CredentialDocumentFormat;
713
+ credentialRole: CredentialRole;
714
+ regulationType: RegulationType;
715
+ rawDocument: string;
716
+ uniformDocument: string;
717
+ credentialId?: string;
718
+ hash: string;
719
+ kmsKeyRef?: string;
720
+ identifierMethod?: string;
721
+ issuerCorrelationType: CredentialCorrelationType;
722
+ subjectCorrelationType?: CredentialCorrelationType;
723
+ rpCorrelationType?: CredentialCorrelationType;
724
+ isIssuerSigned?: boolean;
725
+ issuerCorrelationId: string;
726
+ subjectCorrelationId?: string;
727
+ rpCorrelationId?: string;
728
+ verifiedState?: CredentialStateType;
729
+ tenantId?: string;
730
+ createdAt: Date;
731
+ presentedAt?: Date;
732
+ lastUpdatedAt: Date;
733
+ validUntil?: Date;
734
+ validFrom?: Date;
735
+ verifiedAt?: Date;
736
+ revokedAt?: Date;
737
+ };
738
+ type NonPersistedDigitalCredential = Omit<DigitalCredential, 'id' | 'regulationType'> & {
739
+ regulationType?: RegulationType;
740
+ };
741
+
703
742
  type GetCredentialArgs = {
704
743
  id: string;
705
744
  } | {
@@ -727,9 +766,6 @@ type AddCredentialArgs = {
727
766
  issuerCorrelationId: string;
728
767
  subjectCorrelationId?: string;
729
768
  credentialRole: CredentialRole;
730
- linkedVpId?: string;
731
- linkedVpFrom?: Date;
732
- linkedVpUntil?: Date;
733
769
  tenantId?: string;
734
770
  state?: CredentialStateType;
735
771
  verifiedAt?: Date;
@@ -744,52 +780,8 @@ type UpdateCredentialStateArgs = GetCredentialArgs & {
744
780
  verifiedAt?: Date;
745
781
  revokedAt?: Date;
746
782
  };
747
- type UpdateCredentialArgs = GetCredentialArgs & Partial<Omit<DigitalCredential, 'id' | 'hash' | 'createdAt' | 'lastUpdatedAt'>>;
748
783
  type RemoveCredentialArgs = GetCredentialArgs;
749
784
 
750
- /**
751
- * DigitalCredential
752
- *
753
- * @public
754
- */
755
- type DigitalCredential = {
756
- id: string;
757
- parentId?: string;
758
- documentType: DocumentType;
759
- documentFormat: CredentialDocumentFormat;
760
- credentialRole: CredentialRole;
761
- regulationType: RegulationType;
762
- rawDocument: string;
763
- uniformDocument: string;
764
- credentialId?: string;
765
- hash: string;
766
- kmsKeyRef?: string;
767
- identifierMethod?: string;
768
- issuerCorrelationType: CredentialCorrelationType;
769
- subjectCorrelationType?: CredentialCorrelationType;
770
- rpCorrelationType?: CredentialCorrelationType;
771
- isIssuerSigned?: boolean;
772
- issuerCorrelationId: string;
773
- subjectCorrelationId?: string;
774
- rpCorrelationId?: string;
775
- verifiedState?: CredentialStateType;
776
- tenantId?: string;
777
- linkedVpId?: string;
778
- linkedVpFrom?: Date;
779
- linkedVpUntil?: Date;
780
- createdAt: Date;
781
- presentedAt?: Date;
782
- lastUpdatedAt: Date;
783
- validUntil?: Date;
784
- validFrom?: Date;
785
- verifiedAt?: Date;
786
- revokedAt?: Date;
787
- };
788
- type NonPersistedDigitalCredential = Omit<DigitalCredential, 'id' | 'regulationType'> & {
789
- regulationType?: RegulationType;
790
- };
791
- type UpdateCredentialArgsWithoutIdentifier = Omit<UpdateCredentialArgs, 'id' | 'hash'>;
792
-
793
785
  declare abstract class AbstractContactStore {
794
786
  abstract getParty(args: GetPartyArgs): Promise<Party>;
795
787
  abstract getParties(args?: GetPartiesArgs): Promise<Array<Party>>;
@@ -827,7 +819,6 @@ declare abstract class AbstractDigitalCredentialStore {
827
819
  abstract getCredential(args: GetCredentialArgs): Promise<DigitalCredential>;
828
820
  abstract getCredentials(args?: GetCredentialsArgs): Promise<GetCredentialsResponse>;
829
821
  abstract addCredential(args: AddCredentialArgs): Promise<DigitalCredential>;
830
- abstract updateCredential(args: UpdateCredentialArgs): Promise<DigitalCredential>;
831
822
  abstract updateCredentialState(args: UpdateCredentialStateArgs): Promise<DigitalCredential>;
832
823
  abstract removeCredential(args: RemoveCredentialArgs): Promise<boolean>;
833
824
  }
@@ -922,4 +913,4 @@ declare abstract class AbstractPDStore {
922
913
 
923
914
  declare function ensureRawDocument(input: string | object): string;
924
915
 
925
- export { AbstractContactStore, AbstractDigitalCredentialStore, AbstractEventLoggerStore, AbstractIssuanceBrandingStore, AbstractPDStore, type AddCredentialArgs, type AddDefinitionArgs, type AddElectronicAddressArgs, type AddIdentityArgs, type AddPartyArgs, type AddPartyTypeArgs, type AddPhysicalAddressArgs, type AddRelationshipArgs, type Connection, type ConnectionConfig, ConnectionType, type Contact, type CorrelationIdentifier, CorrelationIdentifierType, CredentialCorrelationType, CredentialDocumentFormat, CredentialStateType, type DcqlQueryItem, type DcqlQueryItemFilter, type DeleteDefinitionArgs, type DeleteDefinitionsArgs, type DidAuthConfig, type DigitalCredential, DocumentType, type ElectronicAddress, type ElectronicAddressType, type FindActivityLoggingEventArgs, type FindAuditLoggingEventArgs, type FindCredentialBrandingArgs, type FindCredentialLocaleBrandingArgs, type FindDcqlQueryArgs, type FindDigitalCredentialArgs, type FindElectronicAddressArgs, type FindIdentityArgs, type FindIssuerBrandingArgs, type FindIssuerLocaleBrandingArgs, type FindMachineStatesFilterArgs, type FindPartyArgs, type FindPartyTypeArgs, type FindPhysicalAddressArgs, type FindRelationshipArgs, type GetActivityEventsArgs, type GetAuditEventsArgs, type GetCredentialArgs, type GetCredentialsArgs, type GetCredentialsResponse, type GetDefinitionArgs, type GetDefinitionsArgs, type GetElectronicAddressArgs, type GetElectronicAddressesArgs, type GetIdentitiesArgs, type GetIdentityArgs, type GetPartiesArgs, type GetPartyArgs, type GetPartyTypeArgs, type GetPartyTypesArgs, type GetPhysicalAddressArgs, type GetPhysicalAddressesArgs, type GetRelationshipArgs, type GetRelationshipsArgs, type HasDefinitionArgs, type HasDefinitionsArgs, IAbstractMachineStateStore, type IAddCredentialBrandingArgs, type IAddCredentialLocaleBrandingArgs, type IAddIssuerBrandingArgs, type IAddIssuerLocaleBrandingArgs, type IBackgroundAttributes, type IBasicBackgroundAttributes, type IBasicCredentialBranding, type IBasicCredentialClaim, type IBasicCredentialLocaleBranding, type IBasicImageAttributes, type IBasicImageDimensions, type IBasicIssuerBranding, type IBasicIssuerLocaleBranding, type IBasicTextAttributes, type ICredentialBranding, type ICredentialBrandingFilter, type ICredentialClaim, type ICredentialLocaleBranding, type ICredentialLocaleBrandingFilter, type IGetCredentialBrandingArgs, type IGetCredentialLocaleBrandingArgs, type IGetIssuerBrandingArgs, type IGetIssuerLocaleBrandingArgs, type IImageAttributes, type IImageDimensions, type IIssuerBranding, type IIssuerBrandingFilter, type IIssuerLocaleBranding, type IIssuerLocaleBrandingFilter, type ILocaleBranding, type IMetadataEntity, type IPartialBackgroundAttributes, type IPartialCredentialBranding, type IPartialCredentialClaim, type IPartialCredentialLocaleBranding, type IPartialImageAttributes, type IPartialImageDimensions, type IPartialIssuerBranding, type IPartialIssuerLocaleBranding, type IPartialTextAttributes, type IRemoveCredentialBrandingArgs, type IRemoveCredentialLocaleBrandingArgs, type IRemoveIssuerBrandingArgs, type IRemoveIssuerLocaleBrandingArgs, type ITextAttributes, type IUpdateCredentialBrandingArgs, type IUpdateCredentialLocaleBrandingArgs, type IUpdateIssuerBrandingArgs, type IUpdateIssuerLocaleBrandingArgs, type Identity, IdentityOrigin, type ImportDcqlQueryItem, type MetadataItem, type MetadataTypes, type NaturalPerson, type NonPersistedActivityLoggingEvent, type NonPersistedAuditLoggingEvent, type NonPersistedConnection, type NonPersistedConnectionConfig, type NonPersistedContact, type NonPersistedCorrelationIdentifier, type NonPersistedDcqlQueryItem, type NonPersistedDidAuthConfig, type NonPersistedDigitalCredential, type NonPersistedElectronicAddress, type NonPersistedIdentity, type NonPersistedMetadataItem, type NonPersistedNaturalPerson, type NonPersistedOpenIdConfig, type NonPersistedOrganization, type NonPersistedParty, type NonPersistedPartyRelationship, type NonPersistedPartyType, type NonPersistedPhysicalAddress, type OpenIdConfig, type Organization, type PartialConnection, type PartialConnectionConfig, type PartialContact, type PartialCorrelationIdentifier, type PartialDcqlQueryItem, type PartialDidAuthConfig, type PartialElectronicAddress, type PartialIdentity, type PartialMetadataItem, type PartialNaturalPerson, type PartialOpenIdConfig, type PartialOrganization, type PartialParty, type PartialPartyRelationship, type PartialPartyType, type PartialPhysicalAddress, type Party, PartyOrigin, type PartyRelationship, type PartyType, PartyTypeType, type PhysicalAddress, type PhysicalAddressType, RegulationType, type RemoveCredentialArgs, type RemoveElectronicAddressArgs, type RemoveIdentityArgs, type RemovePartyArgs, type RemovePartyTypeArgs, type RemovePhysicalAddressArgs, type RemoveRelationshipArgs, type StoreActivityEventArgs, type StoreAuditEventArgs, type StoreFindMachineStatesArgs, type StoreMachineStateDeleteArgs, type StoreMachineStateDeleteExpiredArgs, type StoreMachineStateGetArgs, type StoreMachineStateInfo, type StoreMachineStatePersistArgs, type StoreMachineStatesFindActiveArgs, type UpdateCredentialArgs, type UpdateCredentialArgsWithoutIdentifier, type UpdateCredentialStateArgs, type UpdateDefinitionArgs, type UpdateElectronicAddressArgs, type UpdateIdentityArgs, type UpdatePartyArgs, type UpdatePartyTypeArgs, type UpdatePhysicalAddressArgs, type UpdateRelationshipArgs, type ValidationConstraint, ensureRawDocument };
916
+ export { AbstractContactStore, AbstractDigitalCredentialStore, AbstractEventLoggerStore, AbstractIssuanceBrandingStore, AbstractPDStore, type AddCredentialArgs, type AddDefinitionArgs, type AddElectronicAddressArgs, type AddIdentityArgs, type AddPartyArgs, type AddPartyTypeArgs, type AddPhysicalAddressArgs, type AddRelationshipArgs, type Connection, type ConnectionConfig, ConnectionType, type Contact, type CorrelationIdentifier, CorrelationIdentifierType, CredentialCorrelationType, CredentialDocumentFormat, CredentialStateType, type DcqlQueryItem, type DcqlQueryItemFilter, type DeleteDefinitionArgs, type DeleteDefinitionsArgs, type DidAuthConfig, type DigitalCredential, DocumentType, type ElectronicAddress, type ElectronicAddressType, type FindActivityLoggingEventArgs, type FindAuditLoggingEventArgs, type FindCredentialBrandingArgs, type FindCredentialLocaleBrandingArgs, type FindDcqlQueryArgs, type FindDigitalCredentialArgs, type FindElectronicAddressArgs, type FindIdentityArgs, type FindIssuerBrandingArgs, type FindIssuerLocaleBrandingArgs, type FindMachineStatesFilterArgs, type FindPartyArgs, type FindPartyTypeArgs, type FindPhysicalAddressArgs, type FindRelationshipArgs, type GetActivityEventsArgs, type GetAuditEventsArgs, type GetCredentialArgs, type GetCredentialsArgs, type GetCredentialsResponse, type GetDefinitionArgs, type GetDefinitionsArgs, type GetElectronicAddressArgs, type GetElectronicAddressesArgs, type GetIdentitiesArgs, type GetIdentityArgs, type GetPartiesArgs, type GetPartyArgs, type GetPartyTypeArgs, type GetPartyTypesArgs, type GetPhysicalAddressArgs, type GetPhysicalAddressesArgs, type GetRelationshipArgs, type GetRelationshipsArgs, type HasDefinitionArgs, type HasDefinitionsArgs, IAbstractMachineStateStore, type IAddCredentialBrandingArgs, type IAddCredentialLocaleBrandingArgs, type IAddIssuerBrandingArgs, type IAddIssuerLocaleBrandingArgs, type IBackgroundAttributes, type IBasicBackgroundAttributes, type IBasicCredentialBranding, type IBasicCredentialClaim, type IBasicCredentialLocaleBranding, type IBasicImageAttributes, type IBasicImageDimensions, type IBasicIssuerBranding, type IBasicIssuerLocaleBranding, type IBasicTextAttributes, type ICredentialBranding, type ICredentialBrandingFilter, type ICredentialClaim, type ICredentialLocaleBranding, type ICredentialLocaleBrandingFilter, type IGetCredentialBrandingArgs, type IGetCredentialLocaleBrandingArgs, type IGetIssuerBrandingArgs, type IGetIssuerLocaleBrandingArgs, type IImageAttributes, type IImageDimensions, type IIssuerBranding, type IIssuerBrandingFilter, type IIssuerLocaleBranding, type IIssuerLocaleBrandingFilter, type ILocaleBranding, type IMetadataEntity, type IPartialBackgroundAttributes, type IPartialCredentialBranding, type IPartialCredentialClaim, type IPartialCredentialLocaleBranding, type IPartialImageAttributes, type IPartialImageDimensions, type IPartialIssuerBranding, type IPartialIssuerLocaleBranding, type IPartialTextAttributes, type IRemoveCredentialBrandingArgs, type IRemoveCredentialLocaleBrandingArgs, type IRemoveIssuerBrandingArgs, type IRemoveIssuerLocaleBrandingArgs, type ITextAttributes, type IUpdateCredentialBrandingArgs, type IUpdateCredentialLocaleBrandingArgs, type IUpdateIssuerBrandingArgs, type IUpdateIssuerLocaleBrandingArgs, type Identity, IdentityOrigin, type ImportDcqlQueryItem, type MetadataItem, type MetadataTypes, type NaturalPerson, type NonPersistedActivityLoggingEvent, type NonPersistedAuditLoggingEvent, type NonPersistedConnection, type NonPersistedConnectionConfig, type NonPersistedContact, type NonPersistedCorrelationIdentifier, type NonPersistedDcqlQueryItem, type NonPersistedDidAuthConfig, type NonPersistedDigitalCredential, type NonPersistedElectronicAddress, type NonPersistedIdentity, type NonPersistedMetadataItem, type NonPersistedNaturalPerson, type NonPersistedOpenIdConfig, type NonPersistedOrganization, type NonPersistedParty, type NonPersistedPartyRelationship, type NonPersistedPartyType, type NonPersistedPhysicalAddress, type OpenIdConfig, type Organization, type PartialConnection, type PartialConnectionConfig, type PartialContact, type PartialCorrelationIdentifier, type PartialDcqlQueryItem, type PartialDidAuthConfig, type PartialElectronicAddress, type PartialIdentity, type PartialMetadataItem, type PartialNaturalPerson, type PartialOpenIdConfig, type PartialOrganization, type PartialParty, type PartialPartyRelationship, type PartialPartyType, type PartialPhysicalAddress, type Party, PartyOrigin, type PartyRelationship, type PartyType, PartyTypeType, type PhysicalAddress, type PhysicalAddressType, RegulationType, type RemoveCredentialArgs, type RemoveElectronicAddressArgs, type RemoveIdentityArgs, type RemovePartyArgs, type RemovePartyTypeArgs, type RemovePhysicalAddressArgs, type RemoveRelationshipArgs, type StoreActivityEventArgs, type StoreAuditEventArgs, type StoreFindMachineStatesArgs, type StoreMachineStateDeleteArgs, type StoreMachineStateDeleteExpiredArgs, type StoreMachineStateGetArgs, type StoreMachineStateInfo, type StoreMachineStatePersistArgs, type StoreMachineStatesFindActiveArgs, type UpdateCredentialStateArgs, type UpdateDefinitionArgs, type UpdateElectronicAddressArgs, type UpdateIdentityArgs, type UpdatePartyArgs, type UpdatePartyTypeArgs, type UpdatePhysicalAddressArgs, type UpdateRelationshipArgs, type ValidationConstraint, ensureRawDocument };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/contact/AbstractContactStore.ts","../src/digitalCredential/AbstractDigitalCredentialStore.ts","../src/issuanceBranding/AbstractIssuanceBrandingStore.ts","../src/eventLogger/AbstractEventLoggerStore.ts","../src/machineState/IAbstractMachineStateStore.ts","../src/presentationDefinition/AbstractPDStore.ts","../src/types/contact/contact.ts","../src/types/digitalCredential/enums.ts","../src/utils/MappingUtils.ts"],"sourcesContent":["import {\n AddElectronicAddressArgs,\n AddIdentityArgs,\n AddPartyArgs,\n AddPartyTypeArgs,\n AddPhysicalAddressArgs,\n AddRelationshipArgs,\n ElectronicAddress,\n GetElectronicAddressArgs,\n GetElectronicAddressesArgs,\n GetIdentitiesArgs,\n GetIdentityArgs,\n GetPartiesArgs,\n GetPartyArgs,\n GetPartyTypeArgs,\n GetPartyTypesArgs,\n GetPhysicalAddressArgs,\n GetPhysicalAddressesArgs,\n GetRelationshipArgs,\n GetRelationshipsArgs,\n Identity,\n Party,\n PartyRelationship,\n PartyType,\n PhysicalAddress,\n RemoveElectronicAddressArgs,\n RemoveIdentityArgs,\n RemovePartyArgs,\n RemovePartyTypeArgs,\n RemovePhysicalAddressArgs,\n RemoveRelationshipArgs,\n UpdateElectronicAddressArgs,\n UpdateIdentityArgs,\n UpdatePartyArgs,\n UpdatePartyTypeArgs,\n UpdatePhysicalAddressArgs,\n UpdateRelationshipArgs,\n} from '../types'\n\nexport abstract class AbstractContactStore {\n abstract getParty(args: GetPartyArgs): Promise<Party>\n abstract getParties(args?: GetPartiesArgs): Promise<Array<Party>>\n abstract addParty(args: AddPartyArgs): Promise<Party>\n abstract updateParty(args: UpdatePartyArgs): Promise<Party>\n abstract removeParty(args: RemovePartyArgs): Promise<void>\n abstract getIdentity(args: GetIdentityArgs): Promise<Identity>\n abstract getIdentities(args?: GetIdentitiesArgs): Promise<Array<Identity>>\n abstract addIdentity(args: AddIdentityArgs): Promise<Identity>\n abstract updateIdentity(args: UpdateIdentityArgs): Promise<Identity>\n abstract removeIdentity(args: RemoveIdentityArgs): Promise<void>\n abstract getRelationship(args: GetRelationshipArgs): Promise<PartyRelationship>\n abstract getRelationships(args?: GetRelationshipsArgs): Promise<Array<PartyRelationship>>\n abstract addRelationship(args: AddRelationshipArgs): Promise<PartyRelationship>\n abstract updateRelationship(args: UpdateRelationshipArgs): Promise<PartyRelationship>\n abstract removeRelationship(args: RemoveRelationshipArgs): Promise<void>\n abstract getPartyType(args: GetPartyTypeArgs): Promise<PartyType>\n abstract getPartyTypes(args?: GetPartyTypesArgs): Promise<Array<PartyType>>\n abstract addPartyType(args: AddPartyTypeArgs): Promise<PartyType>\n abstract updatePartyType(args: UpdatePartyTypeArgs): Promise<PartyType>\n abstract removePartyType(args: RemovePartyTypeArgs): Promise<void>\n abstract getElectronicAddress(args: GetElectronicAddressArgs): Promise<ElectronicAddress>\n abstract getElectronicAddresses(args?: GetElectronicAddressesArgs): Promise<Array<ElectronicAddress>>\n abstract addElectronicAddress(args: AddElectronicAddressArgs): Promise<ElectronicAddress>\n abstract updateElectronicAddress(args: UpdateElectronicAddressArgs): Promise<ElectronicAddress>\n abstract removeElectronicAddress(args: RemoveElectronicAddressArgs): Promise<void>\n abstract getPhysicalAddress(args: GetPhysicalAddressArgs): Promise<PhysicalAddress>\n abstract getPhysicalAddresses(args?: GetPhysicalAddressesArgs): Promise<Array<PhysicalAddress>>\n abstract addPhysicalAddress(args: AddPhysicalAddressArgs): Promise<PhysicalAddress>\n abstract updatePhysicalAddress(args: UpdatePhysicalAddressArgs): Promise<PhysicalAddress>\n abstract removePhysicalAddress(args: RemovePhysicalAddressArgs): Promise<void>\n}\n","import {\n AddCredentialArgs,\n DigitalCredential,\n GetCredentialArgs,\n GetCredentialsArgs,\n GetCredentialsResponse,\n RemoveCredentialArgs,\n UpdateCredentialArgs,\n UpdateCredentialStateArgs,\n} from '../types'\n\nexport abstract class AbstractDigitalCredentialStore {\n abstract getCredential(args: GetCredentialArgs): Promise<DigitalCredential>\n\n abstract getCredentials(args?: GetCredentialsArgs): Promise<GetCredentialsResponse>\n\n abstract addCredential(args: AddCredentialArgs): Promise<DigitalCredential>\n\n abstract updateCredential(args: UpdateCredentialArgs): Promise<DigitalCredential>\n\n abstract updateCredentialState(args: UpdateCredentialStateArgs): Promise<DigitalCredential>\n\n abstract removeCredential(args: RemoveCredentialArgs): Promise<boolean>\n}\n","import type {\n IAddCredentialBrandingArgs,\n IAddCredentialLocaleBrandingArgs,\n IAddIssuerBrandingArgs,\n IAddIssuerLocaleBrandingArgs,\n ICredentialBranding,\n ICredentialLocaleBranding,\n IGetCredentialBrandingArgs,\n IGetCredentialLocaleBrandingArgs,\n IGetIssuerBrandingArgs,\n IGetIssuerLocaleBrandingArgs,\n IIssuerBranding,\n IIssuerLocaleBranding,\n IRemoveCredentialBrandingArgs,\n IRemoveCredentialLocaleBrandingArgs,\n IRemoveIssuerBrandingArgs,\n IRemoveIssuerLocaleBrandingArgs,\n IUpdateCredentialBrandingArgs,\n IUpdateCredentialLocaleBrandingArgs,\n IUpdateIssuerBrandingArgs,\n IUpdateIssuerLocaleBrandingArgs,\n} from '../types'\n\nexport abstract class AbstractIssuanceBrandingStore {\n public abstract addCredentialBranding(args: IAddCredentialBrandingArgs): Promise<ICredentialBranding>\n public abstract getCredentialBranding(args?: IGetCredentialBrandingArgs): Promise<Array<ICredentialBranding>>\n public abstract updateCredentialBranding(args: IUpdateCredentialBrandingArgs): Promise<ICredentialBranding>\n public abstract removeCredentialBranding(args: IRemoveCredentialBrandingArgs): Promise<void>\n public abstract addCredentialLocaleBranding(args: IAddCredentialLocaleBrandingArgs): Promise<ICredentialBranding>\n public abstract getCredentialLocaleBranding(args?: IGetCredentialLocaleBrandingArgs): Promise<Array<ICredentialLocaleBranding>>\n public abstract updateCredentialLocaleBranding(args: IUpdateCredentialLocaleBrandingArgs): Promise<ICredentialLocaleBranding>\n public abstract removeCredentialLocaleBranding(args: IRemoveCredentialLocaleBrandingArgs): Promise<void>\n public abstract addIssuerBranding(args: IAddIssuerBrandingArgs): Promise<IIssuerBranding>\n public abstract getIssuerBranding(args?: IGetIssuerBrandingArgs): Promise<Array<IIssuerBranding>>\n public abstract updateIssuerBranding(args: IUpdateIssuerBrandingArgs): Promise<IIssuerBranding>\n public abstract removeIssuerBranding(args: IRemoveIssuerBrandingArgs): Promise<void>\n public abstract addIssuerLocaleBranding(args: IAddIssuerLocaleBrandingArgs): Promise<IIssuerBranding>\n public abstract getIssuerLocaleBranding(args?: IGetIssuerLocaleBrandingArgs): Promise<Array<IIssuerLocaleBranding>>\n public abstract updateIssuerLocaleBranding(args: IUpdateIssuerLocaleBrandingArgs): Promise<IIssuerLocaleBranding>\n public abstract removeIssuerLocaleBranding(args: IRemoveIssuerLocaleBrandingArgs): Promise<void>\n}\n","import type { ActivityLoggingEvent, AuditLoggingEvent } from '@sphereon/ssi-sdk.core'\nimport type { GetActivityEventsArgs, GetAuditEventsArgs, StoreActivityEventArgs, StoreAuditEventArgs } from '../types'\n\nexport abstract class AbstractEventLoggerStore {\n abstract getAuditEvents(args: GetAuditEventsArgs): Promise<Array<AuditLoggingEvent>>\n abstract getActivityEvents(args: GetActivityEventsArgs): Promise<Array<ActivityLoggingEvent>>\n abstract storeAuditEvent(args: StoreAuditEventArgs): Promise<AuditLoggingEvent>\n abstract storeActivityEvent(args: StoreActivityEventArgs): Promise<ActivityLoggingEvent>\n}\n","import type {\n StoreMachineStateDeleteExpiredArgs,\n StoreMachineStateDeleteArgs,\n StoreMachineStatesFindActiveArgs,\n StoreFindMachineStatesArgs,\n StoreMachineStatePersistArgs,\n StoreMachineStateInfo,\n StoreMachineStateGetArgs,\n} from '../types'\n\n/**\n * Represents an abstract class for storing machine states.\n * This class provides methods for persisting, retrieving, and deleting machine states.\n *\n * @interface\n */\nexport abstract class IAbstractMachineStateStore {\n /**\n * Persists the machine state.\n *\n * @param {StoreMachineStatePersistArgs} state - The object containing the machine state to persist.\n * @return {Promise<StoreMachineStateInfo>} - A Promise that resolves to the information about the persisted machine state.\n */\n abstract persistMachineState(state: StoreMachineStatePersistArgs): Promise<StoreMachineStateInfo>\n\n /**\n * Finds active machine states based on the given arguments.\n *\n * @param {StoreMachineStatesFindActiveArgs} args - The arguments for finding active machine states.\n * @return {Promise<Array<StoreMachineStateInfo>>} - A promise that resolves with an array of active machine states.\n */\n abstract findActiveMachineStates(args: StoreMachineStatesFindActiveArgs): Promise<Array<StoreMachineStateInfo>>\n\n /**\n * Retrieves the state of a particular machine.\n *\n * @param {StoreMachineStateGetArgs} args - The arguments for retrieving the machine state.\n * @returns {Promise<StoreMachineStateInfo>} - A promise that resolves to the machine state information.\n */\n abstract getMachineState(args: StoreMachineStateGetArgs): Promise<StoreMachineStateInfo>\n\n /**\n * Finds the machine states based on the given arguments.\n *\n * @param {StoreFindMachineStatesArgs} [args] - The arguments to filter the machine states.\n * @returns {Promise<Array<StoreMachineStateInfo>>} - A promise that resolves to an array of machine state information.\n */\n abstract findMachineStates(args?: StoreFindMachineStatesArgs): Promise<Array<StoreMachineStateInfo>>\n\n /**\n * Deletes a machine state.\n *\n * @param {StoreMachineStateDeleteArgs} args - The arguments for deleting the machine state.\n * @return {Promise<boolean>} - A promise that resolves to a boolean indicating if the machine state was successfully deleted or not.\n */\n abstract deleteMachineState(args: StoreMachineStateDeleteArgs): Promise<boolean>\n\n /**\n * Deletes expired machine states from the database.\n *\n * @param {StoreMachineStateDeleteExpiredArgs} args - The arguments for deleting expired machine states.\n * @return {Promise<number>} - A promise that resolves to the number of deleted machine states.\n */\n abstract deleteExpiredMachineStates(args: StoreMachineStateDeleteExpiredArgs): Promise<number>\n}\n","import type {\n GetDefinitionArgs,\n GetDefinitionsArgs,\n DeleteDefinitionArgs,\n DcqlQueryItem,\n AddDefinitionArgs,\n UpdateDefinitionArgs,\n DeleteDefinitionsArgs,\n} from '../types'\n\nexport abstract class AbstractPDStore {\n abstract hasDefinition(args: GetDefinitionArgs): Promise<boolean>\n abstract hasDefinitions(args: GetDefinitionsArgs): Promise<boolean>\n abstract getDefinition(args: GetDefinitionArgs): Promise<DcqlQueryItem>\n abstract getDefinitions(args: GetDefinitionsArgs): Promise<Array<DcqlQueryItem>>\n abstract addDefinition(args: AddDefinitionArgs): Promise<DcqlQueryItem>\n abstract updateDefinition(args: UpdateDefinitionArgs): Promise<DcqlQueryItem>\n abstract deleteDefinition(args: DeleteDefinitionArgs): Promise<void>\n abstract deleteDefinitions(args: DeleteDefinitionsArgs): Promise<number>\n}\n","import { ManagedIdentifierOptsOrResult } from '@sphereon/ssi-sdk-ext.identifier-resolution'\nimport { IIdentifier } from '@veramo/core'\nimport { IIssuerLocaleBranding } from '../issuanceBranding/issuanceBranding'\nimport { CredentialRole } from '@sphereon/ssi-types'\n\nexport type MetadataTypes = string | number | Date | boolean | undefined\n\nexport interface IMetadataEntity {\n // TODO move to types\n label: string\n stringValue?: string\n numberValue?: number\n dateValue?: Date\n boolValue?: boolean\n}\n\nexport type Party = {\n id: string\n uri?: string\n roles: Array<CredentialRole>\n ownerId?: string\n tenantId?: string\n identities: Array<Identity>\n electronicAddresses: Array<ElectronicAddress>\n physicalAddresses: Array<PhysicalAddress>\n contact: Contact\n partyType: PartyType\n /**\n * TODO: Integrate branding logic here in the future. What we should do is make the issuance branding plugin part of the contact-manager and retrieve any branding there is.\n *\n * Currently, we are only defining the branding type within the SDK without implementing the associated logic. This is because:\n * 1. We are combining two types from the SSI-SDK to create a new type that will be used across multiple places in the wallets (web & mobile).\n * 2. While it makes sense to have this combined type in the SDK, the logic to support database connections for these types is complex. The types belong to different modules, and we don't use them together currently.\n * 3. Implementing the full logic now would require significant changes and cross-module interactions, which we don't have the time to address at present.\n *\n * For now, we are defining the type here and will use it in the mobile wallet has the logic for it. This is a temporary solution until we have the resources to integrate the branding logic fully.\n */\n branding?: IIssuerLocaleBranding\n relationships: Array<PartyRelationship>\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedParty = Omit<\n Party,\n | 'id'\n | 'identities'\n | 'electronicAddresses'\n | 'physicalAddresses'\n | 'contact'\n | 'roles'\n | 'partyType'\n | 'relationships'\n | 'createdAt'\n | 'lastUpdatedAt'\n> & {\n identities?: Array<NonPersistedIdentity>\n electronicAddresses?: Array<NonPersistedElectronicAddress>\n physicalAddresses?: Array<NonPersistedPhysicalAddress>\n contact: NonPersistedContact\n partyType: NonPersistedPartyType\n relationships?: Array<NonPersistedPartyRelationship>\n}\nexport type PartialParty = Partial<\n Omit<Party, 'identities' | 'electronicAddresses' | 'physicalAddresses' | 'contact' | 'partyType' | 'relationships'>\n> & {\n identities?: PartialIdentity\n electronicAddresses?: PartialElectronicAddress\n physicalAddresses?: PartialPhysicalAddress\n contact?: PartialContact\n partyType?: PartialPartyType\n relationships?: PartialPartyRelationship\n}\n\nexport type Identity = {\n id: string\n alias: string\n ownerId?: string\n tenantId?: string\n origin: IdentityOrigin\n roles: Array<CredentialRole>\n identifier: CorrelationIdentifier\n connection?: Connection\n metadata?: Array<MetadataItem<MetadataTypes>>\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedIdentity = Omit<Identity, 'id' | 'identifier' | 'connection' | 'metadata' | 'origin' | 'createdAt' | 'lastUpdatedAt'> & {\n origin: IdentityOrigin\n identifier: NonPersistedCorrelationIdentifier\n connection?: NonPersistedConnection\n metadata?: Array<NonPersistedMetadataItem<MetadataTypes>>\n}\nexport type PartialIdentity = Partial<Omit<Identity, 'identifier' | 'connection' | 'metadata' | 'origin' | 'roles'>> & {\n identifier?: PartialCorrelationIdentifier\n connection?: PartialConnection\n metadata?: PartialMetadataItem<MetadataTypes> // Usage: FindIdentityArgs = Array<PartialIdentity>\n origin?: IdentityOrigin\n roles?: CredentialRole\n partyId?: string\n}\n\nexport type MetadataItem<T extends MetadataTypes> = {\n id: string\n label: string\n value: T\n}\n\nexport type NonPersistedMetadataItem<T extends MetadataTypes> = Omit<MetadataItem<T>, 'id'>\nexport type PartialMetadataItem<T extends MetadataTypes> = Partial<MetadataItem<T>>\n\nexport type CorrelationIdentifier = {\n id: string\n ownerId?: string\n tenantId?: string\n type: CorrelationIdentifierType\n correlationId: string\n}\nexport type NonPersistedCorrelationIdentifier = Omit<CorrelationIdentifier, 'id'>\nexport type PartialCorrelationIdentifier = Partial<CorrelationIdentifier>\n\nexport type Connection = {\n id: string\n ownerId?: string\n tenantId?: string\n type: ConnectionType\n config: ConnectionConfig\n}\nexport type NonPersistedConnection = Omit<Connection, 'id' | 'config'> & {\n config: NonPersistedConnectionConfig\n}\nexport type PartialConnection = Partial<Omit<Connection, 'config'>> & {\n config: PartialConnectionConfig\n}\n\nexport type OpenIdConfig = {\n id: string\n clientId: string\n clientSecret: string\n ownerId?: string\n tenantId?: string\n scopes: Array<string>\n issuer: string\n redirectUrl: string\n dangerouslyAllowInsecureHttpRequests: boolean\n clientAuthMethod: 'basic' | 'post' | undefined\n}\nexport type NonPersistedOpenIdConfig = Omit<OpenIdConfig, 'id'>\nexport type PartialOpenIdConfig = Partial<OpenIdConfig>\n\nexport type DidAuthConfig = {\n id: string\n idOpts: ManagedIdentifierOptsOrResult\n stateId: string\n ownerId?: string\n tenantId?: string\n redirectUrl: string\n sessionId: string\n}\nexport type NonPersistedDidAuthConfig = Omit<DidAuthConfig, 'id'>\nexport type PartialDidAuthConfig = Partial<Omit<DidAuthConfig, 'identifier'>> & {\n identifier: Partial<IIdentifier> // TODO, we need to create partials for sub types in IIdentifier\n}\n\nexport type ConnectionConfig = OpenIdConfig | DidAuthConfig\nexport type NonPersistedConnectionConfig = NonPersistedDidAuthConfig | NonPersistedOpenIdConfig\nexport type PartialConnectionConfig = PartialOpenIdConfig | PartialDidAuthConfig\n\nexport type NaturalPerson = {\n id: string\n firstName: string\n lastName: string\n middleName?: string\n displayName: string\n metadata?: Array<MetadataItem<MetadataTypes>>\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\n\nexport type NonPersistedNaturalPerson = Omit<NaturalPerson, 'id' | 'createdAt' | 'lastUpdatedAt'>\n\nexport type PartialNaturalPerson = Partial<Omit<NaturalPerson, 'metadata'>> & {\n metadata?: PartialMetadataItem<MetadataTypes>\n}\n\nexport type Organization = {\n id: string\n legalName: string\n displayName: string\n metadata?: Array<MetadataItem<MetadataTypes>>\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedOrganization = Omit<Organization, 'id' | 'createdAt' | 'lastUpdatedAt'>\nexport type PartialOrganization = Partial<Omit<Organization, 'metadata'>> & {\n metadata?: PartialMetadataItem<MetadataTypes>\n}\n\nexport type Contact = NaturalPerson | Organization\nexport type NonPersistedContact = NonPersistedNaturalPerson | NonPersistedOrganization\nexport type PartialContact = PartialNaturalPerson | PartialOrganization\n\nexport type PartyType = {\n id: string\n type: PartyTypeType\n origin: PartyOrigin\n name: string\n tenantId: string\n description?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedPartyType = Omit<PartyType, 'id' | 'createdAt' | 'lastUpdatedAt'> & {\n id?: string\n}\nexport type PartialPartyType = Partial<PartyType>\n\nexport type PartyRelationship = {\n id: string\n leftId: string\n rightId: string\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedPartyRelationship = Omit<PartyRelationship, 'id' | 'createdAt' | 'lastUpdatedAt'>\nexport type PartialPartyRelationship = Partial<PartyRelationship>\n\nexport type ElectronicAddress = {\n id: string\n type: ElectronicAddressType\n electronicAddress: string\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedElectronicAddress = Omit<ElectronicAddress, 'id' | 'createdAt' | 'lastUpdatedAt'>\nexport type PartialElectronicAddress = Partial<ElectronicAddress> & {\n partyId?: string\n}\n\nexport type PhysicalAddress = {\n id: string\n type: PhysicalAddressType\n streetName: string\n streetNumber: string\n postalCode: string\n cityName: string\n provinceName: string\n countryCode: string\n buildingName?: string\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedPhysicalAddress = Omit<PhysicalAddress, 'id' | 'createdAt' | 'lastUpdatedAt'>\nexport type PartialPhysicalAddress = Partial<PhysicalAddress> & {\n partyId?: string\n}\n\nexport type ElectronicAddressType = 'email' | 'phone'\n\nexport type PhysicalAddressType = 'home' | 'visit' | 'postal'\n\nexport enum ConnectionType {\n OPENID_CONNECT = 'OIDC',\n SIOPv2 = 'SIOPv2',\n SIOPv2_OpenID4VP = 'SIOPv2+OpenID4VP',\n}\n\nexport enum CorrelationIdentifierType {\n DID = 'did',\n URL = 'url',\n}\n\nexport enum PartyTypeType {\n NATURAL_PERSON = 'naturalPerson',\n ORGANIZATION = 'organization',\n}\n\nexport enum PartyOrigin {\n INTERNAL = 'INTERNAL',\n EXTERNAL = 'EXTERNAL',\n}\n\nexport enum IdentityOrigin {\n INTERNAL = 'INTERNAL',\n EXTERNAL = 'EXTERNAL',\n}\n","export enum DocumentType {\n VC = 'VC',\n VP = 'VP',\n P = 'P',\n C = 'C',\n}\n\nexport enum RegulationType {\n PID = 'PID',\n QEAA = 'QEAA',\n EAA = 'EAA',\n NON_REGULATED = 'NON_REGULATED',\n}\n\nexport enum CredentialDocumentFormat {\n JSON_LD = 'JSON_LD',\n JWT = 'JWT',\n SD_JWT = 'SD_JWT',\n MSO_MDOC = 'MSO_MDOC',\n}\n\nexport namespace CredentialDocumentFormat {\n export function fromSpecValue(credentialFormat: string) {\n const format = credentialFormat.toLowerCase()\n if (format.includes('sd')) {\n return CredentialDocumentFormat.SD_JWT\n } else if (format.includes('ldp')) {\n return CredentialDocumentFormat.JSON_LD\n } else if (format.includes('mso') || credentialFormat.includes('mdoc')) {\n return CredentialDocumentFormat.MSO_MDOC\n } else if (format.includes('jwt_')) {\n return CredentialDocumentFormat.JWT\n } else {\n throw Error(`Could not map format ${format} to known format`)\n }\n }\n\n export function toSpecValue(documentFormat: CredentialDocumentFormat, documentType: DocumentType) {\n switch (documentFormat) {\n case CredentialDocumentFormat.SD_JWT:\n return 'dc+sd-jwt'\n case CredentialDocumentFormat.MSO_MDOC:\n return 'mso_mdoc'\n case CredentialDocumentFormat.JSON_LD:\n return documentType === DocumentType.C || documentType === DocumentType.VC ? 'ldp_vc' : 'ldp_vp'\n case CredentialDocumentFormat.JWT:\n return documentType === DocumentType.C || documentType === DocumentType.VC ? 'jwt_vc_json' : 'jwt_vp_json'\n }\n }\n}\n\nexport enum CredentialCorrelationType {\n DID = 'DID',\n X509_SAN = 'X509_SAN',\n KID = 'KID',\n URL = 'URL',\n}\n\nexport enum CredentialStateType {\n REVOKED = 'REVOKED',\n VERIFIED = 'VERIFIED',\n EXPIRED = 'EXPIRED',\n}\n","import { CredentialMapper, ObjectUtils } from '@sphereon/ssi-types'\n\nfunction isHex(input: string) {\n return input.match(/^([0-9A-Fa-f])+$/g) !== null\n}\n\nexport function ensureRawDocument(input: string | object): string {\n if (typeof input === 'string') {\n if (isHex(input) || ObjectUtils.isBase64(input)) {\n // mso_mdoc\n return input\n } else if (CredentialMapper.isJwtEncoded(input) || CredentialMapper.isSdJwtEncoded(input)) {\n return input\n }\n throw Error('Unknown input to be mapped as rawDocument')\n }\n\n try {\n return JSON.stringify(input)\n } catch (e) {\n throw new Error(`Can't stringify to a raw credential: ${input}`)\n }\n}\n"],"mappings":";;;;AAuCO,IAAeA,uBAAf,MAAeA;EAAtB,OAAsBA;;;AA+BtB;;;AC3DO,IAAeC,iCAAf,MAAeA;EAAtB,OAAsBA;;;AAYtB;;;ACAO,IAAeC,gCAAf,MAAeA;EAAtB,OAAsBA;;;AAiBtB;;;ACrCO,IAAeC,2BAAf,MAAeA;EAAtB,OAAsBA;;;AAKtB;;;ACQO,IAAeC,6BAAf,MAAeA;EANtB,OAMsBA;;;AAgDtB;;;ACtDO,IAAeC,kBAAf,MAAeA;EAAtB,OAAsBA;;;AAStB;;;AC2PO,IAAKC,iBAAAA,0BAAAA,iBAAAA;;;;SAAAA;;AAML,IAAKC,4BAAAA,0BAAAA,4BAAAA;;;SAAAA;;AAKL,IAAKC,gBAAAA,0BAAAA,gBAAAA;;;SAAAA;;AAKL,IAAKC,cAAAA,0BAAAA,cAAAA;;;SAAAA;;AAKL,IAAKC,iBAAAA,0BAAAA,iBAAAA;;;SAAAA;;;;ACnSL,IAAKC,eAAAA,0BAAAA,eAAAA;;;;;SAAAA;;AAOL,IAAKC,iBAAAA,0BAAAA,iBAAAA;;;;;SAAAA;;AAOL,IAAKC,2BAAAA,0BAAAA,2BAAAA;;;;;SAAAA;;UAOKA,2BAAAA;AACR,WAASC,cAAcC,kBAAwB;AACpD,UAAMC,SAASD,iBAAiBE,YAAW;AAC3C,QAAID,OAAOE,SAAS,IAAA,GAAO;AACzB,aAAA;IACF,WAAWF,OAAOE,SAAS,KAAA,GAAQ;AACjC,aAAA;IACF,WAAWF,OAAOE,SAAS,KAAA,KAAUH,iBAAiBG,SAAS,MAAA,GAAS;AACtE,aAAA;IACF,WAAWF,OAAOE,SAAS,MAAA,GAAS;AAClC,aAAA;IACF,OAAO;AACL,YAAMC,MAAM,wBAAwBH,MAAAA,kBAAwB;IAC9D;EACF;AAbgBF;4BAAAA,gBAAAA;AAeT,WAASM,YAAYC,gBAA0CC,cAA0B;AAC9F,YAAQD,gBAAAA;MACN,KAAA;AACE,eAAO;MACT,KAAA;AACE,eAAO;MACT,KAAA;AACE,eAAOC,iBAAAA,OAAmCA,iBAAAA,OAAmC,WAAW;MAC1F,KAAA;AACE,eAAOA,iBAAAA,OAAmCA,iBAAAA,OAAmC,gBAAgB;IACjG;EACF;AAXgBF;4BAAAA,cAAAA;AAYlB,GA5BiBP,6BAAAA,2BAAAA,CAAAA,EAAAA;AA8BV,IAAKU,4BAAAA,0BAAAA,4BAAAA;;;;;SAAAA;;AAOL,IAAKC,sBAAAA,0BAAAA,sBAAAA;;;;SAAAA;;;;AC1DZ,SAASC,kBAAkBC,mBAAmB;AAE9C,SAASC,MAAMC,OAAa;AAC1B,SAAOA,MAAMC,MAAM,mBAAA,MAAyB;AAC9C;AAFSF;AAIF,SAASG,kBAAkBF,OAAsB;AACtD,MAAI,OAAOA,UAAU,UAAU;AAC7B,QAAID,MAAMC,KAAAA,KAAUG,YAAYC,SAASJ,KAAAA,GAAQ;AAE/C,aAAOA;IACT,WAAWK,iBAAiBC,aAAaN,KAAAA,KAAUK,iBAAiBE,eAAeP,KAAAA,GAAQ;AACzF,aAAOA;IACT;AACA,UAAMQ,MAAM,2CAAA;EACd;AAEA,MAAI;AACF,WAAOC,KAAKC,UAAUV,KAAAA;EACxB,SAASW,GAAG;AACV,UAAM,IAAIH,MAAM,wCAAwCR,KAAAA,EAAO;EACjE;AACF;AAhBgBE;","names":["AbstractContactStore","AbstractDigitalCredentialStore","AbstractIssuanceBrandingStore","AbstractEventLoggerStore","IAbstractMachineStateStore","AbstractPDStore","ConnectionType","CorrelationIdentifierType","PartyTypeType","PartyOrigin","IdentityOrigin","DocumentType","RegulationType","CredentialDocumentFormat","fromSpecValue","credentialFormat","format","toLowerCase","includes","Error","toSpecValue","documentFormat","documentType","CredentialCorrelationType","CredentialStateType","CredentialMapper","ObjectUtils","isHex","input","match","ensureRawDocument","ObjectUtils","isBase64","CredentialMapper","isJwtEncoded","isSdJwtEncoded","Error","JSON","stringify","e"]}
1
+ {"version":3,"sources":["../src/contact/AbstractContactStore.ts","../src/digitalCredential/AbstractDigitalCredentialStore.ts","../src/issuanceBranding/AbstractIssuanceBrandingStore.ts","../src/eventLogger/AbstractEventLoggerStore.ts","../src/machineState/IAbstractMachineStateStore.ts","../src/presentationDefinition/AbstractPDStore.ts","../src/types/contact/contact.ts","../src/types/digitalCredential/enums.ts","../src/utils/MappingUtils.ts"],"sourcesContent":["import {\n AddElectronicAddressArgs,\n AddIdentityArgs,\n AddPartyArgs,\n AddPartyTypeArgs,\n AddPhysicalAddressArgs,\n AddRelationshipArgs,\n ElectronicAddress,\n GetElectronicAddressArgs,\n GetElectronicAddressesArgs,\n GetIdentitiesArgs,\n GetIdentityArgs,\n GetPartiesArgs,\n GetPartyArgs,\n GetPartyTypeArgs,\n GetPartyTypesArgs,\n GetPhysicalAddressArgs,\n GetPhysicalAddressesArgs,\n GetRelationshipArgs,\n GetRelationshipsArgs,\n Identity,\n Party,\n PartyRelationship,\n PartyType,\n PhysicalAddress,\n RemoveElectronicAddressArgs,\n RemoveIdentityArgs,\n RemovePartyArgs,\n RemovePartyTypeArgs,\n RemovePhysicalAddressArgs,\n RemoveRelationshipArgs,\n UpdateElectronicAddressArgs,\n UpdateIdentityArgs,\n UpdatePartyArgs,\n UpdatePartyTypeArgs,\n UpdatePhysicalAddressArgs,\n UpdateRelationshipArgs,\n} from '../types'\n\nexport abstract class AbstractContactStore {\n abstract getParty(args: GetPartyArgs): Promise<Party>\n abstract getParties(args?: GetPartiesArgs): Promise<Array<Party>>\n abstract addParty(args: AddPartyArgs): Promise<Party>\n abstract updateParty(args: UpdatePartyArgs): Promise<Party>\n abstract removeParty(args: RemovePartyArgs): Promise<void>\n abstract getIdentity(args: GetIdentityArgs): Promise<Identity>\n abstract getIdentities(args?: GetIdentitiesArgs): Promise<Array<Identity>>\n abstract addIdentity(args: AddIdentityArgs): Promise<Identity>\n abstract updateIdentity(args: UpdateIdentityArgs): Promise<Identity>\n abstract removeIdentity(args: RemoveIdentityArgs): Promise<void>\n abstract getRelationship(args: GetRelationshipArgs): Promise<PartyRelationship>\n abstract getRelationships(args?: GetRelationshipsArgs): Promise<Array<PartyRelationship>>\n abstract addRelationship(args: AddRelationshipArgs): Promise<PartyRelationship>\n abstract updateRelationship(args: UpdateRelationshipArgs): Promise<PartyRelationship>\n abstract removeRelationship(args: RemoveRelationshipArgs): Promise<void>\n abstract getPartyType(args: GetPartyTypeArgs): Promise<PartyType>\n abstract getPartyTypes(args?: GetPartyTypesArgs): Promise<Array<PartyType>>\n abstract addPartyType(args: AddPartyTypeArgs): Promise<PartyType>\n abstract updatePartyType(args: UpdatePartyTypeArgs): Promise<PartyType>\n abstract removePartyType(args: RemovePartyTypeArgs): Promise<void>\n abstract getElectronicAddress(args: GetElectronicAddressArgs): Promise<ElectronicAddress>\n abstract getElectronicAddresses(args?: GetElectronicAddressesArgs): Promise<Array<ElectronicAddress>>\n abstract addElectronicAddress(args: AddElectronicAddressArgs): Promise<ElectronicAddress>\n abstract updateElectronicAddress(args: UpdateElectronicAddressArgs): Promise<ElectronicAddress>\n abstract removeElectronicAddress(args: RemoveElectronicAddressArgs): Promise<void>\n abstract getPhysicalAddress(args: GetPhysicalAddressArgs): Promise<PhysicalAddress>\n abstract getPhysicalAddresses(args?: GetPhysicalAddressesArgs): Promise<Array<PhysicalAddress>>\n abstract addPhysicalAddress(args: AddPhysicalAddressArgs): Promise<PhysicalAddress>\n abstract updatePhysicalAddress(args: UpdatePhysicalAddressArgs): Promise<PhysicalAddress>\n abstract removePhysicalAddress(args: RemovePhysicalAddressArgs): Promise<void>\n}\n","import {\n AddCredentialArgs,\n DigitalCredential,\n GetCredentialArgs,\n GetCredentialsArgs,\n GetCredentialsResponse,\n RemoveCredentialArgs,\n UpdateCredentialStateArgs,\n} from '../types'\n\nexport abstract class AbstractDigitalCredentialStore {\n abstract getCredential(args: GetCredentialArgs): Promise<DigitalCredential>\n\n abstract getCredentials(args?: GetCredentialsArgs): Promise<GetCredentialsResponse>\n\n abstract addCredential(args: AddCredentialArgs): Promise<DigitalCredential>\n\n abstract updateCredentialState(args: UpdateCredentialStateArgs): Promise<DigitalCredential>\n\n abstract removeCredential(args: RemoveCredentialArgs): Promise<boolean>\n}\n","import type {\n IAddCredentialBrandingArgs,\n IAddCredentialLocaleBrandingArgs,\n IAddIssuerBrandingArgs,\n IAddIssuerLocaleBrandingArgs,\n ICredentialBranding,\n ICredentialLocaleBranding,\n IGetCredentialBrandingArgs,\n IGetCredentialLocaleBrandingArgs,\n IGetIssuerBrandingArgs,\n IGetIssuerLocaleBrandingArgs,\n IIssuerBranding,\n IIssuerLocaleBranding,\n IRemoveCredentialBrandingArgs,\n IRemoveCredentialLocaleBrandingArgs,\n IRemoveIssuerBrandingArgs,\n IRemoveIssuerLocaleBrandingArgs,\n IUpdateCredentialBrandingArgs,\n IUpdateCredentialLocaleBrandingArgs,\n IUpdateIssuerBrandingArgs,\n IUpdateIssuerLocaleBrandingArgs,\n} from '../types'\n\nexport abstract class AbstractIssuanceBrandingStore {\n public abstract addCredentialBranding(args: IAddCredentialBrandingArgs): Promise<ICredentialBranding>\n public abstract getCredentialBranding(args?: IGetCredentialBrandingArgs): Promise<Array<ICredentialBranding>>\n public abstract updateCredentialBranding(args: IUpdateCredentialBrandingArgs): Promise<ICredentialBranding>\n public abstract removeCredentialBranding(args: IRemoveCredentialBrandingArgs): Promise<void>\n public abstract addCredentialLocaleBranding(args: IAddCredentialLocaleBrandingArgs): Promise<ICredentialBranding>\n public abstract getCredentialLocaleBranding(args?: IGetCredentialLocaleBrandingArgs): Promise<Array<ICredentialLocaleBranding>>\n public abstract updateCredentialLocaleBranding(args: IUpdateCredentialLocaleBrandingArgs): Promise<ICredentialLocaleBranding>\n public abstract removeCredentialLocaleBranding(args: IRemoveCredentialLocaleBrandingArgs): Promise<void>\n public abstract addIssuerBranding(args: IAddIssuerBrandingArgs): Promise<IIssuerBranding>\n public abstract getIssuerBranding(args?: IGetIssuerBrandingArgs): Promise<Array<IIssuerBranding>>\n public abstract updateIssuerBranding(args: IUpdateIssuerBrandingArgs): Promise<IIssuerBranding>\n public abstract removeIssuerBranding(args: IRemoveIssuerBrandingArgs): Promise<void>\n public abstract addIssuerLocaleBranding(args: IAddIssuerLocaleBrandingArgs): Promise<IIssuerBranding>\n public abstract getIssuerLocaleBranding(args?: IGetIssuerLocaleBrandingArgs): Promise<Array<IIssuerLocaleBranding>>\n public abstract updateIssuerLocaleBranding(args: IUpdateIssuerLocaleBrandingArgs): Promise<IIssuerLocaleBranding>\n public abstract removeIssuerLocaleBranding(args: IRemoveIssuerLocaleBrandingArgs): Promise<void>\n}\n","import type { ActivityLoggingEvent, AuditLoggingEvent } from '@sphereon/ssi-sdk.core'\nimport type { GetActivityEventsArgs, GetAuditEventsArgs, StoreActivityEventArgs, StoreAuditEventArgs } from '../types'\n\nexport abstract class AbstractEventLoggerStore {\n abstract getAuditEvents(args: GetAuditEventsArgs): Promise<Array<AuditLoggingEvent>>\n abstract getActivityEvents(args: GetActivityEventsArgs): Promise<Array<ActivityLoggingEvent>>\n abstract storeAuditEvent(args: StoreAuditEventArgs): Promise<AuditLoggingEvent>\n abstract storeActivityEvent(args: StoreActivityEventArgs): Promise<ActivityLoggingEvent>\n}\n","import type {\n StoreMachineStateDeleteExpiredArgs,\n StoreMachineStateDeleteArgs,\n StoreMachineStatesFindActiveArgs,\n StoreFindMachineStatesArgs,\n StoreMachineStatePersistArgs,\n StoreMachineStateInfo,\n StoreMachineStateGetArgs,\n} from '../types'\n\n/**\n * Represents an abstract class for storing machine states.\n * This class provides methods for persisting, retrieving, and deleting machine states.\n *\n * @interface\n */\nexport abstract class IAbstractMachineStateStore {\n /**\n * Persists the machine state.\n *\n * @param {StoreMachineStatePersistArgs} state - The object containing the machine state to persist.\n * @return {Promise<StoreMachineStateInfo>} - A Promise that resolves to the information about the persisted machine state.\n */\n abstract persistMachineState(state: StoreMachineStatePersistArgs): Promise<StoreMachineStateInfo>\n\n /**\n * Finds active machine states based on the given arguments.\n *\n * @param {StoreMachineStatesFindActiveArgs} args - The arguments for finding active machine states.\n * @return {Promise<Array<StoreMachineStateInfo>>} - A promise that resolves with an array of active machine states.\n */\n abstract findActiveMachineStates(args: StoreMachineStatesFindActiveArgs): Promise<Array<StoreMachineStateInfo>>\n\n /**\n * Retrieves the state of a particular machine.\n *\n * @param {StoreMachineStateGetArgs} args - The arguments for retrieving the machine state.\n * @returns {Promise<StoreMachineStateInfo>} - A promise that resolves to the machine state information.\n */\n abstract getMachineState(args: StoreMachineStateGetArgs): Promise<StoreMachineStateInfo>\n\n /**\n * Finds the machine states based on the given arguments.\n *\n * @param {StoreFindMachineStatesArgs} [args] - The arguments to filter the machine states.\n * @returns {Promise<Array<StoreMachineStateInfo>>} - A promise that resolves to an array of machine state information.\n */\n abstract findMachineStates(args?: StoreFindMachineStatesArgs): Promise<Array<StoreMachineStateInfo>>\n\n /**\n * Deletes a machine state.\n *\n * @param {StoreMachineStateDeleteArgs} args - The arguments for deleting the machine state.\n * @return {Promise<boolean>} - A promise that resolves to a boolean indicating if the machine state was successfully deleted or not.\n */\n abstract deleteMachineState(args: StoreMachineStateDeleteArgs): Promise<boolean>\n\n /**\n * Deletes expired machine states from the database.\n *\n * @param {StoreMachineStateDeleteExpiredArgs} args - The arguments for deleting expired machine states.\n * @return {Promise<number>} - A promise that resolves to the number of deleted machine states.\n */\n abstract deleteExpiredMachineStates(args: StoreMachineStateDeleteExpiredArgs): Promise<number>\n}\n","import type {\n GetDefinitionArgs,\n GetDefinitionsArgs,\n DeleteDefinitionArgs,\n DcqlQueryItem,\n AddDefinitionArgs,\n UpdateDefinitionArgs,\n DeleteDefinitionsArgs,\n} from '../types'\n\nexport abstract class AbstractPDStore {\n abstract hasDefinition(args: GetDefinitionArgs): Promise<boolean>\n abstract hasDefinitions(args: GetDefinitionsArgs): Promise<boolean>\n abstract getDefinition(args: GetDefinitionArgs): Promise<DcqlQueryItem>\n abstract getDefinitions(args: GetDefinitionsArgs): Promise<Array<DcqlQueryItem>>\n abstract addDefinition(args: AddDefinitionArgs): Promise<DcqlQueryItem>\n abstract updateDefinition(args: UpdateDefinitionArgs): Promise<DcqlQueryItem>\n abstract deleteDefinition(args: DeleteDefinitionArgs): Promise<void>\n abstract deleteDefinitions(args: DeleteDefinitionsArgs): Promise<number>\n}\n","import { ManagedIdentifierOptsOrResult } from '@sphereon/ssi-sdk-ext.identifier-resolution'\nimport { IIdentifier } from '@veramo/core'\nimport { IIssuerLocaleBranding } from '../issuanceBranding/issuanceBranding'\nimport { CredentialRole } from '@sphereon/ssi-types'\n\nexport type MetadataTypes = string | number | Date | boolean | undefined\n\nexport interface IMetadataEntity {\n // TODO move to types\n label: string\n stringValue?: string\n numberValue?: number\n dateValue?: Date\n boolValue?: boolean\n}\n\nexport type Party = {\n id: string\n uri?: string\n roles: Array<CredentialRole>\n ownerId?: string\n tenantId?: string\n identities: Array<Identity>\n electronicAddresses: Array<ElectronicAddress>\n physicalAddresses: Array<PhysicalAddress>\n contact: Contact\n partyType: PartyType\n /**\n * TODO: Integrate branding logic here in the future. What we should do is make the issuance branding plugin part of the contact-manager and retrieve any branding there is.\n *\n * Currently, we are only defining the branding type within the SDK without implementing the associated logic. This is because:\n * 1. We are combining two types from the SSI-SDK to create a new type that will be used across multiple places in the wallets (web & mobile).\n * 2. While it makes sense to have this combined type in the SDK, the logic to support database connections for these types is complex. The types belong to different modules, and we don't use them together currently.\n * 3. Implementing the full logic now would require significant changes and cross-module interactions, which we don't have the time to address at present.\n *\n * For now, we are defining the type here and will use it in the mobile wallet has the logic for it. This is a temporary solution until we have the resources to integrate the branding logic fully.\n */\n branding?: IIssuerLocaleBranding\n relationships: Array<PartyRelationship>\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedParty = Omit<\n Party,\n | 'id'\n | 'identities'\n | 'electronicAddresses'\n | 'physicalAddresses'\n | 'contact'\n | 'roles'\n | 'partyType'\n | 'relationships'\n | 'createdAt'\n | 'lastUpdatedAt'\n> & {\n identities?: Array<NonPersistedIdentity>\n electronicAddresses?: Array<NonPersistedElectronicAddress>\n physicalAddresses?: Array<NonPersistedPhysicalAddress>\n contact: NonPersistedContact\n partyType: NonPersistedPartyType\n relationships?: Array<NonPersistedPartyRelationship>\n}\nexport type PartialParty = Partial<\n Omit<Party, 'identities' | 'electronicAddresses' | 'physicalAddresses' | 'contact' | 'partyType' | 'relationships'>\n> & {\n identities?: PartialIdentity\n electronicAddresses?: PartialElectronicAddress\n physicalAddresses?: PartialPhysicalAddress\n contact?: PartialContact\n partyType?: PartialPartyType\n relationships?: PartialPartyRelationship\n}\n\nexport type Identity = {\n id: string\n alias: string\n ownerId?: string\n tenantId?: string\n origin: IdentityOrigin\n roles: Array<CredentialRole>\n identifier: CorrelationIdentifier\n connection?: Connection\n metadata?: Array<MetadataItem<MetadataTypes>>\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedIdentity = Omit<Identity, 'id' | 'identifier' | 'connection' | 'metadata' | 'origin' | 'createdAt' | 'lastUpdatedAt'> & {\n origin: IdentityOrigin\n identifier: NonPersistedCorrelationIdentifier\n connection?: NonPersistedConnection\n metadata?: Array<NonPersistedMetadataItem<MetadataTypes>>\n}\nexport type PartialIdentity = Partial<Omit<Identity, 'identifier' | 'connection' | 'metadata' | 'origin' | 'roles'>> & {\n identifier?: PartialCorrelationIdentifier\n connection?: PartialConnection\n metadata?: PartialMetadataItem<MetadataTypes> // Usage: FindIdentityArgs = Array<PartialIdentity>\n origin?: IdentityOrigin\n roles?: CredentialRole\n partyId?: string\n}\n\nexport type MetadataItem<T extends MetadataTypes> = {\n id: string\n label: string\n value: T\n}\n\nexport type NonPersistedMetadataItem<T extends MetadataTypes> = Omit<MetadataItem<T>, 'id'>\nexport type PartialMetadataItem<T extends MetadataTypes> = Partial<MetadataItem<T>>\n\nexport type CorrelationIdentifier = {\n id: string\n ownerId?: string\n tenantId?: string\n type: CorrelationIdentifierType\n correlationId: string\n}\nexport type NonPersistedCorrelationIdentifier = Omit<CorrelationIdentifier, 'id'>\nexport type PartialCorrelationIdentifier = Partial<CorrelationIdentifier>\n\nexport type Connection = {\n id: string\n ownerId?: string\n tenantId?: string\n type: ConnectionType\n config: ConnectionConfig\n}\nexport type NonPersistedConnection = Omit<Connection, 'id' | 'config'> & {\n config: NonPersistedConnectionConfig\n}\nexport type PartialConnection = Partial<Omit<Connection, 'config'>> & {\n config: PartialConnectionConfig\n}\n\nexport type OpenIdConfig = {\n id: string\n clientId: string\n clientSecret: string\n ownerId?: string\n tenantId?: string\n scopes: Array<string>\n issuer: string\n redirectUrl: string\n dangerouslyAllowInsecureHttpRequests: boolean\n clientAuthMethod: 'basic' | 'post' | undefined\n}\nexport type NonPersistedOpenIdConfig = Omit<OpenIdConfig, 'id'>\nexport type PartialOpenIdConfig = Partial<OpenIdConfig>\n\nexport type DidAuthConfig = {\n id: string\n idOpts: ManagedIdentifierOptsOrResult\n stateId: string\n ownerId?: string\n tenantId?: string\n redirectUrl: string\n sessionId: string\n}\nexport type NonPersistedDidAuthConfig = Omit<DidAuthConfig, 'id'>\nexport type PartialDidAuthConfig = Partial<Omit<DidAuthConfig, 'identifier'>> & {\n identifier: Partial<IIdentifier> // TODO, we need to create partials for sub types in IIdentifier\n}\n\nexport type ConnectionConfig = OpenIdConfig | DidAuthConfig\nexport type NonPersistedConnectionConfig = NonPersistedDidAuthConfig | NonPersistedOpenIdConfig\nexport type PartialConnectionConfig = PartialOpenIdConfig | PartialDidAuthConfig\n\nexport type NaturalPerson = {\n id: string\n firstName: string\n lastName: string\n middleName?: string\n displayName: string\n metadata?: Array<MetadataItem<MetadataTypes>>\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\n\nexport type NonPersistedNaturalPerson = Omit<NaturalPerson, 'id' | 'createdAt' | 'lastUpdatedAt'>\n\nexport type PartialNaturalPerson = Partial<Omit<NaturalPerson, 'metadata'>> & {\n metadata?: PartialMetadataItem<MetadataTypes>\n}\n\nexport type Organization = {\n id: string\n legalName: string\n displayName: string\n metadata?: Array<MetadataItem<MetadataTypes>>\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedOrganization = Omit<Organization, 'id' | 'createdAt' | 'lastUpdatedAt'>\nexport type PartialOrganization = Partial<Omit<Organization, 'metadata'>> & {\n metadata?: PartialMetadataItem<MetadataTypes>\n}\n\nexport type Contact = NaturalPerson | Organization\nexport type NonPersistedContact = NonPersistedNaturalPerson | NonPersistedOrganization\nexport type PartialContact = PartialNaturalPerson | PartialOrganization\n\nexport type PartyType = {\n id: string\n type: PartyTypeType\n origin: PartyOrigin\n name: string\n tenantId: string\n description?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedPartyType = Omit<PartyType, 'id' | 'createdAt' | 'lastUpdatedAt'> & {\n id?: string\n}\nexport type PartialPartyType = Partial<PartyType>\n\nexport type PartyRelationship = {\n id: string\n leftId: string\n rightId: string\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedPartyRelationship = Omit<PartyRelationship, 'id' | 'createdAt' | 'lastUpdatedAt'>\nexport type PartialPartyRelationship = Partial<PartyRelationship>\n\nexport type ElectronicAddress = {\n id: string\n type: ElectronicAddressType\n electronicAddress: string\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedElectronicAddress = Omit<ElectronicAddress, 'id' | 'createdAt' | 'lastUpdatedAt'>\nexport type PartialElectronicAddress = Partial<ElectronicAddress> & {\n partyId?: string\n}\n\nexport type PhysicalAddress = {\n id: string\n type: PhysicalAddressType\n streetName: string\n streetNumber: string\n postalCode: string\n cityName: string\n provinceName: string\n countryCode: string\n buildingName?: string\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedPhysicalAddress = Omit<PhysicalAddress, 'id' | 'createdAt' | 'lastUpdatedAt'>\nexport type PartialPhysicalAddress = Partial<PhysicalAddress> & {\n partyId?: string\n}\n\nexport type ElectronicAddressType = 'email' | 'phone'\n\nexport type PhysicalAddressType = 'home' | 'visit' | 'postal'\n\nexport enum ConnectionType {\n OPENID_CONNECT = 'OIDC',\n SIOPv2 = 'SIOPv2',\n SIOPv2_OpenID4VP = 'SIOPv2+OpenID4VP',\n}\n\nexport enum CorrelationIdentifierType {\n DID = 'did',\n URL = 'url',\n}\n\nexport enum PartyTypeType {\n NATURAL_PERSON = 'naturalPerson',\n ORGANIZATION = 'organization',\n}\n\nexport enum PartyOrigin {\n INTERNAL = 'INTERNAL',\n EXTERNAL = 'EXTERNAL',\n}\n\nexport enum IdentityOrigin {\n INTERNAL = 'INTERNAL',\n EXTERNAL = 'EXTERNAL',\n}\n","export enum DocumentType {\n VC = 'VC',\n VP = 'VP',\n P = 'P',\n C = 'C',\n}\n\nexport enum RegulationType {\n PID = 'PID',\n QEAA = 'QEAA',\n EAA = 'EAA',\n NON_REGULATED = 'NON_REGULATED',\n}\n\nexport enum CredentialDocumentFormat {\n JSON_LD = 'JSON_LD',\n JWT = 'JWT',\n SD_JWT = 'SD_JWT',\n MSO_MDOC = 'MSO_MDOC',\n}\n\nexport namespace CredentialDocumentFormat {\n export function fromSpecValue(credentialFormat: string) {\n const format = credentialFormat.toLowerCase()\n if (format.includes('sd')) {\n return CredentialDocumentFormat.SD_JWT\n } else if (format.includes('ldp')) {\n return CredentialDocumentFormat.JSON_LD\n } else if (format.includes('mso') || credentialFormat.includes('mdoc')) {\n return CredentialDocumentFormat.MSO_MDOC\n } else if (format.includes('jwt_')) {\n return CredentialDocumentFormat.JWT\n } else {\n throw Error(`Could not map format ${format} to known format`)\n }\n }\n\n export function toSpecValue(documentFormat: CredentialDocumentFormat, documentType: DocumentType) {\n switch (documentFormat) {\n case CredentialDocumentFormat.SD_JWT:\n return 'dc+sd-jwt'\n case CredentialDocumentFormat.MSO_MDOC:\n return 'mso_mdoc'\n case CredentialDocumentFormat.JSON_LD:\n return documentType === DocumentType.C || documentType === DocumentType.VC ? 'ldp_vc' : 'ldp_vp'\n case CredentialDocumentFormat.JWT:\n return documentType === DocumentType.C || documentType === DocumentType.VC ? 'jwt_vc_json' : 'jwt_vp_json'\n }\n }\n}\n\nexport enum CredentialCorrelationType {\n DID = 'DID',\n X509_SAN = 'X509_SAN',\n KID = 'KID',\n URL = 'URL',\n}\n\nexport enum CredentialStateType {\n REVOKED = 'REVOKED',\n VERIFIED = 'VERIFIED',\n EXPIRED = 'EXPIRED',\n}\n","import { CredentialMapper, ObjectUtils } from '@sphereon/ssi-types'\n\nfunction isHex(input: string) {\n return input.match(/^([0-9A-Fa-f])+$/g) !== null\n}\nexport function ensureRawDocument(input: string | object): string {\n if (typeof input === 'string') {\n if (isHex(input) || ObjectUtils.isBase64(input)) {\n // mso_mdoc\n return input\n } else if (CredentialMapper.isJwtEncoded(input) || CredentialMapper.isSdJwtEncoded(input)) {\n return input\n }\n throw Error('Unknown input to be mapped as rawDocument')\n }\n\n try {\n return JSON.stringify(input)\n } catch (e) {\n throw new Error(`Can't stringify to a raw credential: ${input}`)\n }\n}\n"],"mappings":";;;;AAuCO,IAAeA,uBAAf,MAAeA;EAAtB,OAAsBA;;;AA+BtB;;;AC5DO,IAAeC,iCAAf,MAAeA;EAAtB,OAAsBA;;;AAUtB;;;ACGO,IAAeC,gCAAf,MAAeA;EAAtB,OAAsBA;;;AAiBtB;;;ACrCO,IAAeC,2BAAf,MAAeA;EAAtB,OAAsBA;;;AAKtB;;;ACQO,IAAeC,6BAAf,MAAeA;EANtB,OAMsBA;;;AAgDtB;;;ACtDO,IAAeC,kBAAf,MAAeA;EAAtB,OAAsBA;;;AAStB;;;AC2PO,IAAKC,iBAAAA,0BAAAA,iBAAAA;;;;SAAAA;;AAML,IAAKC,4BAAAA,0BAAAA,4BAAAA;;;SAAAA;;AAKL,IAAKC,gBAAAA,0BAAAA,gBAAAA;;;SAAAA;;AAKL,IAAKC,cAAAA,0BAAAA,cAAAA;;;SAAAA;;AAKL,IAAKC,iBAAAA,0BAAAA,iBAAAA;;;SAAAA;;;;ACnSL,IAAKC,eAAAA,0BAAAA,eAAAA;;;;;SAAAA;;AAOL,IAAKC,iBAAAA,0BAAAA,iBAAAA;;;;;SAAAA;;AAOL,IAAKC,2BAAAA,0BAAAA,2BAAAA;;;;;SAAAA;;UAOKA,2BAAAA;AACR,WAASC,cAAcC,kBAAwB;AACpD,UAAMC,SAASD,iBAAiBE,YAAW;AAC3C,QAAID,OAAOE,SAAS,IAAA,GAAO;AACzB,aAAA;IACF,WAAWF,OAAOE,SAAS,KAAA,GAAQ;AACjC,aAAA;IACF,WAAWF,OAAOE,SAAS,KAAA,KAAUH,iBAAiBG,SAAS,MAAA,GAAS;AACtE,aAAA;IACF,WAAWF,OAAOE,SAAS,MAAA,GAAS;AAClC,aAAA;IACF,OAAO;AACL,YAAMC,MAAM,wBAAwBH,MAAAA,kBAAwB;IAC9D;EACF;AAbgBF;4BAAAA,gBAAAA;AAeT,WAASM,YAAYC,gBAA0CC,cAA0B;AAC9F,YAAQD,gBAAAA;MACN,KAAA;AACE,eAAO;MACT,KAAA;AACE,eAAO;MACT,KAAA;AACE,eAAOC,iBAAAA,OAAmCA,iBAAAA,OAAmC,WAAW;MAC1F,KAAA;AACE,eAAOA,iBAAAA,OAAmCA,iBAAAA,OAAmC,gBAAgB;IACjG;EACF;AAXgBF;4BAAAA,cAAAA;AAYlB,GA5BiBP,6BAAAA,2BAAAA,CAAAA,EAAAA;AA8BV,IAAKU,4BAAAA,0BAAAA,4BAAAA;;;;;SAAAA;;AAOL,IAAKC,sBAAAA,0BAAAA,sBAAAA;;;;SAAAA;;;;AC1DZ,SAASC,kBAAkBC,mBAAmB;AAE9C,SAASC,MAAMC,OAAa;AAC1B,SAAOA,MAAMC,MAAM,mBAAA,MAAyB;AAC9C;AAFSF;AAGF,SAASG,kBAAkBF,OAAsB;AACtD,MAAI,OAAOA,UAAU,UAAU;AAC7B,QAAID,MAAMC,KAAAA,KAAUG,YAAYC,SAASJ,KAAAA,GAAQ;AAE/C,aAAOA;IACT,WAAWK,iBAAiBC,aAAaN,KAAAA,KAAUK,iBAAiBE,eAAeP,KAAAA,GAAQ;AACzF,aAAOA;IACT;AACA,UAAMQ,MAAM,2CAAA;EACd;AAEA,MAAI;AACF,WAAOC,KAAKC,UAAUV,KAAAA;EACxB,SAASW,GAAG;AACV,UAAM,IAAIH,MAAM,wCAAwCR,KAAAA,EAAO;EACjE;AACF;AAhBgBE;","names":["AbstractContactStore","AbstractDigitalCredentialStore","AbstractIssuanceBrandingStore","AbstractEventLoggerStore","IAbstractMachineStateStore","AbstractPDStore","ConnectionType","CorrelationIdentifierType","PartyTypeType","PartyOrigin","IdentityOrigin","DocumentType","RegulationType","CredentialDocumentFormat","fromSpecValue","credentialFormat","format","toLowerCase","includes","Error","toSpecValue","documentFormat","documentType","CredentialCorrelationType","CredentialStateType","CredentialMapper","ObjectUtils","isHex","input","match","ensureRawDocument","ObjectUtils","isBase64","CredentialMapper","isJwtEncoded","isSdJwtEncoded","Error","JSON","stringify","e"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sphereon/ssi-sdk.data-store-types",
3
- "version": "0.36.1-feature.SSISDK.82.and.SSISDK.70.35+b3c0abff",
3
+ "version": "0.36.1-next.11+262d209a",
4
4
  "source": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -21,12 +21,12 @@
21
21
  "build": "tsup --config ../../tsup.config.ts --tsconfig ../../tsconfig.tsup.json"
22
22
  },
23
23
  "dependencies": {
24
- "@sphereon/ssi-sdk.core": "0.36.1-feature.SSISDK.82.and.SSISDK.70.35+b3c0abff",
25
- "@sphereon/ssi-types": "0.36.1-feature.SSISDK.82.and.SSISDK.70.35+b3c0abff",
24
+ "@sphereon/ssi-sdk.core": "0.36.1-next.11+262d209a",
25
+ "@sphereon/ssi-types": "0.36.1-next.11+262d209a",
26
26
  "dcql": "1.0.1"
27
27
  },
28
28
  "devDependencies": {
29
- "@sphereon/ssi-sdk-ext.identifier-resolution": "0.36.1-feature.SSISDK.82.and.SSISDK.70.35+b3c0abff"
29
+ "@sphereon/ssi-sdk-ext.identifier-resolution": "0.36.1-next.11+262d209a"
30
30
  },
31
31
  "files": [
32
32
  "dist",
@@ -47,5 +47,5 @@
47
47
  "PostgreSQL",
48
48
  "Contact Store"
49
49
  ],
50
- "gitHead": "b3c0abff5a63fc40d620b95888ce8fdd006b5d00"
50
+ "gitHead": "262d209a803fecfba1ad5878724c4f6f91f86cec"
51
51
  }
@@ -5,7 +5,6 @@ import {
5
5
  GetCredentialsArgs,
6
6
  GetCredentialsResponse,
7
7
  RemoveCredentialArgs,
8
- UpdateCredentialArgs,
9
8
  UpdateCredentialStateArgs,
10
9
  } from '../types'
11
10
 
@@ -16,8 +15,6 @@ export abstract class AbstractDigitalCredentialStore {
16
15
 
17
16
  abstract addCredential(args: AddCredentialArgs): Promise<DigitalCredential>
18
17
 
19
- abstract updateCredential(args: UpdateCredentialArgs): Promise<DigitalCredential>
20
-
21
18
  abstract updateCredentialState(args: UpdateCredentialStateArgs): Promise<DigitalCredential>
22
19
 
23
20
  abstract removeCredential(args: RemoveCredentialArgs): Promise<boolean>
@@ -29,9 +29,6 @@ export type AddCredentialArgs = {
29
29
  issuerCorrelationId: string
30
30
  subjectCorrelationId?: string
31
31
  credentialRole: CredentialRole
32
- linkedVpId?: string
33
- linkedVpFrom?: Date
34
- linkedVpUntil?: Date
35
32
  tenantId?: string
36
33
  state?: CredentialStateType
37
34
  verifiedAt?: Date
@@ -41,6 +38,4 @@ export type AddCredentialArgs = {
41
38
 
42
39
  export type UpdateCredentialStateArgs = GetCredentialArgs & { verifiedState: CredentialStateType; verifiedAt?: Date; revokedAt?: Date }
43
40
 
44
- export type UpdateCredentialArgs = GetCredentialArgs & Partial<Omit<DigitalCredential, 'id' | 'hash' | 'createdAt' | 'lastUpdatedAt'>>
45
-
46
41
  export type RemoveCredentialArgs = GetCredentialArgs
@@ -1,6 +1,5 @@
1
- import { CredentialRole } from '@sphereon/ssi-types'
2
1
  import { CredentialCorrelationType, CredentialDocumentFormat, CredentialStateType, DocumentType, RegulationType } from './enums'
3
- import { UpdateCredentialArgs } from './IAbstractDigitalCredentialStore'
2
+ import { CredentialRole } from '@sphereon/ssi-types'
4
3
 
5
4
  /**
6
5
  * DigitalCredential
@@ -29,9 +28,6 @@ export type DigitalCredential = {
29
28
  rpCorrelationId?: string
30
29
  verifiedState?: CredentialStateType
31
30
  tenantId?: string
32
- linkedVpId?: string
33
- linkedVpFrom?: Date
34
- linkedVpUntil?: Date
35
31
  createdAt: Date
36
32
  presentedAt?: Date
37
33
  lastUpdatedAt: Date
@@ -42,5 +38,3 @@ export type DigitalCredential = {
42
38
  }
43
39
 
44
40
  export type NonPersistedDigitalCredential = Omit<DigitalCredential, 'id' | 'regulationType'> & { regulationType?: RegulationType }
45
-
46
- export type UpdateCredentialArgsWithoutIdentifier = Omit<UpdateCredentialArgs, 'id' | 'hash'>
@@ -3,7 +3,6 @@ import { CredentialMapper, ObjectUtils } from '@sphereon/ssi-types'
3
3
  function isHex(input: string) {
4
4
  return input.match(/^([0-9A-Fa-f])+$/g) !== null
5
5
  }
6
-
7
6
  export function ensureRawDocument(input: string | object): string {
8
7
  if (typeof input === 'string') {
9
8
  if (isHex(input) || ObjectUtils.isBase64(input)) {