Skip to content

Commit

Permalink
Merge pull request #1710 from tw-mosip/injimob-2265-ovp-request-enhan…
Browse files Browse the repository at this point in the history
…cement-release

[Injimob 2265] show verifier name in VP sharing screen and consent screen and add translations for same
  • Loading branch information
sree96 authored Dec 5, 2024
2 parents 652f400 + 5951214 commit 0cc262d
Show file tree
Hide file tree
Showing 17 changed files with 90 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ fileignoreconfig:
- filename: android/app/src/main/AndroidManifest.xml
checksum: 8f4bd61770b8bb0a28859ca0f3b4b095aed4e3fb5adef435cb74b9389ff13e09
- filename: ios/Inji.xcworkspace/xcshareddata/swiftpm/Package.resolved
checksum: f20299bbbc14f44eb69e0f81aed50cf10ff4d9eab04cd05ac54855c07bf449ed
checksum: 1f5cf15c5093ec6d873a60bf8e7a19288d7f77707bf1b2f08a1c371c08fcf47b
- filename: ios/Inji.xcodeproj/project.pbxproj
checksum: 6e83472f832f71f75aa82ed06eb677d865195755074144e4bf832d6adb30e959
- filename: screens/Settings/ReceivedCardsModal.tsx
Expand Down
11 changes: 10 additions & 1 deletion ios/Inji.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"location" : "https://github.com/mosip/inji-openid4vp-ios-swift",
"state" : {
"branch" : "release-0.1.x",
"revision" : "cd96f2e819c3d4b543160b0700c74fa4049b9710"
"revision" : "258ff0da26571f090d3a2296212458737eff365f"
}
},
{
Expand Down Expand Up @@ -81,6 +81,15 @@
"branch" : "release-0.5.x",
"revision" : "2d49e123f70dfc2179983a753d370cc2212385db"
}
},
{
"identity" : "zipfoundation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/weichsel/ZIPFoundation.git",
"state" : {
"revision" : "02b6abe5f6eef7e3cbd5f247c5cc24e246efcfe0",
"version" : "0.9.19"
}
}
],
"version" : 2
Expand Down
4 changes: 2 additions & 2 deletions locales/ara.json
Original file line number Diff line number Diff line change
Expand Up @@ -835,14 +835,14 @@
}
},
"SendVPScreen": {
"requester": "الطالب",
"requester": "جهة التحقق",
"cardsSelected": "البطاقات المختارة",
"cardSelected": "card selected",
"unCheck": "البطاقة مختارة",
"checkAll": "تحقق من الكل",
"consentDialog": {
"title": "الموافقة مطلوبة",
"message": "نحن نطلب موافقتك على مشاركة بيانات الاعتماد الخاصة بك التي يمكن التحقق منها. وهذا سيمكننا من التحقق من هويتك وتلبية طلبات الخدمة الخاصة بك. اختر \"نعم، متابعة\" للموافقة أو \"رفض\" إذا كنت لا ترغب في المشاركة.",
"message": "نحن نطلب موافقتك على مشاركة بيانات اعتمادك التي يمكن التحقق منها مع {{verifierName}}. وهذا سيمكننا من التحقق من هويتك وتلبية طلبات الخدمة الخاصة بك. اختر \"نعم، متابعة\" للموافقة أو \"رفض\" إذا كنت لا ترغب في مشاركة بيانات الاعتماد الخاصة بك مع {{verifierName}}.",
"confirmButton": "نعم، تابع",
"cancelButton": "انخفاض"
},
Expand Down
4 changes: 2 additions & 2 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -847,14 +847,14 @@
}
},
"SendVPScreen": {
"requester": "Requester",
"requester": "Verification Entity",
"cardsSelected": "cards selected",
"cardSelected": "card selected",
"unCheck": "Uncheck",
"checkAll": "Check All",
"consentDialog": {
"title": "Consent Required",
"message": "We require your consent to share your verifiable credentials. This will enable us to verify your identity and fulfil your service requests. Choose \"Yes, Proceed\" to consent or \"Decline\" if you do not wish to share.",
"message": "We require your consent to share your verifiable credentials with {{verifierName}}. This will enable us to verify your identity and fulfil your service requests. Choose \"Yes, Proceed\" to consent or \"Decline\" if you do not wish to share your credentials with {{verifierName}}.",
"confirmButton": "Yes, Proceed",
"cancelButton": "Decline"
},
Expand Down
4 changes: 2 additions & 2 deletions locales/fil.json
Original file line number Diff line number Diff line change
Expand Up @@ -838,14 +838,14 @@
}
},
"SendVPScreen": {
"requester": "Humihiling",
"requester": "Entity ng Pagpapatunay",
"cardsSelected": "mga card na napili",
"cardSelected": "card pinili",
"unCheck": "Alisin ang check",
"checkAll": "Suriin Lahat",
"consentDialog": {
"title": "Kinakailangan ang Pahintulot",
"message": "Hinihiling namin ang iyong pahintulot na ibahagi ang iyong mga nabe-verify na kredensyal. Ito ay magbibigay-daan sa amin na i-verify ang iyong pagkakakilanlan at matupad ang iyong mga kahilingan sa serbisyo. Piliin ang \"Oo, Magpatuloy\" sa pagsang-ayon o \"Tanggihan\" kung ayaw mong ibahagi.",
"message": "Hinihiling namin ang iyong pahintulot na ibahagi ang iyong mga nabe-verify na kredensyal sa {{verifierName}}. Ito ay magbibigay-daan sa amin na i-verify ang iyong pagkakakilanlan at matupad ang iyong mga kahilingan sa serbisyo. Piliin ang \"Oo, Magpatuloy\" upang pumayag o \"Tanggihan\" kung hindi mo gustong ibahagi ang iyong mga kredensyal sa {{verifierName}}.",
"confirmButton": "Oo, Magpatuloy",
"cancelButton": "Tanggihan"
},
Expand Down
4 changes: 2 additions & 2 deletions locales/hin.json
Original file line number Diff line number Diff line change
Expand Up @@ -841,14 +841,14 @@
}
},
"SendVPScreen": {
"requester": "अनुरोधकर्ता",
"requester": "सत्यापन इकाई",
"cardsSelected": "कार्ड चयनित",
"cardSelected": "कार्ड चयनित",
"unCheck": "सही का निशान हटाएँ",
"checkAll": "सभी चेक करें",
"consentDialog": {
"title": "सहमति आवश्यक",
"message": "हमें आपकी सत्यापन योग्य साख साझा करने के लिए आपकी सहमति की आवश्यकता है। इससे हमें आपकी पहचान सत्यापित करने और आपके सेवा अनुरोधों को पूरा करने में मदद मिलेगी। यदि आप साझा नहीं करना चाहते हैं तो सहमति के लिए \"हां, आगे बढ़ें\" या \"अस्वीकार करें\" चुनें।",
"message": "हमें आपके सत्यापन योग्य क्रेडेंशियल्स को {{verifierName}} के साथ साझा करने के लिए आपकी सहमति की आवश्यकता है। इससे हमें आपकी पहचान सत्यापित करने और आपके सेवा अनुरोधों को पूरा करने में मदद मिलेगी। यदि आप {{verifierName}} के साथ अपने क्रेडेंशियल साझा नहीं करना चाहते हैं तो सहमति के लिए \"हां, आगे बढ़ें\" या \"अस्वीकार करें\" चुनें।",
"confirmButton": "हाँ, आगे बढ़ें",
"cancelButton": "गिरावट"
},
Expand Down
4 changes: 2 additions & 2 deletions locales/kan.json
Original file line number Diff line number Diff line change
Expand Up @@ -839,14 +839,14 @@
}
},
"SendVPScreen": {
"requester": "ವಿನಂತಿಸುವವರು",
"requester": "ಪರಿಶೀಲನೆ ಘಟಕ",
"cardsSelected": "ಕಾರ್ಡ್‌ಗಳನ್ನು ಆಯ್ಕೆ ಮಾಡಲಾಗಿದೆ",
"cardSelected": "ಕಾರ್ಡ್ ಆಯ್ಕೆಮಾಡಲಾಗಿದೆ",
"unCheck": "ಅನ್ಚೆಕ್ ಮಾಡಿ",
"checkAll": "ಎಲ್ಲವನ್ನೂ ಪರಿಶೀಲಿಸಿ",
"consentDialog": {
"title": "ಒಪ್ಪಿಗೆ ಅಗತ್ಯವಿದೆ",
"message": "ನಿಮ್ಮ ಪರಿಶೀಲಿಸಬಹುದಾದ ರುಜುವಾತುಗಳನ್ನು ಹಂಚಿಕೊಳ್ಳಲು ನಮಗೆ ನಿಮ್ಮ ಒಪ್ಪಿಗೆಯ ಅಗತ್ಯವಿದೆ. ಇದು ನಿಮ್ಮ ಗುರುತನ್ನು ಪರಿಶೀಲಿಸಲು ಮತ್ತು ನಿಮ್ಮ ಸೇವಾ ವಿನಂತಿಗಳನ್ನು ಪೂರೈಸಲು ನಮಗೆ ಅನುವು ಮಾಡಿಕೊಡುತ್ತದೆ. ಒಪ್ಪಿಗೆ ನೀಡಲು \"ಹೌದು, ಮುಂದುವರೆಯಿರಿ\" ಅಥವಾ ನೀವು ಹಂಚಿಕೊಳ್ಳಲು ಬಯಸದಿದ್ದರೆ \"ನಿರಾಕರಿಸಿ\" ಆಯ್ಕೆಮಾಡಿ.",
"message": "ನಿಮ್ಮ ಪರಿಶೀಲಿಸಬಹುದಾದ ರುಜುವಾತುಗಳನ್ನು {{verifierName}} ಜೊತೆಗೆ ಹಂಚಿಕೊಳ್ಳಲು ನಿಮ್ಮ ಸಮ್ಮತಿಯ ಅಗತ್ಯವಿದೆ. ಇದು ನಿಮ್ಮ ಗುರುತನ್ನು ಪರಿಶೀಲಿಸಲು ಮತ್ತು ನಿಮ್ಮ ಸೇವಾ ವಿನಂತಿಗಳನ್ನು ಪೂರೈಸಲು ನಮಗೆ ಅನುವು ಮಾಡಿಕೊಡುತ್ತದೆ. ನಿಮ್ಮ ರುಜುವಾತುಗಳನ್ನು {{verifierName}} ಜೊತೆಗೆ ಹಂಚಿಕೊಳ್ಳಲು ನೀವು ಬಯಸದಿದ್ದರೆ, ಒಪ್ಪಿಗೆ ನೀಡಲು \"ಹೌದು, ಮುಂದುವರಿಯಿರಿ\" ಅಥವಾ \"ನಿರಾಕರಿಸಿ\" ಆಯ್ಕೆಮಾಡಿ.",
"confirmButton": "ಹೌದು, ಮುಂದುವರೆಯಿರಿ",
"cancelButton": "ನಿರಾಕರಿಸು"
},
Expand Down
4 changes: 2 additions & 2 deletions locales/tam.json
Original file line number Diff line number Diff line change
Expand Up @@ -839,14 +839,14 @@
}
},
"SendVPScreen": {
"requester": "கோரிக்கையாளர்",
"requester": "Tagzemt n usefqed",
"cardsSelected": "அட்டைகள் தேர்ந்தெடுக்கப்பட்டன",
"cardSelected": "அட்டை தேர்ந்தெடுக்கப்பட்டது",
"unCheck": "தேர்வுநீக்கவும்",
"checkAll": "அனைத்தையும் சரிபார்க்கவும்",
"consentDialog": {
"title": "ஒப்புதல் தேவை",
"message": "உங்களின் சரிபார்க்கக்கூடிய நற்சான்றிதழ்களைப் பகிர உங்கள் ஒப்புதல் தேவை. இது உங்கள் அடையாளத்தைச் சரிபார்க்கவும் உங்கள் சேவை கோரிக்கைகளை நிறைவேற்றவும் எங்களுக்கு உதவும். ஒப்புக்கொள்ள \"ஆம், தொடரவும்\" அல்லது நீங்கள் பகிர விரும்பவில்லை என்றால் \"நிராகரி\" என்பதைத் தேர்ந்தெடுக்கவும்.",
"message": "உங்கள் சரிபார்க்கக்கூடிய நற்சான்றிதழ்களை {{verifierName}} உடன் பகிர உங்கள் ஒப்புதல் தேவை. இது உங்கள் அடையாளத்தைச் சரிபார்க்கவும் உங்கள் சேவை கோரிக்கைகளை நிறைவேற்றவும் எங்களுக்கு உதவும். ஒப்புதல் அளிக்க \"ஆம், தொடரவும்\" என்பதைத் தேர்வு செய்யவும் அல்லது {{verifierName}} உடன் உங்கள் சான்றுகளைப் பகிர விரும்பவில்லை எனில் \"நிராகரி\" என்பதைத் தேர்ந்தெடுக்கவும்.",
"confirmButton": "ஆம், தொடரவும்",
"cancelButton": "நிராகரி"
},
Expand Down
9 changes: 4 additions & 5 deletions machines/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ export const appMachine = model.createMachine(
target: 'init',
},
BIOMETRIC_CANCELLED: {
target: 'init'
}
target: 'init',
},
},
states: {
init: {
Expand Down Expand Up @@ -171,9 +171,8 @@ export const appMachine = model.createMachine(
target: 'info',
},
BIOMETRIC_CANCELLED: {
target: 'store'
}

target: 'store',
},
},
},
info: {
Expand Down
10 changes: 6 additions & 4 deletions machines/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const authMachine = model.createMachine(
actions: 'setTourGuide',
},
BIOMETRIC_CANCELLED: {
target: 'init'
target: 'init',
},
},
states: {
Expand All @@ -80,9 +80,11 @@ export const authMachine = model.createMachine(
},
{target: 'savingDefaults'},
],
BIOMETRIC_CANCELLED: [{
target: 'init'
}],
BIOMETRIC_CANCELLED: [
{
target: 'init',
},
],
},
},
savingDefaults: {
Expand Down
2 changes: 1 addition & 1 deletion machines/openID4VP/openID4VPActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const openID4VPActions = (model: any) => {
areVCFormatAndProofTypeMatchingRequest(
format,
vc.format,
vc.verifiableCredential.credential.proof.type,
vc?.verifiableCredential?.credential?.proof?.type,
);

if (inputDescriptor.constraints.fields && format) {
Expand Down
5 changes: 4 additions & 1 deletion machines/openID4VP/openID4VPSelectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ export function selectIsFaceVerifiedInVPSharing(state: State) {
}

export function selectVerifierNameInVPSharing(state: State) {
return state.context.authenticationResponse['client_metadata']?.name;
return (
state.context.authenticationResponse['client_metadata']?.['client_name'] ??
state.context.authenticationResponse['client_id']
);
}

export function selectRequestedClaimsByVerifier(state: State) {
Expand Down
31 changes: 19 additions & 12 deletions machines/settings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import {assign, ContextFrom, EventFrom, send, StateFrom, sendUpdate} from 'xstate';
import {
assign,
ContextFrom,
EventFrom,
send,
StateFrom,
sendUpdate,
} from 'xstate';
import {createModel} from 'xstate/lib/model';
import {AppServices} from '../shared/GlobalContext';
import {
Expand Down Expand Up @@ -108,17 +115,17 @@ export const settingsMachine = model.createMachine(
{target: 'storingDefaults'},
],
BIOMETRIC_CANCELLED: {
actions: [
send(
(_, event) => model.events.BIOMETRIC_CANCELLED(event.requester),
{
to: (_, event) => event.requester,
},
),
sendUpdate(),
],
target: 'init',
},
actions: [
send(
(_, event) => model.events.BIOMETRIC_CANCELLED(event.requester),
{
to: (_, event) => event.requester,
},
),
sendUpdate(),
],
target: 'init',
},
},
},
storingDefaults: {
Expand Down
22 changes: 11 additions & 11 deletions machines/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,16 +276,17 @@ export const storeMachine =
BIOMETRIC_CANCELLED: {
actions: [
send(
(_, event) => model.events.BIOMETRIC_CANCELLED(event.requester),
(_, event) =>
model.events.BIOMETRIC_CANCELLED(event.requester),
{
to: (_, event) => event.requester,
},
),
sendUpdate(),
sendParent('BIOMETRIC_CANCELLED')
sendParent('BIOMETRIC_CANCELLED'),
],
target: 'checkFreshInstall',
}
},
},
},
},
Expand All @@ -303,10 +304,10 @@ export const storeMachine =
},
BIOMETRIC_CANCELLED: {
actions: [sendParent('BIOMETRIC_CANCELLED')],
target: 'checkFreshInstall'
target: 'checkFreshInstall',
},
},
},
},
{
actions: {
notifyParent: sendParent(model.events.READY()),
Expand Down Expand Up @@ -334,11 +335,10 @@ export const storeMachine =
return;
},
checkFreshInstall: () => async callback => {
try{
return await getItem('auth', null, '');
}
catch(e){
if(e instanceof BiometricCancellationError){
try {
return await getItem('auth', null, '');
} catch (e) {
if (e instanceof BiometricCancellationError) {
callback(model.events.BIOMETRIC_CANCELLED());
} else {
callback(model.events.STORE_ERROR(e));
Expand All @@ -363,7 +363,7 @@ export const storeMachine =
base64EncodedString,
);
} catch (e) {
if(e instanceof BiometricCancellationError){
if (e instanceof BiometricCancellationError) {
callback(model.events.BIOMETRIC_CANCELLED(event.requester));
}
sendErrorEvent(getErrorEventData('ENCRYPTION', '', e));
Expand Down
11 changes: 6 additions & 5 deletions screens/Scan/SendVPScreenController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ export function useSendVPScreen() {
}

let overlayDetails: Omit<VPShareOverlayProps, 'isVisible'> | null = null;
let vpVerifierName = useSelector(
openID4VPService,
selectVerifierNameInVPSharing,
);
if (isVPSharingConsent) {
overlayDetails = {
primaryButtonTestID: 'confirm',
Expand All @@ -214,7 +218,7 @@ export function useSendVPScreen() {
secondaryButtonEvent: CANCEL,
title: t('consentDialog.title'),
titleTestID: 'consentTitle',
message: t('consentDialog.message'),
message: t('consentDialog.message', {verifierName: vpVerifierName}),
messageTestID: 'consentMsg',
onCancel: DISMISS_POPUP,
};
Expand All @@ -237,10 +241,7 @@ export function useSendVPScreen() {
return {
isSendingVP: useSelector(openID4VPService, selectIsSharingVP),
showLoadingScreen: useSelector(openID4VPService, selectIsShowLoadingScreen),
vpVerifierName: useSelector(
openID4VPService,
selectVerifierNameInVPSharing,
),
vpVerifierName,
flowType: useSelector(openID4VPService, selectFlowType),
showConfirmationPopup,
isSelectingVCs,
Expand Down
30 changes: 15 additions & 15 deletions screens/Settings/SettingsKeyManagement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,21 @@ export const SettingsKeyManagementScreen: React.FC<
</Text>
{!props.controller.isKeyManagementExplored && (
<LinearGradient
colors={Theme.Colors.GradientColors}
start={Theme.LinearGradientDirection.start}
end={Theme.LinearGradientDirection.end}
style={{
justifyContent: 'center',
height: 20,
marginTop: 10,
}}>
<Text
testID="newLabel"
style={Theme.Styles.newLabel}
color={Theme.Colors.whiteText}>
{t('NEW')}
</Text>
</LinearGradient>
colors={Theme.Colors.GradientColors}
start={Theme.LinearGradientDirection.start}
end={Theme.LinearGradientDirection.end}
style={{
justifyContent: 'center',
height: 20,
marginTop: 10,
}}>
<Text
testID="newLabel"
style={Theme.Styles.newLabel}
color={Theme.Colors.whiteText}>
{t('NEW')}
</Text>
</LinearGradient>
)}
</Row>
</ListItem.Title>
Expand Down
2 changes: 1 addition & 1 deletion shared/cryptoutil/cryptoUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export async function getJWT(
) {
try {
const header64 = encodeB64(JSON.stringify(header));
const payLoad64 = encodeB64(JSON.stringify(payLoad));
const payLoad64 = encodeB64(forge.util.encodeUtf8(JSON.stringify(payLoad)));
const preHash = header64 + '.' + payLoad64;
const signature64 = await createSignature(
privateKey,
Expand Down

0 comments on commit 0cc262d

Please sign in to comment.