Skip to content

Commit

Permalink
test: register revocation registry definition and status list
Browse files Browse the repository at this point in the history
Signed-off-by: Berend Sliedrecht <sliedrecht@berend.io>
  • Loading branch information
berendsliedrecht committed Jan 16, 2024
1 parent 419443b commit 5c6e03c
Show file tree
Hide file tree
Showing 12 changed files with 359 additions and 264 deletions.
2 changes: 1 addition & 1 deletion demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"refresh": "rm -rf ./node_modules ./yarn.lock && yarn"
},
"dependencies": {
"@hyperledger/indy-vdr-nodejs": "^0.2.0-dev.5",
"@hyperledger/indy-vdr-nodejs": "^0.2.0-dev.6",
"@hyperledger/anoncreds-nodejs": "^0.2.0-dev.5",
"@hyperledger/aries-askar-nodejs": "^0.2.0-dev.5",
"inquirer": "^8.2.5"
Expand Down
2 changes: 0 additions & 2 deletions packages/anoncreds/src/models/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,5 @@ export interface AnonCredsRevocationStatusList {
revRegDefId: string
revocationList: Array<number>
currentAccumulator: string
issued?: Array<number>
revoked?: Array<number>
timestamp: number
}
9 changes: 0 additions & 9 deletions packages/anoncreds/src/utils/indyIdentifiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,6 @@ export function getUnqualifiedRevocationRegistryDefinitionId(
return `${unqualifiedDid}:4:${unqualifiedDid}:3:CL:${schemaSeqNo}:${credentialDefinitionTag}:CL_ACCUM:${revocationRegistryTag}`
}

export function getUnqualifiedRevocationRegistryEntryId(
unqualifiedDid: string,
schemaSeqNo: string | number,
credentialDefinitionTag: string,
revocationRegistryTag: string
) {
return `${unqualifiedDid}:5:${unqualifiedDid}:3:CL:${schemaSeqNo}:${credentialDefinitionTag}:CL_ACCUM:${revocationRegistryTag}`
}

export function isUnqualifiedCredentialDefinitionId(credentialDefinitionId: string) {
return unqualifiedCredentialDefinitionIdRegex.test(credentialDefinitionId)
}
Expand Down
4 changes: 2 additions & 2 deletions packages/anoncreds/tests/InMemoryAnonCredsRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import BigNumber from 'bn.js'

import {
getDidIndyCredentialDefinitionId,
getDidIndyRevocationRegistryId,
getDidIndyRevocationRegistryDefinitionId,
getDidIndySchemaId,
} from '../../indy-sdk/src/anoncreds/utils/identifiers'
import {
Expand Down Expand Up @@ -249,7 +249,7 @@ export class InMemoryAnonCredsRegistry implements AnonCredsRegistry {

const { namespace, namespaceIdentifier } = parseIndyDid(options.revocationRegistryDefinition.issuerId)
const legacyIssuerId = namespaceIdentifier
const didIndyRevocationRegistryDefinitionId = getDidIndyRevocationRegistryId(
const didIndyRevocationRegistryDefinitionId = getDidIndyRevocationRegistryDefinitionId(
namespace,
namespaceIdentifier,
indyLedgerSeqNo,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
getDidIndyCredentialDefinitionId,
getDidIndyRevocationRegistryId,
getDidIndyRevocationRegistryDefinitionId,
getDidIndySchemaId,
indySdkAnonCredsRegistryIdentifierRegex,
} from '../identifiers'
Expand Down Expand Up @@ -72,7 +72,7 @@ describe('identifiers', () => {
const credentialDefinitionTag = 'someTag'
const tag = 'anotherTag'

expect(getDidIndyRevocationRegistryId(namespace, did, seqNo, credentialDefinitionTag, tag)).toEqual(
expect(getDidIndyRevocationRegistryDefinitionId(namespace, did, seqNo, credentialDefinitionTag, tag)).toEqual(
'did:indy:sovrin:test:12345/anoncreds/v0/REV_REG_DEF/420/someTag/anotherTag'
)
})
Expand Down
10 changes: 5 additions & 5 deletions packages/indy-sdk/src/anoncreds/utils/identifiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ export function getDidIndySchemaId(namespace: string, unqualifiedDid: string, na
export function getDidIndyCredentialDefinitionId(
namespace: string,
unqualifiedDid: string,
seqNo: string | number,
schemaSeqNo: string | number,
tag: string
) {
return `did:indy:${namespace}:${unqualifiedDid}/anoncreds/v0/CLAIM_DEF/${seqNo}/${tag}`
return `did:indy:${namespace}:${unqualifiedDid}/anoncreds/v0/CLAIM_DEF/${schemaSeqNo}/${tag}`
}

export function getDidIndyRevocationRegistryId(
export function getDidIndyRevocationRegistryDefinitionId(
namespace: string,
unqualifiedDid: string,
seqNo: string | number,
schemaSeqNo: string | number,
credentialDefinitionTag: string,
revocationRegistryTag: string
) {
return `did:indy:${namespace}:${unqualifiedDid}/anoncreds/v0/REV_REG_DEF/${seqNo}/${credentialDefinitionTag}/${revocationRegistryTag}`
return `did:indy:${namespace}:${unqualifiedDid}/anoncreds/v0/REV_REG_DEF/${schemaSeqNo}/${credentialDefinitionTag}/${revocationRegistryTag}`
}
2 changes: 0 additions & 2 deletions packages/indy-sdk/src/anoncreds/utils/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ export function anonCredsRevocationStatusListFromIndySdk(
return {
issuerId: revocationRegistryDefinition.issuerId,
currentAccumulator: delta.value.accum,
revoked: delta.value.revoked,
issued: delta.value.issued,
revRegDefId: revocationRegistryDefinitionId,
revocationList,
timestamp,
Expand Down
6 changes: 3 additions & 3 deletions packages/indy-vdr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"@aries-framework/core": "0.4.2"
},
"devDependencies": {
"@hyperledger/indy-vdr-nodejs": "^0.2.0-dev.5",
"@hyperledger/indy-vdr-shared": "^0.2.0-dev.5",
"@hyperledger/indy-vdr-nodejs": "^0.2.0-dev.6",
"@hyperledger/indy-vdr-shared": "^0.2.0-dev.6",
"@stablelib/ed25519": "^1.0.2",
"@types/ref-array-di": "^1.2.6",
"@types/ref-struct-di": "^1.1.10",
Expand All @@ -38,6 +38,6 @@
"typescript": "~4.9.5"
},
"peerDependencies": {
"@hyperledger/indy-vdr-shared": "^0.2.0-dev.5"
"@hyperledger/indy-vdr-shared": "^0.2.0-dev.6"
}
}
Loading

0 comments on commit 5c6e03c

Please sign in to comment.