mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-09 21:48:04 -05:00
Refactor(inji-429) : standardize issuers configuration (#937)
* refactor(inji-429): standardize the issuers configuration Signed-off-by: Vijay <94220135+vijay151096@users.noreply.github.com> * refactor(inji-249): optimise the issuers protocols implementations Signed-off-by: Vijay <94220135+vijay151096@users.noreply.github.com> * refactor(inji-249): remove unnecessary states and unused icons Signed-off-by: Vijay <94220135+vijay151096@users.noreply.github.com> --------- Signed-off-by: Vijay <94220135+vijay151096@users.noreply.github.com>
This commit is contained in:
3
.env
3
.env
@@ -19,6 +19,3 @@ DEBUG_MODE=false
|
|||||||
|
|
||||||
#supported languages( en, fil, ar, hi, kn, ta)
|
#supported languages( en, fil, ar, hi, kn, ta)
|
||||||
APPLICATION_LANGUAGE=en
|
APPLICATION_LANGUAGE=en
|
||||||
|
|
||||||
#Toggle for openID for VC
|
|
||||||
ENABLE_OPENID_FOR_VC=true
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.1 KiB |
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {useTranslation} from 'react-i18next';
|
import {useTranslation} from 'react-i18next';
|
||||||
import {Image, ImageBackground, View} from 'react-native';
|
import {Image, ImageBackground} from 'react-native';
|
||||||
import {getLocalizedField} from '../../../i18n';
|
import {getLocalizedField} from '../../../i18n';
|
||||||
import {VerifiableCredential} from '../../../types/VC/ExistingMosipVC/vc';
|
import {VerifiableCredential} from '../../../types/VC/ExistingMosipVC/vc';
|
||||||
import VerifiedIcon from '../../VerifiedIcon';
|
import VerifiedIcon from '../../VerifiedIcon';
|
||||||
@@ -8,6 +8,7 @@ import {Column, Row, Text} from '../../ui';
|
|||||||
import {Theme} from '../../ui/styleUtils';
|
import {Theme} from '../../ui/styleUtils';
|
||||||
import {CheckBox, Icon} from 'react-native-elements';
|
import {CheckBox, Icon} from 'react-native-elements';
|
||||||
import testIDProps from '../../../shared/commonUtil';
|
import testIDProps from '../../../shared/commonUtil';
|
||||||
|
import {logoType} from '../../../machines/issuersMachine';
|
||||||
|
|
||||||
const getDetails = (arg1, arg2, verifiableCredential) => {
|
const getDetails = (arg1, arg2, verifiableCredential) => {
|
||||||
if (arg1 === 'Status') {
|
if (arg1 === 'Status') {
|
||||||
@@ -87,11 +88,12 @@ function getIdNumber(id: string) {
|
|||||||
return '*'.repeat(id.length - 4) + id.slice(-4);
|
return '*'.repeat(id.length - 4) + id.slice(-4);
|
||||||
}
|
}
|
||||||
|
|
||||||
const getIssuerLogo = (isOpenId4VCI: boolean, issuerLogo: string) => {
|
const getIssuerLogo = (isOpenId4VCI: boolean, issuerLogo: logoType) => {
|
||||||
if (isOpenId4VCI) {
|
if (isOpenId4VCI) {
|
||||||
return (
|
return (
|
||||||
<Image
|
<Image
|
||||||
src={issuerLogo}
|
src={issuerLogo?.url}
|
||||||
|
alt={issuerLogo?.alt_text}
|
||||||
style={Theme.Styles.issuerLogo}
|
style={Theme.Styles.issuerLogo}
|
||||||
resizeMethod="scale"
|
resizeMethod="scale"
|
||||||
resizeMode="contain"
|
resizeMode="contain"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import * as DateFnsLocale from 'date-fns/locale';
|
|||||||
import {useTranslation} from 'react-i18next';
|
import {useTranslation} from 'react-i18next';
|
||||||
import {Dimensions, Image, ImageBackground, View} from 'react-native';
|
import {Dimensions, Image, ImageBackground, View} from 'react-native';
|
||||||
import {Icon} from 'react-native-elements';
|
import {Icon} from 'react-native-elements';
|
||||||
import {VC, CredentialSubject} from '../../../types/VC/ExistingMosipVC/vc';
|
import {CredentialSubject, VC} from '../../../types/VC/ExistingMosipVC/vc';
|
||||||
import {Button, Column, Row, Text} from '../../ui';
|
import {Button, Column, Row, Text} from '../../ui';
|
||||||
import {Theme} from '../../ui/styleUtils';
|
import {Theme} from '../../ui/styleUtils';
|
||||||
import {TextItem} from '../../ui/TextItem';
|
import {TextItem} from '../../ui/TextItem';
|
||||||
@@ -20,10 +20,17 @@ import {
|
|||||||
VerifiablePresentation,
|
VerifiablePresentation,
|
||||||
} from '../../../types/VC/EsignetMosipVC/vc';
|
} from '../../../types/VC/EsignetMosipVC/vc';
|
||||||
import {WalletBindingResponse} from '../../../shared/cryptoutil/cryptoUtil';
|
import {WalletBindingResponse} from '../../../shared/cryptoutil/cryptoUtil';
|
||||||
|
import {logoType} from '../../../machines/issuersMachine';
|
||||||
|
|
||||||
const getIssuerLogo = (isOpenId4VCI: boolean, issuerLogo: string) => {
|
const getIssuerLogo = (isOpenId4VCI: boolean, issuerLogo: logoType) => {
|
||||||
if (isOpenId4VCI) {
|
if (isOpenId4VCI) {
|
||||||
return <Image src={issuerLogo} style={Theme.Styles.issuerLogo} />;
|
return (
|
||||||
|
<Image
|
||||||
|
src={issuerLogo?.url}
|
||||||
|
alt={issuerLogo?.alt_text}
|
||||||
|
style={Theme.Styles.issuerLogo}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return <Image source={Theme.MosipLogo} style={Theme.Styles.vcDetailsLogo} />;
|
return <Image source={Theme.MosipLogo} style={Theme.Styles.vcDetailsLogo} />;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ export const Issuer: React.FC<IssuerProps> = (props: IssuerProps) => {
|
|||||||
const {t} = useTranslation('IssuersScreen');
|
const {t} = useTranslation('IssuersScreen');
|
||||||
|
|
||||||
function getIssuerLogo() {
|
function getIssuerLogo() {
|
||||||
if (props.logoUrl) return {uri: props.logoUrl};
|
return {uri: props.logoUrl};
|
||||||
return Theme.DigitIcon;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1261,7 +1261,6 @@ export const DefaultTheme = {
|
|||||||
protectPrivacy: require('../../../assets/intro-unlock-method.png'),
|
protectPrivacy: require('../../../assets/intro-unlock-method.png'),
|
||||||
NoInternetConnection: require('../../../assets/no-internet-connection.png'),
|
NoInternetConnection: require('../../../assets/no-internet-connection.png'),
|
||||||
SomethingWentWrong: require('../../../assets/something-went-wrong.png'),
|
SomethingWentWrong: require('../../../assets/something-went-wrong.png'),
|
||||||
DigitIcon: require('../../../assets/digit-icon.png'),
|
|
||||||
|
|
||||||
elevation(level: ElevationLevel): ViewStyle {
|
elevation(level: ElevationLevel): ViewStyle {
|
||||||
// https://ethercreative.github.io/react-native-shadow-generator/
|
// https://ethercreative.github.io/react-native-shadow-generator/
|
||||||
|
|||||||
@@ -1259,7 +1259,6 @@ export const PurpleTheme = {
|
|||||||
protectPrivacy: require('../../../assets/intro-unlock-method.png'),
|
protectPrivacy: require('../../../assets/intro-unlock-method.png'),
|
||||||
NoInternetConnection: require('../../../assets/no-internet-connection.png'),
|
NoInternetConnection: require('../../../assets/no-internet-connection.png'),
|
||||||
SomethingWentWrong: require('../../../assets/something-went-wrong.png'),
|
SomethingWentWrong: require('../../../assets/something-went-wrong.png'),
|
||||||
DigitIcon: require('../../../assets/digit-icon.png'),
|
|
||||||
|
|
||||||
elevation(level: ElevationLevel): ViewStyle {
|
elevation(level: ElevationLevel): ViewStyle {
|
||||||
// https://ethercreative.github.io/react-native-shadow-generator/
|
// https://ethercreative.github.io/react-native-shadow-generator/
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
WalletBindingResponse,
|
WalletBindingResponse,
|
||||||
} from '../../../shared/cryptoutil/cryptoUtil';
|
} from '../../../shared/cryptoutil/cryptoUtil';
|
||||||
import {log} from 'xstate/lib/actions';
|
import {log} from 'xstate/lib/actions';
|
||||||
import {OpenId4VCIProtocol} from '../../../shared/openId4VCI/Utils';
|
import {Protocols} from '../../../shared/openId4VCI/Utils';
|
||||||
import {StoreEvents} from '../../../machines/store';
|
import {StoreEvents} from '../../../machines/store';
|
||||||
import {MIMOTO_BASE_URL, MY_VCS_STORE_KEY} from '../../../shared/constants';
|
import {MIMOTO_BASE_URL, MY_VCS_STORE_KEY} from '../../../shared/constants';
|
||||||
import {VcEvents} from '../../../machines/vc';
|
import {VcEvents} from '../../../machines/vc';
|
||||||
@@ -500,7 +500,7 @@ export const EsignetMosipVCItemMachine = model.createMachine(
|
|||||||
context => ({
|
context => ({
|
||||||
type: 'GET_VC_ITEM',
|
type: 'GET_VC_ITEM',
|
||||||
vcMetadata: context.vcMetadata,
|
vcMetadata: context.vcMetadata,
|
||||||
protocol: OpenId4VCIProtocol,
|
protocol: Protocols.OpenId4VCI,
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
to: context => context.serviceRefs.vc,
|
to: context => context.serviceRefs.vc,
|
||||||
|
|||||||
@@ -1,64 +1,47 @@
|
|||||||
// This file was automatically generated. Edits will be overwritten
|
|
||||||
|
|
||||||
export interface Typegen0 {
|
// This file was automatically generated. Edits will be overwritten
|
||||||
'@@xstate/typegen': true;
|
|
||||||
internalEvents: {
|
export interface Typegen0 {
|
||||||
'': {type: ''};
|
'@@xstate/typegen': true;
|
||||||
'done.invoke.auth.authorized:invocation[0]': {
|
internalEvents: {
|
||||||
type: 'done.invoke.auth.authorized:invocation[0]';
|
"": { type: "" };
|
||||||
data: unknown;
|
"done.invoke.auth.authorized:invocation[0]": { type: "done.invoke.auth.authorized:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.';
|
"done.invoke.auth.introSlider:invocation[0]": { type: "done.invoke.auth.introSlider:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||||
};
|
"xstate.init": { type: "xstate.init" };
|
||||||
'done.invoke.auth.introSlider:invocation[0]': {
|
};
|
||||||
type: 'done.invoke.auth.introSlider:invocation[0]';
|
invokeSrcNameMap: {
|
||||||
data: unknown;
|
"downloadFaceSdkModel": "done.invoke.auth.authorized:invocation[0]";
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.';
|
"generatePasscodeSalt": "done.invoke.auth.introSlider:invocation[0]";
|
||||||
};
|
};
|
||||||
'xstate.init': {type: 'xstate.init'};
|
missingImplementations: {
|
||||||
};
|
actions: never;
|
||||||
invokeSrcNameMap: {
|
delays: never;
|
||||||
downloadFaceSdkModel: 'done.invoke.auth.authorized:invocation[0]';
|
guards: never;
|
||||||
generatePasscodeSalt: 'done.invoke.auth.introSlider:invocation[0]';
|
services: never;
|
||||||
};
|
};
|
||||||
missingImplementations: {
|
eventsCausingActions: {
|
||||||
actions: never;
|
"requestStoredContext": "xstate.init";
|
||||||
delays: never;
|
"setBiometrics": "SETUP_BIOMETRICS";
|
||||||
guards: never;
|
"setContext": "STORE_RESPONSE";
|
||||||
services: never;
|
"setLanguage": "SETUP_BIOMETRICS" | "SETUP_PASSCODE";
|
||||||
};
|
"setPasscode": "SETUP_PASSCODE";
|
||||||
eventsCausingActions: {
|
"setPasscodeSalt": "done.invoke.auth.introSlider:invocation[0]";
|
||||||
requestStoredContext: 'xstate.init';
|
"storeContext": "SETUP_BIOMETRICS" | "SETUP_PASSCODE" | "STORE_RESPONSE" | "done.invoke.auth.authorized:invocation[0]" | "done.invoke.auth.introSlider:invocation[0]";
|
||||||
setBiometrics: 'SETUP_BIOMETRICS';
|
};
|
||||||
setContext: 'STORE_RESPONSE';
|
eventsCausingDelays: {
|
||||||
setLanguage: 'SETUP_BIOMETRICS' | 'SETUP_PASSCODE';
|
|
||||||
setPasscode: 'SETUP_PASSCODE';
|
};
|
||||||
setPasscodeSalt: 'done.invoke.auth.introSlider:invocation[0]';
|
eventsCausingGuards: {
|
||||||
storeContext:
|
"hasBiometricSet": "";
|
||||||
| 'SETUP_BIOMETRICS'
|
"hasData": "STORE_RESPONSE";
|
||||||
| 'SETUP_PASSCODE'
|
"hasLanguageset": "";
|
||||||
| 'STORE_RESPONSE'
|
"hasPasscodeSet": "";
|
||||||
| 'done.invoke.auth.authorized:invocation[0]'
|
};
|
||||||
| 'done.invoke.auth.introSlider:invocation[0]';
|
eventsCausingServices: {
|
||||||
};
|
"downloadFaceSdkModel": "LOGIN" | "SETUP_PASSCODE";
|
||||||
eventsCausingDelays: {};
|
"generatePasscodeSalt": "SELECT";
|
||||||
eventsCausingGuards: {
|
};
|
||||||
hasBiometricSet: '';
|
matchesStates: "authorized" | "checkingAuth" | "init" | "introSlider" | "languagesetup" | "savingDefaults" | "settingUp" | "unauthorized";
|
||||||
hasData: 'STORE_RESPONSE';
|
tags: never;
|
||||||
hasLanguageset: '';
|
}
|
||||||
hasPasscodeSet: '';
|
|
||||||
};
|
|
||||||
eventsCausingServices: {
|
|
||||||
downloadFaceSdkModel: 'LOGIN' | 'SETUP_PASSCODE';
|
|
||||||
generatePasscodeSalt: 'SELECT';
|
|
||||||
};
|
|
||||||
matchesStates:
|
|
||||||
| 'authorized'
|
|
||||||
| 'checkingAuth'
|
|
||||||
| 'init'
|
|
||||||
| 'introSlider'
|
|
||||||
| 'languagesetup'
|
|
||||||
| 'savingDefaults'
|
|
||||||
| 'settingUp'
|
|
||||||
| 'unauthorized';
|
|
||||||
tags: never;
|
|
||||||
}
|
|
||||||
@@ -20,6 +20,9 @@ import {
|
|||||||
vcDownloadTimeout,
|
vcDownloadTimeout,
|
||||||
OIDCErrors,
|
OIDCErrors,
|
||||||
ErrorMessage,
|
ErrorMessage,
|
||||||
|
updateCredentialInformation,
|
||||||
|
constructAuthorizationConfiguration,
|
||||||
|
getVCMetadata,
|
||||||
} from '../shared/openId4VCI/Utils';
|
} from '../shared/openId4VCI/Utils';
|
||||||
import {NETWORK_REQUEST_FAILED, REQUEST_TIMEOUT} from '../shared/constants';
|
import {NETWORK_REQUEST_FAILED, REQUEST_TIMEOUT} from '../shared/constants';
|
||||||
import {VCMetadata} from '../shared/VCMetadata';
|
import {VCMetadata} from '../shared/VCMetadata';
|
||||||
@@ -68,7 +71,7 @@ const model = createModel(
|
|||||||
export const IssuerScreenTabEvents = model.events;
|
export const IssuerScreenTabEvents = model.events;
|
||||||
export const Issuer_Tab_Ref_Id = 'issuersMachine';
|
export const Issuer_Tab_Ref_Id = 'issuersMachine';
|
||||||
|
|
||||||
export const Issuers_Key_Ref = 'OpenId4VCI';
|
export const Issuers_Key_Ref = 'OpenId4VCI_KeyPair';
|
||||||
export const IssuersMachine = model.createMachine(
|
export const IssuersMachine = model.createMachine(
|
||||||
{
|
{
|
||||||
/** @xstate-layout N4IgpgJg5mDOIC5QEtawK5gE6wLIEMBjAC2QDswA6CVABwBt8BPASTUxwGIIB7Cy8gDceAayqoM2PEVL8asBszaScCIT0L4ALsj4BtAAwBdQ0cShaPWMh19zIAB6IALAEYAnJWfuAzM4BsAKwAHN7BwQDsfgA0IEyIAEw+Ea6UBgkRwT7uEekGrhHOAL5FsRIc0iTkVPKKrOxSnNhYPFiUiloAZq0AtgINOARVcnSM9SqwamTCmrZkpqb2ltZz9k4Izgme3n5Boe7hUc6x8QgJ3gZpgT6BgRH+yYWBJWUDlbJUza2cACoASgBNAD6AEEAOIglgAOUWSBAyxsujIaxcWy8vgCITCkRicUSIQSlGyCQMETu7n84QKLxA5SkQw+lC+WF+gNBEOhelcZjhCNWcPWrgSJ0QQppdMGMmqTKwLRZ-2B4MhMISPIsVkRdgFooMvjS-jc9wezl1ARFZwiCUClFcN3czmcKWuPnFbwZ0uZnD+AFEAMren5A71-P4AeT+sPVKyRKIQrgMwX8lASCWCgVcgW8lt15oyEU8CSCloz6WcN38rom7v4sDA9DAhB0ZCgyg4nAAIqGAOpQgAyoZB7aBLHbkfhGv5oHWPgMBmclEigQM-lTVpyc9z+R8yfzriyPhTS4zlYq1aotfrjfILYGnH9ve9AGEft6hyxfb6AKrBsd8mPahBAmFPEEB8VwhS8XVkgKA5dXcE96SlOQeAAdzIegeHwCBW2wR8+E6ZAoG4PhxGmURxDdJCalQ9DMOwgY8LIAioCmGZtCRBZjCWCd-ynUVgNOMVSlpSjhmotCMKwnCsEY5imllVp2kYLpen6KsqOoGjJPolRZMI1iNHY-RjF-HitT4jYUwXZwgMpFMfHCGcIlze15zuFdghyA5UweBDJTEygSAbEQWDILRsAoLRiP4dQxEC4hgtC8KsEi0zo3MxxRVuQlLUCdxdUzb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S6+0tBrtjGGgZU6XqsqSMEc0ZJtwFRNAUHeGYz7Hvzae3a-V2oQ1aAka9VCwVROhS3PKfhlwFA+mNZMjxcgORskkI9IkUU8xzonPOpthb-LCW0gSoofB+C8GNFaLd4zLhjmMq+qCx5gYsoehcMcbi7g2imVW5H0yqrGjcPwlo6pzueZQfhMjGNYGY1-PwhISQFGeoJlILCwJeHWhmBVFahK-vnchCZBTSXYvjco4tCAch9LU7Va48ZHSUjORc4lUAsUlJk+sQZyYqrrgNFrZ9VrKR3uMR5TWZGf5tq0AzZsbnSO+0NNkNwbhHKQsEv7bcar8pgW8FsUI2r6zRZRhmNIMdVy5Dyuqyz84AhPXsqqlI0aSL5ZgjawdXSR26NOCmX2WxHS6k-Xxs+JQgA */
|
||||||
@@ -171,7 +174,8 @@ export const IssuersMachine = model.createMachine(
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
onError: {
|
onError: {
|
||||||
actions: () => console.log('checkInternet error caught'),
|
actions: () =>
|
||||||
|
console.log('Error Occurred while checking Internet'),
|
||||||
target: 'error',
|
target: 'error',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -205,7 +209,11 @@ export const IssuersMachine = model.createMachine(
|
|||||||
actions: [
|
actions: [
|
||||||
'setError',
|
'setError',
|
||||||
'resetLoadingReason',
|
'resetLoadingReason',
|
||||||
(_, event) => console.log('error in invokeAuth - ', event.data),
|
(_, event) =>
|
||||||
|
console.log(
|
||||||
|
'Error Occurred while invoking Auth - ',
|
||||||
|
event.data,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
target: 'error',
|
target: 'error',
|
||||||
},
|
},
|
||||||
@@ -499,7 +507,7 @@ export const IssuersMachine = model.createMachine(
|
|||||||
const downloadTimeout = await vcDownloadTimeout();
|
const downloadTimeout = await vcDownloadTimeout();
|
||||||
let credential = await request(
|
let credential = await request(
|
||||||
'POST',
|
'POST',
|
||||||
context.selectedIssuer.serviceConfiguration.credentialEndpoint,
|
context.selectedIssuer.credential_endpoint,
|
||||||
body,
|
body,
|
||||||
'',
|
'',
|
||||||
{
|
{
|
||||||
@@ -518,10 +526,12 @@ export const IssuersMachine = model.createMachine(
|
|||||||
sendImpressionEvent(
|
sendImpressionEvent(
|
||||||
getImpressionEventData(
|
getImpressionEventData(
|
||||||
'VC Download',
|
'VC Download',
|
||||||
context.selectedIssuer.id + ' Web View Page',
|
context.selectedIssuer.credential_issuer + ' Web View Page',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return await authorize(context.selectedIssuer);
|
return await authorize(
|
||||||
|
constructAuthorizationConfiguration(context.selectedIssuer),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
generateKeyPair: async context => {
|
generateKeyPair: async context => {
|
||||||
if (!isCustomSecureKeystore()) {
|
if (!isCustomSecureKeystore()) {
|
||||||
@@ -607,32 +617,27 @@ export function selectStoring(state: State) {
|
|||||||
return state.matches('storing');
|
return state.matches('storing');
|
||||||
}
|
}
|
||||||
|
|
||||||
interface issuerType {
|
export interface logoType {
|
||||||
id: string;
|
url: string;
|
||||||
displayName: string;
|
alt_text: string;
|
||||||
logoUrl: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateCredentialInformation = (context, credential) => {
|
export interface displayType {
|
||||||
let credentialWrapper: CredentialWrapper = {};
|
name: string;
|
||||||
credentialWrapper.verifiableCredential = credential;
|
logo: logoType;
|
||||||
credentialWrapper.verifiableCredential.issuerLogo =
|
language: string;
|
||||||
context.selectedIssuer.logoUrl;
|
}
|
||||||
credentialWrapper.identifier = getIdentifier(context, credential);
|
export interface issuerType {
|
||||||
credentialWrapper.generatedOn = new Date();
|
credential_issuer: string;
|
||||||
credentialWrapper.issuerLogo = context.selectedIssuer.logoUrl;
|
protocol: string;
|
||||||
return credentialWrapper;
|
client_id: string;
|
||||||
};
|
'.well-known': string;
|
||||||
|
redirect_uri: string;
|
||||||
const getVCMetadata = context => {
|
scopes_supported: [string];
|
||||||
const [issuer, protocol, requestId] =
|
additional_headers: object;
|
||||||
context.credentialWrapper?.identifier.split(':');
|
authorization_endpoint: string;
|
||||||
return VCMetadata.fromVC({
|
token_endpoint: string;
|
||||||
requestId: requestId ? requestId : null,
|
credential_endpoint: string;
|
||||||
issuer: issuer,
|
credential_audience: string;
|
||||||
protocol: protocol,
|
display: [displayType];
|
||||||
id: context.verifiableCredential?.credential.credentialSubject.UIN
|
}
|
||||||
? context.verifiableCredential?.credential.credentialSubject.UIN
|
|
||||||
: context.verifiableCredential?.credential.credentialSubject.VID,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,152 +1,90 @@
|
|||||||
// This file was automatically generated. Edits will be overwritten
|
|
||||||
|
|
||||||
export interface Typegen0 {
|
// This file was automatically generated. Edits will be overwritten
|
||||||
'@@xstate/typegen': true;
|
|
||||||
internalEvents: {
|
export interface Typegen0 {
|
||||||
'done.invoke.checkInternet': {
|
'@@xstate/typegen': true;
|
||||||
type: 'done.invoke.checkInternet';
|
internalEvents: {
|
||||||
data: unknown;
|
"done.invoke.checkInternet": { type: "done.invoke.checkInternet"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.';
|
"done.invoke.issuersMachine.displayIssuers:invocation[0]": { type: "done.invoke.issuersMachine.displayIssuers:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||||
};
|
"done.invoke.issuersMachine.downloadCredentials:invocation[0]": { type: "done.invoke.issuersMachine.downloadCredentials:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||||
'done.invoke.issuersMachine.displayIssuers:invocation[0]': {
|
"done.invoke.issuersMachine.downloadIssuerConfig:invocation[0]": { type: "done.invoke.issuersMachine.downloadIssuerConfig:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||||
type: 'done.invoke.issuersMachine.displayIssuers:invocation[0]';
|
"done.invoke.issuersMachine.generateKeyPair:invocation[0]": { type: "done.invoke.issuersMachine.generateKeyPair:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||||
data: unknown;
|
"done.invoke.issuersMachine.performAuthorization:invocation[0]": { type: "done.invoke.issuersMachine.performAuthorization:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.';
|
"done.invoke.issuersMachine.verifyingCredential:invocation[0]": { type: "done.invoke.issuersMachine.verifyingCredential:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||||
};
|
"error.platform.checkInternet": { type: "error.platform.checkInternet"; data: unknown };
|
||||||
'done.invoke.issuersMachine.downloadCredentials:invocation[0]': {
|
"error.platform.issuersMachine.displayIssuers:invocation[0]": { type: "error.platform.issuersMachine.displayIssuers:invocation[0]"; data: unknown };
|
||||||
type: 'done.invoke.issuersMachine.downloadCredentials:invocation[0]';
|
"error.platform.issuersMachine.downloadCredentials:invocation[0]": { type: "error.platform.issuersMachine.downloadCredentials:invocation[0]"; data: unknown };
|
||||||
data: unknown;
|
"error.platform.issuersMachine.downloadIssuerConfig:invocation[0]": { type: "error.platform.issuersMachine.downloadIssuerConfig:invocation[0]"; data: unknown };
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.';
|
"error.platform.issuersMachine.performAuthorization:invocation[0]": { type: "error.platform.issuersMachine.performAuthorization:invocation[0]"; data: unknown };
|
||||||
};
|
"error.platform.issuersMachine.verifyingCredential:invocation[0]": { type: "error.platform.issuersMachine.verifyingCredential:invocation[0]"; data: unknown };
|
||||||
'done.invoke.issuersMachine.downloadIssuerConfig:invocation[0]': {
|
"xstate.init": { type: "xstate.init" };
|
||||||
type: 'done.invoke.issuersMachine.downloadIssuerConfig:invocation[0]';
|
};
|
||||||
data: unknown;
|
invokeSrcNameMap: {
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.';
|
"checkInternet": "done.invoke.checkInternet";
|
||||||
};
|
"downloadCredential": "done.invoke.issuersMachine.downloadCredentials:invocation[0]";
|
||||||
'done.invoke.issuersMachine.generateKeyPair:invocation[0]': {
|
"downloadIssuerConfig": "done.invoke.issuersMachine.downloadIssuerConfig:invocation[0]";
|
||||||
type: 'done.invoke.issuersMachine.generateKeyPair:invocation[0]';
|
"downloadIssuersList": "done.invoke.issuersMachine.displayIssuers:invocation[0]";
|
||||||
data: unknown;
|
"generateKeyPair": "done.invoke.issuersMachine.generateKeyPair:invocation[0]";
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.';
|
"invokeAuthorization": "done.invoke.issuersMachine.performAuthorization:invocation[0]";
|
||||||
};
|
"verifyCredential": "done.invoke.issuersMachine.verifyingCredential:invocation[0]";
|
||||||
'done.invoke.issuersMachine.performAuthorization:invocation[0]': {
|
};
|
||||||
type: 'done.invoke.issuersMachine.performAuthorization:invocation[0]';
|
missingImplementations: {
|
||||||
data: unknown;
|
actions: never;
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.';
|
delays: never;
|
||||||
};
|
guards: never;
|
||||||
'done.invoke.issuersMachine.verifyingCredential:invocation[0]': {
|
services: never;
|
||||||
type: 'done.invoke.issuersMachine.verifyingCredential:invocation[0]';
|
};
|
||||||
data: unknown;
|
eventsCausingActions: {
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.';
|
"getKeyPairFromStore": "done.invoke.issuersMachine.performAuthorization:invocation[0]";
|
||||||
};
|
"loadKeyPair": "done.invoke.issuersMachine.performAuthorization:invocation[0]";
|
||||||
'error.platform.checkInternet': {
|
"logDownloaded": "done.invoke.issuersMachine.verifyingCredential:invocation[0]";
|
||||||
type: 'error.platform.checkInternet';
|
"resetError": "RESET_ERROR" | "TRY_AGAIN" | "error.platform.issuersMachine.performAuthorization:invocation[0]";
|
||||||
data: unknown;
|
"resetLoadingReason": "done.invoke.checkInternet" | "done.invoke.issuersMachine.displayIssuers:invocation[0]" | "error.platform.issuersMachine.downloadCredentials:invocation[0]" | "error.platform.issuersMachine.downloadIssuerConfig:invocation[0]" | "error.platform.issuersMachine.performAuthorization:invocation[0]";
|
||||||
};
|
"sendErrorEndEvent": "error.platform.issuersMachine.verifyingCredential:invocation[0]";
|
||||||
'error.platform.issuersMachine.displayIssuers:invocation[0]': {
|
"sendImpressionEvent": "done.invoke.issuersMachine.displayIssuers:invocation[0]";
|
||||||
type: 'error.platform.issuersMachine.displayIssuers:invocation[0]';
|
"sendSuccessEndEvent": "done.invoke.issuersMachine.verifyingCredential:invocation[0]";
|
||||||
data: unknown;
|
"setCredentialWrapper": "done.invoke.issuersMachine.downloadCredentials:invocation[0]";
|
||||||
};
|
"setError": "error.platform.issuersMachine.displayIssuers:invocation[0]" | "error.platform.issuersMachine.downloadCredentials:invocation[0]" | "error.platform.issuersMachine.downloadIssuerConfig:invocation[0]" | "error.platform.issuersMachine.performAuthorization:invocation[0]";
|
||||||
'error.platform.issuersMachine.downloadCredentials:invocation[0]': {
|
"setIssuers": "done.invoke.issuersMachine.displayIssuers:invocation[0]";
|
||||||
type: 'error.platform.issuersMachine.downloadCredentials:invocation[0]';
|
"setLoadingReasonAsDisplayIssuers": "TRY_AGAIN";
|
||||||
data: unknown;
|
"setLoadingReasonAsDownloadingCredentials": "done.invoke.issuersMachine.generateKeyPair:invocation[0]";
|
||||||
};
|
"setLoadingReasonAsSettingUp": "done.invoke.issuersMachine.performAuthorization:invocation[0]";
|
||||||
'error.platform.issuersMachine.downloadIssuerConfig:invocation[0]': {
|
"setNoInternet": "done.invoke.checkInternet";
|
||||||
type: 'error.platform.issuersMachine.downloadIssuerConfig:invocation[0]';
|
"setOIDCConfigError": "error.platform.issuersMachine.performAuthorization:invocation[0]";
|
||||||
data: unknown;
|
"setPrivateKey": "done.invoke.issuersMachine.generateKeyPair:invocation[0]";
|
||||||
};
|
"setPublicKey": "done.invoke.issuersMachine.generateKeyPair:invocation[0]";
|
||||||
'error.platform.issuersMachine.performAuthorization:invocation[0]': {
|
"setSelectedIssuerId": "SELECTED_ISSUER";
|
||||||
type: 'error.platform.issuersMachine.performAuthorization:invocation[0]';
|
"setSelectedIssuers": "done.invoke.issuersMachine.downloadIssuerConfig:invocation[0]";
|
||||||
data: unknown;
|
"setTokenResponse": "done.invoke.issuersMachine.performAuthorization:invocation[0]";
|
||||||
};
|
"setVerifiableCredential": "done.invoke.issuersMachine.downloadCredentials:invocation[0]";
|
||||||
'xstate.init': {type: 'xstate.init'};
|
"storeKeyPair": "done.invoke.issuersMachine.generateKeyPair:invocation[0]";
|
||||||
};
|
"storeVcMetaContext": "done.invoke.issuersMachine.verifyingCredential:invocation[0]";
|
||||||
invokeSrcNameMap: {
|
"storeVcsContext": "done.invoke.issuersMachine.verifyingCredential:invocation[0]";
|
||||||
checkInternet: 'done.invoke.checkInternet';
|
"storeVerifiableCredentialData": "done.invoke.issuersMachine.verifyingCredential:invocation[0]";
|
||||||
downloadCredential: 'done.invoke.issuersMachine.downloadCredentials:invocation[0]';
|
"storeVerifiableCredentialMeta": "done.invoke.issuersMachine.verifyingCredential:invocation[0]";
|
||||||
downloadIssuerConfig: 'done.invoke.issuersMachine.downloadIssuerConfig:invocation[0]';
|
};
|
||||||
downloadIssuersList: 'done.invoke.issuersMachine.displayIssuers:invocation[0]';
|
eventsCausingDelays: {
|
||||||
generateKeyPair: 'done.invoke.issuersMachine.generateKeyPair:invocation[0]';
|
|
||||||
invokeAuthorization: 'done.invoke.issuersMachine.performAuthorization:invocation[0]';
|
};
|
||||||
verifyCredential: 'done.invoke.issuersMachine.verifyingCredential:invocation[0]';
|
eventsCausingGuards: {
|
||||||
};
|
"canSelectIssuerAgain": "TRY_AGAIN";
|
||||||
missingImplementations: {
|
"hasKeyPair": "CHECK_KEY_PAIR";
|
||||||
actions: never;
|
"isCustomSecureKeystore": "done.invoke.issuersMachine.generateKeyPair:invocation[0]";
|
||||||
delays: never;
|
"isInternetConnected": "done.invoke.checkInternet";
|
||||||
guards: never;
|
"isOIDCConfigError": "error.platform.issuersMachine.performAuthorization:invocation[0]";
|
||||||
services: never;
|
"isOIDCflowCancelled": "error.platform.issuersMachine.performAuthorization:invocation[0]";
|
||||||
};
|
"shouldFetchIssuersAgain": "TRY_AGAIN";
|
||||||
eventsCausingActions: {
|
};
|
||||||
getKeyPairFromStore: 'done.invoke.issuersMachine.performAuthorization:invocation[0]';
|
eventsCausingServices: {
|
||||||
loadKeyPair: 'done.invoke.issuersMachine.performAuthorization:invocation[0]';
|
"checkInternet": "done.invoke.issuersMachine.downloadIssuerConfig:invocation[0]";
|
||||||
logDownloaded: 'done.invoke.issuersMachine.verifyingCredential:invocation[0]';
|
"downloadCredential": "CHECK_KEY_PAIR" | "done.invoke.issuersMachine.generateKeyPair:invocation[0]";
|
||||||
resetError:
|
"downloadIssuerConfig": "SELECTED_ISSUER" | "TRY_AGAIN";
|
||||||
| 'RESET_ERROR'
|
"downloadIssuersList": "TRY_AGAIN" | "xstate.init";
|
||||||
| 'TRY_AGAIN'
|
"generateKeyPair": "CHECK_KEY_PAIR";
|
||||||
| 'error.platform.issuersMachine.performAuthorization:invocation[0]';
|
"invokeAuthorization": "done.invoke.checkInternet";
|
||||||
resetLoadingReason:
|
"verifyCredential": "done.invoke.issuersMachine.downloadCredentials:invocation[0]";
|
||||||
| 'done.invoke.checkInternet'
|
};
|
||||||
| 'done.invoke.issuersMachine.displayIssuers:invocation[0]'
|
matchesStates: "checkInternet" | "checkKeyPair" | "displayIssuers" | "done" | "downloadCredentials" | "downloadIssuerConfig" | "error" | "generateKeyPair" | "idle" | "performAuthorization" | "selectingIssuer" | "storing" | "verifyingCredential";
|
||||||
| 'error.platform.issuersMachine.downloadCredentials:invocation[0]'
|
tags: never;
|
||||||
| 'error.platform.issuersMachine.downloadIssuerConfig:invocation[0]'
|
}
|
||||||
| 'error.platform.issuersMachine.performAuthorization:invocation[0]';
|
|
||||||
setCredentialWrapper: 'done.invoke.issuersMachine.downloadCredentials:invocation[0]';
|
|
||||||
setError:
|
|
||||||
| 'error.platform.issuersMachine.displayIssuers:invocation[0]'
|
|
||||||
| 'error.platform.issuersMachine.downloadCredentials:invocation[0]'
|
|
||||||
| 'error.platform.issuersMachine.downloadIssuerConfig:invocation[0]'
|
|
||||||
| 'error.platform.issuersMachine.performAuthorization:invocation[0]';
|
|
||||||
setIssuers: 'done.invoke.issuersMachine.displayIssuers:invocation[0]';
|
|
||||||
setLoadingReasonAsDisplayIssuers: 'TRY_AGAIN';
|
|
||||||
setLoadingReasonAsDownloadingCredentials: 'done.invoke.issuersMachine.generateKeyPair:invocation[0]';
|
|
||||||
setLoadingReasonAsSettingUp: 'done.invoke.issuersMachine.performAuthorization:invocation[0]';
|
|
||||||
setNoInternet: 'done.invoke.checkInternet';
|
|
||||||
setOIDCConfigError: 'error.platform.issuersMachine.performAuthorization:invocation[0]';
|
|
||||||
setPrivateKey: 'done.invoke.issuersMachine.generateKeyPair:invocation[0]';
|
|
||||||
setPublicKey: 'done.invoke.issuersMachine.generateKeyPair:invocation[0]';
|
|
||||||
setSelectedIssuerId: 'SELECTED_ISSUER';
|
|
||||||
setSelectedIssuers: 'done.invoke.issuersMachine.downloadIssuerConfig:invocation[0]';
|
|
||||||
setTokenResponse: 'done.invoke.issuersMachine.performAuthorization:invocation[0]';
|
|
||||||
setVerifiableCredential: 'done.invoke.issuersMachine.downloadCredentials:invocation[0]';
|
|
||||||
storeKeyPair: 'done.invoke.issuersMachine.generateKeyPair:invocation[0]';
|
|
||||||
storeVcMetaContext: 'done.invoke.issuersMachine.verifyingCredential:invocation[0]';
|
|
||||||
storeVcsContext: 'done.invoke.issuersMachine.verifyingCredential:invocation[0]';
|
|
||||||
storeVerifiableCredentialData: 'done.invoke.issuersMachine.verifyingCredential:invocation[0]';
|
|
||||||
storeVerifiableCredentialMeta: 'done.invoke.issuersMachine.verifyingCredential:invocation[0]';
|
|
||||||
};
|
|
||||||
eventsCausingDelays: {};
|
|
||||||
eventsCausingGuards: {
|
|
||||||
canSelectIssuerAgain: 'TRY_AGAIN';
|
|
||||||
hasKeyPair: 'CHECK_KEY_PAIR';
|
|
||||||
isCustomSecureKeystore: 'done.invoke.issuersMachine.generateKeyPair:invocation[0]';
|
|
||||||
isInternetConnected: 'done.invoke.checkInternet';
|
|
||||||
isOIDCConfigError: 'error.platform.issuersMachine.performAuthorization:invocation[0]';
|
|
||||||
isOIDCflowCancelled: 'error.platform.issuersMachine.performAuthorization:invocation[0]';
|
|
||||||
shouldFetchIssuersAgain: 'TRY_AGAIN';
|
|
||||||
};
|
|
||||||
eventsCausingServices: {
|
|
||||||
checkInternet: 'done.invoke.issuersMachine.downloadIssuerConfig:invocation[0]';
|
|
||||||
downloadCredential:
|
|
||||||
| 'CHECK_KEY_PAIR'
|
|
||||||
| 'done.invoke.issuersMachine.generateKeyPair:invocation[0]';
|
|
||||||
downloadIssuerConfig: 'SELECTED_ISSUER' | 'TRY_AGAIN';
|
|
||||||
downloadIssuersList: 'TRY_AGAIN' | 'xstate.init';
|
|
||||||
generateKeyPair: 'CHECK_KEY_PAIR';
|
|
||||||
invokeAuthorization: 'done.invoke.checkInternet';
|
|
||||||
verifyCredential: 'done.invoke.issuersMachine.downloadCredentials:invocation[0]';
|
|
||||||
};
|
|
||||||
matchesStates:
|
|
||||||
| 'checkInternet'
|
|
||||||
| 'checkKeyPair'
|
|
||||||
| 'displayIssuers'
|
|
||||||
| 'done'
|
|
||||||
| 'downloadCredentials'
|
|
||||||
| 'downloadIssuerConfig'
|
|
||||||
| 'error'
|
|
||||||
| 'generateKeyPair'
|
|
||||||
| 'idle'
|
|
||||||
| 'performAuthorization'
|
|
||||||
| 'selectingIssuer'
|
|
||||||
| 'storing'
|
|
||||||
| 'verifyingCredential';
|
|
||||||
tags: never;
|
|
||||||
}
|
|
||||||
@@ -7,7 +7,7 @@ import {log, respond} from 'xstate/lib/actions';
|
|||||||
import {ExistingMosipVCItemEvents} from './VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine';
|
import {ExistingMosipVCItemEvents} from './VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine';
|
||||||
import {MY_VCS_STORE_KEY, RECEIVED_VCS_STORE_KEY} from '../shared/constants';
|
import {MY_VCS_STORE_KEY, RECEIVED_VCS_STORE_KEY} from '../shared/constants';
|
||||||
import {parseMetadatas, VCMetadata} from '../shared/VCMetadata';
|
import {parseMetadatas, VCMetadata} from '../shared/VCMetadata';
|
||||||
import {OpenId4VCIProtocol} from '../shared/openId4VCI/Utils';
|
import {Protocols} from '../shared/openId4VCI/Utils';
|
||||||
import {EsignetMosipVCItemEvents} from './VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine';
|
import {EsignetMosipVCItemEvents} from './VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine';
|
||||||
import {ActivityLogEvents} from './activityLog';
|
import {ActivityLogEvents} from './activityLog';
|
||||||
import {ActivityLog} from '../components/ActivityLogEvent';
|
import {ActivityLog} from '../components/ActivityLogEvent';
|
||||||
@@ -251,7 +251,7 @@ export const vcMachine =
|
|||||||
|
|
||||||
getVcItemResponse: respond((context, event) => {
|
getVcItemResponse: respond((context, event) => {
|
||||||
const vc = context.vcs[event.vcMetadata?.getVcKey()];
|
const vc = context.vcs[event.vcMetadata?.getVcKey()];
|
||||||
if (event.protocol === OpenId4VCIProtocol) {
|
if (event.protocol === Protocols.OpenId4VCI) {
|
||||||
return EsignetMosipVCItemEvents.GET_VC_RESPONSE(vc);
|
return EsignetMosipVCItemEvents.GET_VC_RESPONSE(vc);
|
||||||
}
|
}
|
||||||
return ExistingMosipVCItemEvents.GET_VC_RESPONSE(vc);
|
return ExistingMosipVCItemEvents.GET_VC_RESPONSE(vc);
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import {TabRef} from './HomeScreenMachine';
|
|||||||
import {useTranslation} from 'react-i18next';
|
import {useTranslation} from 'react-i18next';
|
||||||
import {ActorRefFrom} from 'xstate';
|
import {ActorRefFrom} from 'xstate';
|
||||||
import {ExistingMosipVCItemMachine} from '../../machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine';
|
import {ExistingMosipVCItemMachine} from '../../machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine';
|
||||||
import {isOpenId4VCIEnabled} from '../../shared/openId4VCI/Utils';
|
|
||||||
import LinearGradient from 'react-native-linear-gradient';
|
import LinearGradient from 'react-native-linear-gradient';
|
||||||
import {EsignetMosipVCItemMachine} from '../../machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine';
|
import {EsignetMosipVCItemMachine} from '../../machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine';
|
||||||
import {ErrorMessageOverlay} from '../../components/MessageOverlay';
|
import {ErrorMessageOverlay} from '../../components/MessageOverlay';
|
||||||
@@ -76,7 +75,7 @@ export const HomeScreen: React.FC<HomeRouteProps> = props => {
|
|||||||
</Column>
|
</Column>
|
||||||
)}
|
)}
|
||||||
</Column>
|
</Column>
|
||||||
{isOpenId4VCIEnabled() && <DownloadFABIcon />}
|
<DownloadFABIcon />
|
||||||
<ErrorMessageOverlay
|
<ErrorMessageOverlay
|
||||||
translationPath={'MyVcsTab'}
|
translationPath={'MyVcsTab'}
|
||||||
isVisible={controller.isMinimumStorageLimitReached}
|
isVisible={controller.isMinimumStorageLimitReached}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import {
|
|||||||
MessageOverlay,
|
MessageOverlay,
|
||||||
} from '../../components/MessageOverlay';
|
} from '../../components/MessageOverlay';
|
||||||
import {groupBy} from '../../shared/javascript';
|
import {groupBy} from '../../shared/javascript';
|
||||||
import {isOpenId4VCIEnabled} from '../../shared/openId4VCI/Utils';
|
|
||||||
import {VcItemContainer} from '../../components/VC/VcItemContainer';
|
import {VcItemContainer} from '../../components/VC/VcItemContainer';
|
||||||
import {BannerNotification} from '../../components/BannerNotification';
|
import {BannerNotification} from '../../components/BannerNotification';
|
||||||
import {
|
import {
|
||||||
@@ -49,14 +48,6 @@ export const MyVcsTab: React.FC<HomeScreenTabProps> = props => {
|
|||||||
GET_INDIVIDUAL_ID({id: '', idType: 'UIN'});
|
GET_INDIVIDUAL_ID({id: '', idType: 'UIN'});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onPressHandler = () => {
|
|
||||||
sendStartEvent(getStartEventData('VC Download', {id: 'UIN, VID, AID'}));
|
|
||||||
sendInteractEvent(
|
|
||||||
getInteractEventData('VC Download', 'CLICK', `Download VC Button`),
|
|
||||||
);
|
|
||||||
controller.DOWNLOAD_ID();
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (controller.areAllVcsLoaded) {
|
if (controller.areAllVcsLoaded) {
|
||||||
controller.RESET_STORE_VC_ITEM_STATUS();
|
controller.RESET_STORE_VC_ITEM_STATUS();
|
||||||
@@ -134,15 +125,6 @@ export const MyVcsTab: React.FC<HomeScreenTabProps> = props => {
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</Column>
|
</Column>
|
||||||
{!isOpenId4VCIEnabled() && (
|
|
||||||
<Button
|
|
||||||
testID="downloadCard"
|
|
||||||
type="gradient"
|
|
||||||
disabled={controller.isRefreshingVcs}
|
|
||||||
title={t('downloadCard')}
|
|
||||||
onPress={onPressHandler}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)}
|
)}
|
||||||
{controller.vcMetadatas.length === 0 && (
|
{controller.vcMetadatas.length === 0 && (
|
||||||
@@ -157,34 +139,13 @@ export const MyVcsTab: React.FC<HomeScreenTabProps> = props => {
|
|||||||
lineHeight={1}>
|
lineHeight={1}>
|
||||||
{t('bringYourDigitalID')}
|
{t('bringYourDigitalID')}
|
||||||
</Text>
|
</Text>
|
||||||
|
<Text
|
||||||
{isOpenId4VCIEnabled() && (
|
style={Theme.TextStyles.bold}
|
||||||
<Text
|
color={Theme.Colors.textLabel}
|
||||||
style={Theme.TextStyles.bold}
|
align="center"
|
||||||
color={Theme.Colors.textLabel}
|
margin="0 12 30 12">
|
||||||
align="center"
|
{t('generateVcFABDescription')}
|
||||||
margin="0 12 30 12">
|
</Text>
|
||||||
{t('generateVcFABDescription')}
|
|
||||||
</Text>
|
|
||||||
)}
|
|
||||||
{!isOpenId4VCIEnabled() && (
|
|
||||||
<React.Fragment>
|
|
||||||
<Text
|
|
||||||
style={Theme.TextStyles.bold}
|
|
||||||
color={Theme.Colors.textLabel}
|
|
||||||
align="center"
|
|
||||||
margin="0 12 30 12">
|
|
||||||
{t('generateVcDescription')}
|
|
||||||
</Text>
|
|
||||||
<Button
|
|
||||||
testID="downloadCard"
|
|
||||||
type="gradient"
|
|
||||||
disabled={controller.isRefreshingVcs}
|
|
||||||
title={t('downloadCard')}
|
|
||||||
onPress={onPressHandler}
|
|
||||||
/>
|
|
||||||
</React.Fragment>
|
|
||||||
)}
|
|
||||||
</Column>
|
</Column>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)}
|
)}
|
||||||
@@ -227,12 +188,6 @@ export const MyVcsTab: React.FC<HomeScreenTabProps> = props => {
|
|||||||
title={controller.walletBindingError}
|
title={controller.walletBindingError}
|
||||||
onButtonPress={controller.DISMISS}
|
onButtonPress={controller.DISMISS}
|
||||||
/>
|
/>
|
||||||
<ErrorMessageOverlay
|
|
||||||
translationPath={'MyVcsTab'}
|
|
||||||
isVisible={controller.isMinimumStorageLimitReached}
|
|
||||||
error={'errors.storageLimitReached'}
|
|
||||||
onDismiss={controller.DISMISS}
|
|
||||||
/>
|
|
||||||
<MessageOverlay
|
<MessageOverlay
|
||||||
isVisible={controller.isTampered}
|
isVisible={controller.isTampered}
|
||||||
title={t('errors.vcIsTampered.title')}
|
title={t('errors.vcIsTampered.title')}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import {
|
|||||||
selectIsRequestSuccessful,
|
selectIsRequestSuccessful,
|
||||||
selectGetVcModal,
|
selectGetVcModal,
|
||||||
selectIsSavingFailedInIdle,
|
selectIsSavingFailedInIdle,
|
||||||
selectIsMinimumStorageLimitReached,
|
|
||||||
selectIsNetworkOff,
|
selectIsNetworkOff,
|
||||||
} from './MyVcsTabMachine';
|
} from './MyVcsTabMachine';
|
||||||
import {
|
import {
|
||||||
@@ -54,10 +53,6 @@ export function useMyVcsTab(props: HomeScreenTabProps) {
|
|||||||
walletBindingError: useSelector(service, selectWalletBindingError),
|
walletBindingError: useSelector(service, selectWalletBindingError),
|
||||||
isBindingError: useSelector(service, selectShowWalletBindingError),
|
isBindingError: useSelector(service, selectShowWalletBindingError),
|
||||||
isBindingSuccess: useSelector(vcService, selectWalletBindingSuccess),
|
isBindingSuccess: useSelector(vcService, selectWalletBindingSuccess),
|
||||||
isMinimumStorageLimitReached: useSelector(
|
|
||||||
service,
|
|
||||||
selectIsMinimumStorageLimitReached,
|
|
||||||
),
|
|
||||||
isNetworkOff: useSelector(service, selectIsNetworkOff),
|
isNetworkOff: useSelector(service, selectIsNetworkOff),
|
||||||
showHardwareKeystoreNotExistsAlert: useSelector(
|
showHardwareKeystoreNotExistsAlert: useSelector(
|
||||||
settingsService,
|
settingsService,
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import {AppServices} from '../../shared/GlobalContext';
|
|||||||
import {MY_VCS_STORE_KEY} from '../../shared/constants';
|
import {MY_VCS_STORE_KEY} from '../../shared/constants';
|
||||||
import {AddVcModalMachine} from './MyVcs/AddVcModalMachine';
|
import {AddVcModalMachine} from './MyVcs/AddVcModalMachine';
|
||||||
import {GetVcModalMachine} from './MyVcs/GetVcModalMachine';
|
import {GetVcModalMachine} from './MyVcs/GetVcModalMachine';
|
||||||
import Storage from '../../shared/storage';
|
|
||||||
import {VCMetadata} from '../../shared/VCMetadata';
|
import {VCMetadata} from '../../shared/VCMetadata';
|
||||||
import {EsignetMosipVCItemMachine} from '../../machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine';
|
import {EsignetMosipVCItemMachine} from '../../machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine';
|
||||||
import NetInfo from '@react-native-community/netinfo';
|
import NetInfo from '@react-native-community/netinfo';
|
||||||
@@ -75,7 +74,7 @@ export const MyVcsTabMachine = model.createMachine(
|
|||||||
onDone: [
|
onDone: [
|
||||||
{
|
{
|
||||||
cond: 'isNetworkOn',
|
cond: 'isNetworkOn',
|
||||||
target: 'checkStorage',
|
target: '#MyVcsTab.addingVc',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
target: 'networkOff',
|
target: 'networkOff',
|
||||||
@@ -83,26 +82,6 @@ export const MyVcsTabMachine = model.createMachine(
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
checkStorage: {
|
|
||||||
invoke: {
|
|
||||||
src: 'checkStorageAvailability',
|
|
||||||
onDone: [
|
|
||||||
{
|
|
||||||
cond: 'isMinimumStorageLimitReached',
|
|
||||||
target: 'storageLimitReached',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
target: '#MyVcsTab.addingVc',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
storageLimitReached: {
|
|
||||||
on: {
|
|
||||||
DISMISS: '#idle',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
networkOff: {
|
networkOff: {
|
||||||
on: {
|
on: {
|
||||||
DISMISS: '#idle',
|
DISMISS: '#idle',
|
||||||
@@ -188,11 +167,6 @@ export const MyVcsTabMachine = model.createMachine(
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
services: {
|
services: {
|
||||||
checkStorageAvailability: () => async () => {
|
|
||||||
return Promise.resolve(
|
|
||||||
Storage.isMinimumLimitReached('minStorageRequired'),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
checkNetworkStatus: async () => {
|
checkNetworkStatus: async () => {
|
||||||
const state = await NetInfo.fetch();
|
const state = await NetInfo.fetch();
|
||||||
return state.isConnected;
|
return state.isConnected;
|
||||||
@@ -231,7 +205,6 @@ export const MyVcsTabMachine = model.createMachine(
|
|||||||
},
|
},
|
||||||
|
|
||||||
guards: {
|
guards: {
|
||||||
isMinimumStorageLimitReached: (_context, event) => Boolean(event.data),
|
|
||||||
isNetworkOn: (_context, event) => Boolean(event.data),
|
isNetworkOn: (_context, event) => Boolean(event.data),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -262,9 +235,6 @@ export function selectIsSavingFailedInIdle(state: State) {
|
|||||||
return state.matches('addingVc.savingFailed.idle');
|
return state.matches('addingVc.savingFailed.idle');
|
||||||
}
|
}
|
||||||
|
|
||||||
export function selectIsMinimumStorageLimitReached(state: State) {
|
|
||||||
return state.matches('addVc.storageLimitReached');
|
|
||||||
}
|
|
||||||
export function selectIsNetworkOff(state: State) {
|
export function selectIsNetworkOff(state: State) {
|
||||||
return state.matches('addVc.networkOff');
|
return state.matches('addVc.networkOff');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,75 +1,44 @@
|
|||||||
// This file was automatically generated. Edits will be overwritten
|
|
||||||
|
|
||||||
export interface Typegen0 {
|
// This file was automatically generated. Edits will be overwritten
|
||||||
'@@xstate/typegen': true;
|
|
||||||
internalEvents: {
|
export interface Typegen0 {
|
||||||
'done.invoke.AddVcModal': {
|
'@@xstate/typegen': true;
|
||||||
type: 'done.invoke.AddVcModal';
|
internalEvents: {
|
||||||
data: unknown;
|
"done.invoke.AddVcModal": { type: "done.invoke.AddVcModal"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.';
|
"done.invoke.GetVcModal": { type: "done.invoke.GetVcModal"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||||
};
|
"done.invoke.MyVcsTab.addVc.checkNetwork:invocation[0]": { type: "done.invoke.MyVcsTab.addVc.checkNetwork:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||||
'done.invoke.GetVcModal': {
|
"xstate.init": { type: "xstate.init" };
|
||||||
type: 'done.invoke.GetVcModal';
|
};
|
||||||
data: unknown;
|
invokeSrcNameMap: {
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.';
|
"checkNetworkStatus": "done.invoke.MyVcsTab.addVc.checkNetwork:invocation[0]";
|
||||||
};
|
};
|
||||||
'done.invoke.MyVcsTab.addVc.checkStorage:invocation[0]': {
|
missingImplementations: {
|
||||||
type: 'done.invoke.MyVcsTab.addVc.checkStorage:invocation[0]';
|
actions: never;
|
||||||
data: unknown;
|
delays: never;
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.';
|
guards: never;
|
||||||
};
|
services: never;
|
||||||
'xstate.init': {type: 'xstate.init'};
|
};
|
||||||
};
|
eventsCausingActions: {
|
||||||
invokeSrcNameMap: {
|
"resetStoringVcItemStatus": "RESET_STORE_VC_ITEM_STATUS";
|
||||||
checkStorageAvailability: 'done.invoke.MyVcsTab.addVc.checkStorage:invocation[0]';
|
"sendVcAdded": "STORE_RESPONSE";
|
||||||
};
|
"setStoringVcItemStatus": "SET_STORE_VC_ITEM_STATUS" | "STORE_RESPONSE";
|
||||||
missingImplementations: {
|
"storeVcItem": "done.invoke.AddVcModal";
|
||||||
actions: never;
|
"viewVcFromParent": "VIEW_VC";
|
||||||
delays: never;
|
};
|
||||||
guards: never;
|
eventsCausingDelays: {
|
||||||
services: never;
|
|
||||||
};
|
};
|
||||||
eventsCausingActions: {
|
eventsCausingGuards: {
|
||||||
refreshMyVc: 'IS_TAMPERED';
|
"isNetworkOn": "done.invoke.MyVcsTab.addVc.checkNetwork:invocation[0]";
|
||||||
resetIsTampered: 'IS_TAMPERED';
|
};
|
||||||
resetStoringVcItemStatus: 'RESET_STORE_VC_ITEM_STATUS';
|
eventsCausingServices: {
|
||||||
sendVcAdded: 'STORE_RESPONSE';
|
"AddVcModal": "done.invoke.GetVcModal" | "done.invoke.MyVcsTab.addVc.checkNetwork:invocation[0]";
|
||||||
setStoringVcItemStatus: 'SET_STORE_VC_ITEM_STATUS' | 'STORE_RESPONSE';
|
"GetVcModal": "GET_VC";
|
||||||
storeVcItem: 'done.invoke.AddVcModal';
|
"checkNetworkStatus": "ADD_VC" | "TRY_AGAIN";
|
||||||
viewVcFromParent: 'VIEW_VC';
|
};
|
||||||
};
|
matchesStates: "addVc" | "addVc.checkNetwork" | "addVc.networkOff" | "addingVc" | "addingVc.savingFailed" | "addingVc.savingFailed.idle" | "addingVc.storing" | "addingVc.waitingForvcKey" | "gettingVc" | "gettingVc.waitingForvcKey" | "idle" | "viewingVc" | { "addVc"?: "checkNetwork" | "networkOff";
|
||||||
eventsCausingDelays: {};
|
"addingVc"?: "savingFailed" | "storing" | "waitingForvcKey" | { "savingFailed"?: "idle"; };
|
||||||
eventsCausingGuards: {
|
"gettingVc"?: "waitingForvcKey"; };
|
||||||
isMinimumStorageLimitReached: 'done.invoke.MyVcsTab.addVc.checkStorage:invocation[0]';
|
tags: never;
|
||||||
};
|
}
|
||||||
eventsCausingServices: {
|
|
||||||
AddVcModal:
|
|
||||||
| 'done.invoke.GetVcModal'
|
|
||||||
| 'done.invoke.MyVcsTab.addVc.checkStorage:invocation[0]';
|
|
||||||
GetVcModal: 'GET_VC';
|
|
||||||
checkStorageAvailability: 'ADD_VC';
|
|
||||||
};
|
|
||||||
matchesStates:
|
|
||||||
| 'addVc'
|
|
||||||
| 'addVc.checkStorage'
|
|
||||||
| 'addVc.storageLimitReached'
|
|
||||||
| 'addingVc'
|
|
||||||
| 'addingVc.savingFailed'
|
|
||||||
| 'addingVc.savingFailed.idle'
|
|
||||||
| 'addingVc.storing'
|
|
||||||
| 'addingVc.waitingForvcKey'
|
|
||||||
| 'gettingVc'
|
|
||||||
| 'gettingVc.waitingForvcKey'
|
|
||||||
| 'idle'
|
|
||||||
| 'viewingVc'
|
|
||||||
| {
|
|
||||||
addVc?: 'checkStorage' | 'storageLimitReached';
|
|
||||||
addingVc?:
|
|
||||||
| 'savingFailed'
|
|
||||||
| 'storing'
|
|
||||||
| 'waitingForvcKey'
|
|
||||||
| {savingFailed?: 'idle'};
|
|
||||||
gettingVc?: 'waitingForvcKey';
|
|
||||||
};
|
|
||||||
tags: never;
|
|
||||||
}
|
|
||||||
@@ -11,7 +11,11 @@ import {HomeRouteProps} from '../../routes/main';
|
|||||||
import {useIssuerScreenController} from './IssuerScreenController';
|
import {useIssuerScreenController} from './IssuerScreenController';
|
||||||
import {Loader} from '../../components/ui/Loader';
|
import {Loader} from '../../components/ui/Loader';
|
||||||
import testIDProps, {removeWhiteSpace} from '../../shared/commonUtil';
|
import testIDProps, {removeWhiteSpace} from '../../shared/commonUtil';
|
||||||
import {ErrorMessage} from '../../shared/openId4VCI/Utils';
|
import {
|
||||||
|
ErrorMessage,
|
||||||
|
getDisplayObjectForCurrentLanguage,
|
||||||
|
Protocols,
|
||||||
|
} from '../../shared/openId4VCI/Utils';
|
||||||
import {
|
import {
|
||||||
getInteractEventData,
|
getInteractEventData,
|
||||||
getStartEventData,
|
getStartEventData,
|
||||||
@@ -52,16 +56,14 @@ export const IssuersScreen: React.FC<
|
|||||||
controller.isStoring,
|
controller.isStoring,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const onPressHandler = (id: string) => {
|
const onPressHandler = (id: string, protocol: string) => {
|
||||||
sendStartEvent(getStartEventData('VC Download', {id: id}));
|
sendStartEvent(getStartEventData('VC Download', {id: id}));
|
||||||
sendInteractEvent(
|
sendInteractEvent(
|
||||||
getInteractEventData('VC Download', 'CLICK', `IssuerType: ${id}`),
|
getInteractEventData('VC Download', 'CLICK', `IssuerType: ${id}`),
|
||||||
);
|
);
|
||||||
if (id !== 'UIN, VID, AID') {
|
protocol === Protocols.OTP
|
||||||
controller.SELECTED_ISSUER(id);
|
? controller.DOWNLOAD_ID()
|
||||||
} else {
|
: controller.SELECTED_ISSUER(id);
|
||||||
controller.DOWNLOAD_ID();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const isGenericError = () => {
|
const isGenericError = () => {
|
||||||
@@ -139,15 +141,21 @@ export const IssuersScreen: React.FC<
|
|||||||
{controller.issuers.length > 0 && (
|
{controller.issuers.length > 0 && (
|
||||||
<FlatList
|
<FlatList
|
||||||
data={controller.issuers}
|
data={controller.issuers}
|
||||||
scrollEnabled={false}
|
|
||||||
renderItem={({item}) => (
|
renderItem={({item}) => (
|
||||||
<Issuer
|
<Issuer
|
||||||
testID={removeWhiteSpace(item.id)}
|
testID={removeWhiteSpace(item.credential_issuer)}
|
||||||
key={item.id}
|
key={item.credential_issuer}
|
||||||
id={item.id}
|
id={item.credential_issuer}
|
||||||
displayName={item.displayName}
|
displayName={
|
||||||
logoUrl={item.logoUrl}
|
getDisplayObjectForCurrentLanguage(item.display)?.name
|
||||||
onPress={() => onPressHandler(item.id)}
|
}
|
||||||
|
logoUrl={
|
||||||
|
getDisplayObjectForCurrentLanguage(item.display)?.logo
|
||||||
|
?.url
|
||||||
|
}
|
||||||
|
onPress={() =>
|
||||||
|
onPressHandler(item.credential_issuer, item.protocol)
|
||||||
|
}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import {VC, VcIdType} from '../types/VC/ExistingMosipVC/vc';
|
import {VC, VcIdType} from '../types/VC/ExistingMosipVC/vc';
|
||||||
|
import {Protocols} from './openId4VCI/Utils';
|
||||||
|
|
||||||
const VC_KEY_PREFIX = 'VC';
|
const VC_KEY_PREFIX = 'VC';
|
||||||
const VC_ITEM_STORE_KEY_REGEX = '^VC_[a-zA-Z0-9_-]+$';
|
const VC_ITEM_STORE_KEY_REGEX = '^VC_[a-zA-Z0-9_-]+$';
|
||||||
@@ -57,7 +58,7 @@ export class VCMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isFromOpenId4VCI() {
|
isFromOpenId4VCI() {
|
||||||
return this.protocol !== '' && this.issuer !== '';
|
return this.protocol === Protocols.OpenId4VCI;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used for mmkv storage purposes and as a key for components and vc maps
|
// Used for mmkv storage purposes and as a key for components and vc maps
|
||||||
|
|||||||
@@ -21,16 +21,11 @@ export const API_URLS = {
|
|||||||
|
|
||||||
export const API = {
|
export const API = {
|
||||||
fetchIssuers: async () => {
|
fetchIssuers: async () => {
|
||||||
const defaultIssuer = {
|
|
||||||
id: 'UIN, VID, AID',
|
|
||||||
displayName: 'UIN, VID, AID',
|
|
||||||
};
|
|
||||||
|
|
||||||
const response = await request(
|
const response = await request(
|
||||||
API_URLS.issuersList.method,
|
API_URLS.issuersList.method,
|
||||||
API_URLS.issuersList.buildURL(),
|
API_URLS.issuersList.buildURL(),
|
||||||
);
|
);
|
||||||
return [defaultIssuer, ...(response.response.issuers || [])];
|
return response.response.issuers || [];
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchIssuerConfig: async (issuerId: string) => {
|
fetchIssuerConfig: async (issuerId: string) => {
|
||||||
|
|||||||
@@ -25,5 +25,5 @@ export default function testIDProps(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const removeWhiteSpace = (str: string) => {
|
export const removeWhiteSpace = (str: string) => {
|
||||||
return str.replace(/\s/g, '');
|
return str ? str.replace(/\s/g, '') : str;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,19 +3,25 @@ import jwtDecode from 'jwt-decode';
|
|||||||
import jose from 'node-jose';
|
import jose from 'node-jose';
|
||||||
import {isIOS} from '../constants';
|
import {isIOS} from '../constants';
|
||||||
import pem2jwk from 'simple-pem2jwk';
|
import pem2jwk from 'simple-pem2jwk';
|
||||||
import {Issuers_Key_Ref} from '../../machines/issuersMachine';
|
import {
|
||||||
import {ENABLE_OPENID_FOR_VC} from 'react-native-dotenv';
|
displayType,
|
||||||
|
Issuers_Key_Ref,
|
||||||
|
issuerType,
|
||||||
|
} from '../../machines/issuersMachine';
|
||||||
import getAllConfigurations from '../commonprops/commonProps';
|
import getAllConfigurations from '../commonprops/commonProps';
|
||||||
|
import {CredentialWrapper} from '../../types/VC/EsignetMosipVC/vc';
|
||||||
|
import {VCMetadata} from '../VCMetadata';
|
||||||
|
import i18next from 'i18next';
|
||||||
|
|
||||||
export const OpenId4VCIProtocol = 'OpenId4VCIProtocol';
|
export const Protocols = {
|
||||||
export const isOpenId4VCIEnabled = () => {
|
OpenId4VCI: 'OpenId4VCI',
|
||||||
return ENABLE_OPENID_FOR_VC === 'true';
|
OTP: 'OTP',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getIdentifier = (context, credential) => {
|
export const getIdentifier = (context, credential) => {
|
||||||
const credId = credential.credential.id.split('/');
|
const credId = credential.credential.id.split('/');
|
||||||
return (
|
return (
|
||||||
context.selectedIssuer.id +
|
context.selectedIssuer.credential_issuer +
|
||||||
':' +
|
':' +
|
||||||
context.selectedIssuer.protocol +
|
context.selectedIssuer.protocol +
|
||||||
':' +
|
':' +
|
||||||
@@ -38,6 +44,56 @@ export const getBody = async context => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const updateCredentialInformation = (context, credential) => {
|
||||||
|
let credentialWrapper: CredentialWrapper = {};
|
||||||
|
credentialWrapper.verifiableCredential = credential;
|
||||||
|
credentialWrapper.identifier = getIdentifier(context, credential);
|
||||||
|
credentialWrapper.generatedOn = new Date();
|
||||||
|
credentialWrapper.verifiableCredential.issuerLogo =
|
||||||
|
getDisplayObjectForCurrentLanguage(context.selectedIssuer.display)?.logo;
|
||||||
|
return credentialWrapper;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getDisplayObjectForCurrentLanguage = (
|
||||||
|
display: [displayType],
|
||||||
|
): displayType => {
|
||||||
|
const currentLanguage = i18next.language;
|
||||||
|
let displayType = display.filter(obj => obj.language == currentLanguage)[0];
|
||||||
|
if (!displayType) {
|
||||||
|
displayType = display.filter(obj => obj.language == 'en')[0];
|
||||||
|
}
|
||||||
|
return displayType;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getVCMetadata = context => {
|
||||||
|
const [issuer, protocol, requestId] =
|
||||||
|
context.credentialWrapper?.identifier.split(':');
|
||||||
|
return VCMetadata.fromVC({
|
||||||
|
requestId: requestId ? requestId : null,
|
||||||
|
issuer: issuer,
|
||||||
|
protocol: protocol,
|
||||||
|
id: context.verifiableCredential?.credential.credentialSubject.UIN
|
||||||
|
? context.verifiableCredential?.credential.credentialSubject.UIN
|
||||||
|
: context.verifiableCredential?.credential.credentialSubject.VID,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const constructAuthorizationConfiguration = (
|
||||||
|
selectedIssuer: issuerType,
|
||||||
|
) => {
|
||||||
|
return {
|
||||||
|
clientId: selectedIssuer.client_id,
|
||||||
|
scopes: selectedIssuer.scopes_supported,
|
||||||
|
additionalHeaders: selectedIssuer.additional_headers,
|
||||||
|
wellKnownEndpoint: selectedIssuer['.well-known'],
|
||||||
|
redirectUrl: selectedIssuer.redirect_uri,
|
||||||
|
serviceConfiguration: {
|
||||||
|
authorizationEndpoint: selectedIssuer.authorization_endpoint,
|
||||||
|
tokenEndpoint: selectedIssuer.token_endpoint,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export const getJWK = async publicKey => {
|
export const getJWK = async publicKey => {
|
||||||
try {
|
try {
|
||||||
let publicKeyJWKString;
|
let publicKeyJWKString;
|
||||||
@@ -74,9 +130,9 @@ export const getJWT = async context => {
|
|||||||
const decodedToken = jwtDecode(context.tokenResponse.accessToken);
|
const decodedToken = jwtDecode(context.tokenResponse.accessToken);
|
||||||
const payload64 = encodeB64(
|
const payload64 = encodeB64(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
iss: context.selectedIssuer.clientId,
|
iss: context.selectedIssuer.client_id,
|
||||||
nonce: decodedToken.c_nonce,
|
nonce: decodedToken.c_nonce,
|
||||||
aud: context.selectedIssuer.serviceConfiguration.credentialAudience,
|
aud: context.selectedIssuer.credential_audience,
|
||||||
iat: Math.floor(new Date().getTime() / 1000),
|
iat: Math.floor(new Date().getTime() / 1000),
|
||||||
exp: Math.floor(new Date().getTime() / 1000) + 18000,
|
exp: Math.floor(new Date().getTime() / 1000) + 18000,
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export class BackendResponseError extends Error {
|
|||||||
|
|
||||||
export async function request(
|
export async function request(
|
||||||
method: HTTP_METHOD,
|
method: HTTP_METHOD,
|
||||||
path: `/${string}`,
|
path: `/${string}` | string,
|
||||||
body?: Record<string, unknown>,
|
body?: Record<string, unknown>,
|
||||||
host = MIMOTO_BASE_URL,
|
host = MIMOTO_BASE_URL,
|
||||||
headers: Record<string, string> = {
|
headers: Record<string, string> = {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import {WalletBindingResponse} from '../../../shared/cryptoutil/cryptoUtil';
|
import {WalletBindingResponse} from '../../../shared/cryptoutil/cryptoUtil';
|
||||||
|
import {logoType} from '../../../machines/issuersMachine';
|
||||||
|
|
||||||
export interface VC {
|
export interface VC {
|
||||||
id?: string;
|
id?: string;
|
||||||
@@ -68,7 +69,7 @@ export interface Credential {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface VerifiableCredential {
|
export interface VerifiableCredential {
|
||||||
issuerLogo: string;
|
issuerLogo: logoType;
|
||||||
format: string;
|
format: string;
|
||||||
credential: Credential;
|
credential: Credential;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user