Skip to content

Commit

Permalink
feat: Minor update
Browse files Browse the repository at this point in the history
Signed-off-by: DaevMithran <[email protected]>
  • Loading branch information
DaevMithran committed Apr 13, 2023
1 parent 34304f4 commit 6414422
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export class CheqdAnonCredsRegistry implements AnonCredsRegistry {

const response = await cheqdDidResolver.resolveResource(
agentContext,
`${revocationRegistryId}&resourceType=anonCredsStatusList&resourceTime=${timestamp}`
`${revocationRegistryId}&resourceType=anonCredsStatusList&resourceVersionTime=${timestamp}`
)
const revocationStatusList = JsonTransformer.fromJSON(response.resource, CheqdRevocationStatusList)

Expand Down
7 changes: 5 additions & 2 deletions packages/cheqd/src/dids/CheqdDidResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { ParsedCheqdDid } from '../anoncreds/utils/identifiers'
import type { AgentContext, DidDocument, DidResolutionResult, DidResolver, ParsedDid } from '@aries-framework/core'
import type { Metadata } from '@cheqd/ts-proto/cheqd/resource/v2'

import { AriesFrameworkError } from '@aries-framework/core'
import { AriesFrameworkError, utils } from '@aries-framework/core'

import {
cheqdDidMetadataRegex,
Expand Down Expand Up @@ -87,7 +87,7 @@ export class CheqdDidResolver implements DidResolver {
if (params.version) {
resource = resources.find((resource) => resource.version == params.version)
} else {
const date = params.resourceTime ? new Date(Number(params.resourceTime) * 1000) : new Date()
const date = params.resourceVersionTime ? new Date(Number(params.resourceVersionTime) * 1000) : new Date()
// find the resourceId closest to the created time
resource = getClosestResourceVersion(resources, date)
}
Expand All @@ -103,6 +103,9 @@ export class CheqdDidResolver implements DidResolver {
message: `resolver_error: Invalid did url '${did}'`,
}
}
if (!utils.isValidUuid(resourceId)) {
throw new Error('Invalid resource Id')
}

const { resource, metadata } = await cheqdLedgerService.resolveResource(parsedDid.did, id, resourceId)
if (!resource || !metadata) {
Expand Down

0 comments on commit 6414422

Please sign in to comment.