Skip to content

Commit

Permalink
Merge pull request hyperledger-archives#1605 from dkulic/feature/CM-2…
Browse files Browse the repository at this point in the history
…206_Cache_cred_def_and_schemas

Cache credential definitions and schemas
  • Loading branch information
jovfer authored May 20, 2019
2 parents d7f1b76 + acb7aaa commit 3381e6b
Show file tree
Hide file tree
Showing 45 changed files with 3,160 additions and 22 deletions.
8 changes: 4 additions & 4 deletions Jenkinsfile.cd
Original file line number Diff line number Diff line change
Expand Up @@ -778,10 +778,10 @@ def iosTesting() {
sh "rm -f wrappers/ios/libindy-pod/Pods/libindy/*.[ah]"
sh "cp libindy/out_pod/*.[ah] wrappers/ios/libindy-pod/Pods/libindy"

dir('wrappers/ios/libindy-pod') {
echo "iOS Test: Testing"
sh "xcodebuild test -workspace Indy.xcworkspace -scheme Indy-demo -destination 'platform=iOS Simulator,name=iPhone X IndySDK,OS=11.2'"
}
// dir('wrappers/ios/libindy-pod') {
// echo "iOS Test: Testing"
// sh "xcodebuild test -workspace Indy.xcworkspace -scheme Indy-demo -destination 'platform=iOS Simulator,name=iPhone X IndySDK,OS=11.2'"
// }

stash includes: 'libindy/out_pod/libindy.tar.gz', name: "LibindyUniversalIOSPod"

Expand Down
8 changes: 4 additions & 4 deletions Jenkinsfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,10 @@ def iosTesting() {
sh "rm -f wrappers/ios/libindy-pod/Pods/libindy/*.[ah]"
sh "cp libindy/out_pod/*.[ah] wrappers/ios/libindy-pod/Pods/libindy"

dir('wrappers/ios/libindy-pod') {
echo "iOS Test: Testing"
sh "xcodebuild test -workspace Indy.xcworkspace -scheme Indy-demo -destination 'platform=iOS Simulator,name=iPhone X IndySDK,OS=11.2'"
}
// dir('wrappers/ios/libindy-pod') {
// echo "iOS Test: Testing"
// sh "xcodebuild test -workspace Indy.xcworkspace -scheme Indy-demo -destination 'platform=iOS Simulator,name=iPhone X IndySDK,OS=11.2'"
// }
}
} finally {
try {
Expand Down
23 changes: 23 additions & 0 deletions Specs/libindy/1.8.3-1100/libindy.podspec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "libindy",
"version": "1.8.3-1100",
"summary": "Summary TODO.",
"description": "Description TODO.",
"homepage": "TODO",
"license": {
"type": "Apache License 2.0",
"file": "LICENSE"
},
"authors": {
"Daniel Hardman": "[email protected]"
},
"platforms": {
"ios": "10.0"
},
"source": {
"http": "https://repo.sovrin.org/ios/libindy/master/libindy-core/1.8.3-1100/libindy.tar.gz"
},
"source_files": "*.h",
"vendored_libraries": "*.a",
"requires_arc": false
}
130 changes: 130 additions & 0 deletions libindy/include/indy_cache.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
#ifndef __indy__cache__included__
#define __indy__cache__included__

#ifdef __cplusplus
extern "C" {
#endif

/// Gets schema json data for specified schema id.
/// If data is present inside of cache, cached data is returned.
/// Otherwise data is fetched from the ledger and stored inside of cache for future use.
///
/// EXPERIMENTAL
///
/// #Params
/// command_handle: command handle to map callback to caller context.
/// pool_handle: pool handle (created by open_pool_ledger).
/// wallet_handle: wallet handle (created by open_wallet).
/// submitter_did: DID of the submitter stored in secured Wallet.
/// id: identifier of schema.
/// options_json:
/// {
/// noCache: (bool, optional, false by default) Skip usage of cache,
/// noUpdate: (bool, optional, false by default) Use only cached data, do not try to update.
/// noStore: (bool, optional, false by default) Skip storing fresh data if updated,
/// minFresh: (int, optional, -1 by default) Return cached data if not older than this many seconds. -1 means do not check age.
/// }
/// #Returns
/// Schema json:
/// {
/// id: identifier of schema
/// attrNames: array of attribute name strings
/// name: Schema's name string
/// version: Schema's version string
/// ver: Version of the Schema json
/// }
extern indy_error_t indy_get_schema(indy_handle_t command_handle,
indy_handle_t pool_handle,
indy_handle_t wallet_handle,
const char * submitter_did,
const char * id,
const char * options_json,
void (*cb)(indy_handle_t command_handle_,
indy_error_t err,
const char* schema_json)
);

/// Gets credential definition json data for specified credential definition id.
/// If data is present inside of cache, cached data is returned.
/// Otherwise data is fetched from the ledger and stored inside of cache for future use.
///
/// EXPERIMENTAL
///
/// #Params
/// command_handle: command handle to map callback to caller context.
/// pool_handle: pool handle (created by open_pool_ledger).
/// wallet_handle: wallet handle (created by open_wallet).
/// submitter_did: DID of the submitter stored in secured Wallet.
/// id: identifier of credential definition.
/// options_json:
/// {
/// noCache: (bool, optional, false by default) Skip usage of cache,
/// noUpdate: (bool, optional, false by default) Use only cached data, do not try to update.
/// noStore: (bool, optional, false by default) Skip storing fresh data if updated,
/// minFresh: (int, optional, -1 by default) Return cached data if not older than this many seconds. -1 means do not check age.
/// }
///
/// #Returns
/// Credential Definition json:
/// {
/// id: string - identifier of credential definition
/// schemaId: string - identifier of stored in ledger schema
/// type: string - type of the credential definition. CL is the only supported type now.
/// tag: string - allows to distinct between credential definitions for the same issuer and schema
/// value: Dictionary with Credential Definition's data: {
/// primary: primary credential public key,
/// Optional<revocation>: revocation credential public key
/// },
/// ver: Version of the Credential Definition json
/// }
extern indy_error_t indy_get_cred_def(indy_handle_t command_handle,
indy_handle_t pool_handle,
indy_handle_t wallet_handle,
const char * submitter_did,
const char * id,
const char * options_json,
void (*cb)(indy_handle_t command_handle_,
indy_error_t err,
const char* cred_def_json)
);

/// Purge schema cache.
///
/// EXPERIMENTAL
///
/// #Params
/// command_handle: command handle to map callback to caller context.
/// wallet_handle: wallet handle (created by open_wallet).
/// options_json:
/// {
/// maxAge: (int, optional, -1 by default) Purge cached data if older than this many seconds. -1 means purge all.
/// }
extern indy_error_t indy_purge_schema_cache(indy_handle_t command_handle,
indy_handle_t wallet_handle,
const char * options_json,
void (*cb)(indy_handle_t command_handle_,
indy_error_t err)
);

/// Purge credential definition cache.
///
/// EXPERIMENTAL
///
/// #Params
/// command_handle: command handle to map callback to caller context.
/// wallet_handle: wallet handle (created by open_wallet).
/// options_json:
/// {
/// maxAge: (int, optional, -1 by default) Purge cached data if older than this many seconds. -1 means purge all.
/// }
extern indy_error_t indy_purge_cred_def_cache(indy_handle_t command_handle,
indy_handle_t wallet_handle,
const char * options_json,
void (*cb)(indy_handle_t command_handle_,
indy_error_t err)
);
#ifdef __cplusplus
}
#endif

#endif
1 change: 1 addition & 0 deletions libindy/include/indy_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
#include "indy_blob_storage.h"
#include "indy_non_secrets.h"
#include "indy_logger.h"
#include "indy_cache.h"

#endif
2 changes: 1 addition & 1 deletion libindy/include/indy_non_secrets.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ extern "C" {
indy_error_t err)
);


#ifdef __cplusplus
}
#endif

#endif

Loading

0 comments on commit 3381e6b

Please sign in to comment.