mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-08 21:18:14 -05:00
* [INJIMOB-2160] use pixelpass for processing mmdoc data for rendering Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-2160] fix history not showing properly post download Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-2160] add processing VC logic for iOS Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-2160] modify selectCredential in VCItemSelectors to return selectCredential Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-2160] refactor - remove debug logs Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-2160] refactor - mark prop credentialWrapper as mandatory Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-2160] refactor - optimize imports Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-2160] refactor - remove unused functions / code block Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-2160] refactor - format code Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-2160] modify pixelpass module to get toJSON api from pixelpass class Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-2160] refactor - optimize imports Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-2160] show keytype for mso_mdoc format VCs Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-2160] use id in mso_mdoc VC as unique VC ID Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-2160] refactor getDisplayId method Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-2160] update ci-client & pixelpass version Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-2160] add runtime asset to gitignore Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-2160] remove unused var Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-2160] bypass verification for mock VCs This is done since mock VCs are not verifiable as of now. Co-Authored by: BalachandarG <balachandar.g@thoughtworks.com> Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> --------- Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com>
140 lines
4.0 KiB
TypeScript
140 lines
4.0 KiB
TypeScript
import {StateFrom} from 'xstate';
|
|
import {VCMetadata} from '../../../shared/VCMetadata';
|
|
import {VCItemMachine} from './VCItemMachine';
|
|
import {getMosipLogo} from '../../../components/VC/common/VCUtils';
|
|
import {
|
|
Credential,
|
|
VerifiableCredential,
|
|
VerifiableCredentialData,
|
|
} from '../VCMetaMachine/vc';
|
|
import {VCFormat} from '../../../shared/VCFormat';
|
|
import {VCProcessor} from '../../../components/VC/common/VCProcessor';
|
|
|
|
type State = StateFrom<typeof VCItemMachine>;
|
|
|
|
export function selectVerificationStatus(state: State) {
|
|
return state.context.verificationStatus;
|
|
}
|
|
|
|
export function selectIsVerificationInProgress(state: State) {
|
|
return state.matches('verifyState.verifyingCredential');
|
|
}
|
|
|
|
export function selectIsVerificationCompleted(state: State) {
|
|
return state.matches('verifyState.verificationCompleted');
|
|
}
|
|
|
|
export function selectShowVerificationStatusBanner(state: State) {
|
|
return state.context.showVerificationStatusBanner;
|
|
}
|
|
|
|
export function selectVerifiableCredential(state: State) {
|
|
return state.context.verifiableCredential;
|
|
}
|
|
|
|
export function getVerifiableCredential(
|
|
verifiableCredential: VerifiableCredential | Credential,
|
|
): Credential {
|
|
return verifiableCredential?.credential || verifiableCredential;
|
|
}
|
|
|
|
export function selectCredential(state: State): VerifiableCredential {
|
|
return state.context.verifiableCredential;
|
|
}
|
|
|
|
export function selectVerifiableCredentialData(
|
|
state: State,
|
|
): VerifiableCredentialData {
|
|
const vcMetadata = new VCMetadata(state.context.vcMetadata);
|
|
|
|
return {
|
|
vcMetadata: vcMetadata,
|
|
format: vcMetadata.format,
|
|
face:
|
|
state.context.verifiableCredential?.credential?.credentialSubject?.face ??
|
|
state.context.credential?.biometrics?.face,
|
|
issuerLogo:
|
|
state.context.verifiableCredential?.issuerLogo ?? getMosipLogo(),
|
|
wellKnown: state.context.verifiableCredential?.wellKnown,
|
|
credentialConfigurationId:
|
|
state.context.verifiableCredential?.credentialConfigurationId,
|
|
issuer: vcMetadata.issuer,
|
|
};
|
|
}
|
|
|
|
export function selectKebabPopUp(state: State) {
|
|
return state.context.isMachineInKebabPopupState;
|
|
}
|
|
|
|
export function selectContext(state: State) {
|
|
return state.context;
|
|
}
|
|
|
|
export function selectGeneratedOn(state: State) {
|
|
return state.context.generatedOn;
|
|
}
|
|
|
|
export function selectWalletBindingSuccess(state: State) {
|
|
return state.context.walletBindingResponse;
|
|
}
|
|
|
|
export function selectWalletBindingResponse(state: State) {
|
|
return state.context.walletBindingResponse;
|
|
}
|
|
|
|
export function selectIsCommunicationDetails(state: State) {
|
|
return state.context.communicationDetails;
|
|
}
|
|
|
|
export function selectWalletBindingError(state: State) {
|
|
return state.context.error;
|
|
}
|
|
|
|
export function selectBindingAuthFailedError(state: State) {
|
|
return state.context.error;
|
|
}
|
|
|
|
export function selectAcceptingBindingOtp(state: State) {
|
|
return state.matches('vcUtilitiesState.walletBinding.acceptingBindingOTP');
|
|
}
|
|
|
|
export function selectWalletBindingInProgress(state: State) {
|
|
return (
|
|
state.matches('vcUtilitiesState.walletBinding.requestingBindingOTP') ||
|
|
state.matches('vcUtilitiesState.walletBinding.addingWalletBindingId') ||
|
|
state.matches('vcUtilitiesState.walletBinding.addKeyPair') ||
|
|
state.matches('vcUtilitiesState.walletBinding.updatingPrivateKey')
|
|
);
|
|
}
|
|
|
|
export function selectBindingWarning(state: State) {
|
|
return state.matches('vcUtilitiesState.walletBinding.showBindingWarning');
|
|
}
|
|
|
|
export function selectRemoveWalletWarning(state: State) {
|
|
return state.matches('vcUtilitiesState.kebabPopUp.removeWallet');
|
|
}
|
|
|
|
export function selectIsPinned(state: State) {
|
|
return state.context.vcMetadata.isPinned;
|
|
}
|
|
|
|
export function selectOtpError(state: State) {
|
|
return state.context.error;
|
|
}
|
|
|
|
export function selectShowActivities(state: State) {
|
|
return state.matches('vcUtilitiesState.kebabPopUp.showActivities');
|
|
}
|
|
|
|
export function selectShowWalletBindingError(state: State) {
|
|
return state.matches(
|
|
'vcUtilitiesState.walletBinding.showingWalletBindingError',
|
|
);
|
|
}
|
|
|
|
export function selectVc(state: State) {
|
|
const {serviceRefs, ...data} = state.context;
|
|
return data;
|
|
}
|