Skip to content

Commit

Permalink
Merge branch 'master' into feature/vcx-android-demo
Browse files Browse the repository at this point in the history
  • Loading branch information
jovfer authored Sep 20, 2020
2 parents b36665b + 58314e8 commit 3c90c6c
Show file tree
Hide file tree
Showing 20 changed files with 161 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile.cd
Original file line number Diff line number Diff line change
Expand Up @@ -1766,7 +1766,7 @@ def shell(command) {
}

def setupRust() {
shell("rustup default 1.40.0")
shell("rustup default 1.46.0")
}

def androidPublishing() {
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ def shell(command) {
}

def setupRust() {
shell("rustup default 1.40.0")
shell("rustup default 1.46.0")
}

def setupBrewPackages() {
Expand Down
2 changes: 1 addition & 1 deletion libindy/ci/centos.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ RUN wget https://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-mav
RUN sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
RUN yum install -y apache-maven

ENV RUST_ARCHIVE=rust-1.40.0-x86_64-unknown-linux-gnu.tar.gz
ENV RUST_ARCHIVE=rust-1.46.0-x86_64-unknown-linux-gnu.tar.gz
ENV RUST_DOWNLOAD_URL=https://static.rust-lang.org/dist/$RUST_ARCHIVE

RUN mkdir -p /rust
Expand Down
2 changes: 1 addition & 1 deletion libindy/ci/ubuntu.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
RUN useradd -ms /bin/bash -u $uid indy
USER indy

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.40.0
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.46.0
ENV PATH /home/indy/.cargo/bin:$PATH

RUN cargo install cargo-deb
Expand Down
2 changes: 1 addition & 1 deletion libindy/ci/ubuntu18.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ RUN apt-get install -y wget
RUN useradd -ms /bin/bash -u $uid indy
USER indy

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.40.0
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.46.0
ENV PATH /home/indy/.cargo/bin:$PATH

RUN cargo install cargo-deb
Expand Down
6 changes: 3 additions & 3 deletions libindy/include/indy_non_secrets.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ extern "C" {
/// {
/// retrieveType: (optional, false by default) Retrieve record type,
/// retrieveValue: (optional, true by default) Retrieve record value,
/// retrieveTags: (optional, true by default) Retrieve record tags
/// retrieveTags: (optional, false by default) Retrieve record tags
/// }
/// #Returns
/// wallet record json:
Expand Down Expand Up @@ -199,7 +199,7 @@ extern "C" {
/// retrieveTotalCount: (optional, false by default) Calculate total count,
/// retrieveType: (optional, false by default) Retrieve record type,
/// retrieveValue: (optional, true by default) Retrieve record value,
/// retrieveTags: (optional, true by default) Retrieve record tags,
/// retrieveTags: (optional, false by default) Retrieve record tags,
/// }
/// #Returns
/// search_handle: Wallet search handle that can be used later
Expand All @@ -226,7 +226,7 @@ extern "C" {
/// {
/// retrieveType: (optional, false by default) Retrieve record type,
/// retrieveValue: (optional, true by default) Retrieve record value,
/// retrieveTags: (optional, true by default) Retrieve record tags
/// retrieveTags: (optional, false by default) Retrieve record tags
/// }
/// #Returns
/// wallet record json:
Expand Down
4 changes: 2 additions & 2 deletions libindy/indy-api-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ pub mod wallet {
/// {
/// retrieveType: (optional, false by default) Retrieve record type,
/// retrieveValue: (optional, true by default) Retrieve record value,
/// retrieveTags: (optional, true by default) Retrieve record tags
/// retrieveTags: (optional, false by default) Retrieve record tags
/// }
/// record_handle_p: pointer to store retrieved record handle
pub type WalletGetRecord = extern fn(storage_handle: StorageHandle,
Expand Down Expand Up @@ -537,7 +537,7 @@ pub mod wallet {
/// retrieveTotalCount: (optional, false by default) Calculate total count,
/// retrieveType: (optional, false by default) Retrieve record type,
/// retrieveValue: (optional, true by default) Retrieve record value,
/// retrieveTags: (optional, true by default) Retrieve record tags,
/// retrieveTags: (optional, false by default) Retrieve record tags,
/// }
/// search_handle_p: pointer to store wallet search handle
pub type WalletSearchRecords = extern fn(storage_handle: StorageHandle,
Expand Down
2 changes: 1 addition & 1 deletion vcx/ci/ubuntu.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ ARG uid=1000
RUN useradd -ms /bin/bash -u $uid vcx
USER vcx

ARG RUST_VER="1.40.0"
ARG RUST_VER="1.46.0"
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUST_VER
ENV PATH /home/vcx/.cargo/bin:$PATH

Expand Down
2 changes: 1 addition & 1 deletion vcx/libvcx/build_scripts/ios/mac/mac.01.libindy.setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fi

if [[ $RUSTUP_VERSION =~ ^'rustup ' ]]; then
rustup update
rustup default 1.40.0
rustup default 1.46.0
rustup component add rls-preview rust-analysis rust-src
echo "Using rustc version $(rustc --version)"
rustup target add aarch64-apple-ios armv7-apple-ios armv7s-apple-ios x86_64-apple-ios i386-apple-ios
Expand Down
2 changes: 1 addition & 1 deletion vcx/libvcx/src/utils/libindy/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ pub fn inputs(cost: u64) -> VcxResult<(u64, Vec<String>, String)> {
// Todo: explore 'smarter' ways of selecting utxos ie bitcoin algorithms etc
'outer: for address in wallet_info.addresses.iter() {
refund_address = address.address.clone();
'inner: for utxo in address.utxo.iter() {
'_inner: for utxo in address.utxo.iter() {
if balance < cost {
inputs.push(utxo.source.clone().ok_or(VcxErrorKind::InsufficientTokenAmount)?.to_string());
balance += utxo.amount;
Expand Down
6 changes: 3 additions & 3 deletions vcx/libvcx/src/v3/messages/a2a/protocol_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ impl ProtocolRegistry {
Some((actor_1, actor_2)) => {
match (actors.contains(&actor_1), actors.contains(&actor_2)) {
(true, true) => {
self.protocols.push({ ProtocolDescriptor { pid: family.id(), roles: None } })
self.protocols.push(ProtocolDescriptor { pid: family.id(), roles: None })
}
(true, false) => {
self.protocols.push({ ProtocolDescriptor { pid: family.id(), roles: Some(vec![actor_1]) } })
self.protocols.push(ProtocolDescriptor { pid: family.id(), roles: Some(vec![actor_1]) })
}
(false, true) => {
self.protocols.push({ ProtocolDescriptor { pid: family.id(), roles: Some(vec![actor_2]) } })
self.protocols.push(ProtocolDescriptor { pid: family.id(), roles: Some(vec![actor_2]) })
}
(false, false) => {}
}
Expand Down
10 changes: 10 additions & 0 deletions vcx/wrappers/ios/vcx/ConnectMeVcx.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ extern void VcxWrapperCommonNumberStringCallback(vcx_command_handle_t xcommand_h
- (void)agentProvisionAsync:(NSString *)config
completion:(void (^)(NSError *error, NSString *config))completion;

- (int)updateWebhookUrl:(NSString *) notification_webhook_url;

- (NSString *)errorCMessage:(NSInteger) errorCode;

- (void)connectionCreateWithInvite:(NSString *)invitationId
inviteDetails:(NSString *)inviteDetails
completion:(void (^)(NSError *error, NSInteger connectionHandle))completion;
Expand All @@ -106,6 +110,12 @@ extern void VcxWrapperCommonNumberStringCallback(vcx_command_handle_t xcommand_h
- (void)deleteConnection:(VcxHandle)connectionHandle
withCompletion:(void (^)(NSError *error))completion;

- (void)connectionGetPwDid:(NSInteger)connectionHandle
completion:(void (^)(NSError *error, NSString *pwDid))completion;

- (void)connectionGetTheirPwDid:(NSInteger)connectionHandle
completion:(void (^)(NSError *error, NSString *theirPwDid))completion;

- (void)connectionSendMessage:(VcxHandle)connectionHandle
withMessage:(NSString *)message
withSendMessageOptions:(NSString *)sendMessageOptions
Expand Down
54 changes: 54 additions & 0 deletions vcx/wrappers/ios/vcx/ConnectMeVcx.m
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,24 @@ - (void)agentProvisionAsync:(NSString *)config

}

- (int)updateWebhookUrl:(NSString *) notification_webhook_url {
const char *notification_webhook_url_char = [notification_webhook_url cStringUsingEncoding:NSUTF8StringEncoding];

return vcx_update_webhook_url(notification_webhook_url_char);
}

- (NSString *)errorCMessage:(NSInteger) errorCode {
const char * ret = vcx_error_c_message(errorCode);

NSString *message = nil;

if (ret) {
message = [NSString stringWithUTF8String:ret];
}

return message;
}

- (void)connectionCreateWithInvite:(NSString *)invitationId
inviteDetails:(NSString *)inviteDetails
completion:(void (^)(NSError *error, NSInteger connectionHandle)) completion
Expand Down Expand Up @@ -470,6 +488,42 @@ - (void)deleteConnection:(VcxHandle)connectionHandle
}
}

- (void)connectionGetPwDid:(NSInteger)connectionHandle
completion:(void (^)(NSError *error, NSString *pwDid))completion
{
vcx_error_t ret;
vcx_command_handle_t handle = [[VcxCallbacks sharedInstance] createCommandHandleFor:completion];

ret = vcx_connection_get_pw_did(handle,connectionHandle, VcxWrapperCommonStringCallback);

if( ret != 0 )
{
[[VcxCallbacks sharedInstance] deleteCommandHandleFor: handle];

dispatch_async(dispatch_get_main_queue(), ^{
completion([NSError errorFromVcxError: ret],nil);
});
}
}

- (void)connectionGetTheirPwDid:(NSInteger)connectionHandle
completion:(void (^)(NSError *error, NSString *theirPwDid))completion
{
vcx_error_t ret;
vcx_command_handle_t handle = [[VcxCallbacks sharedInstance] createCommandHandleFor:completion];

ret = vcx_connection_get_their_pw_did(handle,connectionHandle, VcxWrapperCommonStringCallback);

if( ret != 0 )
{
[[VcxCallbacks sharedInstance] deleteCommandHandleFor: handle];

dispatch_async(dispatch_get_main_queue(), ^{
completion([NSError errorFromVcxError: ret],nil);
});
}
}

- (void)connectionSendMessage:(VcxHandle)connectionHandle
withMessage:(NSString *)message
withSendMessageOptions:(NSString *)sendMessageOptions
Expand Down
8 changes: 8 additions & 0 deletions vcx/wrappers/ios/vcx/include/libvcx.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ vcx_error_t vcx_init(vcx_command_handle_t handle, const char *config_path, void
vcx_error_t vcx_create_agent(vcx_command_handle_t handle, const char *config, void (*cb)(vcx_command_handle_t xhandle, vcx_error_t err, const char *xconfig));
vcx_error_t vcx_update_agent_info(vcx_command_handle_t handle, const char *info, void (*cb)(vcx_command_handle_t xhandle, vcx_error_t err));

vcx_error_t vcx_update_webhook_url(const char *notification_webhook_url);

const char *vcx_error_c_message(int);
const char *vcx_version();

Expand Down Expand Up @@ -153,6 +155,12 @@ vcx_error_t vcx_connection_create_with_invite(vcx_command_handle_t command_handl
/** Deletes a connection, send an API call to agency to stop sending messages from this connection */
vcx_error_t vcx_connection_delete_connection(vcx_command_handle_t command_handle, vcx_connection_handle_t connection_handle, void (*cb)(vcx_command_handle_t, vcx_error_t err));

/** Retrieves pw_did from Connection object. */
vcx_error_t vcx_connection_get_pw_did(vcx_command_handle_t command_handle, vcx_connection_handle_t connection_handle, void (*cb)(vcx_command_handle_t xcommand_handle, vcx_error_t err, const char *pw_did));

/** Retrieves their_pw_did from Connection object. */
vcx_error_t vcx_connection_get_their_pw_did(vcx_command_handle_t command_handle, vcx_connection_handle_t connection_handle, void (*cb)(vcx_command_handle_t xcommand_handle, vcx_error_t err, const char *their_pw_did));

/** Send a message to the specified connection
///
/// #params
Expand Down
4 changes: 2 additions & 2 deletions wrappers/ios/libindy-pod/Indy/Wrapper/IndyNonSecrets.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
{
retrieveType: (optional, false by default) Retrieve record type,
retrieveValue: (optional, true by default) Retrieve record value,
retrieveTags: (optional, true by default) Retrieve record tags
retrieveTags: (optional, false by default) Retrieve record tags
}
@param completion Completion callback that returns error code and wallet record:
Expand Down Expand Up @@ -181,7 +181,7 @@
retrieveTotalCount: (optional, false by default) Calculate total count,
retrieveType: (optional, false by default) Retrieve record type,
retrieveValue: (optional, true by default) Retrieve record value,
retrieveTags: (optional, true by default) Retrieve record tags,
retrieveTags: (optional, false by default) Retrieve record tags,
}
@param completion Completion callback that returns error code and searchHandle that can be used later
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public static CompletableFuture<IssuerCreateAndStoreCredentialDefResult> issuerC
*
* @throws IndyException Thrown if an error occurs when calling the underlying SDK.
*/
public static CompletableFuture<String>issuerRotateCredentialDefStart(
public static CompletableFuture<String> issuerRotateCredentialDefStart(
Wallet wallet,
String credDefId,
String configJson) throws IndyException {
Expand Down Expand Up @@ -358,7 +358,7 @@ public static CompletableFuture<IssuerCreateAndStoreCredentialDefResult> issuerC
*
* @throws IndyException Thrown if an error occurs when calling the underlying SDK.
*/
public static CompletableFuture<Void>issuerRotateCredentialDefApply(
public static CompletableFuture<Void> issuerRotateCredentialDefApply(
Wallet wallet,
String credDefId) throws IndyException {

Expand Down Expand Up @@ -1003,7 +1003,7 @@ public static CompletableFuture<Void> proverDeleteCredential(
commandHandle,
walletHandle,
credId,
stringCb);
voidCb);

checkResult(future, result);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public static CompletableFuture<Void> delete(
* {
* retrieveType: (optional, false by default) Retrieve record type,
* retrieveValue: (optional, true by default) Retrieve record value,
* retrieveTags: (optional, true by default) Retrieve record tags
* retrieveTags: (optional, false by default) Retrieve record tags
* }
* @return A future that resolves to wallet records json:
* {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void callback(int xcommand_handle, int err, int handle) {
* retrieveTotalCount: (optional, false by default) Calculate total count,
* retrieveType: (optional, false by default) Retrieve record type,
* retrieveValue: (optional, true by default) Retrieve record value,
* retrieveTags: (optional, true by default) Retrieve record tags,
* retrieveTags: (optional, false by default) Retrieve record tags,
* }
* @return A future that resolves to WalletSearch instance.
* @throws IndyException Thrown if an error occurs when calling the underlying SDK.
Expand Down
64 changes: 64 additions & 0 deletions wrappers/nodejs/test/nonsecrets.js
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)
})
4 changes: 2 additions & 2 deletions wrappers/python/indy/non_secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ async def get_wallet_record(wallet_handle: int,
{
retrieveType: (optional, false by default) Retrieve record type,
retrieveValue: (optional, true by default) Retrieve record value,
retrieveTags: (optional, true by default) Retrieve record tags
retrieveTags: (optional, false by default) Retrieve record tags
}
:return: wallet record json:
{
Expand Down Expand Up @@ -346,7 +346,7 @@ async def open_wallet_search(wallet_handle: int,
retrieveTotalCount: (optional, false by default) Calculate total count,
retrieveType: (optional, false by default) Retrieve record type,
retrieveValue: (optional, true by default) Retrieve record value,
retrieveTags: (optional, true by default) Retrieve record tags,
retrieveTags: (optional, false by default) Retrieve record tags,
}
:return: search_handle: Wallet search handle that can be used later
to fetch records by small batches (with fetch_wallet_search_next_records)
Expand Down

0 comments on commit 3c90c6c

Please sign in to comment.