{"version":3,"sources":["../src/index.ts","../src/types/index.ts","../src/functions.ts","../src/utils.ts","../src/impl/StatusList2021.ts","../src/impl/OAuthStatusList.ts","../src/impl/encoding/jwt.ts","../src/impl/encoding/common.ts","../src/impl/encoding/cbor.ts","../src/impl/StatusListFactory.ts","../src/impl/BitstringStatusListImplementation.ts"],"sourcesContent":["/**\n */\n\nexport * from './types'\nexport * from './functions'\nexport { determineStatusListType } from './utils'\n","import type { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution'\nimport {\n  type CredentialProofFormat,\n  type ICredential,\n  type ICredentialStatus,\n  type IIssuer,\n  type IVerifiableCredential,\n  type OrPromise,\n  type StatusListCredential,\n  StatusListCredentialIdMode,\n  StatusListDriverType,\n  type StatusListIndexingDirection,\n  StatusListType,\n  type StatusPurpose2021,\n} from '@sphereon/ssi-types'\nimport type { CredentialPayload, IAgentContext, ICredentialIssuer, ICredentialVerifier, IKeyManager, IPluginMethodMap } from '@veramo/core'\nimport { DataSource } from 'typeorm'\nimport type { BitsPerStatus } from '@sd-jwt/jwt-status-list'\nimport type { SdJwtVcPayload } from '@sd-jwt/sd-jwt-vc'\nimport type { StatusListOpts } from '@sphereon/oid4vci-common'\nimport { BitstringStatusPurpose } from '@4sure-tech/vc-bitstring-status-lists'\nimport { IVcdmCredentialPlugin } from '@sphereon/ssi-sdk.credential-vcdm'\nimport { IExtractedCredentialDetails } from '../impl/IStatusList'\nimport { BitstringStatusListArgs, IStatusListEntity } from '@sphereon/ssi-sdk.data-store'\n\nexport enum StatusOAuth {\n  Valid = 0,\n  Invalid = 1,\n  Suspended = 2,\n}\n\nexport enum Status2021 {\n  Valid = 0,\n  Invalid = 1,\n}\n\nexport type StatusList2021Args = {\n  indexingDirection: StatusListIndexingDirection\n  statusPurpose?: StatusPurpose2021\n  // todo: validFrom and validUntil\n}\n\nexport type OAuthStatusListArgs = {\n  bitsPerStatus: BitsPerStatus\n  expiresAt?: Date\n}\n\nexport type BaseCreateNewStatusListArgs = {\n  type: StatusListType\n  id: string\n  issuer: string | IIssuer\n  correlationId?: string\n  length?: number\n  proofFormat?: CredentialProofFormat\n  keyRef?: string\n  statusList2021?: StatusList2021Args\n  oauthStatusList?: OAuthStatusListArgs\n  bitstringStatusList?: BitstringStatusListArgs\n  driverType?: StatusListDriverType\n}\n\nexport type UpdateStatusList2021Args = {\n  statusPurpose: StatusPurpose2021\n}\n\nexport type UpdateOAuthStatusListArgs = {\n  bitsPerStatus: BitsPerStatus\n  expiresAt?: Date\n}\n\nexport type UpdateBitstringStatusListArgs = {\n  statusPurpose: BitstringStatusPurpose\n  bitsPerStatus: number\n  validFrom?: Date\n  validUntil?: Date\n  ttl?: number\n}\n\nexport interface UpdateStatusListFromEncodedListArgs {\n  type?: StatusListType\n  statusListIndex: number | string\n  value: number\n  proofFormat?: CredentialProofFormat\n  keyRef?: string\n  correlationId?: string\n  encodedList: string\n  issuer: string | IIssuer\n  id: string\n  statusList2021?: UpdateStatusList2021Args\n  oauthStatusList?: UpdateOAuthStatusListArgs\n  bitstringStatusList?: UpdateBitstringStatusListArgs\n}\n\nexport interface UpdateStatusListFromStatusListCredentialArgs {\n  statusListCredential: StatusListCredential // | CompactJWT\n  keyRef?: string\n  statusListIndex: number | string\n  value: number | Status2021 | StatusOAuth\n}\n\nexport interface StatusListResult {\n  id: string\n  encodedList: string\n  issuer: string | IIssuer\n  type: StatusListType\n  proofFormat: CredentialProofFormat\n  length: number\n  statusListCredential: StatusListCredential\n  statuslistContentType: string\n  correlationId?: string\n  driverType?: StatusListDriverType\n\n  statusList2021?: {\n    indexingDirection: StatusListIndexingDirection\n    statusPurpose: StatusPurpose2021\n    credentialIdMode: StatusListCredentialIdMode\n  }\n  oauthStatusList?: {\n    bitsPerStatus: number\n    expiresAt?: Date\n  }\n  bitstringStatusList?: {\n    statusPurpose: BitstringStatusPurpose | BitstringStatusPurpose[]\n    bitsPerStatus?: number\n    validFrom?: Date\n    validUntil?: Date\n    ttl?: number\n  }\n}\n\nexport interface StatusList2021EntryCredentialStatus extends ICredentialStatus {\n  type: 'StatusList2021Entry'\n  statusPurpose: StatusPurpose2021\n  statusListIndex: string\n  statusListCredential: string\n}\n\nexport interface StatusListOAuthEntryCredentialStatus extends ICredentialStatus {\n  type: 'OAuthStatusListEntry'\n  bitsPerStatus: number\n  statusListIndex: string\n  statusListCredential: string\n  expiresAt?: Date\n}\n\nexport interface StatusList2021ToVerifiableCredentialArgs {\n  issuer: string | IIssuer\n  id: string\n  type?: StatusListType\n  proofFormat?: CredentialProofFormat\n  keyRef?: string\n  encodedList: string\n  statusPurpose: StatusPurpose2021\n}\n\nexport interface CreateStatusListArgs {\n  issuer: string | IIssuer\n  id: string\n  proofFormat?: CredentialProofFormat\n  keyRef?: string\n  correlationId?: string\n  length?: number\n  statusList2021?: StatusList2021Args\n  oauthStatusList?: OAuthStatusListArgs\n  bitstringStatusList?: BitstringStatusListArgs\n}\n\nexport interface UpdateStatusListIndexArgs {\n  statusListCredential: StatusListCredential // | CompactJWT\n  statusListIndex: number | string\n  value: number | Status2021 | StatusOAuth\n  bitsPerStatus?: number\n  keyRef?: string\n  expiresAt?: Date\n}\n\nexport interface CheckStatusIndexArgs {\n  statusListCredential: StatusListCredential // | CompactJWT\n  statusListIndex: string | number\n  bitsPerStatus?: number\n}\n\n// For the CREATE and READ contexts\nexport interface IToDetailsFromCredentialArgs {\n  // The source credential we are converting\n  statusListCredential: StatusListCredential\n\n  // The required metadata that is NOT in the credential itself\n  statusListType: StatusListType\n  bitsPerStatus?: number\n  correlationId?: string\n  driverType?: StatusListDriverType\n}\n\n// For the UPDATE context\nexport interface IMergeDetailsWithEntityArgs {\n  extractedDetails: IExtractedCredentialDetails\n  statusListEntity: IStatusListEntity\n}\n\n/**\n * The interface definition for a plugin that can add statuslist info to a credential\n *\n * @remarks Please see {@link https://www.w3.org/TR/vc-data-model | W3C Verifiable Credentials data model}\n *\n * @beta This API is likely to change without a BREAKING CHANGE notice\n */\nexport interface IStatusListPlugin extends IPluginMethodMap {\n  /**\n   * Create a new status list\n   *\n   * @param args Status list information like type and size\n   * @param context - This reserved param is automatically added and handled by the framework, *do not override*\n   *\n   * @returns - The details of the newly created status list\n   */\n  slCreateStatusList(args: CreateNewStatusListArgs, context: IRequiredContext): Promise<StatusListResult>\n\n  /**\n   * Ensures status list info like index and list id is added to a credential\n   *\n   * @param args - Arguments necessary to add the statuslist info.\n   * @param context - This reserved param is automatically added and handled by the framework, *do not override*\n   *\n   * @returns - a promise that resolves to the credential now with status support\n   *\n   * @beta This API is likely to change without a BREAKING CHANGE notice\n   */\n  slAddStatusToCredential(args: IAddStatusToCredentialArgs, context: IRequiredContext): Promise<CredentialWithStatusSupport>\n\n  slAddStatusToSdJwtCredential(args: IAddStatusToSdJwtCredentialArgs, context: IRequiredContext): Promise<SdJwtVcPayload>\n\n  /**\n   * Get the status list using the configured driver for the SL. Normally a correlationId or id should suffice. Optionally accepts a dbName/datasource\n   * @param args\n   * @param context\n   */\n  slGetStatusList(args: GetStatusListArgs, context: IRequiredContext): Promise<StatusListResult>\n\n  /**\n   * Import status lists when noy yet present\n   *\n   * @param imports Array of status list information like type and size\n   * @param context - This reserved param is automatically added and handled by the framework, *do not override*\n   */\n  slImportStatusLists(imports: Array<CreateNewStatusListArgs>, context: IRequiredContext): Promise<boolean>\n}\n\nexport type CreateNewStatusListFuncArgs = BaseCreateNewStatusListArgs\n\nexport type CreateNewStatusListArgs = BaseCreateNewStatusListArgs & {\n  dbName?: string\n  dataSource?: OrPromise<DataSource>\n  isDefault?: boolean\n}\n\nexport type IAddStatusToCredentialArgs = Omit<IIssueCredentialStatusOpts, 'dataSource'> & {\n  credential: CredentialWithStatusSupport\n}\n\nexport type IAddStatusToSdJwtCredentialArgs = Omit<IIssueCredentialStatusOpts, 'dataSource'> & {\n  credential: SdJwtVcPayload\n}\n\nexport interface IIssueCredentialStatusOpts {\n  dataSource?: DataSource\n  statusLists?: Array<StatusListOpts>\n  credentialId?: string // An id to use for the credential. Normally should be set as the crdential.id value\n  value?: string\n}\n\nexport type GetStatusListArgs = {\n  id?: string\n  correlationId?: string\n  dataSource?: OrPromise<DataSource>\n  dbName?: string\n}\n\nexport type CredentialWithStatusSupport = ICredential | CredentialPayload | IVerifiableCredential\n\nexport type SignedStatusListData = {\n  statusListCredential: StatusListCredential\n  encodedList: string\n}\n\nexport type IRequiredPlugins = IVcdmCredentialPlugin & IIdentifierResolution\nexport type IRequiredContext = IAgentContext<ICredentialIssuer & ICredentialVerifier & IIdentifierResolution & IKeyManager & IVcdmCredentialPlugin>\n","import type { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution'\nimport { CredentialMapper, type CredentialProofFormat, type StatusListCredential, StatusListType, type StatusPurpose2021 } from '@sphereon/ssi-types'\nimport type { CredentialStatus, DIDDocument, IAgentContext, ProofFormat as VeramoProofFormat } from '@veramo/core'\n\nimport {\n  BitstringStatusListEntryCredentialStatus,\n  IBitstringStatusListEntryEntity,\n  IStatusListEntryEntity,\n  StatusListEntity,\n} from '@sphereon/ssi-sdk.data-store'\n\nimport { checkStatus } from '@sphereon/vc-status-list'\n\n// @ts-ignore\nimport { CredentialJwtOrJSON, StatusMethod } from 'credential-status'\nimport {\n  CreateNewStatusListFuncArgs,\n  IMergeDetailsWithEntityArgs,\n  IToDetailsFromCredentialArgs,\n  Status2021,\n  StatusList2021EntryCredentialStatus,\n  StatusList2021ToVerifiableCredentialArgs,\n  StatusListOAuthEntryCredentialStatus,\n  StatusListResult,\n  StatusOAuth,\n  UpdateStatusListFromEncodedListArgs,\n  UpdateStatusListIndexArgs,\n} from './types'\nimport { assertValidProofType, determineStatusListType, getAssertedValue, getAssertedValues } from './utils'\nimport { getStatusListImplementation } from './impl/StatusListFactory'\nimport { IVcdmCredentialPlugin } from '@sphereon/ssi-sdk.credential-vcdm'\nimport {\n  IBitstringStatusListImplementationResult,\n  IExtractedCredentialDetails,\n  IOAuthStatusListImplementationResult,\n  IStatusList2021ImplementationResult,\n} from './impl/IStatusList'\n\n/**\n * Fetches a status list credential from a URL\n * @param args - Object containing the status list credential URL\n * @returns Promise resolving to the fetched StatusListCredential\n */\nexport async function fetchStatusListCredential(args: { statusListCredential: string }): Promise<StatusListCredential> {\n  const url = getAssertedValue('statusListCredential', args.statusListCredential)\n  try {\n    const response = await fetch(url)\n    if (!response.ok) {\n      throw Error(`Fetching status list ${url} resulted in an error: ${response.status} : ${response.statusText}`)\n    }\n    const responseAsText = await response.text()\n    if (responseAsText.trim().startsWith('{')) {\n      return JSON.parse(responseAsText) as StatusListCredential\n    }\n    return responseAsText as StatusListCredential\n  } catch (error) {\n    console.error(`Fetching status list ${url} resulted in an unexpected error: ${error instanceof Error ? error.message : JSON.stringify(error)}`)\n    throw error\n  }\n}\n\n/**\n * Creates a status checking function for credential-status plugin\n * @param args - Configuration options for status verification\n * @returns StatusMethod function for checking credential status\n */\nexport function statusPluginStatusFunction(args: {\n  documentLoader: any\n  suite: any\n  mandatoryCredentialStatus?: boolean\n  verifyStatusListCredential?: boolean\n  verifyMatchingIssuers?: boolean\n  errorUnknownListType?: boolean\n}): StatusMethod {\n  return async (credential: CredentialJwtOrJSON, didDoc: DIDDocument): Promise<CredentialStatus> => {\n    const result = await checkStatusForCredential({\n      ...args,\n      documentLoader: args.documentLoader,\n      credential: credential as StatusListCredential,\n      errorUnknownListType: args.errorUnknownListType,\n    })\n\n    return {\n      revoked: !result.verified || result.error,\n      ...(result.error && { error: result.error }),\n    }\n  }\n}\n\n/**\n * Function that can be used together with @digitalbazar/vc and @digitialcredentials/vc\n * @param args - Configuration options for status verification\n * @returns Function for checking credential status\n */\nexport function vcLibCheckStatusFunction(args: {\n  mandatoryCredentialStatus?: boolean\n  verifyStatusListCredential?: boolean\n  verifyMatchingIssuers?: boolean\n  errorUnknownListType?: boolean\n}) {\n  const { mandatoryCredentialStatus, verifyStatusListCredential, verifyMatchingIssuers, errorUnknownListType } = args\n  return (args: {\n    credential: StatusListCredential\n    documentLoader: any\n    suite: any\n  }): Promise<{\n    verified: boolean\n    error?: any\n  }> => {\n    return checkStatusForCredential({\n      ...args,\n      mandatoryCredentialStatus,\n      verifyStatusListCredential,\n      verifyMatchingIssuers,\n      errorUnknownListType,\n    })\n  }\n}\n\n/**\n * Checks the status of a credential using its credential status information\n * @param args - Parameters for credential status verification\n * @returns Promise resolving to verification result with error details if any\n */\nexport async function checkStatusForCredential(args: {\n  credential: StatusListCredential\n  documentLoader: any\n  suite: any\n  mandatoryCredentialStatus?: boolean\n  verifyStatusListCredential?: boolean\n  verifyMatchingIssuers?: boolean\n  errorUnknownListType?: boolean\n}): Promise<{ verified: boolean; error?: any }> {\n  const verifyStatusListCredential = args.verifyStatusListCredential ?? true\n  const verifyMatchingIssuers = args.verifyMatchingIssuers ?? true\n  const uniform = CredentialMapper.toUniformCredential(args.credential)\n  if (!('credentialStatus' in uniform) || !uniform.credentialStatus) {\n    if (args.mandatoryCredentialStatus) {\n      const error = 'No credential status object found in the Verifiable Credential and it is mandatory'\n      console.log(error)\n      return { verified: false, error }\n    }\n    return { verified: true }\n  }\n  if ('credentialStatus' in uniform && uniform.credentialStatus) {\n    if (uniform.credentialStatus.type === 'StatusList2021Entry' || uniform.credentialStatus.type === 'BitstringStatusListEntry') {\n      return checkStatus({ ...args, verifyStatusListCredential, verifyMatchingIssuers })\n    } else if (args?.errorUnknownListType) {\n      const error = `Credential status type ${uniform.credentialStatus.type} is not supported, and check status has been configured to not allow for that`\n      console.log(error)\n      return { verified: false, error }\n    } else {\n      console.log(`Skipped verification of status type ${uniform.credentialStatus.type} as we do not support it (yet)`)\n    }\n  }\n  return { verified: true }\n}\n\nexport async function simpleCheckStatusFromStatusListUrl(args: {\n  statusListCredential: string\n  statusPurpose?: StatusPurpose2021\n  type?: StatusListType | 'StatusList2021Entry'\n  id?: string\n  statusListIndex: string\n}): Promise<number | Status2021 | StatusOAuth> {\n  return checkStatusIndexFromStatusListCredential({\n    ...args,\n    statusListCredential: await fetchStatusListCredential(args),\n  })\n}\n\n/**\n * Checks the status at a specific index in a status list credential\n * @param args - Parameters including credential and index to check\n * @returns Promise resolving to status value at the specified index\n */\nexport async function checkStatusIndexFromStatusListCredential(args: {\n  statusListCredential: StatusListCredential\n  statusPurpose?: StatusPurpose2021 | string | string[]\n  type?: StatusListType | 'StatusList2021Entry' | 'BitstringStatusListEntry'\n  id?: string\n  statusListIndex: string | number\n  bitsPerStatus?: number\n}): Promise<number | Status2021 | StatusOAuth> {\n  const statusListType: StatusListType = determineStatusListType(args.statusListCredential)\n  const implementation = getStatusListImplementation(statusListType)\n  return implementation.checkStatusIndex(args)\n}\n\nexport async function createNewStatusList(\n  args: CreateNewStatusListFuncArgs,\n  context: IAgentContext<(IVcdmCredentialPlugin | any) /*IvcdMCredentialPlugin is not available*/ & IIdentifierResolution>,\n): Promise<StatusListResult> {\n  const { type } = getAssertedValues(args)\n  const implementation = getStatusListImplementation(type)\n  return implementation.createNewStatusList(args, context)\n}\n\n/**\n * Updates a status index in a status list credential\n * @param args - Parameters for status update including credential and new value\n * @param context - Agent context with required plugins\n * @returns Promise resolving to updated status list details\n */\nexport async function updateStatusIndexFromStatusListCredential(\n  args: UpdateStatusListIndexArgs,\n  context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>,\n): Promise<StatusListResult> {\n  const credential = getAssertedValue('statusListCredential', args.statusListCredential)\n  const statusListType: StatusListType = determineStatusListType(credential)\n  const implementation = getStatusListImplementation(statusListType)\n  return implementation.updateStatusListIndex(args, context)\n}\n\n/**\n * Extracts credential details from a status list credential\n * @param statusListCredential - The status list credential to extract from\n * @returns Promise resolving to extracted credential details\n */\nexport async function extractCredentialDetails(statusListCredential: StatusListCredential): Promise<IExtractedCredentialDetails> {\n  const statusListType = determineStatusListType(statusListCredential)\n  const implementation = getStatusListImplementation(statusListType)\n  return implementation.extractCredentialDetails(statusListCredential)\n}\n\nexport async function toStatusListDetails(\n  args: IToDetailsFromCredentialArgs,\n): Promise<StatusListResult & (IStatusList2021ImplementationResult | IOAuthStatusListImplementationResult | IBitstringStatusListImplementationResult)>\n\nexport async function toStatusListDetails(\n  args: IMergeDetailsWithEntityArgs,\n): Promise<StatusListResult & (IStatusList2021ImplementationResult | IOAuthStatusListImplementationResult | IBitstringStatusListImplementationResult)>\n\n/**\n * Converts credential and metadata into detailed status list information\n * Handles both CREATE/READ and UPDATE contexts based on input arguments\n * @param args - Either credential-based args or entity-based args for merging\n * @returns Promise resolving to complete status list details\n */\nexport async function toStatusListDetails(\n  args: IToDetailsFromCredentialArgs | IMergeDetailsWithEntityArgs,\n): Promise<\n  StatusListResult & (IStatusList2021ImplementationResult | IOAuthStatusListImplementationResult | IBitstringStatusListImplementationResult)\n> {\n  if ('statusListCredential' in args) {\n    // CREATE/READ context\n    const statusListType = args.statusListType\n    const implementation = getStatusListImplementation(statusListType)\n    return implementation.toStatusListDetails(args)\n  } else {\n    // UPDATE context\n    const statusListType = args.statusListEntity.type\n    const implementation = getStatusListImplementation(statusListType)\n    return implementation.toStatusListDetails(args)\n  }\n}\n\n/**\n * Creates a credential status object from status list and entry information\n * @param args - Parameters including status list, entry, and index\n * @returns Promise resolving to appropriate credential status type\n */\nexport async function createCredentialStatusFromStatusList(args: {\n  statusList: StatusListEntity\n  statusListEntry: IStatusListEntryEntity | IBitstringStatusListEntryEntity\n  statusListIndex: number\n}): Promise<StatusList2021EntryCredentialStatus | StatusListOAuthEntryCredentialStatus | BitstringStatusListEntryCredentialStatus> {\n  const { statusList, statusListEntry, statusListIndex } = args\n\n  // Determine the status list type and delegate to appropriate implementation\n  const statusListType = determineStatusListType(statusList.statusListCredential!)\n  const implementation = getStatusListImplementation(statusListType)\n\n  // Each implementation should have a method to create credential status\n  return implementation.createCredentialStatus({\n    statusList,\n    statusListEntry,\n    statusListIndex,\n  })\n}\n\n/**\n * Updates a status list using a base64 encoded list of statuses\n * @param args - Parameters including encoded list and update details\n * @param context - Agent context with required plugins\n * @returns Promise resolving to updated status list details\n */\nexport async function updateStatusListIndexFromEncodedList(\n  args: UpdateStatusListFromEncodedListArgs,\n  context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>,\n): Promise<StatusListResult> {\n  const { type } = getAssertedValue('type', args)\n  const implementation = getStatusListImplementation(type!)\n  return implementation.updateStatusListFromEncodedList(args, context)\n}\n\n/**\n * Converts a StatusList2021 to a verifiable credential\n * @param args - Parameters for credential creation including issuer and encoded list\n * @param context - Agent context with required plugins\n * @returns Promise resolving to signed status list credential\n */\nexport async function statusList2021ToVerifiableCredential(\n  args: StatusList2021ToVerifiableCredentialArgs,\n  context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>,\n): Promise<StatusListCredential> {\n  const { issuer, id, type } = getAssertedValues(args)\n  const identifier = await context.agent.identifierManagedGet({\n    identifier: typeof issuer === 'string' ? issuer : issuer.id,\n    vmRelationship: 'assertionMethod',\n    offlineWhenNoDIDRegistered: true, // FIXME Fix identifier resolution for EBSI\n  })\n  const proofFormat: CredentialProofFormat = args?.proofFormat ?? 'lds'\n  assertValidProofType(StatusListType.StatusList2021, proofFormat)\n  const veramoProofFormat: VeramoProofFormat = proofFormat as VeramoProofFormat\n\n  const encodedList = getAssertedValue('encodedList', args.encodedList)\n  const statusPurpose = getAssertedValue('statusPurpose', args.statusPurpose)\n  const credential = {\n    '@context': ['https://www.w3.org/2018/credentials/v1', 'https://w3id.org/vc/status-list/2021/v1'],\n    id,\n    issuer,\n    // issuanceDate: \"2021-03-10T04:24:12.164Z\",\n    type: ['VerifiableCredential', `${type}Credential`],\n    credentialSubject: {\n      id,\n      type,\n      statusPurpose,\n      encodedList,\n    },\n  }\n  // TODO copy statuslist schema to local and disable fetching remote contexts\n  const verifiableCredential = await context.agent.createVerifiableCredential({\n    credential,\n    keyRef: identifier.kmsKeyRef,\n    proofFormat: veramoProofFormat,\n    fetchRemoteContexts: true,\n  })\n\n  return CredentialMapper.toWrappedVerifiableCredential(verifiableCredential as StatusListCredential).original as StatusListCredential\n}\n","import {\n  CredentialMapper,\n  type IIssuer,\n  type CredentialProofFormat,\n  StatusListType,\n  StatusListType as StatusListTypeW3C,\n  type StatusListCredential,\n  DocumentFormat,\n} from '@sphereon/ssi-types'\nimport { jwtDecode } from 'jwt-decode'\n\nexport function getAssertedStatusListType(type?: StatusListType) {\n  const assertedType = type ?? StatusListType.StatusList2021\n  if (![StatusListType.StatusList2021, StatusListType.OAuthStatusList, StatusListType.BitstringStatusList].includes(assertedType)) {\n    throw Error(`StatusList type ${assertedType} is not supported (yet)`)\n  }\n  return assertedType\n}\n\nexport function getAssertedValue<T>(name: string, value: T): NonNullable<T> {\n  if (value === undefined || value === null) {\n    throw Error(`Missing required ${name} value`)\n  }\n  return value\n}\n\nexport function getAssertedValues(args: { issuer: string | IIssuer; id: string; type?: StatusListTypeW3C | StatusListType }) {\n  const type = getAssertedStatusListType(args?.type)\n  const id = getAssertedValue('id', args.id)\n  const issuer = getAssertedValue('issuer', args.issuer)\n  return { id, issuer, type }\n}\n\nexport function getAssertedProperty<T extends object>(propertyName: string, obj: T): NonNullable<any> {\n  if (!(propertyName in obj)) {\n    throw Error(`The input object does not contain required property: ${propertyName}`)\n  }\n  return getAssertedValue(propertyName, (obj as any)[propertyName])\n}\n\nconst ValidProofTypeMap = new Map<StatusListType, CredentialProofFormat[]>([\n  [StatusListType.StatusList2021, ['jwt', 'lds']],\n  [StatusListType.OAuthStatusList, ['jwt', 'cbor']],\n  [StatusListType.BitstringStatusList, ['lds', 'vc+jwt']],\n])\n\nexport function assertValidProofType(type: StatusListType, proofFormat: CredentialProofFormat) {\n  const validProofTypes = ValidProofTypeMap.get(type)\n  if (!validProofTypes?.includes(proofFormat)) {\n    throw Error(`Invalid proof format '${proofFormat}' for status list type ${type}`)\n  }\n}\n\nexport function determineStatusListType(credential: StatusListCredential): StatusListType {\n  const proofFormat = determineProofFormat(credential)\n\n  switch (proofFormat) {\n    case 'jwt':\n      return determineJwtStatusListType(credential as string)\n    case 'lds':\n      return determineLdsStatusListType(credential)\n    case 'cbor':\n      return StatusListType.OAuthStatusList\n    default:\n      throw new Error('Cannot determine status list type from credential payload')\n  }\n}\n\nfunction determineJwtStatusListType(credential: string): StatusListType {\n  const payload: any = jwtDecode(credential)\n\n  // OAuth status list format\n  if ('status_list' in payload) {\n    return StatusListType.OAuthStatusList\n  }\n\n  // Direct credential subject\n  if ('credentialSubject' in payload) {\n    return getStatusListTypeFromSubject(payload.credentialSubject)\n  }\n\n  // Wrapped VC format\n  if ('vc' in payload && 'credentialSubject' in payload.vc) {\n    return getStatusListTypeFromSubject(payload.vc.credentialSubject)\n  }\n\n  throw new Error('Invalid status list credential: credentialSubject not found')\n}\n\nfunction determineLdsStatusListType(credential: StatusListCredential): StatusListType {\n  const uniform = CredentialMapper.toUniformCredential(credential)\n  const statusListType = uniform.type.find((type) => Object.values(StatusListType).some((statusType) => type.includes(statusType)))\n\n  if (!statusListType) {\n    throw new Error('Invalid status list credential type')\n  }\n\n  return statusListType.replace('Credential', '') as StatusListType\n}\n\nfunction getStatusListTypeFromSubject(credentialSubject: any): StatusListType {\n  switch (credentialSubject.type) {\n    case 'StatusList2021':\n      return StatusListType.StatusList2021\n    case 'BitstringStatusList':\n      return StatusListType.BitstringStatusList\n    default:\n      throw new Error(`Unknown credential subject type: ${credentialSubject.type}`)\n  }\n}\n\nexport function determineProofFormat(credential: StatusListCredential): CredentialProofFormat {\n  const type: DocumentFormat = CredentialMapper.detectDocumentType(credential)\n  switch (type) {\n    case DocumentFormat.JWT:\n      return 'jwt'\n    case DocumentFormat.MSO_MDOC:\n      // Not really mdoc, just assume Cbor for now, I'd need to decode at least the header to what type of Cbor we have\n      return 'cbor'\n    case DocumentFormat.JSONLD:\n      return 'lds'\n    default:\n      throw Error('Cannot determine credential payload type')\n  }\n}\n\n/**\n * Ensures a value is converted to a Date object if it's a valid date string,\n * otherwise returns the original value or undefined\n *\n * @param value - The value to convert to Date (can be Date, string, or undefined)\n * @returns Date object, undefined, or the original value if conversion fails\n */\nexport function ensureDate(value: Date | string | undefined): Date | undefined {\n  if (value === undefined || value === null) {\n    return undefined\n  }\n\n  if (value instanceof Date) {\n    return value\n  }\n\n  if (typeof value === 'string') {\n    if (value.trim() === '') {\n      return undefined\n    }\n\n    const date = new Date(value)\n    // Check if the date is valid\n    if (isNaN(date.getTime())) {\n      return undefined\n    }\n    return date\n  }\n\n  return undefined\n}\n","import type { IAgentContext, ProofFormat as VeramoProofFormat } from '@veramo/core'\nimport type { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution'\nimport {\n  CredentialMapper,\n  type CredentialProofFormat,\n  DocumentFormat,\n  type IIssuer,\n  type StatusListCredential,\n  StatusListCredentialIdMode,\n  StatusListType,\n} from '@sphereon/ssi-types'\n\nimport { StatusList } from '@sphereon/vc-status-list'\nimport type { IExtractedCredentialDetails, IStatusList, IStatusList2021ImplementationResult } from './IStatusList'\nimport type {\n  CheckStatusIndexArgs,\n  CreateStatusListArgs,\n  IMergeDetailsWithEntityArgs,\n  IToDetailsFromCredentialArgs,\n  StatusListResult,\n  UpdateStatusListFromEncodedListArgs,\n  UpdateStatusListIndexArgs,\n} from '../types'\nimport { Status2021, StatusList2021EntryCredentialStatus } from '../types'\nimport { assertValidProofType, getAssertedProperty, getAssertedValue, getAssertedValues } from '../utils'\nimport { IBitstringStatusListEntryEntity, IStatusListEntryEntity, StatusList2021Entity, StatusListEntity } from '@sphereon/ssi-sdk.data-store'\nimport { IVcdmCredentialPlugin } from '@sphereon/ssi-sdk.credential-vcdm'\n\nexport const DEFAULT_LIST_LENGTH = 250000\nexport const DEFAULT_PROOF_FORMAT = 'lds' as CredentialProofFormat\n\nexport class StatusList2021Implementation implements IStatusList {\n  async createNewStatusList(\n    args: CreateStatusListArgs,\n    context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>,\n  ): Promise<StatusListResult> {\n    const length = args?.length ?? DEFAULT_LIST_LENGTH\n    const proofFormat: CredentialProofFormat = args?.proofFormat ?? DEFAULT_PROOF_FORMAT\n    assertValidProofType(StatusListType.StatusList2021, proofFormat)\n    const veramoProofFormat: VeramoProofFormat = proofFormat as VeramoProofFormat\n\n    const { issuer, id } = args\n    const correlationId = getAssertedValue('correlationId', args.correlationId)\n\n    const list = new StatusList({ length })\n    const encodedList = await list.encode()\n    const statusPurpose = 'revocation'\n\n    const statusListCredential = await this.createVerifiableCredential(\n      {\n        ...args,\n        encodedList,\n        proofFormat: veramoProofFormat,\n      },\n      context,\n    )\n\n    return {\n      encodedList,\n      statusListCredential: statusListCredential,\n      statusList2021: {\n        statusPurpose,\n        indexingDirection: 'rightToLeft',\n        credentialIdMode: StatusListCredentialIdMode.ISSUANCE,\n      },\n      length,\n      type: StatusListType.StatusList2021,\n      proofFormat,\n      id,\n      correlationId,\n      issuer,\n      statuslistContentType: this.buildContentType(proofFormat),\n    }\n  }\n\n  async updateStatusListIndex(\n    args: UpdateStatusListIndexArgs,\n    context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>,\n  ): Promise<StatusListResult> {\n    const credential = args.statusListCredential\n    const uniform = CredentialMapper.toUniformCredential(credential)\n    const { issuer, credentialSubject } = uniform\n    const id = getAssertedValue('id', uniform.id)\n    const origEncodedList = getAssertedProperty('encodedList', credentialSubject)\n\n    const index = typeof args.statusListIndex === 'number' ? args.statusListIndex : parseInt(args.statusListIndex)\n    const statusList = await StatusList.decode({ encodedList: origEncodedList })\n    statusList.setStatus(index, args.value != 0)\n    const encodedList = await statusList.encode()\n\n    const proofFormat = CredentialMapper.detectDocumentType(credential) === DocumentFormat.JWT ? 'jwt' : 'lds'\n    const updatedCredential = await this.createVerifiableCredential(\n      {\n        ...args,\n        id,\n        issuer,\n        encodedList,\n        proofFormat: proofFormat,\n      },\n      context,\n    )\n\n    if (!('statusPurpose' in credentialSubject)) {\n      return Promise.reject(Error('statusPurpose is required in credentialSubject for StatusList2021'))\n    }\n\n    return {\n      statusListCredential: updatedCredential,\n      encodedList,\n      statusList2021: {\n        statusPurpose: credentialSubject.statusPurpose,\n        indexingDirection: 'rightToLeft',\n        credentialIdMode: StatusListCredentialIdMode.ISSUANCE,\n      },\n      length: statusList.length - 1,\n      type: StatusListType.StatusList2021,\n      proofFormat: proofFormat,\n      id,\n      issuer,\n      statuslistContentType: this.buildContentType(proofFormat),\n    }\n  }\n\n  async updateStatusListFromEncodedList(\n    args: UpdateStatusListFromEncodedListArgs,\n    context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>,\n  ): Promise<StatusListResult> {\n    if (!args.statusList2021) {\n      throw new Error('statusList2021 options required for type StatusList2021')\n    }\n    const proofFormat: CredentialProofFormat = args?.proofFormat ?? DEFAULT_PROOF_FORMAT\n    assertValidProofType(StatusListType.StatusList2021, proofFormat)\n    const veramoProofFormat: VeramoProofFormat = proofFormat as VeramoProofFormat\n\n    const { issuer, id } = getAssertedValues(args)\n    const statusList = await StatusList.decode({ encodedList: args.encodedList })\n    const index = typeof args.statusListIndex === 'number' ? args.statusListIndex : parseInt(args.statusListIndex)\n    statusList.setStatus(index, args.value !== 0)\n\n    const newEncodedList = await statusList.encode()\n    const credential = await this.createVerifiableCredential(\n      {\n        id,\n        issuer,\n        encodedList: newEncodedList,\n        proofFormat: veramoProofFormat,\n        keyRef: args.keyRef,\n      },\n      context,\n    )\n\n    return {\n      type: StatusListType.StatusList2021,\n      statusListCredential: credential,\n      encodedList: newEncodedList,\n      statusList2021: {\n        statusPurpose: args.statusList2021.statusPurpose,\n        indexingDirection: 'rightToLeft',\n        credentialIdMode: StatusListCredentialIdMode.ISSUANCE,\n      },\n      length: statusList.length,\n      proofFormat: args.proofFormat ?? 'lds',\n      id: id,\n      issuer: issuer,\n      statuslistContentType: this.buildContentType(proofFormat),\n    }\n  }\n\n  async checkStatusIndex(args: CheckStatusIndexArgs): Promise<number | Status2021> {\n    const uniform = CredentialMapper.toUniformCredential(args.statusListCredential)\n    const { credentialSubject } = uniform\n    const encodedList = getAssertedProperty('encodedList', credentialSubject)\n\n    const statusList = await StatusList.decode({ encodedList })\n    const status = statusList.getStatus(typeof args.statusListIndex === 'number' ? args.statusListIndex : parseInt(args.statusListIndex))\n    return status ? Status2021.Invalid : Status2021.Valid\n  }\n\n  /**\n   * Performs the initial parsing of a StatusListCredential.\n   * This method handles expensive operations like JWT/CWT decoding once.\n   * It extracts all details available from the credential payload itself.\n   */\n  async extractCredentialDetails(credential: StatusListCredential): Promise<IExtractedCredentialDetails> {\n    const uniform = CredentialMapper.toUniformCredential(credential)\n    const { issuer, credentialSubject } = uniform\n    const subject = Array.isArray(credentialSubject) ? credentialSubject[0] : credentialSubject\n\n    return {\n      id: getAssertedValue('id', uniform.id),\n      issuer,\n      encodedList: getAssertedProperty('encodedList', subject),\n    }\n  }\n\n  async toStatusListDetails(args: IToDetailsFromCredentialArgs): Promise<StatusListResult & IStatusList2021ImplementationResult>\n  // For UPDATE contexts\n  async toStatusListDetails(args: IMergeDetailsWithEntityArgs): Promise<StatusListResult & IStatusList2021ImplementationResult>\n  async toStatusListDetails(\n    args: IToDetailsFromCredentialArgs | IMergeDetailsWithEntityArgs,\n  ): Promise<StatusListResult & IStatusList2021ImplementationResult> {\n    if ('statusListCredential' in args) {\n      // CREATE/READ context\n      const { statusListCredential, correlationId, driverType } = args\n      const uniform = CredentialMapper.toUniformCredential(statusListCredential)\n      const { issuer, credentialSubject } = uniform\n      const subject = Array.isArray(credentialSubject) ? credentialSubject[0] : credentialSubject\n\n      const id = getAssertedValue('id', uniform.id)\n      const encodedList = getAssertedProperty('encodedList', subject)\n      const statusPurpose = getAssertedProperty('statusPurpose', subject)\n      const proofFormat: CredentialProofFormat = CredentialMapper.detectDocumentType(statusListCredential) === DocumentFormat.JWT ? 'jwt' : 'lds'\n      const list = await StatusList.decode({ encodedList })\n\n      return {\n        id,\n        encodedList,\n        issuer,\n        type: StatusListType.StatusList2021,\n        proofFormat,\n        length: list.length,\n        statusListCredential,\n        statuslistContentType: this.buildContentType(proofFormat),\n        correlationId,\n        driverType,\n        indexingDirection: 'rightToLeft',\n        statusPurpose,\n        statusList2021: {\n          indexingDirection: 'rightToLeft',\n          statusPurpose,\n          credentialIdMode: StatusListCredentialIdMode.ISSUANCE,\n        },\n      }\n    } else {\n      // UPDATE context\n      const { extractedDetails, statusListEntity } = args\n      const statusList2021Entity = statusListEntity as StatusList2021Entity\n\n      const proofFormat: CredentialProofFormat =\n        CredentialMapper.detectDocumentType(statusListEntity.statusListCredential!) === DocumentFormat.JWT ? 'jwt' : 'lds'\n      const list = await StatusList.decode({ encodedList: extractedDetails.encodedList })\n\n      return {\n        id: extractedDetails.id,\n        encodedList: extractedDetails.encodedList,\n        issuer: extractedDetails.issuer,\n        type: StatusListType.StatusList2021,\n        proofFormat,\n        length: list.length,\n        statusListCredential: statusListEntity.statusListCredential!,\n        statuslistContentType: this.buildContentType(proofFormat),\n        correlationId: statusListEntity.correlationId,\n        driverType: statusListEntity.driverType,\n        indexingDirection: statusList2021Entity.indexingDirection,\n        statusPurpose: statusList2021Entity.statusPurpose,\n        statusList2021: {\n          indexingDirection: statusList2021Entity.indexingDirection,\n          statusPurpose: statusList2021Entity.statusPurpose,\n          credentialIdMode: StatusListCredentialIdMode.ISSUANCE,\n        },\n      }\n    }\n  }\n\n  async createCredentialStatus(args: {\n    statusList: StatusListEntity\n    statusListEntry: IStatusListEntryEntity | IBitstringStatusListEntryEntity\n    statusListIndex: number\n  }): Promise<StatusList2021EntryCredentialStatus> {\n    const { statusList, statusListIndex } = args\n\n    // Cast to StatusList2021Entity to access specific properties\n    const statusList2021 = statusList as StatusList2021Entity\n\n    return {\n      id: `${statusList.id}#${statusListIndex}`,\n      type: 'StatusList2021Entry',\n      statusPurpose: statusList2021.statusPurpose ?? 'revocation',\n      statusListIndex: '' + statusListIndex,\n      statusListCredential: statusList.id,\n    }\n  }\n\n  private async createVerifiableCredential(\n    args: {\n      id: string\n      issuer: string | IIssuer\n      encodedList: string\n      proofFormat: VeramoProofFormat\n      keyRef?: string\n    },\n    context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>,\n  ): Promise<StatusListCredential> {\n    const identifier = await context.agent.identifierManagedGet({\n      identifier: typeof args.issuer === 'string' ? args.issuer : args.issuer.id,\n      vmRelationship: 'assertionMethod',\n      offlineWhenNoDIDRegistered: true,\n    })\n\n    const credential = {\n      '@context': ['https://www.w3.org/2018/credentials/v1', 'https://w3id.org/vc/status-list/2021/v1'],\n      id: args.id,\n      issuer: args.issuer,\n      type: ['VerifiableCredential', 'StatusList2021Credential'],\n      credentialSubject: {\n        id: args.id,\n        type: 'StatusList2021',\n        statusPurpose: 'revocation',\n        encodedList: args.encodedList,\n      },\n    }\n\n    const verifiableCredential = await context.agent.createVerifiableCredential({\n      credential,\n      keyRef: args.keyRef ?? identifier.kmsKeyRef,\n      proofFormat: args.proofFormat,\n      fetchRemoteContexts: true,\n    })\n\n    return CredentialMapper.toWrappedVerifiableCredential(verifiableCredential as StatusListCredential).original as StatusListCredential\n  }\n\n  private buildContentType(proofFormat: CredentialProofFormat | undefined) {\n    switch (proofFormat) {\n      case 'jwt':\n        return `application/statuslist+jwt`\n      case 'cbor':\n        return `application/statuslist+cwt`\n      case 'lds':\n        return 'application/statuslist+ld+json'\n      default:\n        throw Error(`Unsupported content type '${proofFormat}' for status lists`)\n    }\n  }\n}\n","import type { IAgentContext, IKeyManager } from '@veramo/core'\nimport { type CompactJWT, type CredentialProofFormat, type CWT, StatusListType } from '@sphereon/ssi-types'\nimport type {\n  CheckStatusIndexArgs,\n  CreateStatusListArgs,\n  IMergeDetailsWithEntityArgs,\n  IToDetailsFromCredentialArgs,\n  SignedStatusListData,\n  StatusListOAuthEntryCredentialStatus,\n  StatusListResult,\n  StatusOAuth,\n  UpdateStatusListFromEncodedListArgs,\n  UpdateStatusListIndexArgs,\n} from '../types'\nimport { determineProofFormat, ensureDate, getAssertedValue, getAssertedValues } from '../utils'\nimport type { IExtractedCredentialDetails, IOAuthStatusListImplementationResult, IStatusList } from './IStatusList'\nimport { StatusList } from '@sd-jwt/jwt-status-list'\nimport type { IJwtService } from '@sphereon/ssi-sdk-ext.jwt-service'\nimport type { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution'\nimport { createSignedJwt, decodeStatusListJWT } from './encoding/jwt'\nimport { createSignedCbor, decodeStatusListCWT } from './encoding/cbor'\nimport { IBitstringStatusListEntryEntity, IStatusListEntryEntity, OAuthStatusListEntity, StatusListEntity } from '@sphereon/ssi-sdk.data-store'\nimport { IVcdmCredentialPlugin } from '@sphereon/ssi-sdk.credential-vcdm'\n\ntype IRequiredContext = IAgentContext<IVcdmCredentialPlugin & IJwtService & IIdentifierResolution & IKeyManager>\n\nexport const DEFAULT_BITS_PER_STATUS = 1 // 1 bit is sufficient for 0x00 - \"VALID\" 0x01 - \"INVALID\" saving space in the process\nexport const DEFAULT_LIST_LENGTH = 250000\nexport const DEFAULT_PROOF_FORMAT = 'jwt' as CredentialProofFormat\n\nexport class OAuthStatusListImplementation implements IStatusList {\n  async createNewStatusList(args: CreateStatusListArgs, context: IRequiredContext): Promise<StatusListResult> {\n    if (!args.oauthStatusList) {\n      throw new Error('OAuthStatusList options are required for type OAuthStatusList')\n    }\n\n    const proofFormat = args?.proofFormat ?? DEFAULT_PROOF_FORMAT\n    const { issuer, id, oauthStatusList, keyRef } = args\n    const { bitsPerStatus } = oauthStatusList\n    const expiresAt = ensureDate(oauthStatusList.expiresAt)\n    const length = args.length ?? DEFAULT_LIST_LENGTH\n    const issuerString = typeof issuer === 'string' ? issuer : issuer.id\n    const correlationId = getAssertedValue('correlationId', args.correlationId)\n\n    const statusList = new StatusList(new Array(length).fill(0), bitsPerStatus ?? DEFAULT_BITS_PER_STATUS)\n    const encodedList = statusList.compressStatusList()\n    const { statusListCredential } = await this.createSignedStatusList(proofFormat, context, statusList, issuerString, id, expiresAt, keyRef)\n\n    return {\n      encodedList,\n      statusListCredential,\n      oauthStatusList: { bitsPerStatus },\n      length,\n      type: StatusListType.OAuthStatusList,\n      proofFormat,\n      id,\n      correlationId,\n      issuer,\n      statuslistContentType: this.buildContentType(proofFormat),\n    }\n  }\n\n  async updateStatusListIndex(args: UpdateStatusListIndexArgs, context: IRequiredContext): Promise<StatusListResult> {\n    const { statusListCredential, value, keyRef } = args\n    const expiresAt = ensureDate(args.expiresAt)\n    if (typeof statusListCredential !== 'string') {\n      return Promise.reject('statusListCredential in neither JWT nor CWT')\n    }\n\n    const proofFormat = determineProofFormat(statusListCredential)\n    const decoded = proofFormat === 'jwt' ? decodeStatusListJWT(statusListCredential) : decodeStatusListCWT(statusListCredential)\n    const { statusList, issuer, id } = decoded\n\n    const index = typeof args.statusListIndex === 'number' ? args.statusListIndex : parseInt(args.statusListIndex)\n    if (index < 0 || index >= statusList.statusList.length) {\n      throw new Error('Status list index out of bounds')\n    }\n\n    if (typeof value !== 'number') {\n      throw new Error('Status list values should be of type number')\n    }\n\n    statusList.setStatus(index, value)\n    const { statusListCredential: signedCredential, encodedList } = await this.createSignedStatusList(\n      proofFormat,\n      context,\n      statusList,\n      issuer,\n      id,\n      expiresAt,\n      keyRef,\n    )\n\n    return {\n      statusListCredential: signedCredential,\n      encodedList,\n      oauthStatusList: {\n        bitsPerStatus: statusList.getBitsPerStatus(),\n      },\n      length: statusList.statusList.length,\n      type: StatusListType.OAuthStatusList,\n      proofFormat,\n      id,\n      issuer,\n      statuslistContentType: this.buildContentType(proofFormat),\n    }\n  }\n\n  // FIXME: This still assumes only two values (boolean), whilst this list supports 8 bits max\n  async updateStatusListFromEncodedList(args: UpdateStatusListFromEncodedListArgs, context: IRequiredContext): Promise<StatusListResult> {\n    if (!args.oauthStatusList) {\n      throw new Error('OAuthStatusList options are required for type OAuthStatusList')\n    }\n    const { proofFormat, oauthStatusList, keyRef } = args\n    const { bitsPerStatus } = oauthStatusList\n    const expiresAt = ensureDate(oauthStatusList.expiresAt)\n\n    const { issuer, id } = getAssertedValues(args)\n    const issuerString = typeof issuer === 'string' ? issuer : issuer.id\n\n    const listToUpdate = StatusList.decompressStatusList(args.encodedList, bitsPerStatus ?? DEFAULT_BITS_PER_STATUS)\n    const index = typeof args.statusListIndex === 'number' ? args.statusListIndex : parseInt(args.statusListIndex)\n    listToUpdate.setStatus(index, args.value)\n\n    const { statusListCredential, encodedList } = await this.createSignedStatusList(\n      proofFormat ?? DEFAULT_PROOF_FORMAT,\n      context,\n      listToUpdate,\n      issuerString,\n      id,\n      expiresAt,\n      keyRef,\n    )\n\n    return {\n      encodedList,\n      statusListCredential,\n      oauthStatusList: {\n        bitsPerStatus,\n        expiresAt,\n      },\n      length: listToUpdate.statusList.length,\n      type: StatusListType.OAuthStatusList,\n      proofFormat: proofFormat ?? DEFAULT_PROOF_FORMAT,\n      id,\n      issuer,\n      statuslistContentType: this.buildContentType(proofFormat),\n    }\n  }\n\n  async checkStatusIndex(args: CheckStatusIndexArgs): Promise<number | StatusOAuth> {\n    const { statusListCredential, statusListIndex } = args\n    if (typeof statusListCredential !== 'string') {\n      return Promise.reject('statusListCredential in neither JWT nor CWT')\n    }\n\n    const proofFormat = determineProofFormat(statusListCredential)\n    const { statusList } = proofFormat === 'jwt' ? decodeStatusListJWT(statusListCredential) : decodeStatusListCWT(statusListCredential)\n\n    const index = typeof statusListIndex === 'number' ? statusListIndex : parseInt(statusListIndex)\n    if (index < 0 || index >= statusList.statusList.length) {\n      throw new Error(`Status list index out of bounds, has ${statusList.statusList.length} items, requested ${index}`)\n    }\n\n    return statusList.getStatus(index)\n  }\n\n  /**\n   * Performs the initial parsing of a StatusListCredential.\n   * This method handles expensive operations like JWT/CWT decoding once.\n   * It extracts all details available from the credential payload itself.\n   */\n  async extractCredentialDetails(credential: CompactJWT | CWT): Promise<IExtractedCredentialDetails> {\n    if (typeof credential !== 'string') {\n      return Promise.reject('statusListCredential must be a JWT or CWT string')\n    }\n\n    const proofFormat = determineProofFormat(credential)\n    const decoded = proofFormat === 'jwt' ? decodeStatusListJWT(credential) : decodeStatusListCWT(credential)\n\n    return {\n      id: decoded.id,\n      issuer: decoded.issuer,\n      encodedList: decoded.statusList.compressStatusList(),\n      decodedPayload: decoded,\n    }\n  }\n\n  // For CREATE and READ contexts\n  async toStatusListDetails(args: IToDetailsFromCredentialArgs): Promise<StatusListResult & IOAuthStatusListImplementationResult>\n  // For UPDATE contexts\n  async toStatusListDetails(args: IMergeDetailsWithEntityArgs): Promise<StatusListResult & IOAuthStatusListImplementationResult>\n  async toStatusListDetails(\n    args: IToDetailsFromCredentialArgs | IMergeDetailsWithEntityArgs,\n  ): Promise<StatusListResult & IOAuthStatusListImplementationResult> {\n    if ('statusListCredential' in args) {\n      // CREATE/READ context\n      const { statusListCredential, bitsPerStatus, correlationId, driverType } = args\n      if (!bitsPerStatus || bitsPerStatus < 1) {\n        return Promise.reject(Error('bitsPerStatus must be set for OAuth status lists and must be 1 or higher'))\n      }\n\n      const proofFormat = determineProofFormat(statusListCredential as string)\n      const decoded =\n        proofFormat === 'jwt' ? decodeStatusListJWT(statusListCredential as string) : decodeStatusListCWT(statusListCredential as string)\n      const { statusList, issuer, id, exp } = decoded\n      const expiresAt = exp ? new Date(exp * 1000) : undefined\n\n      return {\n        id,\n        encodedList: statusList.compressStatusList(),\n        issuer,\n        type: StatusListType.OAuthStatusList,\n        proofFormat,\n        length: statusList.statusList.length,\n        statusListCredential: statusListCredential as CompactJWT | CWT,\n        statuslistContentType: this.buildContentType(proofFormat),\n        correlationId,\n        driverType,\n        bitsPerStatus,\n        ...(expiresAt && { expiresAt }),\n        oauthStatusList: {\n          bitsPerStatus,\n          ...(expiresAt && { expiresAt }),\n        },\n      }\n    } else {\n      // UPDATE context\n      const { extractedDetails, statusListEntity } = args\n      const oauthEntity = statusListEntity as OAuthStatusListEntity\n      const decoded = extractedDetails.decodedPayload as { statusList: StatusList; exp?: number }\n\n      const proofFormat = determineProofFormat(statusListEntity.statusListCredential as string)\n      const expiresAt = decoded.exp ? new Date(decoded.exp * 1000) : undefined\n\n      return {\n        id: extractedDetails.id,\n        encodedList: extractedDetails.encodedList,\n        issuer: extractedDetails.issuer,\n        type: StatusListType.OAuthStatusList,\n        proofFormat,\n        length: decoded.statusList.statusList.length,\n        statusListCredential: statusListEntity.statusListCredential!,\n        statuslistContentType: this.buildContentType(proofFormat),\n        correlationId: statusListEntity.correlationId,\n        driverType: statusListEntity.driverType,\n        bitsPerStatus: oauthEntity.bitsPerStatus,\n        ...(expiresAt && { expiresAt }),\n        oauthStatusList: {\n          bitsPerStatus: oauthEntity.bitsPerStatus,\n          ...(expiresAt && { expiresAt }),\n        },\n      }\n    }\n  }\n\n  async createCredentialStatus(args: {\n    statusList: StatusListEntity\n    statusListEntry: IStatusListEntryEntity | IBitstringStatusListEntryEntity\n    statusListIndex: number\n  }): Promise<StatusListOAuthEntryCredentialStatus> {\n    const { statusList, statusListIndex } = args\n\n    // Cast to OAuthStatusListEntity to access specific properties\n    const oauthStatusList = statusList as OAuthStatusListEntity\n\n    return {\n      id: `${statusList.id}#${statusListIndex}`,\n      type: 'OAuthStatusListEntry',\n      bitsPerStatus: oauthStatusList.bitsPerStatus,\n      statusListIndex: '' + statusListIndex,\n      statusListCredential: statusList.id,\n      expiresAt: oauthStatusList.expiresAt,\n    }\n  }\n\n  private buildContentType(proofFormat: CredentialProofFormat | undefined) {\n    return `application/statuslist+${proofFormat === 'cbor' ? 'cwt' : 'jwt'}`\n  }\n\n  private async createSignedStatusList(\n    proofFormat: CredentialProofFormat,\n    context: IAgentContext<IVcdmCredentialPlugin & IJwtService & IIdentifierResolution & IKeyManager>,\n    statusList: StatusList,\n    issuerString: string,\n    id: string,\n    expiresAt?: Date,\n    keyRef?: string,\n  ): Promise<SignedStatusListData> {\n    switch (proofFormat) {\n      case 'jwt': {\n        return await createSignedJwt(context, statusList, issuerString, id, expiresAt, keyRef)\n      }\n      case 'cbor': {\n        return await createSignedCbor(context, statusList, issuerString, id, expiresAt, keyRef)\n      }\n      default:\n        throw new Error(`Invalid proof format '${proofFormat}' for OAuthStatusList`)\n    }\n  }\n}\n","import { type CompactJWT, JoseSignatureAlgorithm } from '@sphereon/ssi-types'\nimport { createHeaderAndPayload, StatusList, type StatusListJWTHeaderParameters, type StatusListJWTPayload } from '@sd-jwt/jwt-status-list'\nimport base64url from 'base64url'\nimport type { JWTPayload } from 'did-jwt'\nimport type { IRequiredContext, SignedStatusListData } from '../../types'\nimport { type DecodedStatusListPayload, resolveIdentifier } from './common'\nimport type { TKeyType } from '@veramo/core'\nimport { ensureManagedIdentifierResult } from '@sphereon/ssi-sdk-ext.identifier-resolution'\n\nconst STATUS_LIST_JWT_TYP = 'statuslist+jwt'\n\nexport const createSignedJwt = async (\n  context: IRequiredContext,\n  statusList: StatusList,\n  issuerString: string,\n  id: string,\n  expiresAt?: Date,\n  keyRef?: string,\n): Promise<SignedStatusListData> => {\n  const identifier = await resolveIdentifier(context, issuerString, keyRef)\n  const resolution = await ensureManagedIdentifierResult(identifier, context)\n\n  const payload: JWTPayload = {\n    iss: issuerString,\n    sub: id,\n    iat: Math.floor(Date.now() / 1000),\n    ...(expiresAt && { exp: Math.floor(expiresAt.getTime() / 1000) }),\n  }\n\n  const header: StatusListJWTHeaderParameters = {\n    alg: getSigningAlgo(resolution.key.type),\n    typ: STATUS_LIST_JWT_TYP,\n  }\n  const values = createHeaderAndPayload(statusList, payload, header)\n  const signedJwt = await context.agent.jwtCreateJwsCompactSignature({\n    issuer: { ...identifier, noIssPayloadUpdate: false },\n    protectedHeader: values.header,\n    payload: values.payload,\n  })\n\n  return {\n    statusListCredential: signedJwt.jwt,\n    encodedList: (values.payload as StatusListJWTPayload).status_list.lst,\n  }\n}\n\nexport const decodeStatusListJWT = (jwt: CompactJWT): DecodedStatusListPayload => {\n  const [, payloadBase64] = jwt.split('.')\n  const payload = JSON.parse(base64url.decode(payloadBase64))\n\n  if (!payload.iss || !payload.sub || !payload.status_list) {\n    throw new Error('Missing required fields in JWT payload')\n  }\n\n  const statusList = StatusList.decompressStatusList(payload.status_list.lst, payload.status_list.bits)\n\n  return {\n    issuer: payload.iss,\n    id: payload.sub,\n    statusList,\n    exp: payload.exp,\n    ttl: payload.ttl,\n    iat: payload.iat,\n  }\n}\n\nexport const getSigningAlgo = (type: TKeyType): JoseSignatureAlgorithm => {\n  switch (type) {\n    case 'Ed25519':\n      return JoseSignatureAlgorithm.EdDSA\n    case 'Secp256k1':\n      return JoseSignatureAlgorithm.ES256K\n    case 'Secp256r1':\n      return JoseSignatureAlgorithm.ES256\n    case 'RSA':\n      return JoseSignatureAlgorithm.RS256\n    default:\n      throw Error('Key type not yet supported')\n  }\n}\n","import type { IRequiredContext } from '../../types'\nimport { StatusList } from '@sd-jwt/jwt-status-list'\n\nexport interface DecodedStatusListPayload {\n  issuer: string\n  id: string\n  statusList: StatusList\n  exp?: number\n  ttl?: number\n  iat: number\n}\n\nexport const resolveIdentifier = async (context: IRequiredContext, issuer: string, keyRef?: string) => {\n  return await context.agent.identifierManagedGet({\n    identifier: issuer,\n    vmRelationship: 'assertionMethod',\n    offlineWhenNoDIDRegistered: true,\n    ...(keyRef && { kmsKeyRef: keyRef }), // TODO the getDid resolver should look at this ASAP\n  })\n}\n","import type { BitsPerStatus } from '@sd-jwt/jwt-status-list'\nimport { StatusList } from '@sd-jwt/jwt-status-list'\nimport { deflate, inflate } from 'pako'\n\nimport mdocPkg from '@sphereon/kmp-mdoc-core'\nconst { com, kotlin } = mdocPkg\n\nimport base64url from 'base64url'\nimport type { IRequiredContext, SignedStatusListData } from '../../types'\nimport { type DecodedStatusListPayload, resolveIdentifier } from './common'\n\nexport type IKey = mdocPkg.com.sphereon.crypto.IKey\nexport type CborItem<T> = mdocPkg.com.sphereon.cbor.CborItem<T>\nexport const CborByteString = mdocPkg.com.sphereon.cbor.CborByteString\nexport type CborByteStringType = mdocPkg.com.sphereon.cbor.CborByteString\nexport const CborUInt = mdocPkg.com.sphereon.cbor.CborUInt\nexport type CborUIntType = mdocPkg.com.sphereon.cbor.CborUInt\nexport const CborString = mdocPkg.com.sphereon.cbor.CborString\nexport type CborStringType = mdocPkg.com.sphereon.cbor.CborString\n\n// const cbor = cborpkg.com.sphereon.cbor\n// const kmp = cborpkg. mdoc.com.sphereon.kmp\n// const kotlin = cborpkg.kotlin\nconst decompressRawStatusList = (StatusList as any).decodeStatusList.bind(StatusList)\n\nconst CWT_CLAIMS = {\n  SUBJECT: 2,\n  ISSUER: 1,\n  ISSUED_AT: 6,\n  EXPIRATION: 4,\n  TIME_TO_LIVE: 65534,\n  STATUS_LIST: 65533,\n} as const\n\nexport const createSignedCbor = async (\n  context: IRequiredContext,\n  statusList: StatusList,\n  issuerString: string,\n  id: string,\n  expiresAt?: Date,\n  keyRef?: string,\n): Promise<SignedStatusListData> => {\n  const identifier = await resolveIdentifier(context, issuerString, keyRef)\n\n  const encodeStatusList = statusList.encodeStatusList()\n  const compressedList = deflate(encodeStatusList, { level: 9 })\n  const compressedBytes = new Int8Array(compressedList)\n\n  const statusListMap = new com.sphereon.cbor.CborMap(\n    kotlin.collections.KtMutableMap.fromJsMap(\n      new Map<CborStringType, CborItem<any>>([\n        [\n          new com.sphereon.cbor.CborString('bits'),\n          new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(statusList.getBitsPerStatus())),\n        ],\n        [new com.sphereon.cbor.CborString('lst'), new com.sphereon.cbor.CborByteString(compressedBytes)],\n      ]),\n    ),\n  )\n\n  const protectedHeader = new com.sphereon.cbor.CborMap(\n    kotlin.collections.KtMutableMap.fromJsMap(\n      new Map([[new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(16)), new com.sphereon.cbor.CborString('statuslist+cwt')]]), // \"type\"\n    ),\n  )\n  const protectedHeaderEncoded = com.sphereon.cbor.Cbor.encode(protectedHeader)\n  const claimsMap = buildClaimsMap(id, issuerString, statusListMap, expiresAt)\n  const claimsEncoded: Int8Array = com.sphereon.cbor.Cbor.encode(claimsMap)\n\n  const signedCWT: string = await context.agent.keyManagerSign({\n    keyRef: identifier.kmsKeyRef,\n    data: base64url.encode(Buffer.from(claimsEncoded)), // TODO test on RN\n    encoding: undefined,\n  })\n\n  const protectedHeaderEncodedInt8 = new Int8Array(protectedHeaderEncoded)\n  const claimsEncodedInt8 = new Int8Array(claimsEncoded)\n  const signatureBytes = base64url.decode(signedCWT)\n  const signatureInt8 = new Int8Array(Buffer.from(signatureBytes))\n\n  const cwtArrayElements: Array<CborItem<any>> = [\n    new CborByteString(protectedHeaderEncodedInt8),\n    new CborByteString(claimsEncodedInt8),\n    new CborByteString(signatureInt8),\n  ]\n  const cwtArray = new com.sphereon.cbor.CborArray(kotlin.collections.KtMutableList.fromJsArray(cwtArrayElements))\n  const cwtEncoded = com.sphereon.cbor.Cbor.encode(cwtArray)\n  const cwtBuffer = Buffer.from(cwtEncoded)\n  return {\n    statusListCredential: base64url.encode(cwtBuffer),\n    encodedList: base64url.encode(compressedList as Buffer), // JS in @sd-jwt/jwt-status-list drops it in like this, so keep the same method\n  }\n}\n\nfunction buildClaimsMap(\n  id: string,\n  issuerString: string,\n  statusListMap: mdocPkg.com.sphereon.cbor.CborMap<CborStringType, CborItem<any>>,\n  expiresAt?: Date,\n) {\n  const ttl = 65535 // FIXME figure out what value should be / come from and what the difference is with exp\n  const claimsEntries: Array<[CborUIntType, CborItem<any>]> = [\n    [new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.SUBJECT)), new com.sphereon.cbor.CborString(id)], // \"sub\"\n    [new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.ISSUER)), new com.sphereon.cbor.CborString(issuerString)], // \"iss\"\n    [\n      new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.ISSUED_AT)),\n      new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(Math.floor(Date.now() / 1000))), // \"iat\"\n    ],\n  ]\n\n  if (expiresAt) {\n    claimsEntries.push([\n      new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.EXPIRATION)),\n      new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(Math.floor(expiresAt.getTime() / 1000))), // \"exp\"\n    ])\n  }\n\n  if (ttl) {\n    claimsEntries.push([\n      new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.TIME_TO_LIVE)),\n      new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(ttl)), // \"time to live\"\n    ])\n  }\n\n  claimsEntries.push([new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.STATUS_LIST)), statusListMap])\n\n  const claimsMap = new com.sphereon.cbor.CborMap(kotlin.collections.KtMutableMap.fromJsMap(new Map(claimsEntries)))\n  return claimsMap\n}\n\nconst getCborValueFromMap = <T>(map: Map<CborItem<any>, CborItem<any>>, key: number): T => {\n  const value = getCborOptionalValueFromMap<T>(map, key)\n  if (value === undefined) {\n    throw new Error(`Required claim ${key} not found`)\n  }\n  return value\n}\n\nconst getCborOptionalValueFromMap = <T>(map: Map<CborItem<any>, CborItem<any>>, key: number): T | undefined | never => {\n  const value = map.get(new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(key)))\n  if (!value) {\n    return undefined\n  }\n  return value.value as T\n}\n\nexport const decodeStatusListCWT = (cwt: string): DecodedStatusListPayload => {\n  const encodedCbor = base64url.toBuffer(cwt)\n  const encodedCborArray = new Int8Array(encodedCbor)\n  const decodedCbor = com.sphereon.cbor.Cbor.decode(encodedCborArray)\n\n  if (!(decodedCbor instanceof com.sphereon.cbor.CborArray)) {\n    throw new Error('Invalid CWT format: Expected a CBOR array')\n  }\n\n  const [, payload] = decodedCbor.value.asJsArrayView()\n  if (!(payload instanceof com.sphereon.cbor.CborByteString)) {\n    throw new Error('Invalid payload format: Expected a CBOR ByteString')\n  }\n\n  const claims = com.sphereon.cbor.Cbor.decode(payload.value)\n  if (!(claims instanceof com.sphereon.cbor.CborMap)) {\n    throw new Error('Invalid claims format: Expected a CBOR map')\n  }\n\n  const claimsMap = claims.value.asJsMapView()\n\n  const statusListMap = claimsMap.get(new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(65533))).value.asJsMapView()\n\n  const bits = Number(statusListMap.get(new CborString('bits')).value) as BitsPerStatus\n  const decoded = new Uint8Array(statusListMap.get(new CborString('lst')).value)\n  const uint8Array = inflate(decoded)\n  const rawStatusList = decompressRawStatusList(uint8Array, bits)\n  const statusList = new StatusList(rawStatusList, bits)\n\n  return {\n    issuer: getCborValueFromMap<string>(claimsMap, CWT_CLAIMS.ISSUER),\n    id: getCborValueFromMap<string>(claimsMap, CWT_CLAIMS.SUBJECT),\n    statusList,\n    iat: Number(getCborValueFromMap<number>(claimsMap, CWT_CLAIMS.ISSUED_AT)),\n    exp: getCborOptionalValueFromMap<number>(claimsMap, CWT_CLAIMS.EXPIRATION),\n    ttl: getCborOptionalValueFromMap<number>(claimsMap, CWT_CLAIMS.TIME_TO_LIVE),\n  }\n}\n","import type { IStatusList } from './IStatusList'\nimport { StatusList2021Implementation } from './StatusList2021'\nimport { OAuthStatusListImplementation } from './OAuthStatusList'\nimport { StatusListType } from '@sphereon/ssi-types'\nimport { BitstringStatusListImplementation } from './BitstringStatusListImplementation'\n\nexport class StatusListFactory {\n  private static instance: StatusListFactory\n  private implementations: Map<StatusListType, IStatusList>\n\n  private constructor() {\n    this.implementations = new Map()\n    this.implementations.set(StatusListType.StatusList2021, new StatusList2021Implementation())\n    this.implementations.set(StatusListType.OAuthStatusList, new OAuthStatusListImplementation())\n    this.implementations.set(StatusListType.BitstringStatusList, new BitstringStatusListImplementation())\n  }\n\n  public static getInstance(): StatusListFactory {\n    if (!StatusListFactory.instance) {\n      StatusListFactory.instance = new StatusListFactory()\n    }\n    return StatusListFactory.instance\n  }\n\n  public getByType(type: StatusListType): IStatusList {\n    const statusList = this.implementations.get(type)\n    if (!statusList) {\n      throw new Error(`No implementation found for status list type: ${type}`)\n    }\n    return statusList\n  }\n}\n\nexport function getStatusListImplementation(type: StatusListType): IStatusList {\n  return StatusListFactory.getInstance().getByType(type)\n}\n","/**\n * Bitstring Status List Implementation\n *\n * This module implements the W3C Bitstring Status List specification for managing\n * credential status information. It provides functionality to create, update, and\n * check the status of verifiable credentials using compressed bitstring status lists.\n *\n * Key features:\n * - Create new bitstring status lists with configurable purposes and bit sizes\n * - Update individual credential status entries in existing lists\n * - Check the status of specific credentials by index\n * - Support for multiple proof formats (JWT, LDS, CBOR)\n * - Integration with Veramo agent context for credential signing\n *\n * @author Sphereon International B.V.\n * @since 2024\n */\n\nimport type { IAgentContext } from '@veramo/core'\nimport type { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution'\n\nimport {\n  CredentialMapper,\n  type CredentialProofFormat,\n  DocumentFormat,\n  type IIssuer,\n  type StatusListCredential,\n  StatusListType,\n} from '@sphereon/ssi-types'\n\nimport type { IBitstringStatusListImplementationResult, IExtractedCredentialDetails, IStatusList } from './IStatusList'\nimport {\n  CheckStatusIndexArgs,\n  CreateStatusListArgs,\n  IMergeDetailsWithEntityArgs,\n  IToDetailsFromCredentialArgs,\n  StatusListResult,\n  UpdateStatusListFromEncodedListArgs,\n  UpdateStatusListIndexArgs,\n} from '../types'\n\nimport { assertValidProofType, ensureDate, getAssertedProperty, getAssertedValue, getAssertedValues } from '../utils'\nimport { BitstringStatusListCredential } from '../types/BitstringStatusList'\nimport {\n  BitstreamStatusList,\n  BitstringStatusListCredentialUnsigned,\n  BitstringStatusPurpose,\n  createStatusListCredential,\n} from '@4sure-tech/vc-bitstring-status-lists'\nimport {\n  BitstringStatusListEntity,\n  BitstringStatusListEntryCredentialStatus,\n  IBitstringStatusListEntryEntity,\n  IStatusListEntryEntity,\n  StatusListEntity,\n} from '@sphereon/ssi-sdk.data-store'\nimport { IVcdmCredentialPlugin } from '@sphereon/ssi-sdk.credential-vcdm'\n\nexport const DEFAULT_LIST_LENGTH = 131072 // W3C spec minimum\nexport const DEFAULT_PROOF_FORMAT = 'vc+jwt' as CredentialProofFormat\nexport const DEFAULT_STATUS_PURPOSE: BitstringStatusPurpose = 'revocation'\n\n/**\n * Implementation of the IStatusList interface for W3C Bitstring Status Lists\n *\n * This class handles the creation, updating, and verification of bitstring status lists\n * according to the W3C Bitstring Status List specification. It supports multiple\n * status purposes (revocation, suspension, etc.) and various proof formats.\n */\nexport class BitstringStatusListImplementation implements IStatusList {\n  /**\n   * Creates a new bitstring status list with the specified configuration\n   *\n   * @param args - Configuration for the new status list including issuer, purpose, and size\n   * @param context - Veramo agent context for credential operations\n   * @returns Promise resolving to the created status list details\n   */\n  async createNewStatusList(\n    args: CreateStatusListArgs,\n    context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>,\n  ): Promise<StatusListResult> {\n    if (!args.bitstringStatusList) {\n      throw new Error('BitstringStatusList options are required for type BitstringStatusList')\n    }\n\n    const length = args?.length ?? DEFAULT_LIST_LENGTH\n    const proofFormat: CredentialProofFormat = args?.proofFormat ?? DEFAULT_PROOF_FORMAT\n    assertValidProofType(StatusListType.BitstringStatusList, proofFormat)\n\n    const { issuer, id } = args\n    const correlationId = getAssertedValue('correlationId', args.correlationId)\n    const { statusPurpose, bitsPerStatus, validFrom, validUntil, ttl } = args.bitstringStatusList\n\n    const unsignedCredential: BitstringStatusListCredentialUnsigned = await createStatusListCredential({\n      id,\n      issuer,\n      statusPurpose: statusPurpose ?? DEFAULT_STATUS_PURPOSE,\n      validFrom: ensureDate(validFrom),\n      validUntil: ensureDate(validUntil),\n      ttl,\n    })\n    const statusListCredential = await this.createVerifiableCredential(\n      {\n        unsignedCredential,\n        id,\n        issuer,\n        proofFormat,\n        keyRef: args.keyRef,\n      },\n      context,\n    )\n\n    return {\n      encodedList: unsignedCredential.credentialSubject.encodedList,\n      statusListCredential,\n      bitstringStatusList: {\n        statusPurpose: statusPurpose ?? DEFAULT_STATUS_PURPOSE,\n        ...(unsignedCredential.validFrom && { validFrom: new Date(unsignedCredential.validFrom) }),\n        ...(unsignedCredential.validUntil && { validUntil: new Date(unsignedCredential.validUntil) }),\n        ttl,\n        bitsPerStatus,\n      },\n      length,\n      type: StatusListType.BitstringStatusList,\n      proofFormat,\n      id,\n      correlationId,\n      issuer,\n      statuslistContentType: this.buildContentType(proofFormat),\n    }\n  }\n\n  /**\n   * Updates the status of a specific credential in an existing status list\n   *\n   * @param args - Update parameters including the status list credential, index, and new value\n   * @param context - Veramo agent context for credential operations\n   * @returns Promise resolving to the updated status list details\n   */\n  async updateStatusListIndex(\n    args: UpdateStatusListIndexArgs,\n    context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>,\n  ): Promise<StatusListResult> {\n    if (!args.bitsPerStatus || args.bitsPerStatus < 1) {\n      return Promise.reject(Error('bitsPerStatus must be set for bitstring status lists and must be 1 or higher. (updateStatusListIndex)'))\n    }\n\n    const credential = args.statusListCredential\n    const uniform = CredentialMapper.toUniformCredential(credential)\n    const { issuer, credentialSubject } = uniform\n    const id = getAssertedValue('id', uniform.id)\n    const origEncodedList = getAssertedProperty('encodedList', credentialSubject)\n\n    const index = typeof args.statusListIndex === 'number' ? args.statusListIndex : parseInt(args.statusListIndex)\n    const statusList: BitstreamStatusList = await BitstreamStatusList.decode({ encodedList: origEncodedList, statusSize: args.bitsPerStatus })\n    const bitstringStatusId = args.value as number\n    statusList.setStatus(index, bitstringStatusId)\n\n    const proofFormat = CredentialMapper.detectDocumentType(credential) === DocumentFormat.JWT ? 'vc+jwt' : 'lds'\n\n    const credSubject = Array.isArray(credentialSubject) ? credentialSubject[0] : credentialSubject\n\n    const statusPurpose = getAssertedProperty('statusPurpose', credSubject)\n\n    const validFrom = uniform.validFrom ? new Date(uniform.validFrom) : undefined\n    const validUntil = uniform.validUntil ? new Date(uniform.validUntil) : undefined\n    const ttl = credSubject.ttl\n\n    const unsignedCredential: BitstringStatusListCredentialUnsigned = await createStatusListCredential({\n      id,\n      issuer,\n      statusList,\n      statusPurpose: statusPurpose ?? DEFAULT_STATUS_PURPOSE,\n      validFrom: ensureDate(validFrom),\n      validUntil: ensureDate(validUntil),\n      ttl,\n    })\n\n    const updatedCredential = await this.createVerifiableCredential(\n      {\n        unsignedCredential,\n        id,\n        issuer,\n        proofFormat,\n        keyRef: args.keyRef,\n      },\n      context,\n    )\n\n    return {\n      statusListCredential: updatedCredential,\n      encodedList: unsignedCredential.credentialSubject.encodedList,\n      bitstringStatusList: {\n        statusPurpose,\n        ...(unsignedCredential.validFrom && { validFrom: new Date(unsignedCredential.validFrom) }),\n        ...(unsignedCredential.validUntil && { validUntil: new Date(unsignedCredential.validUntil) }),\n        bitsPerStatus: args.bitsPerStatus,\n        ttl,\n      },\n      length: statusList.getLength(),\n      type: StatusListType.BitstringStatusList,\n      proofFormat,\n      id,\n      issuer,\n      statuslistContentType: this.buildContentType(proofFormat),\n    }\n  }\n\n  /**\n   * Updates a status list by decoding an encoded list, modifying it, and re-encoding\n   *\n   * @param args - Update parameters including encoded list, index, and new value\n   * @param context - Veramo agent context for credential operations\n   * @returns Promise resolving to the updated status list details\n   */\n  async updateStatusListFromEncodedList(\n    args: UpdateStatusListFromEncodedListArgs,\n    context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>,\n  ): Promise<StatusListResult> {\n    if (!args.bitstringStatusList) {\n      throw new Error('bitstringStatusList options required for type BitstringStatusList')\n    }\n\n    if (args.bitstringStatusList.bitsPerStatus < 1) {\n      return Promise.reject(Error('bitsPerStatus must be set for bitstring status lists and must be 1 or higher. (updateStatusListFromEncodedList)'))\n    }\n\n    const { statusPurpose, bitsPerStatus, ttl, validFrom, validUntil } = args.bitstringStatusList\n\n    const proofFormat: CredentialProofFormat = args?.proofFormat ?? DEFAULT_PROOF_FORMAT\n    assertValidProofType(StatusListType.BitstringStatusList, proofFormat)\n\n    const { issuer, id } = getAssertedValues(args)\n    const statusList: BitstreamStatusList = await BitstreamStatusList.decode({ encodedList: args.encodedList, statusSize: bitsPerStatus })\n    const index = typeof args.statusListIndex === 'number' ? args.statusListIndex : parseInt(args.statusListIndex)\n    statusList.setStatus(index, args.value)\n\n    const unsignedCredential: BitstringStatusListCredentialUnsigned = await createStatusListCredential({\n      id,\n      issuer,\n      statusList,\n      statusPurpose: statusPurpose ?? DEFAULT_STATUS_PURPOSE,\n      validFrom: ensureDate(validFrom),\n      validUntil: ensureDate(validUntil),\n      ttl,\n    })\n\n    const credential = await this.createVerifiableCredential(\n      {\n        unsignedCredential,\n        id,\n        issuer,\n        proofFormat,\n        keyRef: args.keyRef,\n      },\n      context,\n    )\n\n    return {\n      type: StatusListType.BitstringStatusList,\n      statusListCredential: credential,\n      encodedList: unsignedCredential.credentialSubject.encodedList,\n      bitstringStatusList: {\n        statusPurpose,\n        bitsPerStatus,\n        ...(unsignedCredential.validFrom && { validFrom: new Date(unsignedCredential.validFrom) }),\n        ...(unsignedCredential.validUntil && { validUntil: new Date(unsignedCredential.validUntil) }),\n        ttl,\n      },\n      length: statusList.getLength(),\n      proofFormat: args.proofFormat ?? 'lds',\n      id,\n      issuer,\n      statuslistContentType: this.buildContentType(proofFormat),\n    }\n  }\n\n  /**\n   * Checks the status of a specific credential by its index in the status list\n   *\n   * @param args - Check parameters including the status list credential and index\n   * @returns Promise resolving to the status value at the specified index\n   */\n  async checkStatusIndex(args: CheckStatusIndexArgs): Promise<number> {\n    if (!args.bitsPerStatus || args.bitsPerStatus < 1) {\n      return Promise.reject(Error('bitsPerStatus must be set for bitstring status lists and must be 1 or higher. (checkStatusIndex)'))\n    }\n\n    const uniform = CredentialMapper.toUniformCredential(args.statusListCredential)\n    const { credentialSubject } = uniform\n    const encodedList = getAssertedProperty('encodedList', credentialSubject)\n\n    const statusList = await BitstreamStatusList.decode({ encodedList, statusSize: args.bitsPerStatus })\n    const numIndex = typeof args.statusListIndex === 'number' ? args.statusListIndex : parseInt(args.statusListIndex)\n    if (statusList.getLength() <= numIndex) {\n      throw new Error(`Status list index out of bounds, has ${statusList.getLength()} entries, requested ${numIndex}`)\n    }\n    return statusList.getStatus(numIndex)\n  }\n\n  /**\n   * Performs the initial parsing of a StatusListCredential.\n   * This method handles expensive operations like JWT/CWT decoding once.\n   * It extracts all details available from the credential payload itself.\n   */\n  async extractCredentialDetails(credential: StatusListCredential): Promise<IExtractedCredentialDetails> {\n    const uniform = CredentialMapper.toUniformCredential(credential)\n    const { issuer, credentialSubject } = uniform\n    const subject = Array.isArray(credentialSubject) ? credentialSubject[0] : credentialSubject\n\n    return {\n      id: getAssertedValue('id', uniform.id),\n      issuer,\n      encodedList: getAssertedProperty('encodedList', subject),\n    }\n  }\n\n  /**\n   * Converts a status list credential payload to detailed status list information\n   *\n   * @param args - Conversion parameters including the status list payload\n   * @returns Promise resolving to detailed status list information\n   */\n  // For CREATE and READ contexts\n  async toStatusListDetails(args: IToDetailsFromCredentialArgs): Promise<StatusListResult & IBitstringStatusListImplementationResult>\n  // For UPDATE contexts\n  async toStatusListDetails(args: IMergeDetailsWithEntityArgs): Promise<StatusListResult & IBitstringStatusListImplementationResult>\n  async toStatusListDetails(\n    args: IToDetailsFromCredentialArgs | IMergeDetailsWithEntityArgs,\n  ): Promise<StatusListResult & IBitstringStatusListImplementationResult> {\n    if ('statusListCredential' in args) {\n      // CREATE/READ context\n      const { statusListCredential, bitsPerStatus, correlationId, driverType } = args\n      if (!bitsPerStatus || bitsPerStatus < 1) {\n        return Promise.reject(Error('bitsPerStatus must be set for bitstring status lists and must be 1 or higher'))\n      }\n\n      const uniform = CredentialMapper.toUniformCredential(statusListCredential)\n      const { issuer, credentialSubject } = uniform\n      const subject = Array.isArray(credentialSubject) ? credentialSubject[0] : credentialSubject\n\n      const id = getAssertedValue('id', uniform.id)\n      const encodedList = getAssertedProperty('encodedList', subject)\n      const statusPurpose = getAssertedProperty('statusPurpose', subject)\n      const validFrom = uniform.validFrom ? new Date(uniform.validFrom) : undefined\n      const validUntil = uniform.validUntil ? new Date(uniform.validUntil) : undefined\n      const ttl = subject.ttl\n      const proofFormat: CredentialProofFormat = CredentialMapper.detectDocumentType(statusListCredential) === DocumentFormat.JWT ? 'vc+jwt' : 'lds'\n      const statuslistLength = BitstreamStatusList.getStatusListLength(encodedList, bitsPerStatus)\n\n      return {\n        id,\n        encodedList,\n        issuer,\n        type: StatusListType.BitstringStatusList,\n        proofFormat,\n        length: statuslistLength,\n        statusListCredential,\n        statuslistContentType: this.buildContentType(proofFormat),\n        correlationId,\n        driverType,\n        statusPurpose,\n        bitsPerStatus,\n        ...(validFrom && { validFrom }),\n        ...(validUntil && { validUntil }),\n        ...(ttl && { ttl }),\n        bitstringStatusList: {\n          statusPurpose,\n          bitsPerStatus,\n          ...(validFrom && { validFrom }),\n          ...(validUntil && { validUntil }),\n          ...(ttl && { ttl }),\n        },\n      }\n    } else {\n      // UPDATE context\n      const { extractedDetails, statusListEntity } = args\n      const bitstringEntity = statusListEntity as BitstringStatusListEntity\n      if (!bitstringEntity.bitsPerStatus) {\n        return Promise.reject(Error('bitsPerStatus must be present for a bitstring status list'))\n      }\n\n      const proofFormat: CredentialProofFormat =\n        CredentialMapper.detectDocumentType(statusListEntity.statusListCredential!) === DocumentFormat.JWT ? 'vc+jwt' : 'lds'\n      const statuslistLength = BitstreamStatusList.getStatusListLength(extractedDetails.encodedList, bitstringEntity.bitsPerStatus)\n\n      return {\n        id: extractedDetails.id,\n        encodedList: extractedDetails.encodedList,\n        issuer: extractedDetails.issuer,\n        type: StatusListType.BitstringStatusList,\n        proofFormat,\n        length: statuslistLength,\n        statusListCredential: statusListEntity.statusListCredential!,\n        statuslistContentType: this.buildContentType(proofFormat),\n        correlationId: statusListEntity.correlationId,\n        driverType: statusListEntity.driverType,\n        statusPurpose: bitstringEntity.statusPurpose,\n        bitsPerStatus: bitstringEntity.bitsPerStatus,\n        ...(bitstringEntity.validFrom && { validFrom: bitstringEntity.validFrom }),\n        ...(bitstringEntity.validUntil && { validUntil: bitstringEntity.validUntil }),\n        ...(bitstringEntity.ttl && { ttl: bitstringEntity.ttl }),\n        bitstringStatusList: {\n          statusPurpose: bitstringEntity.statusPurpose,\n          bitsPerStatus: bitstringEntity.bitsPerStatus,\n          ...(bitstringEntity.validFrom && { validFrom: bitstringEntity.validFrom }),\n          ...(bitstringEntity.validUntil && { validUntil: bitstringEntity.validUntil }),\n          ...(bitstringEntity.ttl && { ttl: bitstringEntity.ttl }),\n        },\n      }\n    }\n  }\n\n  /**\n   * Creates a credential status entry for a specific credential in a status list\n   *\n   * @param args - Parameters including the status list, entry details, and index\n   * @returns Promise resolving to the credential status entry\n   */\n  async createCredentialStatus(args: {\n    statusList: StatusListEntity\n    statusListEntry: IStatusListEntryEntity | IBitstringStatusListEntryEntity\n    statusListIndex: number\n  }): Promise<BitstringStatusListEntryCredentialStatus> {\n    const { statusList, statusListEntry, statusListIndex } = args\n\n    const bitstringStatusList = statusList as BitstringStatusListEntity\n    const bitstringStatusListEntry = statusListEntry as IBitstringStatusListEntryEntity\n    return {\n      id: `${statusList.id}#${statusListIndex}`,\n      type: 'BitstringStatusListEntry',\n      statusPurpose: bitstringStatusListEntry.statusPurpose,\n      statusListIndex: '' + statusListIndex,\n      statusListCredential: statusList.id,\n      bitsPerStatus: bitstringStatusList.bitsPerStatus,\n      statusMessage: bitstringStatusListEntry.statusMessage,\n      statusReference: bitstringStatusListEntry.statusReference,\n    } satisfies BitstringStatusListEntryCredentialStatus\n  }\n\n  /**\n   * Creates a signed verifiable credential from an unsigned status list credential\n   *\n   * @param args - Parameters including the unsigned credential and signing details\n   * @param context - Veramo agent context for credential operations\n   * @returns Promise resolving to the signed credential\n   */\n  private async createVerifiableCredential(\n    args: {\n      unsignedCredential: BitstringStatusListCredentialUnsigned\n      id: string\n      issuer: string | IIssuer\n      proofFormat: CredentialProofFormat\n      keyRef?: string\n    },\n    context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>,\n  ): Promise<BitstringStatusListCredential> {\n    const { unsignedCredential, issuer, proofFormat, keyRef } = args\n\n    const identifier = await context.agent.identifierManagedGet({\n      identifier: typeof issuer === 'string' ? issuer : issuer.id,\n      vmRelationship: 'assertionMethod',\n      offlineWhenNoDIDRegistered: true,\n    })\n\n    const verifiableCredential = await context.agent.createVerifiableCredential({\n      credential: unsignedCredential,\n      keyRef: keyRef ?? identifier.kmsKeyRef,\n      proofFormat,\n      fetchRemoteContexts: true,\n    })\n\n    return CredentialMapper.toWrappedVerifiableCredential(verifiableCredential as StatusListCredential).original as BitstringStatusListCredential\n  }\n\n  /**\n   * Builds the appropriate content type string for a given proof format\n   *\n   * @param proofFormat - The proof format to build content type for\n   * @returns The corresponding content type string\n   */\n  private buildContentType(proofFormat: CredentialProofFormat | undefined): string {\n    switch (proofFormat) {\n      case 'jwt':\n        return 'application/statuslist+jwt'\n      case 'cbor':\n        return 'application/statuslist+cwt'\n      case 'vc+jwt':\n        return 'application/statuslist+vc+jwt'\n      case 'lds':\n        return 'application/statuslist+ld+json'\n      default:\n        throw Error(`Unsupported content type '${proofFormat}' for status lists`)\n    }\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;ACyBO,IAAKA,cAAAA,0BAAAA,cAAAA;;;;SAAAA;;AAML,IAAKC,aAAAA,0BAAAA,aAAAA;;;SAAAA;;;;AC9BZ,IAAAC,oBAAgI;AAUhI,IAAAC,yBAA4B;;;ACX5B,uBAQO;AACP,wBAA0B;AAEnB,SAASC,0BAA0BC,MAAqB;AAC7D,QAAMC,eAAeD,QAAQE,gCAAeC;AAC5C,MAAI,CAAC;IAACD,gCAAeC;IAAgBD,gCAAeE;IAAiBF,gCAAeG;IAAqBC,SAASL,YAAAA,GAAe;AAC/H,UAAMM,MAAM,mBAAmBN,YAAAA,yBAAqC;EACtE;AACA,SAAOA;AACT;AANgBF;AAQT,SAASS,iBAAoBC,MAAcC,OAAQ;AACxD,MAAIA,UAAUC,UAAaD,UAAU,MAAM;AACzC,UAAMH,MAAM,oBAAoBE,IAAAA,QAAY;EAC9C;AACA,SAAOC;AACT;AALgBF;AAOT,SAASI,kBAAkBC,MAAyF;AACzH,QAAMb,OAAOD,0BAA0Bc,MAAMb,IAAAA;AAC7C,QAAMc,KAAKN,iBAAiB,MAAMK,KAAKC,EAAE;AACz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C;MAAwB,GAAGA,IAAAA;;IAClCuC,mBAAmB;MACjBb;MACA1B;MACAsC;MACAD;IACF;EACF;AAEA,QAAMG,uBAAuB,MAAM9B,QAAQkB,MAAMa,2BAA2B;IAC1E1D;IACA2D,QAAQf,WAAWgB;IACnBX,aAAaI;IACbQ,qBAAqB;EACvB,CAAA;AAEA,SAAOhD,mCAAiBiD,8BAA8BL,oBAAAA,EAA8CM;AACtG;AAtCsBtB;","names":["StatusOAuth","Status2021","import_ssi_types","import_vc_status_list","getAssertedStatusListType","type","assertedType","StatusListType","StatusList2021","OAuthStatusList","BitstringStatusList","includes","Error","getAssertedValue","name","value","undefined","getAssertedValues","args","id","issuer","getAssertedProperty","propertyName","obj","ValidProofTypeMap","Map","assertValidProofType","proofFormat","validProofTypes","get","determineStatusListType","credential","determineProofFormat","determineJwtStatusListType","determineLdsStatusListType","payload","jwtDecode","getStatusListTypeFromSubject","credentialSubject","vc","uniform","CredentialMapper","toUniformCredential","statusListType","find","Object","values","some","statusType","replace","detectDocumentType","DocumentFormat","JWT","MSO_MDOC","JSONLD","ensureDate","Date","trim","date","isNaN","getTime","import_ssi_types","DEFAULT_LIST_LENGTH","DEFAULT_PROOF_FORMAT","StatusList2021Implementation","createNewStatusList","args","context","length","proofFormat","assertValidProofType","StatusListType","StatusList2021","veramoProofFormat","issuer","id","correlationId","getAssertedValue","list","StatusList","encodedList","encode","statusPurpose","statusListCredential","createVerifiableCredential","statusList2021","indexingDirection","credentialIdMode","StatusListCredentialIdMode","ISSUANCE","type","statuslistContentType","buildContentType","updateStatusListIndex","credential","uniform","CredentialMapper","toUniformCredential","credentialSubject","origEncodedList","getAssertedProperty","index","statusListIndex","parseInt","statusList","decode","setStatus","value","detectDocumentType","DocumentFormat","JWT","updatedCredential","Promise","reject","Error","updateStatusListFromEncodedList","getAssertedValues","newEncodedList","keyRef","checkStatusIndex","status","getStatus","Status2021","Invalid","Valid","extractCredentialDetails","subject","Array","isArray","toStatusListDetails","driverType","extractedDetails","statusListEntity","statusList2021Entity","createCredentialStatus","identifier","agent","identifierManagedGet","vmRelationship","offlineWhenNoDIDRegistered","verifiableCredential","kmsKeyRef","fetchRemoteContexts","toWrappedVerifiableCredential","original","import_ssi_types","import_jwt_status_list","import_ssi_types","resolveIdentifier","context","issuer","keyRef","agent","identifierManagedGet","identifier","vmRelationship","offlineWhenNoDIDRegistered","kmsKeyRef","STATUS_LIST_JWT_TYP","createSignedJwt","context","statusList","issuerString","id","expiresAt","keyRef","identifier","resolveIdentifier","resolution","ensureManagedIdentifierResult","payload","iss","sub","iat","Math","floor","Date","now","exp","getTime","header","alg","getSigningAlgo","key","type","typ","values","createHeaderAndPayload","signedJwt","agent","jwtCreateJwsCompactSignature","issuer","noIssPayloadUpdate","protectedHeader","statusListCredential","jwt","encodedList","status_list","lst","decodeStatusListJWT","payloadBase64","split","JSON","parse","base64url","decode","Error","StatusList","decompressStatusList","bits","ttl","JoseSignatureAlgorithm","EdDSA","ES256K","ES256","RS256","import_jwt_status_list","import_base64url","com","kotlin","mdocPkg","CborByteString","sphereon","cbor","CborUInt","CborString","decompressRawStatusList","StatusList","decodeStatusList","bind","CWT_CLAIMS","SUBJECT","ISSUER","ISSUED_AT","EXPIRATION","TIME_TO_LIVE","STATUS_LIST","createSignedCbor","context","statusList","issuerString","id","expiresAt","keyRef","identifier","resolveIdentifier","encodeStatusList","compressedList","deflate","level","compressedBytes","Int8Array","statusListMap","CborMap","collections","KtMutableMap","fromJsMap","Map","kmp","LongKMP","fromNumber","getBitsPerStatus","protectedHeader","protectedHeaderEncoded","Cbor","encode","claimsMap","buildClaimsMap","claimsEncoded","signedCWT","agent","keyManagerSign","kmsKeyRef","data","base64url","Buffer","from","encoding","undefined","protectedHeaderEncodedInt8","claimsEncodedInt8","signatureBytes","decode","signatureInt8","cwtArrayElements","cwtArray","CborArray","KtMutableList","fromJsArray","cwtEncoded","cwtBuffer","statusListCredential","encodedList","ttl","claimsEntries","Math","floor","Date","now","push","getTime","getCborValueFromMap","map","key","value","getCborOptionalValueFromMap","Error","get","decodeStatusListCWT","cwt","encodedCbor","toBuffer","encodedCborArray","decodedCbor","payload","asJsArrayView","claims","asJsMapView","bits","Number","decoded","Uint8Array","uint8Array","inflate","rawStatusList","issuer","iat","exp","DEFAULT_BITS_PER_STATUS","DEFAULT_LIST_LENGTH","DEFAULT_PROOF_FORMAT","OAuthStatusListImplementation","createNewStatusList","args","context","oauthStatusList","Error","proofFormat","issuer","id","keyRef","bitsPerStatus","expiresAt","ensureDate","length","issuerString","correlationId","getAssertedValue","statusList","StatusList","Array","fill","encodedList","compressStatusList","statusListCredential","createSignedStatusList","type","StatusListType","OAuthStatusList","statuslistContentType","buildContentType","updateStatusListIndex","value","Promise","reject","determineProofFormat","decoded","decodeStatusListJWT","decodeStatusListCWT","index","statusListIndex","parseInt","setStatus","signedCredential","getBitsPerStatus","updateStatusListFromEncodedList","getAssertedValues","listToUpdate","decompressStatusList","checkStatusIndex","getStatus","extractCredentialDetails","credential","decodedPayload","toStatusListDetails","driverType","exp","Date","undefined","extractedDetails","statusListEntity","oauthEntity","createCredentialStatus","createSignedJwt","createSignedCbor","import_ssi_types","import_ssi_types","DEFAULT_LIST_LENGTH","DEFAULT_PROOF_FORMAT","DEFAULT_STATUS_PURPOSE","BitstringStatusListImplementation","createNewStatusList","args","context","bitstringStatusList","Error","length","proofFormat","assertValidProofType","StatusListType","BitstringStatusList","issuer","id","correlationId","getAssertedValue","statusPurpose","bitsPerStatus","validFrom","validUntil","ttl","unsignedCredential","createStatusListCredential","ensureDate","statusListCredential","createVerifiableCredential","keyRef","encodedList","credentialSubject","Date","type","statuslistContentType","buildContentType","updateStatusListIndex","Promise","reject","credential","uniform","CredentialMapper","toUniformCredential","origEncodedList","getAssertedProperty","index","statusListIndex","parseInt","statusList","BitstreamStatusList","decode","statusSize","bitstringStatusId","value","setStatus","detectDocumentType","DocumentFormat","JWT","credSubject","Array","isArray","undefined","updatedCredential","getLength","updateStatusListFromEncodedList","getAssertedValues","checkStatusIndex","numIndex","getStatus","extractCredentialDetails","subject","toStatusListDetails","driverType","statuslistLength","getStatusListLength","extractedDetails","statusListEntity","bitstringEntity","createCredentialStatus","statusListEntry","bitstringStatusListEntry","statusMessage","statusReference","identifier","agent","identifierManagedGet","vmRelationship","offlineWhenNoDIDRegistered","verifiableCredential","kmsKeyRef","fetchRemoteContexts","toWrappedVerifiableCredential","original","StatusListFactory","instance","implementations","Map","set","StatusListType","StatusList2021","StatusList2021Implementation","OAuthStatusList","OAuthStatusListImplementation","BitstringStatusList","BitstringStatusListImplementation","getInstance","getByType","type","statusList","get","Error","getStatusListImplementation","fetchStatusListCredential","args","url","getAssertedValue","statusListCredential","response","fetch","ok","Error","status","statusText","responseAsText","text","trim","startsWith","JSON","parse","error","console","message","stringify","statusPluginStatusFunction","credential","didDoc","result","checkStatusForCredential","documentLoader","errorUnknownListType","revoked","verified","vcLibCheckStatusFunction","mandatoryCredentialStatus","verifyStatusListCredential","verifyMatchingIssuers","uniform","CredentialMapper","toUniformCredential","credentialStatus","log","type","checkStatus","simpleCheckStatusFromStatusListUrl","checkStatusIndexFromStatusListCredential","statusListType","determineStatusListType","implementation","getStatusListImplementation","checkStatusIndex","createNewStatusList","context","getAssertedValues","updateStatusIndexFromStatusListCredential","updateStatusListIndex","extractCredentialDetails","toStatusListDetails","statusListEntity","createCredentialStatusFromStatusList","statusList","statusListEntry","statusListIndex","createCredentialStatus","updateStatusListIndexFromEncodedList","updateStatusListFromEncodedList","statusList2021ToVerifiableCredential","issuer","id","identifier","agent","identifierManagedGet","vmRelationship","offlineWhenNoDIDRegistered","proofFormat","assertValidProofType","StatusListType","StatusList2021","veramoProofFormat","encodedList","statusPurpose","credentialSubject","verifiableCredential","createVerifiableCredential","keyRef","kmsKeyRef","fetchRemoteContexts","toWrappedVerifiableCredential","original"]}