Skip to content

Commit

Permalink
added support for querying proof schemas using query object. Bug #10
Browse files Browse the repository at this point in the history
  • Loading branch information
joevolleyball committed May 14, 2020
1 parent ee8a307 commit a936d28
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 4 additions & 3 deletions nodejs/sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -773,9 +773,10 @@ class Agent {

this.logger.info('Getting proof schemas');
this.logger.info(`Getting proof schemas that match: ${query}`);
let r = await this.request('proof_schemas');
let r = await this.request(`proof_schemas${query}`);
this.logger.info(`r: ${JSON.stringify(r)}`);
if (r.items) r = r.items;
this.logger.info(`Got ${r.length} credential definitions`);
this.logger.info(`Got ${r.length} proof schemas`);
this.logger.debug('Result from getProofSchemas: '+jsonPrint(r));
return r;
}
Expand Down Expand Up @@ -1874,4 +1875,4 @@ class Agent {

module.exports = {
Agent: Agent
};
};
11 changes: 11 additions & 0 deletions nodejs/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,17 @@ describe('sdk', () => {
expect(proofSchema).to.not.be.undefined;
});

it(`should get proof schemas from '${verifierName}'`, async () => {
let foundProofSchemaArray = await verifier.verifierGetProofSchemas();
expect(foundProofSchemaArray).to.not.be.undefined;
expect(foundProofSchemaArray.length).to.be.greaterThan(0);

foundProofSchemaArray = await verifier.verifierGetProofSchemas({id: proofSchema.id});
expect(foundProofSchemaArray).to.not.be.undefined;
expect(foundProofSchemaArray.length).to.be.equal(1);
expect(foundProofSchemaArray[0].id).to.be.equal(proofSchema.id);
});

it(`should connect '${holderName}' to '${verifierName}'`, async () => {
pairwiseDid = await connect(holder, holderIdentity, verifier, verifierIdentity);
});
Expand Down

0 comments on commit a936d28

Please sign in to comment.