import { RevocationStatusList } from './revocationStatusList.js'; import { RevocationStatusListBitSet } from './revocationStatusListBitSet.js'; import { RevocationStatusListArray } from './revocationStatusListArray.js'; import UnsupportedStatusListCredentialTypeException from './exceptions/unsupportedStatusListCredentialTypeException.js'; import { StatusListType } from './statusListReference.js'; export class RevocationStatusListFactory { static fromEncoded( encodedList: string, statusListType: string, ): RevocationStatusList { if (!statusListType) throw new UnsupportedStatusListCredentialTypeException(statusListType); if (statusListType === StatusListType.RevocationList2021) return RevocationStatusListBitSet.fromEncoded(encodedList); if (statusListType.startsWith(StatusListType.StatusList2021)) return RevocationStatusListArray.fromEncoded(encodedList); throw new UnsupportedStatusListCredentialTypeException(statusListType); } }