INJIMOB-2020 - Fix VC download and Error screen toaster issue. (#1612)

* [INJIMOB-2020]: fix error screen in issuers screen when download fails

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>

* [INJIMOB-2020]: fix ES256 key type vc download failure issue in android and refactor

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>

* [INJIMOB-2020]: update secure keystore swift package and refactor

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>

---------

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>
Co-authored-by: adityankannan-tw <adityan410pm@gmail.com>
This commit is contained in:
adityankannan-tw
2024-09-12 12:49:06 +05:30
committed by GitHub
parent 6dee27dd9f
commit 99e6645a7f
7 changed files with 17 additions and 9 deletions

View File

@@ -52,7 +52,7 @@
"location" : "https://github.com/mosip/secure-keystore-ios-swift",
"state" : {
"branch" : "develop",
"revision" : "497a8a3dc4a8658665c84bc8a36fa0e6bf252c09"
"revision" : "9ae89f3dea4fbcf2554f6fb9b16ae49533996373"
}
},
{

View File

@@ -43,6 +43,10 @@ export function selectStoring(state: State) {
return state.matches('storing');
}
export function selectIsError(state: State) {
return state.matches('error');
}
export function selectVerificationErrorMessage(state: State) {
return state.context.verificationErrorMessage;
}

View File

@@ -7,6 +7,7 @@ import {
selectIsDownloadCredentials,
selectIsIdle,
selectIssuers,
selectIsError,
selectLoadingReason,
selectSelectedIssuer,
selectSelectingCredentialType,
@@ -35,6 +36,7 @@ export function useIssuerScreenController({route, navigation}) {
isBiometricsCancelled: useSelector(service, selectIsBiometricCancelled),
isDone: useSelector(service, selectIsDone),
isIdle: useSelector(service, selectIsIdle),
isNonGenericError: useSelector(service, selectIsError) && !!!useSelector(service, selectErrorMessageType),
loadingReason: useSelector(service, selectLoadingReason),
isStoring: useSelector(service, selectStoring),
isSelectingCredentialType: useSelector(

View File

@@ -49,7 +49,7 @@ export const IssuersScreen: React.FC<
);
useLayoutEffect(() => {
if (controller.loadingReason || controller.errorMessageType) {
if (controller.loadingReason || controller.isNonGenericError) {
props.navigation.setOptions({
headerShown: false,
});
@@ -200,7 +200,7 @@ export const IssuersScreen: React.FC<
);
}
if (controller.errorMessageType) {
if (controller.errorMessageType && controller.isNonGenericError) {
return (
<Error
testID={`${controller.errorMessageType}Error`}

View File

@@ -206,7 +206,7 @@ class Cloud {
const userIdentifier = await RNSecureKeystoreModule.getData(
'userIdentifier',
)[0];
)[1];
const userToken = JSON.parse(userIdentifier + '');
const user = userToken.user;
const email = userToken.email;

View File

@@ -259,7 +259,7 @@ export async function createSignatureECR1(
throw Error;
} else {
if (isAndroid()) {
let signature64 = RNSecureKeystoreModule.sign(
let signature64 = await RNSecureKeystoreModule.sign(
KeyTypes.ES256,
KeyTypes.ES256,
preHash,

View File

@@ -322,8 +322,10 @@ async function getJWKRSA(publicKey): Promise<any> {
const publicKeyJWKString = await jose.JWK.asKey(publicKey, 'pem');
return publicKeyJWKString.toJSON();
}
function getJWKECR1(publicKey): any {
return JSON.parse(publicKey);
async function getJWKECR1(publicKey): Promise<any> {
if (isIOS()) return JSON.parse(publicKey);
const publicKeyJWKString = await jose.JWK.asKey(publicKey, 'pem');
return publicKeyJWKString.toJSON();
}
function getJWKECK1(publicKey): any {
const x = base64url(Buffer.from(publicKey.slice(1, 33))); // Skip the first byte (0x04) in the uncompressed public key
@@ -351,10 +353,10 @@ export async function hasKeyPair(keyType: any): Promise<boolean> {
export function selectCredentialRequestKey(keyTypes: string[]) {
const availableKeys = [
KeyTypes.ED25519,
KeyTypes.ES256K,
KeyTypes.ES256,
KeyTypes.RS256,
KeyTypes.ED25519,
KeyTypes.ES256K,
];
for (const key of availableKeys) {
if (keyTypes.includes(key)) return key;