diff --git a/app/container-imp.ts b/app/container-imp.ts index 0c984851..36b02951 100644 --- a/app/container-imp.ts +++ b/app/container-imp.ts @@ -1,3 +1,4 @@ +import { BaseLogger } from '@credo-ts/core' import { Container, TOKENS, @@ -14,6 +15,7 @@ import { Screens, } from '@hyperledger/aries-bifold-core' import { RemoteLogger, RemoteLoggerOptions } from '@hyperledger/aries-bifold-remote-logs' +import { useProofRequestTemplates } from '@hyperledger/aries-bifold-verifier' import { BrandingOverlayType, RemoteOCABundleResolver } from '@hyperledger/aries-oca/build/legacy' import AsyncStorage from '@react-native-async-storage/async-storage' import { NavigationProp } from '@react-navigation/native' @@ -32,8 +34,6 @@ import Developer from './src/screens/Developer' import Preface from './src/screens/Preface' import Terms, { TermsVersion } from './src/screens/Terms' import { BCLocalStorageKeys, BCState, DismissPersonCredentialOffer, IASEnvironment, initialState } from './src/store' -import { useProofRequestTemplates } from '@hyperledger/aries-bifold-verifier' -import { BaseLogger } from '@credo-ts/core' export class AppContainer implements Container { private _container: DependencyContainer @@ -75,6 +75,58 @@ export class AppContainer implements Container { }, }, ]) + this._container.registerInstance(TOKENS.CACHE_CRED_DEFS, [ + // { did: "4WW6792ksq62UroZyfd6nQ", id: "4WW6792ksq62UroZyfd6nQ:3:CL:1098:SellingItRight" }, + { did: 'TeT8SJGHruVL9up3Erp4o', id: 'TeT8SJGHruVL9up3Erp4o:3:CL:224665:Selling It Right' }, + { did: 'TeT8SJGHruVL9up3Erp4o', id: 'TeT8SJGHruVL9up3Erp4o:3:CL:400095:SellingItRight' }, + { did: 'Ttmj1pEotg8FbKZZD81S7i', id: 'Ttmj1pEotg8FbKZZD81S7i:3:CL:184:SellingItRight' }, + // { did: "4WW6792ksq62UroZyfd6nQ", id: "4WW6792ksq62UroZyfd6nQ:3:CL:1098:ServingItRight" }, + { did: 'TeT8SJGHruVL9up3Erp4o', id: 'TeT8SJGHruVL9up3Erp4o:3:CL:224665:Serving It Right' }, + { did: 'TeT8SJGHruVL9up3Erp4o', id: 'TeT8SJGHruVL9up3Erp4o:3:CL:400095:ServingItRight' }, + { did: 'Ttmj1pEotg8FbKZZD81S7i', id: 'Ttmj1pEotg8FbKZZD81S7i:3:CL:184:ServingItRight' }, + // { did: "4WW6792ksq62UroZyfd6nQ", id: "4WW6792ksq62UroZyfd6nQ:3:CL:1098:SpecialEventServer" }, + { did: 'TeT8SJGHruVL9up3Erp4o', id: 'TeT8SJGHruVL9up3Erp4o:3:CL:224665:Special Event Server' }, + { did: 'TeT8SJGHruVL9up3Erp4o', id: 'TeT8SJGHruVL9up3Erp4o:3:CL:400095:SpecialEventServer' }, + { did: 'Ttmj1pEotg8FbKZZD81S7i', id: 'Ttmj1pEotg8FbKZZD81S7i:3:CL:184:SpecialEventServer' }, + + { did: '4xE68b6S5VRFrKMMG1U95M', id: '4xE68b6S5VRFrKMMG1U95M:3:CL:59232:default' }, + { did: 'L6ASjmDDbDH7yPL1t2yFj9', id: 'L6ASjmDDbDH7yPL1t2yFj9:3:CL:7162:member_card' }, + { did: 'M6dhuFj5UwbhWkSLmvYSPc', id: 'M6dhuFj5UwbhWkSLmvYSPc:3:CL:834686:member_card' }, + { did: 'QEquAHkM35w4XVT3Ku5yat', id: 'QEquAHkM35w4XVT3Ku5yat:3:CL:834674:member_card' }, + { did: 'AuJrigKQGRLJajKAebTgWu', id: 'AuJrigKQGRLJajKAebTgWu:3:CL:209526:default' }, + + { did: 'RGjWbW1eycP7FrMf4QJvX8', id: 'RGjWbW1eycP7FrMf4QJvX8:3:CL:13:Person' }, + { did: 'L6ASjmDDbDH7yPL1t2yFj9', id: 'L6ASjmDDbDH7yPL1t2yFj9:3:CL:257:Person' }, + { did: 'M6dhuFj5UwbhWkSLmvYSPc', id: 'M6dhuFj5UwbhWkSLmvYSPc:3:CL:834685:Person' }, + { did: 'QEquAHkM35w4XVT3Ku5yat', id: 'QEquAHkM35w4XVT3Ku5yat:3:CL:834664:Person' }, + { did: 'KCxVC8GkKywjhWJnUfCmkW', id: 'KCxVC8GkKywjhWJnUfCmkW:3:CL:20:PersonQA' }, + { did: '7xjfawcnyTUcduWVysLww5', id: '7xjfawcnyTUcduWVysLww5:3:CL:28075:PersonSIT' }, + { did: 'XpgeQa93eZvGSZBZef3PHn', id: 'XpgeQa93eZvGSZBZef3PHn:3:CL:28075:PersonDEV' }, + + { did: 'AcZpBDz3oxmKrpcuPcdKai', id: 'AcZpBDz3oxmKrpcuPcdKai:3:CL:350:default' }, + { did: 'K9igebFysBL6jcBwR8bKuN', id: 'K9igebFysBL6jcBwR8bKuN:3:CL:61:default' }, + ]) + this._container.registerInstance(TOKENS.CACHE_SCHEMAS, [ + { did: 'TeT8SJGHruVL9up3Erp4o', id: 'TeT8SJGHruVL9up3Erp4o:2:LCRB:1.1.1' }, + { did: 'TeT8SJGHruVL9up3Erp4o', id: 'TeT8SJGHruVL9up3Erp4o:2:LCRBSirSes:1.0.0' }, + { did: 'Ttmj1pEotg8FbKZZD81S7i', id: 'Ttmj1pEotg8FbKZZD81S7i:2:LCRBSirSes:1.0.0' }, + + { did: '4xE68b6S5VRFrKMMG1U95M', id: '4xE68b6S5VRFrKMMG1U95M:2:Member Card:1.5.1' }, + { did: 'L6ASjmDDbDH7yPL1t2yFj9', id: 'L6ASjmDDbDH7yPL1t2yFj9:2:member_card:1.53' }, + { did: 'M6dhuFj5UwbhWkSLmvYSPc', id: 'M6dhuFj5UwbhWkSLmvYSPc:2:member_card:1.54' }, + { did: 'QEquAHkM35w4XVT3Ku5yat', id: 'QEquAHkM35w4XVT3Ku5yat:2:member_card:1.54' }, + { did: 'AuJrigKQGRLJajKAebTgWu', id: 'AuJrigKQGRLJajKAebTgWu:2:Member Card:1.5.1' }, + + { did: 'RGjWbW1eycP7FrMf4QJvX8', id: 'RGjWbW1eycP7FrMf4QJvX8:2:Person:1.0' }, + { did: 'L6ASjmDDbDH7yPL1t2yFj9', id: 'L6ASjmDDbDH7yPL1t2yFj9:2:Person:1.2' }, + { did: 'M6dhuFj5UwbhWkSLmvYSPc', id: 'M6dhuFj5UwbhWkSLmvYSPc:2:Person:1.3' }, + { did: 'QEquAHkM35w4XVT3Ku5yat', id: 'QEquAHkM35w4XVT3Ku5yat:2:Person:1.3' }, + { did: 'KCxVC8GkKywjhWJnUfCmkW', id: 'KCxVC8GkKywjhWJnUfCmkW:2:Person:1.0' }, + { did: 'XpgeQa93eZvGSZBZef3PHn', id: 'XpgeQa93eZvGSZBZef3PHn:2:Person:1.0' }, + + { did: 'AcZpBDz3oxmKrpcuPcdKai', id: 'AcZpBDz3oxmKrpcuPcdKai:2:Digital Business Card:1.0.0' }, + { did: 'K9igebFysBL6jcBwR8bKuN', id: 'K9igebFysBL6jcBwR8bKuN:2:Digital Business Card:1.0.0' }, + ]) this._container.registerInstance(TOKENS.SCREEN_TERMS, { screen: Terms, version: TermsVersion }) this._container.registerInstance(TOKENS.SCREEN_DEVELOPER, Developer) diff --git a/app/package.json b/app/package.json index 85d665b1..6e6ef6b8 100644 --- a/app/package.json +++ b/app/package.json @@ -67,6 +67,7 @@ "@hyperledger/aries-oca": "1.0.0-alpha.274", "@hyperledger/aries-react-native-attestation": "1.0.0-alpha.274", "@hyperledger/indy-vdr-react-native": "0.2.2", + "@hyperledger/indy-vdr-shared": "0.2.2", "@react-native-async-storage/async-storage": "1.15.11", "@react-native-community/masked-view": "0.1.11", "@react-native-community/netinfo": "9.3.7", diff --git a/app/src/localization/en/index.ts b/app/src/localization/en/index.ts index b6332372..8cfa013c 100644 --- a/app/src/localization/en/index.ts +++ b/app/src/localization/en/index.ts @@ -159,6 +159,7 @@ const translation = { "GettingCredentials": "Getting wallet credentials...", "RegisteringTransports": "Registering transports...", "InitializingAgent": "Initializing agent...", + "CacheWarmup": "Warming up cache...", "ConnectingLedgers": "Connecting to ledgers...", "SettingAgent": "Setting agent...", "Finishing": "Finishing..." diff --git a/app/src/localization/fr/index.ts b/app/src/localization/fr/index.ts index 9c10ea37..25ddb1b9 100644 --- a/app/src/localization/fr/index.ts +++ b/app/src/localization/fr/index.ts @@ -158,6 +158,7 @@ const translation = { "GettingCredentials": "Récupération des identifiants du portefeuille...", "RegisteringTransports": "Enregistrement des transports...", "InitializingAgent": "Initialisation de l'agent...", + "CacheWarmup": "Warming up cache... (FR)", "ConnectingLedgers": "Connexion aux registres...", "SettingAgent": "Paramétrage de l'agent...", "Finishing": "Finalisation...", diff --git a/app/src/localization/pt-br/index.ts b/app/src/localization/pt-br/index.ts index 39aeb499..0a5acd13 100644 --- a/app/src/localization/pt-br/index.ts +++ b/app/src/localization/pt-br/index.ts @@ -158,6 +158,7 @@ const translation = { "GettingCredentials": "Getting wallet credentials... (PT-BR)", "RegisteringTransports": "Registering transports... (PT-BR)", "InitializingAgent": "Initializing agent... (PT-BR)", + "CacheWarmup": "Warming up cache... (PT-BR)", "ConnectingLedgers": "Connecting to ledgers... (PT-BR)", "SettingAgent": "Setting agent... (PT-BR)", "Finishing": "Finishing... (PT-BR)", diff --git a/app/src/screens/Splash.tsx b/app/src/screens/Splash.tsx index e434cbc0..15103e9b 100644 --- a/app/src/screens/Splash.tsx +++ b/app/src/screens/Splash.tsx @@ -23,6 +23,7 @@ import { useContainer, } from '@hyperledger/aries-bifold-core' import { RemoteOCABundleResolver } from '@hyperledger/aries-oca/build/legacy' +import { GetCredentialDefinitionRequest, GetSchemaRequest } from '@hyperledger/indy-vdr-shared' import AsyncStorage from '@react-native-async-storage/async-storage' import { CommonActions, useNavigation } from '@react-navigation/native' import moment from 'moment' @@ -142,6 +143,7 @@ const Splash = () => { t('Init.GettingCredentials'), t('Init.RegisteringTransports'), t('Init.InitializingAgent'), + t('Init.CacheWarmup'), t('Init.ConnectingLedgers'), t('Init.SettingAgent'), t('Init.Finishing'), @@ -410,15 +412,31 @@ const Splash = () => { } setStep(6) - await createLinkSecretIfRequired(newAgent) + const credDefs = container.resolve(TOKENS.CACHE_CRED_DEFS) + const schemas = container.resolve(TOKENS.CACHE_SCHEMAS) + + credDefs.forEach(async ({ did, id }) => { + const pool = await poolService.getPoolForDid(newAgent.context, did) + const credDefRequest = new GetCredentialDefinitionRequest({ credentialDefinitionId: id }) + await pool.pool.submitRequest(credDefRequest) + }) + + schemas.forEach(async ({ did, id }) => { + const pool = await poolService.getPoolForDid(newAgent.context, did) + const schemaRequest = new GetSchemaRequest({ schemaId: id }) + await pool.pool.submitRequest(schemaRequest) + }) setStep(7) + await createLinkSecretIfRequired(newAgent) + + setStep(8) setAgent(newAgent) if (store.preferences.usePushNotifications) { activate(newAgent) } - setStep(8) + setStep(9) navigation.dispatch( CommonActions.reset({ index: 0, diff --git a/yarn.lock b/yarn.lock index 5b41286a..4d721624 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8968,6 +8968,7 @@ __metadata: "@hyperledger/aries-oca": "npm:1.0.0-alpha.274" "@hyperledger/aries-react-native-attestation": "npm:1.0.0-alpha.274" "@hyperledger/indy-vdr-react-native": "npm:0.2.2" + "@hyperledger/indy-vdr-shared": "npm:0.2.2" "@react-native-async-storage/async-storage": "npm:1.15.11" "@react-native-community/masked-view": "npm:0.1.11" "@react-native-community/netinfo": "npm:9.3.7"