Skip to content

Commit

Permalink
refactor: pick encryption key from env file
Browse files Browse the repository at this point in the history
Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>
  • Loading branch information
sairanjit committed Sep 5, 2024
1 parent 15f2b11 commit 13553b8
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/screens/CredentialDetailsW3C.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { toString as toQRCodeString } from 'qrcode'
import React, { useCallback, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { DeviceEventEmitter, Image, ImageBackground, Platform, StyleSheet, Text, View } from 'react-native'
import { Config } from 'react-native-config'
import RNHTMLtoPDF from 'react-native-html-to-pdf'
import { SafeAreaView } from 'react-native-safe-area-context'
import Toast from 'react-native-toast-message'
Expand Down Expand Up @@ -342,7 +343,7 @@ const CredentialDetailsW3C: React.FC<CredentialDetailsProps> = ({ navigation, ro
})

// eslint-disable-next-line import/namespace
const encryptedToken = CryptoJS.AES.encrypt(dataToEncrypt, 'dataEncryptionKey').toString()
const encryptedToken = CryptoJS.AES.encrypt(dataToEncrypt, Config.DATA_ENCRYPTION_KEY!).toString()

const qrCodeSvg = await generateQRCodeString(encryptedToken)

Expand Down
4 changes: 2 additions & 2 deletions ios/AdeyaWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = AdeyaWallet/AdeyaWallet.entitlements;
CURRENT_PROJECT_VERSION = 43;
CURRENT_PROJECT_VERSION = 45;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = Z5W7KRPGHZ;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -545,7 +545,7 @@
CODE_SIGN_ENTITLEMENTS = AdeyaWallet/AdeyaWallet.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 43;
CURRENT_PROJECT_VERSION = 45;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = Z5W7KRPGHZ;
INFOPLIST_FILE = AdeyaWallet/Info.plist;
Expand Down
40 changes: 40 additions & 0 deletions patches/@credo-ts+indy-vdr+0.5.3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
diff --git a/node_modules/@credo-ts/indy-vdr/build/anoncreds/IndyVdrAnonCredsRegistry.js b/node_modules/@credo-ts/indy-vdr/build/anoncreds/IndyVdrAnonCredsRegistry.js
index 30ded2c..5928d48 100644
--- a/node_modules/@credo-ts/indy-vdr/build/anoncreds/IndyVdrAnonCredsRegistry.js
+++ b/node_modules/@credo-ts/indy-vdr/build/anoncreds/IndyVdrAnonCredsRegistry.js
@@ -182,7 +182,7 @@ class IndyVdrAnonCredsRegistry {
}
// Format the schema id based on the type of the credential definition id
const schemaId = credentialDefinitionId.startsWith('did:indy')
- ? (0, identifiers_1.getDidIndySchemaId)(pool.indyNamespace, namespaceIdentifier, schema.schema.name, schema.schema.version)
+ ? (0, identifiers_1.getDidIndySchemaId)(pool.indyNamespace, schema.schema.issuerId, schema.schema.name, schema.schema.version)
: schema.schema.schemaId;
return {
credentialDefinitionId,
@@ -624,7 +624,7 @@ class IndyVdrAnonCredsRegistry {
}
}
async fetchIndySchemaWithSeqNo(agentContext, seqNo, did) {
- var _a, _b;
+ var _a, _b, _c;
const indyVdrPoolService = agentContext.dependencyManager.resolve(pool_1.IndyVdrPoolService);
const { pool } = await indyVdrPoolService.getPoolForDid(agentContext, did);
agentContext.config.logger.debug(`Getting transaction with seqNo '${seqNo}' from ledger '${pool.indyNamespace}'`);
@@ -637,14 +637,15 @@ class IndyVdrAnonCredsRegistry {
return null;
}
const schema = (_b = response.result.data) === null || _b === void 0 ? void 0 : _b.txn.data;
- const schemaId = (0, anoncreds_1.getUnqualifiedSchemaId)(did, schema.data.name, schema.data.version);
+ const schemaDid = (_c = response.result.data) === null || _c === void 0 ? void 0 : _c.txn.metadata.from;
+ const schemaId = (0, anoncreds_1.getUnqualifiedSchemaId)(schemaDid, schema.data.name, schema.data.version);
return {
schema: {
schemaId,
attr_name: schema.data.attr_names,
name: schema.data.name,
version: schema.data.version,
- issuerId: did,
+ issuerId: schemaDid,
seqNo,
},
indyNamespace: pool.indyNamespace,

0 comments on commit 13553b8

Please sign in to comment.