-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(anoncreds): support credential attribute value and marker (#1369)
Signed-off-by: Victor Anene <[email protected]>
- Loading branch information
1 parent
2efc009
commit 5559996
Showing
9 changed files
with
241 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import '@hyperledger/anoncreds-nodejs' | ||
import 'reflect-metadata' | ||
|
||
jest.setTimeout(120000) |
11 changes: 11 additions & 0 deletions
11
packages/anoncreds/src/models/AnonCredsRestrictionWrapper.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Type } from 'class-transformer' | ||
import { ValidateNested } from 'class-validator' | ||
|
||
import { AnonCredsRestrictionTransformer, AnonCredsRestriction } from './AnonCredsRestriction' | ||
|
||
export class AnonCredsRestrictionWrapper { | ||
@ValidateNested({ each: true }) | ||
@Type(() => AnonCredsRestriction) | ||
@AnonCredsRestrictionTransformer() | ||
public restrictions!: AnonCredsRestriction[] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './internal' | ||
export * from './exchange' | ||
export * from './registry' | ||
export * from './AnonCredsRestrictionWrapper' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
packages/anoncreds/src/repository/__tests__/AnonCredsCredentialRecord.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import type { AnonCredsCredential } from '@aries-framework/anoncreds' | ||
|
||
import { AnonCredsCredentialRecord } from '../AnonCredsCredentialRecord' | ||
|
||
describe('AnoncredsCredentialRecords', () => { | ||
test('Returns the correct tags from the getTags methods based on the credential record values', () => { | ||
const anoncredsCredentialRecords = new AnonCredsCredentialRecord({ | ||
credential: { | ||
cred_def_id: 'credDefId', | ||
schema_id: 'schemaId', | ||
signature: 'signature', | ||
signature_correctness_proof: 'signatureCorrectnessProof', | ||
values: { attr1: { raw: 'value1', encoded: 'encvalue1' }, attr2: { raw: 'value2', encoded: 'encvalue2' } }, | ||
rev_reg_id: 'revRegId', | ||
} as AnonCredsCredential, | ||
credentialId: 'myCredentialId', | ||
credentialRevocationId: 'credentialRevocationId', | ||
linkSecretId: 'linkSecretId', | ||
issuerId: 'issuerDid', | ||
schemaIssuerId: 'schemaIssuerDid', | ||
schemaName: 'schemaName', | ||
schemaVersion: 'schemaVersion', | ||
}) | ||
|
||
const tags = anoncredsCredentialRecords.getTags() | ||
|
||
expect(tags).toMatchObject({ | ||
issuerId: 'issuerDid', | ||
schemaIssuerId: 'schemaIssuerDid', | ||
schemaName: 'schemaName', | ||
schemaVersion: 'schemaVersion', | ||
credentialDefinitionId: 'credDefId', | ||
schemaId: 'schemaId', | ||
credentialId: 'myCredentialId', | ||
credentialRevocationId: 'credentialRevocationId', | ||
linkSecretId: 'linkSecretId', | ||
'attr::attr1::value': 'value1', | ||
'attr::attr1::marker': true, | ||
'attr::attr2::value': 'value2', | ||
'attr::attr2::marker': true, | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.