Skip to content

Commit

Permalink
fix(anoncreds-rs): revocation status list as JSON (#1422)
Browse files Browse the repository at this point in the history
Signed-off-by: Ariel Gentile <gentilester@gmail.com>
  • Loading branch information
genaris authored Apr 10, 2023
1 parent 644e860 commit ec5c233
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions packages/anoncreds-rs/src/services/AnonCredsRsVerifierService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { AgentContext } from '@aries-framework/core'
import type { JsonObject } from '@hyperledger/anoncreds-shared'

import { injectable } from '@aries-framework/core'
import { Presentation, RevocationRegistryDefinition, RevocationStatusList } from '@hyperledger/anoncreds-shared'
import { Presentation } from '@hyperledger/anoncreds-shared'

@injectable()
export class AnonCredsRsVerifierService implements AnonCredsVerifierService {
Expand All @@ -24,27 +24,15 @@ export class AnonCredsRsVerifierService implements AnonCredsVerifierService {
rsSchemas[schemaId] = schemas[schemaId] as unknown as JsonObject
}

const revocationRegistryDefinitions: Record<string, RevocationRegistryDefinition> = {}
const lists = []
const revocationRegistryDefinitions: Record<string, JsonObject> = {}
const lists: JsonObject[] = []

for (const revocationRegistryDefinitionId in revocationRegistries) {
const { definition, revocationStatusLists } = options.revocationRegistries[revocationRegistryDefinitionId]

revocationRegistryDefinitions[revocationRegistryDefinitionId] = RevocationRegistryDefinition.fromJson(
definition as unknown as JsonObject
)

for (const timestamp in revocationStatusLists) {
lists.push(
RevocationStatusList.create({
issuerId: definition.issuerId,
issuanceByDefault: true,
revocationRegistryDefinition: revocationRegistryDefinitions[revocationRegistryDefinitionId],
revocationRegistryDefinitionId,
timestamp: Number(timestamp),
})
)
}
revocationRegistryDefinitions[revocationRegistryDefinitionId] = definition as unknown as JsonObject

lists.push(...(Object.values(revocationStatusLists) as unknown as Array<JsonObject>))
}

return presentation.verify({
Expand Down

0 comments on commit ec5c233

Please sign in to comment.