Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/bcgov/bc-wallet-mobile into… (
Browse files Browse the repository at this point in the history
#82)

Signed-off-by: Jean-Christophe Drouin <[email protected]>
  • Loading branch information
jcdrouin21 authored Feb 14, 2024
1 parent e6c48d0 commit 3f910d4
Show file tree
Hide file tree
Showing 47 changed files with 8,924 additions and 9,820 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ inputs:
node-version:
description: Select the nodejs version to use
required: false
default: "16.15.0"
default: "18.18.2"

runs:
using: composite
Expand Down
18 changes: 4 additions & 14 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ jobs:
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/app/Gemfile
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Pull & update submodules recursively
run: |
git submodule update --init --recursive
- uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Setup NodeJS
uses: ./.github/workflows/actions/setup-node
Expand Down Expand Up @@ -106,11 +106,6 @@ jobs:
path: app/ios/xbuild/Build
key: ${{ runner.os }}-dd-xcode

- name: Setup Python 3.11.5
uses: actions/setup-python@v2
with:
python-version: 3.11.5

- name: Install dependencies
working-directory: ./
run: |
Expand Down Expand Up @@ -264,14 +259,9 @@ jobs:
server-id: github
settings-path: ${{ github.workspace }}

- name: Update ledgers
uses: ./.github/workflows/actions/update-ledgers

- name: Install dependencies
working-directory: ./
run: |
rm bifold/package.json && \
rm bifold/yarn.lock && \
yarn install --immutable && \
git status
Expand Down
142 changes: 142 additions & 0 deletions .yarn/patches/@aries-framework-anoncreds-npm-0.4.0-4d3b4e769d.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,145 @@
diff --git a/build/utils/getRevocationRegistries.js b/build/utils/getRevocationRegistries.js
index 659e85e5d206ae9ba291383325403f922b2e9e1d..0a30ed45f36271e65dc7f6504b8b77afa59ccce8 100644
--- a/build/utils/getRevocationRegistries.js
+++ b/build/utils/getRevocationRegistries.js
@@ -33,6 +33,8 @@ async function getRevocationRegistriesForRequest(agentContext, proofRequest, sel
nonRevoked: (_b = proofRequest.requested_predicates[referent].non_revoked) !== null && _b !== void 0 ? _b : proofRequest.non_revoked,
});
}
+
+ const revocationRegistryPromises = [];
for (const { referent, selectedCredential, nonRevoked, type } of referentCredentials) {
if (!selectedCredential.credentialInfo) {
throw new core_1.AriesFrameworkError(`Credential for referent '${referent} does not have credential info for revocation state creation`);
@@ -54,39 +56,45 @@ async function getRevocationRegistriesForRequest(agentContext, proofRequest, sel
const registry = agentContext.dependencyManager
.resolve(services_1.AnonCredsRegistryService)
.getRegistryForIdentifier(agentContext, revocationRegistryId);
- // Fetch revocation registry definition if not in revocation registries list yet
- if (!revocationRegistries[revocationRegistryId]) {
- const { revocationRegistryDefinition, resolutionMetadata } = await registry.getRevocationRegistryDefinition(agentContext, revocationRegistryId);
- if (!revocationRegistryDefinition) {
- throw new core_1.AriesFrameworkError(`Could not retrieve revocation registry definition for revocation registry ${revocationRegistryId}: ${resolutionMetadata.message}`);
+
+ const getRevocationRegistry = async () => {
+ // Fetch revocation registry definition if not in revocation registries list yet
+ if (!revocationRegistries[revocationRegistryId]) {
+ const { revocationRegistryDefinition, resolutionMetadata } = await registry.getRevocationRegistryDefinition(agentContext, revocationRegistryId);
+ if (!revocationRegistryDefinition) {
+ throw new core_1.AriesFrameworkError(`Could not retrieve revocation registry definition for revocation registry ${revocationRegistryId}: ${resolutionMetadata.message}`);
+ }
+ const { tailsLocation, tailsHash } = revocationRegistryDefinition.value;
+ const { tailsFilePath } = await (0, tails_1.downloadTailsFile)(agentContext, tailsLocation, tailsHash);
+ // const tails = await this.indyUtilitiesService.downloadTails(tailsHash, tailsLocation)
+ revocationRegistries[revocationRegistryId] = {
+ definition: revocationRegistryDefinition,
+ tailsFilePath,
+ revocationStatusLists: {},
+ };
}
- const { tailsLocation, tailsHash } = revocationRegistryDefinition.value;
- const { tailsFilePath } = await (0, tails_1.downloadTailsFile)(agentContext, tailsLocation, tailsHash);
- // const tails = await this.indyUtilitiesService.downloadTails(tailsHash, tailsLocation)
- revocationRegistries[revocationRegistryId] = {
- definition: revocationRegistryDefinition,
- tailsFilePath,
- revocationStatusLists: {},
- };
- }
- // In most cases we will have a timestamp, but if it's not defined, we use the nonRevoked.to value
- const timestampToFetch = timestamp !== null && timestamp !== void 0 ? timestamp : nonRevoked.to;
- // Fetch revocation status list if we don't already have a revocation status list for the given timestamp
- if (!revocationRegistries[revocationRegistryId].revocationStatusLists[timestampToFetch]) {
- const { revocationStatusList, resolutionMetadata: statusListResolutionMetadata } = await registry.getRevocationStatusList(agentContext, revocationRegistryId, timestampToFetch);
- if (!revocationStatusList) {
- throw new core_1.AriesFrameworkError(`Could not retrieve revocation status list for revocation registry ${revocationRegistryId}: ${statusListResolutionMetadata.message}`);
- }
- revocationRegistries[revocationRegistryId].revocationStatusLists[revocationStatusList.timestamp] =
- revocationStatusList;
- // If we don't have a timestamp on the selected credential, we set it to the timestamp of the revocation status list
- // this way we know which revocation status list to use when creating the proof.
- if (!timestamp) {
- updatedSelectedCredentials = Object.assign(Object.assign({}, updatedSelectedCredentials), { [type]: Object.assign(Object.assign({}, updatedSelectedCredentials[type]), { [referent]: Object.assign(Object.assign({}, updatedSelectedCredentials[type][referent]), { timestamp: revocationStatusList.timestamp }) }) });
+ // In most cases we will have a timestamp, but if it's not defined, we use the nonRevoked.to value
+ const timestampToFetch = timestamp !== null && timestamp !== void 0 ? timestamp : nonRevoked.to;
+ // Fetch revocation status list if we don't already have a revocation status list for the given timestamp
+ if (!revocationRegistries[revocationRegistryId].revocationStatusLists[timestampToFetch]) {
+ const { revocationStatusList, resolutionMetadata: statusListResolutionMetadata } = await registry.getRevocationStatusList(agentContext, revocationRegistryId, timestampToFetch);
+ if (!revocationStatusList) {
+ throw new core_1.AriesFrameworkError(`Could not retrieve revocation status list for revocation registry ${revocationRegistryId}: ${statusListResolutionMetadata.message}`);
+ }
+ revocationRegistries[revocationRegistryId].revocationStatusLists[revocationStatusList.timestamp] =
+ revocationStatusList;
+ // If we don't have a timestamp on the selected credential, we set it to the timestamp of the revocation status list
+ // this way we know which revocation status list to use when creating the proof.
+ if (!timestamp) {
+ updatedSelectedCredentials = Object.assign(Object.assign({}, updatedSelectedCredentials), { [type]: Object.assign(Object.assign({}, updatedSelectedCredentials[type]), { [referent]: Object.assign(Object.assign({}, updatedSelectedCredentials[type][referent]), { timestamp: revocationStatusList.timestamp }) }) });
+ }
}
}
+
+ revocationRegistryPromises.push(getRevocationRegistry());
}
}
+ await Promise.all(revocationRegistryPromises);
agentContext.config.logger.debug(`Retrieved revocation registries for proof request`, {
revocationRegistries,
});
@@ -104,6 +112,7 @@ async function getRevocationRegistriesForRequest(agentContext, proofRequest, sel
exports.getRevocationRegistriesForRequest = getRevocationRegistriesForRequest;
async function getRevocationRegistriesForProof(agentContext, proof) {
const revocationRegistries = {};
+ const revocationRegistryPromises = [];
for (const identifier of proof.identifiers) {
const revocationRegistryId = identifier.rev_reg_id;
const timestamp = identifier.timestamp;
@@ -113,26 +122,30 @@ async function getRevocationRegistriesForProof(agentContext, proof) {
const registry = agentContext.dependencyManager
.resolve(services_1.AnonCredsRegistryService)
.getRegistryForIdentifier(agentContext, revocationRegistryId);
- // Fetch revocation registry definition if not already fetched
- if (!revocationRegistries[revocationRegistryId]) {
- const { revocationRegistryDefinition, resolutionMetadata } = await registry.getRevocationRegistryDefinition(agentContext, revocationRegistryId);
- if (!revocationRegistryDefinition) {
- throw new core_1.AriesFrameworkError(`Could not retrieve revocation registry definition for revocation registry ${revocationRegistryId}: ${resolutionMetadata.message}`);
+ const getRevocationRegistry = async () => {
+ // Fetch revocation registry definition if not already fetched
+ if (!revocationRegistries[revocationRegistryId]) {
+ const { revocationRegistryDefinition, resolutionMetadata } = await registry.getRevocationRegistryDefinition(agentContext, revocationRegistryId);
+ if (!revocationRegistryDefinition) {
+ throw new core_1.AriesFrameworkError(`Could not retrieve revocation registry definition for revocation registry ${revocationRegistryId}: ${resolutionMetadata.message}`);
+ }
+ revocationRegistries[revocationRegistryId] = {
+ definition: revocationRegistryDefinition,
+ revocationStatusLists: {},
+ };
}
- revocationRegistries[revocationRegistryId] = {
- definition: revocationRegistryDefinition,
- revocationStatusLists: {},
- };
- }
- // Fetch revocation status list by timestamp if not already fetched
- if (!revocationRegistries[revocationRegistryId].revocationStatusLists[timestamp]) {
- const { revocationStatusList, resolutionMetadata: statusListResolutionMetadata } = await registry.getRevocationStatusList(agentContext, revocationRegistryId, timestamp);
- if (!revocationStatusList) {
- throw new core_1.AriesFrameworkError(`Could not retrieve revocation status list for revocation registry ${revocationRegistryId}: ${statusListResolutionMetadata.message}`);
+ // Fetch revocation status list by timestamp if not already fetched
+ if (!revocationRegistries[revocationRegistryId].revocationStatusLists[timestamp]) {
+ const { revocationStatusList, resolutionMetadata: statusListResolutionMetadata } = await registry.getRevocationStatusList(agentContext, revocationRegistryId, timestamp);
+ if (!revocationStatusList) {
+ throw new core_1.AriesFrameworkError(`Could not retrieve revocation status list for revocation registry ${revocationRegistryId}: ${statusListResolutionMetadata.message}`);
+ }
+ revocationRegistries[revocationRegistryId].revocationStatusLists[timestamp] = revocationStatusList;
}
- revocationRegistries[revocationRegistryId].revocationStatusLists[timestamp] = revocationStatusList;
}
+ revocationRegistryPromises.push(getRevocationRegistry());
}
+ await Promise.all(revocationRegistryPromises);
return revocationRegistries;
}
exports.getRevocationRegistriesForProof = getRevocationRegistriesForProof;
diff --git a/build/utils/revocationInterval.js b/build/utils/revocationInterval.js
index 728732d5119b879a2a2399eab6e6430b62796106..5c69ea0731c0fbdc0ff4820891d67773c7105b3b 100644
--- a/build/utils/revocationInterval.js
Expand Down
20 changes: 0 additions & 20 deletions .yarn/patches/@aries-framework-core-npm-0.3.3-dd6486de3d.patch

This file was deleted.

40 changes: 40 additions & 0 deletions .yarn/patches/@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
diff --git a/build/pool/IndyVdrPool.js b/build/pool/IndyVdrPool.js
index 0ec57415429a0b97844b2d65a8ee83f68ad10466..ff874884b2d740fc5b5a2c89a619942baf121e2b 100644
--- a/build/pool/IndyVdrPool.js
+++ b/build/pool/IndyVdrPool.js
@@ -25,6 +25,12 @@ class IndyVdrPool {
},
});
}
+ async refreshConnection() {
+ await this.pool.refresh()
+ }
+ async getPoolTransactions(){
+ return this.pool.transactions
+ }
get pool() {
if (!this._pool)
this.connect();
diff --git a/build/pool/IndyVdrPoolService.js b/build/pool/IndyVdrPoolService.js
index e5abc0d40cae5a4d5777220fd0c36d85496df313..366631ac8d8b6b093d8a8d849b587d3c55aaf10e 100644
--- a/build/pool/IndyVdrPoolService.js
+++ b/build/pool/IndyVdrPoolService.js
@@ -113,6 +113,18 @@ let IndyVdrPoolService = class IndyVdrPoolService {
successful,
};
}
+ /**
+ * Refresh the pool connections asynchronously
+ */
+ refreshPoolConnections() {
+ return Promise.allSettled(this.pools.map((pool) => pool.refreshConnection()))
+ }
+ /**
+ * get the pool transactions asynchronously
+ */
+ getPoolTransactions() {
+ return Promise.all(this.pools.map(async (pool) => {return {config: pool.config, transactions: await pool.getPoolTransactions()}}))
+ }
/**
* Get the most appropriate pool for the given indyNamespace
*/

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/build/ReactNativeIndyVdr.js b/build/ReactNativeIndyVdr.js
index 11f1bf74b1e776401ca593acaf9dbce2b53871e5..c0cd20d3bd402b501b4ccf2e3a986c931455b98e 100644
--- a/build/ReactNativeIndyVdr.js
+++ b/build/ReactNativeIndyVdr.js
@@ -164,7 +164,7 @@ class ReactNativeIndyVdr {
async poolGetTransactions(options) {
const { poolHandle } = (0, serialize_1.serializeArguments)(options);
const result = (0, indy_vdr_shared_1.handleInvalidNullResponse)(await this.promisifyWithResponse((cb) => this.indyVdr.poolGetTransactions({ cb, poolHandle }), true));
- return JSON.parse(result);
+ return result;
}
async poolGetVerifiers(options) {
const { poolHandle } = (0, serialize_1.serializeArguments)(options);
Loading

0 comments on commit 3f910d4

Please sign in to comment.