forked from hyperledger-indy/indy-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/vcx-android-demo
- Loading branch information
Showing
20 changed files
with
161 additions
and
25 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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
var test = require('ava') | ||
var indy = require('../') | ||
var cuid = require('cuid') | ||
|
||
test('nonsecrets', async function (t) { | ||
var walletConfig = { 'id': 'wallet-' + cuid() } | ||
var walletCredentials = { 'key': 'key' } | ||
await indy.createWallet(walletConfig, walletCredentials) | ||
var wh = await indy.openWallet(walletConfig, walletCredentials) | ||
|
||
await indy.addWalletRecord(wh, 'contact', '1', 'john', JSON.stringify({ | ||
'~score': 'aaa' | ||
})) | ||
await indy.addWalletRecord(wh, 'contact', '2', 'jessica', JSON.stringify({ | ||
'~score': 'ccc' | ||
})) | ||
await indy.addWalletRecord(wh, 'contact', '3', 'jack', JSON.stringify({ | ||
'~score': 'eee', | ||
'~note': 'foo' | ||
})) | ||
|
||
await indy.updateWalletRecordValue(wh, 'contact', '3', 'george') | ||
await indy.updateWalletRecordTags(wh, 'contact', '3', JSON.stringify({ | ||
'~score': 'fff' | ||
})) | ||
|
||
const record = await indy.getWalletRecord(wh, 'contact', '1', '{}') | ||
t.is(record.id, '1') | ||
t.is(record.value, 'john') | ||
t.is(record.tags, null) | ||
t.is(record.type, null) | ||
|
||
const record2 = await indy.getWalletRecord(wh, 'contact', '1', '{"retrieveType": true, "retrieveTags": true}') | ||
t.is(record2.id, '1') | ||
t.is(record2.value, 'john') | ||
t.deepEqual(record2.tags, { | ||
'~score': 'aaa' | ||
}) | ||
t.is(record2.type, 'contact') | ||
|
||
const query = { '~score': { '$gte': 'bbb' } } | ||
let searchHandle = await indy.openWalletSearch(wh, 'contact', JSON.stringify(query), JSON.stringify({ | ||
retrieveRecords: true, | ||
retrieveTotalCount: true, | ||
retrieveType: true, | ||
retrieveValue: true, | ||
retrieveTags: true | ||
})) | ||
let searchResult = await indy.fetchWalletSearchNextRecords(wh, searchHandle, 10) | ||
t.is(searchResult.totalCount, 2) | ||
let jessica = searchResult.records.find(r => r.value === 'jessica') | ||
t.is(jessica.id, '2') | ||
t.is(jessica.type, 'contact') | ||
t.is(jessica.tags['~score'], 'ccc') | ||
let jack = searchResult.records.find(r => r.value === 'george') | ||
t.is(jack.id, '3') | ||
t.is(jack.type, 'contact') | ||
t.is(jack.tags['~score'], 'fff') | ||
t.is(jack.tags['~note'], undefined) | ||
|
||
await indy.closeWalletSearch(searchHandle) | ||
await indy.closeWallet(wh) | ||
await indy.deleteWallet(walletConfig, walletCredentials) | ||
}) |
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