mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-09 05:27:57 -05:00
[INJIMOB-3571] | [INJIMOB-3572] | [INJIMOB-3453] Sync release 0.20.0 (#2097)
* [INJIMOB-3453] fix share-with-selfie not coming with vc with face (#2095) * [INJIMOB-3453] fix share-with-selfie not coming with vc with face and remove mosip vc hardcoding Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com> * [INJIMOB-3453] pass issuerHost instead of issuer name in activitylogs Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com> * [INJIMOB-3453] exclude processed credentialdata data in ble share Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com> * [INJIMOB-3453] refactor: rename vcHasImage to getFaceAtribute Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-3453] refactor: modify fallback for face in VC Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-3453] fix: inexisting function import Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> --------- Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com> Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> Co-authored-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com> * [INJIMOB-3571] | [INJIMOB-3572] refactor: Modify trusted verifiers construction (#2094) * [INJIMOB-3571] add: modify trusted verifiers Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-3571] add: modify trusted verifiers in swift Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-3571] refactor: remove unused logs and code Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-3572] add: support for unsigned request in pre-registered verifiers Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-3572] chore: update openid4vp swift package version Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-3571] refactor: revert changes trustedVerifiers cachePreference Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-3558] refactor: update vc renderer renderVc to generateCredentualDisplayCOntent Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-3559] fix: bridging issue of generateCredentialContent method Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-3559] refactor: modify vc renderer native module Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-3559] refactor: modify vc renderer native module Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-3559] chore: update vc renderer swift package Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> --------- Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> --------- Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com> Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> Co-authored-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com>
This commit is contained in:
committed by
GitHub
parent
decb0ce25e
commit
5413671e8e
@@ -26,6 +26,7 @@ import com.google.gson.GsonBuilder;
|
||||
|
||||
import io.mosip.openID4VP.authorizationRequest.clientMetadata.ClientMetadata;
|
||||
import io.mosip.openID4VP.authorizationRequest.clientMetadata.ClientMetadataSerializer;
|
||||
import io.mosip.openID4VP.authorizationRequest.clientMetadata.Jwks;
|
||||
import io.mosip.openID4VP.constants.ClientIdScheme;
|
||||
import io.mosip.openID4VP.constants.ContentEncryptionAlgorithm;
|
||||
import io.mosip.openID4VP.constants.KeyManagementAlgorithm;
|
||||
@@ -235,19 +236,21 @@ public class InjiOpenID4VPModule extends ReactContextBaseJavaModule {
|
||||
String clientId = verifierMap.getString("client_id");
|
||||
ReadableArray responseUris = verifierMap.getArray("response_uris");
|
||||
List<String> responseUriList = convertReadableArrayToList(responseUris);
|
||||
ClientMetadata clientMetadata = null;
|
||||
if (verifierMap.hasKey("client_metadata") && !verifierMap.isNull("client_metadata")) {
|
||||
String jwksUri = null;
|
||||
if (verifierMap.hasKey("jwks_uri") && !verifierMap.isNull("jwks_uri")) {
|
||||
try {
|
||||
ReadableMap metadataMap = verifierMap.getMap("client_metadata");
|
||||
String metadataJsonString = readableMapToJson(metadataMap).toString();
|
||||
clientMetadata = Json.Default.decodeFromString(ClientMetadataSerializer.INSTANCE,
|
||||
metadataJsonString);
|
||||
jwksUri = verifierMap.getString("jwks_uri");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if(verifierMap.hasKey("allow_unsigned_request")){
|
||||
boolean allowUnsignedRequest = verifierMap.getBoolean("allow_unsigned_request");
|
||||
verifiers.add(new Verifier(clientId, responseUriList, jwksUri, allowUnsignedRequest));
|
||||
continue;
|
||||
}
|
||||
|
||||
verifiers.add(new Verifier(clientId, responseUriList, clientMetadata));
|
||||
verifiers.add(new Verifier(clientId, responseUriList, jwksUri));
|
||||
}
|
||||
|
||||
return verifiers;
|
||||
|
||||
@@ -2,7 +2,6 @@ package io.mosip.residentapp;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.Promise;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
@@ -35,10 +34,14 @@ public class RNInjiVcRendererModule extends ReactContextBaseJavaModule {
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void renderVC(String credentialFormat, String wellKnown, String vcJsonString, Promise promise) {
|
||||
public void generateCredentialDisplayContent(String credentialFormat, String wellKnown, String vcJsonString, Promise promise) {
|
||||
try {
|
||||
List<Object> results = injiVcRenderer.renderVC(
|
||||
CredentialFormat.Companion.fromValue(credentialFormat),
|
||||
CredentialFormat format = CredentialFormat.Companion.fromValue(credentialFormat);
|
||||
if (format == null) {
|
||||
throw new UnsupportedOperationException("Invalid credential format: " + credentialFormat);
|
||||
}
|
||||
List<Object> results = injiVcRenderer.generateCredentialDisplayContent(
|
||||
format,
|
||||
wellKnown,
|
||||
vcJsonString
|
||||
);
|
||||
|
||||
@@ -14,7 +14,6 @@ buildscript {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath("com.android.tools.build:gradle:8.4.0")
|
||||
|
||||
@@ -152,7 +152,7 @@ export const getFieldValue = (
|
||||
return null;
|
||||
}
|
||||
return getLocalizedField(value?.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -715,3 +715,32 @@ const ProtectedCurve = {
|
||||
const PROOF_TYPE_ALGORITHM_MAP = {
|
||||
[-7]: 'ES256',
|
||||
};
|
||||
|
||||
export function getFaceAttribute(verifiableCredential, format) {
|
||||
let credentialSubject = {};
|
||||
if (format === VCFormat.ldp_vc) {
|
||||
credentialSubject =
|
||||
verifiableCredential?.credential?.credentialSubject ??
|
||||
verifiableCredential?.verifiableCredential.credential.credentialSubject ?? {};
|
||||
} else if (format === VCFormat.mso_mdoc) {
|
||||
const nameSpaces =
|
||||
verifiableCredential?.processedCredential?.issuerSigned?.nameSpaces ??
|
||||
verifiableCredential?.processedCredential?.nameSpaces ??
|
||||
{};
|
||||
credentialSubject = Object.values(nameSpaces)
|
||||
.flat()
|
||||
.reduce((acc, item) => {
|
||||
const key = item.elementIdentifier;
|
||||
const value = item.elementValue;
|
||||
acc[key] = value;
|
||||
return acc;
|
||||
}, {} as Record<string, any>);
|
||||
} else if (format === VCFormat.vc_sd_jwt || format === VCFormat.dc_sd_jwt) {
|
||||
credentialSubject =
|
||||
verifiableCredential?.processedCredential?.fullResolvedPayload ?? {};
|
||||
}
|
||||
const faceField =
|
||||
getFaceField(credentialSubject)
|
||||
|
||||
return faceField
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import {useTranslation} from 'react-i18next';
|
||||
import {SvgImage} from './ui/svg';
|
||||
import {useKebabPopUp} from './KebabPopUpController';
|
||||
import {isActivationNeeded} from '../shared/openId4VCI/Utils';
|
||||
import {isMosipVC, VCShareFlowType} from '../shared/Utils';
|
||||
import {VCShareFlowType} from '../shared/Utils';
|
||||
|
||||
export const getKebabMenuOptions = props => {
|
||||
const controller = useKebabPopUp(props);
|
||||
@@ -68,7 +68,7 @@ export const getKebabMenuOptions = props => {
|
||||
|
||||
if (props.vcMetadata.isVerified) {
|
||||
vcActionsList.splice(1, 0, share);
|
||||
if (isMosipVC(props.vcMetadata.issuer)) {
|
||||
if (props.vcHasImage) {
|
||||
vcActionsList.splice(2, 0, shareWithSelfieOption, VCActivationOption);
|
||||
}
|
||||
if (props.vcMetadata.isExpired) {
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
"location" : "https://github.com/mosip/inji-openid4vp-ios-swift.git",
|
||||
"state" : {
|
||||
"branch" : "release-0.5.x",
|
||||
"revision" : "e939d4acf4e9f54d902b65913b93432fcd068b46"
|
||||
"revision" : "b3ce7ef9f70229d76e01af89dcf92e7d9d677254"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -88,7 +88,7 @@
|
||||
"location" : "https://github.com/mosip/inji-vc-renderer-ios-swift.git",
|
||||
"state" : {
|
||||
"branch" : "release-0.1.x",
|
||||
"revision" : "97842f70c7bc510afb0bb415b9806b4e722808f0"
|
||||
"revision" : "68b6c14aaf1e572f84307e0f932d93a66134055d"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
RCT_EXTERN_METHOD(init:(NSString *)traceabilityId)
|
||||
|
||||
|
||||
RCT_EXTERN_METHOD(renderVC:(NSString *)credentialFormat
|
||||
wellKnown:(NSString *)wellKnown
|
||||
RCT_EXTERN_METHOD(generateCredentialDisplayContent: (NSString *)credentialFormat
|
||||
wellKnown:(NSString * _Nullable)wellKnown
|
||||
vcJsonString:(NSString *)vcJsonString
|
||||
resolver:(RCTPromiseResolveBlock)resolve
|
||||
rejecter:(RCTPromiseRejectBlock)reject)
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -3,55 +3,57 @@ import React
|
||||
import InjiVcRenderer
|
||||
@objc(InjiVcRenderer)
|
||||
class RNInjiVcRenderer: NSObject, RCTBridgeModule {
|
||||
|
||||
private var vcRenderer: InjiVcRenderer?
|
||||
|
||||
@objc static func requiresMainQueueSetup() -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
static func moduleName() -> String {
|
||||
return "InjiVcRenderer"
|
||||
}
|
||||
|
||||
|
||||
private var vcRenderer: InjiVcRenderer?
|
||||
|
||||
@objc static func requiresMainQueueSetup() -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
static func moduleName() -> String {
|
||||
return "InjiVcRenderer"
|
||||
}
|
||||
|
||||
@objc
|
||||
func `init`(_ traceabilityId: String) {
|
||||
vcRenderer = InjiVcRenderer(traceabilityId: traceabilityId)
|
||||
}
|
||||
|
||||
|
||||
@objc(renderVC:wellKnown:vcJsonString:resolver:rejecter:)
|
||||
func renderVC(
|
||||
credentialFormat: String,
|
||||
wellKnown: String?,
|
||||
vcJsonString: String,
|
||||
resolve: @escaping RCTPromiseResolveBlock,
|
||||
reject: @escaping RCTPromiseRejectBlock
|
||||
) {
|
||||
guard let renderer = self.vcRenderer else {
|
||||
reject(nil, "InjiVcRenderer not initialized", nil)
|
||||
return
|
||||
}
|
||||
|
||||
do {
|
||||
let format = CredentialFormat.fromValue(credentialFormat)
|
||||
let result = try renderer.renderVC(
|
||||
credentialFormat: format,
|
||||
wellKnownJson: wellKnown,
|
||||
vcJsonString: vcJsonString
|
||||
)
|
||||
resolve(result)
|
||||
} catch {
|
||||
rejectWithVcRendererError(error, reject: reject)
|
||||
}
|
||||
|
||||
|
||||
@objc(generateCredentialDisplayContent:wellKnown:vcJsonString:resolver:rejecter:)
|
||||
func generateCredentialDisplayContent(
|
||||
credentialFormat: String,
|
||||
wellKnown: String?,
|
||||
vcJsonString: String,
|
||||
resolve: @escaping RCTPromiseResolveBlock,
|
||||
reject: @escaping RCTPromiseRejectBlock
|
||||
) {
|
||||
guard let renderer = self.vcRenderer else {
|
||||
reject(nil, "InjiVcRenderer not initialized", nil)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
do {
|
||||
guard let format = CredentialFormat.fromValue(credentialFormat) else {
|
||||
throw NSError(domain: "Invalid credential format", code: 0)
|
||||
}
|
||||
let result = try renderer.generateCredentialDisplayContent(
|
||||
credentialFormat: format,
|
||||
wellKnownJson: wellKnown,
|
||||
vcJsonString: vcJsonString
|
||||
)
|
||||
resolve(result)
|
||||
} catch {
|
||||
rejectWithVcRendererError(error, reject: reject)
|
||||
}
|
||||
}
|
||||
|
||||
func rejectWithVcRendererError(_ error: Error, reject: RCTPromiseRejectBlock) {
|
||||
if let vcRendererError = error as? VcRendererException {
|
||||
reject(vcRendererError.errorCode, vcRendererError.message, vcRendererError)
|
||||
} else {
|
||||
let nsError = NSError(domain: error.localizedDescription, code: 0)
|
||||
reject("ERR_UNKNOWN", nsError.localizedDescription, nsError)
|
||||
}
|
||||
reject(vcRendererError.errorCode, vcRendererError.message, vcRendererError)
|
||||
} else {
|
||||
let nsError = NSError(domain: error.localizedDescription, code: 0)
|
||||
reject("ERR_UNKNOWN", nsError.localizedDescription, nsError)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,13 +197,13 @@ func sendErrorToVerifier(_ error: String, _ errorCode: String,
|
||||
throw NSError(domain: "OpenID4VP", code: -1, userInfo: [NSLocalizedDescriptionKey: "Invalid Verifier data"])
|
||||
}
|
||||
|
||||
var clientMetadata: ClientMetadata? = nil
|
||||
if let metadata = verifierDict["client_metadata"] as? [String: Any] {
|
||||
let encoded = try JSONSerialization.data(withJSONObject: metadata)
|
||||
clientMetadata = try ClientMetadata.deserializeAndValidate(clientMetadata: encoded)
|
||||
let jwksUri: String? = verifierDict["jwks_uri"] as? String
|
||||
|
||||
if let allowUnsignedRequest = verifierDict["allow_unsigned_request"] as? Bool {
|
||||
return Verifier(clientId: clientId, responseUris: responseUris, jwksUri: jwksUri, allowUnsignedRequest: allowUnsignedRequest)
|
||||
}
|
||||
|
||||
return Verifier(clientId: clientId, responseUris: responseUris,clientMetadata: clientMetadata)
|
||||
return Verifier(clientId: clientId, responseUris: responseUris,jwksUri: jwksUri)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -462,7 +462,7 @@ export const VCItemActions = model => {
|
||||
VCActivityLog.getLogFromObject({
|
||||
_vcKey: context.vcMetadata.getVcKey(),
|
||||
type: 'VC_DOWNLOADED',
|
||||
issuer: context.vcMetadata.issuer!!,
|
||||
issuer: context.vcMetadata.issuerHost!!,
|
||||
credentialConfigurationId:
|
||||
context.verifiableCredential.credentialConfigurationId,
|
||||
timestamp: Date.now(),
|
||||
@@ -481,7 +481,7 @@ export const VCItemActions = model => {
|
||||
VCActivityLog.getLogFromObject({
|
||||
credentialConfigurationId:
|
||||
context.verifiableCredential.credentialConfigurationId,
|
||||
issuer: vcMetadata.issuer!!,
|
||||
issuer: vcMetadata.issuerHost!!,
|
||||
_vcKey: vcMetadata.getVcKey(),
|
||||
type: 'VC_REMOVED',
|
||||
timestamp: Date.now(),
|
||||
@@ -502,7 +502,7 @@ export const VCItemActions = model => {
|
||||
type: 'WALLET_BINDING_SUCCESSFULL',
|
||||
credentialConfigurationId:
|
||||
context.verifiableCredential.credentialConfigurationId,
|
||||
issuer: vcMetadata.issuer!!,
|
||||
issuer: vcMetadata.issuerHost!!,
|
||||
timestamp: Date.now(),
|
||||
deviceName: '',
|
||||
}),
|
||||
@@ -522,7 +522,7 @@ export const VCItemActions = model => {
|
||||
type: 'WALLET_BINDING_FAILURE',
|
||||
credentialConfigurationId:
|
||||
context.verifiableCredential.credentialConfigurationId,
|
||||
issuer: vcMetadata.issuer!!,
|
||||
issuer: vcMetadata.issuerHost!!,
|
||||
timestamp: Date.now(),
|
||||
deviceName: '',
|
||||
}),
|
||||
|
||||
@@ -2,8 +2,8 @@ import {StateFrom} from 'xstate';
|
||||
import {VCMetadata} from '../../../shared/VCMetadata';
|
||||
import {VCItemMachine} from './VCItemMachine';
|
||||
import {
|
||||
getFaceField,
|
||||
getMosipLogo,
|
||||
getFaceAttribute,
|
||||
} from '../../../components/VC/common/VCUtils';
|
||||
import {
|
||||
Credential,
|
||||
@@ -48,30 +48,8 @@ export function selectVerifiableCredentialData(
|
||||
state: State,
|
||||
): VerifiableCredentialData {
|
||||
const vcMetadata = new VCMetadata(state.context.vcMetadata);
|
||||
const verifiableCredential = state.context.verifiableCredential;
|
||||
let credentialSubject = {};
|
||||
if (state.context?.format === VCFormat.ldp_vc) {
|
||||
credentialSubject =
|
||||
verifiableCredential?.credential?.credentialSubject ?? {};
|
||||
} else if (state.context?.format === VCFormat.mso_mdoc) {
|
||||
const nameSpaces =
|
||||
verifiableCredential?.processedCredential?.issuerSigned?.nameSpaces ??
|
||||
verifiableCredential?.processedCredential?.nameSpaces ??
|
||||
{};
|
||||
credentialSubject = Object.values(nameSpaces)
|
||||
.flat()
|
||||
.reduce((acc, item) => {
|
||||
const key = item.elementIdentifier;
|
||||
const value = item.elementValue;
|
||||
acc[key] = value;
|
||||
return acc;
|
||||
}, {} as Record<string, any>);
|
||||
} else if (state.context?.format === VCFormat.vc_sd_jwt || state.context?.format === VCFormat.dc_sd_jwt) {
|
||||
credentialSubject =
|
||||
verifiableCredential?.processedCredential?.fullResolvedPayload ?? {};
|
||||
}
|
||||
const faceField =
|
||||
getFaceField(credentialSubject) ??
|
||||
getFaceAttribute(state.context.verifiableCredential,state.context.format) ??
|
||||
state.context.credential?.biometrics?.face;
|
||||
|
||||
return {
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
|
||||
// This file was automatically generated. Edits will be overwritten
|
||||
|
||||
export interface Typegen0 {
|
||||
'@@xstate/typegen': true;
|
||||
internalEvents: {
|
||||
"done.invoke.vcMeta.ready.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]": { type: "done.invoke.vcMeta.ready.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||
"xstate.init": { type: "xstate.init" };
|
||||
};
|
||||
invokeSrcNameMap: {
|
||||
"isUserSignedAlready": "done.invoke.vcMeta.ready.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]";
|
||||
};
|
||||
missingImplementations: {
|
||||
actions: "addVcToInProgressDownloads" | "getVcItemResponse" | "loadMyVcs" | "loadReceivedVcs" | "logTamperedVCsremoved" | "prependToMyVcsMetadata" | "removeDownloadFailedVcsFromStorage" | "removeDownloadingFailedVcsFromMyVcs" | "removeVcFromInProgressDownlods" | "removeVcFromMyVcsMetadata" | "resetDownloadCreadentialsFailed" | "resetDownloadCredentialsSuccess" | "resetDownloadFailedVcs" | "resetInProgressVcsDownloaded" | "resetTamperedVcs" | "resetVerificationErrorMessage" | "resetVerificationStatus" | "resetWalletBindingSuccess" | "sendBackupEvent" | "setDownloadCreadentialsFailed" | "setDownloadCredentialsSuccess" | "setDownloadedVc" | "setDownloadingFailedVcs" | "setMyVcs" | "setReceivedVcs" | "setUpdatedVcMetadatas" | "setVerificationErrorMessage" | "setVerificationStatus" | "setWalletBindingSuccess" | "updateMyVcsMetadata";
|
||||
delays: never;
|
||||
guards: "isAnyVcTampered" | "isSignedIn";
|
||||
services: "isUserSignedAlready";
|
||||
};
|
||||
eventsCausingActions: {
|
||||
"addVcToInProgressDownloads": "ADD_VC_TO_IN_PROGRESS_DOWNLOADS";
|
||||
"getVcItemResponse": "GET_VC_ITEM";
|
||||
"loadMyVcs": "REFRESH_MY_VCS" | "REFRESH_RECEIVED_VCS" | "STORE_RESPONSE" | "VERIFY_VC_FAILED" | "xstate.init";
|
||||
"loadReceivedVcs": "REFRESH_RECEIVED_VCS" | "STORE_RESPONSE";
|
||||
"logTamperedVCsremoved": "done.invoke.vcMeta.ready.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]";
|
||||
"prependToMyVcsMetadata": "VC_ADDED";
|
||||
"removeDownloadFailedVcsFromStorage": "DELETE_VC";
|
||||
"removeDownloadingFailedVcsFromMyVcs": "STORE_RESPONSE";
|
||||
"removeVcFromInProgressDownlods": "DOWNLOAD_LIMIT_EXPIRED" | "REMOVE_VC_FROM_IN_PROGRESS_DOWNLOADS" | "VERIFY_VC_FAILED";
|
||||
"removeVcFromMyVcsMetadata": "REMOVE_VC_FROM_CONTEXT";
|
||||
"resetDownloadCreadentialsFailed": "RESET_DOWNLOADING_FAILED";
|
||||
"resetDownloadCredentialsSuccess": "RESET_DOWNLOADING_SUCCESS";
|
||||
"resetDownloadFailedVcs": "STORE_RESPONSE";
|
||||
"resetInProgressVcsDownloaded": "RESET_IN_PROGRESS_VCS_DOWNLOADED";
|
||||
"resetTamperedVcs": "REMOVE_TAMPERED_VCS";
|
||||
"resetVerificationErrorMessage": "RESET_VERIFY_ERROR";
|
||||
"resetVerificationStatus": "RESET_VERIFICATION_STATUS";
|
||||
"resetWalletBindingSuccess": "RESET_WALLET_BINDING_SUCCESS";
|
||||
"sendBackupEvent": "done.invoke.vcMeta.ready.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]";
|
||||
"setDownloadCreadentialsFailed": "VC_DOWNLOADING_FAILED";
|
||||
"setDownloadCredentialsSuccess": "VC_DOWNLOADED";
|
||||
"setDownloadedVc": "VC_DOWNLOADED";
|
||||
"setDownloadingFailedVcs": "DOWNLOAD_LIMIT_EXPIRED";
|
||||
"setMyVcs": "STORE_RESPONSE";
|
||||
"setReceivedVcs": "STORE_RESPONSE";
|
||||
"setUpdatedVcMetadatas": "VC_METADATA_UPDATED";
|
||||
"setVerificationErrorMessage": "VERIFY_VC_FAILED";
|
||||
"setVerificationStatus": "SET_VERIFICATION_STATUS";
|
||||
"setWalletBindingSuccess": "WALLET_BINDING_SUCCESS";
|
||||
"updateMyVcsMetadata": "VC_METADATA_UPDATED";
|
||||
};
|
||||
eventsCausingDelays: {
|
||||
|
||||
};
|
||||
eventsCausingGuards: {
|
||||
"isAnyVcTampered": "SHOW_TAMPERED_POPUP";
|
||||
"isSignedIn": "done.invoke.vcMeta.ready.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]";
|
||||
};
|
||||
eventsCausingServices: {
|
||||
"isUserSignedAlready": "REMOVE_TAMPERED_VCS";
|
||||
};
|
||||
matchesStates: "deletingFailedVcs" | "ready" | "ready.myVcs" | "ready.receivedVcs" | "ready.showTamperedPopup" | "ready.tamperedVCs" | "ready.tamperedVCs.idle" | "ready.tamperedVCs.triggerAutoBackupForTamperedVcDeletion" | { "ready"?: "myVcs" | "receivedVcs" | "showTamperedPopup" | "tamperedVCs" | { "tamperedVCs"?: "idle" | "triggerAutoBackupForTamperedVcDeletion"; }; };
|
||||
tags: never;
|
||||
}
|
||||
|
||||
@@ -115,7 +115,8 @@ export const activityLogMachine =
|
||||
}),
|
||||
|
||||
setActivities: model.assign({
|
||||
activities: (_, event) => (event.response || []) as VCActivityLog[],
|
||||
activities: (_, event) => {
|
||||
return (event.response || []) as VCActivityLog[]},
|
||||
}),
|
||||
|
||||
storeActivity: send(
|
||||
|
||||
@@ -623,7 +623,7 @@ export const requestMachine =
|
||||
credentialConfigurationId:
|
||||
context.incomingVc.verifiableCredential
|
||||
.credentialConfigurationId,
|
||||
issuer: vcMetadata.issuer!!,
|
||||
issuer: vcMetadata.issuerHost!!,
|
||||
timestamp: Date.now(),
|
||||
deviceName:
|
||||
context.senderInfo.name || context.senderInfo.deviceName,
|
||||
|
||||
@@ -254,7 +254,7 @@ export const ScanActions = (model: any) => {
|
||||
: 'VC_SHARED_WITH_VERIFICATION_CONSENT',
|
||||
credentialConfigurationId:
|
||||
context.selectedVc.verifiableCredential.credentialConfigurationId,
|
||||
issuer: vcMetadata.issuer!!,
|
||||
issuer: vcMetadata.issuerHost!!,
|
||||
timestamp: Date.now(),
|
||||
deviceName:
|
||||
context.receiverInfo.name || context.receiverInfo.deviceName,
|
||||
@@ -274,7 +274,7 @@ export const ScanActions = (model: any) => {
|
||||
timestamp: Date.now(),
|
||||
credentialConfigurationId:
|
||||
context.selectedVc.verifiableCredential.credentialConfigurationId,
|
||||
issuer: vcMetadata.issuer!!,
|
||||
issuer: vcMetadata.issuerHost!!,
|
||||
deviceName:
|
||||
context.receiverInfo.name || context.receiverInfo.deviceName,
|
||||
}),
|
||||
@@ -362,7 +362,7 @@ export const ScanActions = (model: any) => {
|
||||
return ActivityLogEvents.LOG_ACTIVITY(
|
||||
VCActivityLog.getLogFromObject({
|
||||
_vcKey: vcMetadata.getVcKey(),
|
||||
issuer: vcMetadata.issuer!!,
|
||||
issuer: vcMetadata.issuerHost!!,
|
||||
credentialConfigurationId:
|
||||
selectedVc.verifiableCredential.credentialConfigurationId,
|
||||
type: 'QRLOGIN_SUCCESFULL',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {StateFrom} from 'xstate';
|
||||
import {scanMachine} from './scanMachine';
|
||||
import {VCMetadata} from '../../../shared/VCMetadata';
|
||||
import {getMosipLogo} from '../../../components/VC/common/VCUtils';
|
||||
import {getMosipLogo, getFaceAttribute} from '../../../components/VC/common/VCUtils';
|
||||
|
||||
type State = StateFrom<typeof scanMachine>;
|
||||
|
||||
@@ -30,6 +30,9 @@ export function selectCredential(state: State) {
|
||||
|
||||
export function selectVerifiableCredentialData(state: State) {
|
||||
const vcMetadata = new VCMetadata(state.context.selectedVc?.vcMetadata);
|
||||
const faceField =
|
||||
getFaceAttribute(state.context.selectedVc,state.context.selectedVc?.format) ??
|
||||
state.context.selectedVc?.credential?.biometrics?.face;
|
||||
return [
|
||||
{
|
||||
vcMetadata: vcMetadata,
|
||||
@@ -37,10 +40,7 @@ export function selectVerifiableCredentialData(state: State) {
|
||||
issuerLogo:
|
||||
state.context.selectedVc?.verifiableCredential?.issuerLogo ||
|
||||
getMosipLogo(),
|
||||
face:
|
||||
state.context.selectedVc?.verifiableCredential?.credential
|
||||
?.credentialSubject?.face ||
|
||||
state.context.selectedVc?.credential?.biometrics?.face,
|
||||
face:faceField,
|
||||
wellKnown: state.context.selectedVc?.verifiableCredential?.wellKnown,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {isLocationEnabled} from 'react-native-device-info';
|
||||
import Storage, { isMinimumStorageLimitReached } from '../../../shared/storage';
|
||||
import { isMinimumStorageLimitReached } from '../../../shared/storage';
|
||||
import BluetoothStateManager from 'react-native-bluetooth-state-manager';
|
||||
import {
|
||||
check,
|
||||
@@ -169,10 +169,10 @@ export const ScanServices = (model: any) => {
|
||||
});
|
||||
}
|
||||
};
|
||||
const { processedCredential, ...rest } = context.selectedVc;
|
||||
const payload = JSON.stringify(rest);
|
||||
wallet.sendData(
|
||||
JSON.stringify({
|
||||
...context.selectedVc,
|
||||
}),
|
||||
payload
|
||||
);
|
||||
const subscription = subscribe(statusCallback);
|
||||
return () => subscription?.remove();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { getFaceAttribute } from '../../components/VC/common/VCUtils';
|
||||
import {VCShareFlowType} from '../../shared/Utils';
|
||||
|
||||
export const openID4VPGuards = () => {
|
||||
@@ -25,7 +26,7 @@ export const openID4VPGuards = () => {
|
||||
const hasImage = Object.values(context.selectedVCs)
|
||||
.flatMap(vc => vc)
|
||||
.some(
|
||||
vc => vc.verifiableCredential?.credential?.credentialSubject?.face,
|
||||
vc => getFaceAttribute(vc.verifiableCredential,vc.format) != null,
|
||||
);
|
||||
return !!hasImage;
|
||||
},
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
|
||||
// This file was automatically generated. Edits will be overwritten
|
||||
|
||||
export interface Typegen0 {
|
||||
'@@xstate/typegen': true;
|
||||
internalEvents: {
|
||||
"done.invoke.OpenID4VP.authenticateVerifier:invocation[0]": { type: "done.invoke.OpenID4VP.authenticateVerifier:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||
"done.invoke.OpenID4VP.checkIfClientValidationIsRequired:invocation[0]": { type: "done.invoke.OpenID4VP.checkIfClientValidationIsRequired:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||
"done.invoke.OpenID4VP.checkKeyPair:invocation[0]": { type: "done.invoke.OpenID4VP.checkKeyPair:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||
"done.invoke.OpenID4VP.checkVerifierTrust:invocation[0]": { type: "done.invoke.OpenID4VP.checkVerifierTrust:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||
"done.invoke.OpenID4VP.getKeyPairFromKeystore:invocation[0]": { type: "done.invoke.OpenID4VP.getKeyPairFromKeystore:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||
"done.invoke.OpenID4VP.getTrustedVerifiersList:invocation[0]": { type: "done.invoke.OpenID4VP.getTrustedVerifiersList:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||
"done.invoke.OpenID4VP.sendingVP:invocation[0]": { type: "done.invoke.OpenID4VP.sendingVP:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||
"done.invoke.OpenID4VP.storeTrustedVerifier:invocation[0]": { type: "done.invoke.OpenID4VP.storeTrustedVerifier:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||
"error.platform.OpenID4VP.authenticateVerifier:invocation[0]": { type: "error.platform.OpenID4VP.authenticateVerifier:invocation[0]"; data: unknown };
|
||||
"error.platform.OpenID4VP.checkKeyPair:invocation[0]": { type: "error.platform.OpenID4VP.checkKeyPair:invocation[0]"; data: unknown };
|
||||
"error.platform.OpenID4VP.checkVerifierTrust:invocation[0]": { type: "error.platform.OpenID4VP.checkVerifierTrust:invocation[0]"; data: unknown };
|
||||
"error.platform.OpenID4VP.getKeyPairFromKeystore:invocation[0]": { type: "error.platform.OpenID4VP.getKeyPairFromKeystore:invocation[0]"; data: unknown };
|
||||
"error.platform.OpenID4VP.getTrustedVerifiersList:invocation[0]": { type: "error.platform.OpenID4VP.getTrustedVerifiersList:invocation[0]"; data: unknown };
|
||||
"error.platform.OpenID4VP.sendingVP:invocation[0]": { type: "error.platform.OpenID4VP.sendingVP:invocation[0]"; data: unknown };
|
||||
"xstate.after(200)#OpenID4VP.delayBeforeDismissToParent": { type: "xstate.after(200)#OpenID4VP.delayBeforeDismissToParent" };
|
||||
"xstate.init": { type: "xstate.init" };
|
||||
"xstate.stop": { type: "xstate.stop" };
|
||||
};
|
||||
invokeSrcNameMap: {
|
||||
"fetchTrustedVerifiers": "done.invoke.OpenID4VP.getTrustedVerifiersList:invocation[0]";
|
||||
"getAuthenticationResponse": "done.invoke.OpenID4VP.authenticateVerifier:invocation[0]";
|
||||
"getKeyPair": "done.invoke.OpenID4VP.getKeyPairFromKeystore:invocation[0]";
|
||||
"getSelectedKey": "done.invoke.OpenID4VP.checkKeyPair:invocation[0]";
|
||||
"isVerifierTrusted": "done.invoke.OpenID4VP.checkVerifierTrust:invocation[0]";
|
||||
"sendVP": "done.invoke.OpenID4VP.sendingVP:invocation[0]";
|
||||
"shouldValidateClient": "done.invoke.OpenID4VP.checkIfClientValidationIsRequired:invocation[0]";
|
||||
"storeTrustedVerifier": "done.invoke.OpenID4VP.storeTrustedVerifier:invocation[0]";
|
||||
};
|
||||
missingImplementations: {
|
||||
actions: "compareAndStoreSelectedVC" | "dismissTrustModal" | "forwardToParent" | "getFaceAuthConsent" | "getVcsMatchingAuthRequest" | "incrementOpenID4VPRetryCount" | "loadKeyPair" | "logActivity" | "resetError" | "resetFaceCaptureBannerStatus" | "resetIsFaceVerificationRetryAttempt" | "resetIsShareWithSelfie" | "resetIsShowLoadingScreen" | "resetOpenID4VPRetryCount" | "setAuthenticationError" | "setAuthenticationResponse" | "setError" | "setFlowType" | "setIsFaceVerificationRetryAttempt" | "setIsOVPViaDeepLink" | "setIsShareWithSelfie" | "setIsShowLoadingScreen" | "setMiniViewShareSelectedVC" | "setSelectedVCs" | "setSendVPShareError" | "setShareLogTypeUnverified" | "setShowFaceAuthConsent" | "setTrustedVerifiers" | "setTrustedVerifiersApiCallError" | "setUrlEncodedAuthorizationRequest" | "shareDeclineStatus" | "showTrustConsentModal" | "storeShowFaceAuthConsent" | "updateFaceCaptureBannerStatus" | "updateShowFaceAuthConsent";
|
||||
delays: never;
|
||||
guards: "hasKeyPair" | "isAnyVCHasImage" | "isClientValidationRequred" | "isFaceVerificationRetryAttempt" | "isSelectedVCMatchingRequest" | "isShareWithSelfie" | "isSimpleOpenID4VPShare" | "showFaceAuthConsentScreen";
|
||||
services: "fetchTrustedVerifiers" | "getAuthenticationResponse" | "getKeyPair" | "getSelectedKey" | "isVerifierTrusted" | "sendVP" | "shouldValidateClient" | "storeTrustedVerifier";
|
||||
};
|
||||
eventsCausingActions: {
|
||||
"compareAndStoreSelectedVC": "SET_SELECTED_VC";
|
||||
"dismissTrustModal": "CANCEL" | "VERIFIER_TRUST_CONSENT_GIVEN" | "done.invoke.OpenID4VP.checkVerifierTrust:invocation[0]" | "done.invoke.OpenID4VP.storeTrustedVerifier:invocation[0]";
|
||||
"forwardToParent": "CANCEL" | "DISMISS_POPUP";
|
||||
"getFaceAuthConsent": "AUTHENTICATE";
|
||||
"getVcsMatchingAuthRequest": "DOWNLOADED_VCS";
|
||||
"incrementOpenID4VPRetryCount": "RETRY";
|
||||
"loadKeyPair": "done.invoke.OpenID4VP.getKeyPairFromKeystore:invocation[0]";
|
||||
"logActivity": "LOG_ACTIVITY";
|
||||
"resetError": "RESET_ERROR" | "RESET_RETRY_COUNT" | "RETRY";
|
||||
"resetFaceCaptureBannerStatus": "ACCEPT_REQUEST" | "CLOSE_BANNER";
|
||||
"resetIsFaceVerificationRetryAttempt": "DISMISS";
|
||||
"resetIsShareWithSelfie": "CANCEL" | "DISMISS_POPUP";
|
||||
"resetIsShowLoadingScreen": "DISMISS_POPUP" | "done.invoke.OpenID4VP.authenticateVerifier:invocation[0]" | "error.platform.OpenID4VP.authenticateVerifier:invocation[0]" | "xstate.stop";
|
||||
"resetOpenID4VPRetryCount": "RESET_RETRY_COUNT";
|
||||
"setAuthenticationError": "error.platform.OpenID4VP.authenticateVerifier:invocation[0]";
|
||||
"setAuthenticationResponse": "done.invoke.OpenID4VP.authenticateVerifier:invocation[0]";
|
||||
"setError": "error.platform.OpenID4VP.checkKeyPair:invocation[0]" | "error.platform.OpenID4VP.getKeyPairFromKeystore:invocation[0]";
|
||||
"setFlowType": "AUTHENTICATE";
|
||||
"setIsFaceVerificationRetryAttempt": "FACE_INVALID";
|
||||
"setIsOVPViaDeepLink": "AUTHENTICATE";
|
||||
"setIsShareWithSelfie": "AUTHENTICATE";
|
||||
"setIsShowLoadingScreen": "AUTHENTICATE";
|
||||
"setMiniViewShareSelectedVC": "AUTHENTICATE";
|
||||
"setSelectedVCs": "ACCEPT_REQUEST" | "VERIFY_AND_ACCEPT_REQUEST";
|
||||
"setSendVPShareError": "error.platform.OpenID4VP.sendingVP:invocation[0]";
|
||||
"setShareLogTypeUnverified": "ACCEPT_REQUEST";
|
||||
"setShowFaceAuthConsent": "FACE_VERIFICATION_CONSENT";
|
||||
"setTrustedVerifiers": "done.invoke.OpenID4VP.getTrustedVerifiersList:invocation[0]";
|
||||
"setTrustedVerifiersApiCallError": "error.platform.OpenID4VP.getTrustedVerifiersList:invocation[0]";
|
||||
"setUrlEncodedAuthorizationRequest": "AUTHENTICATE";
|
||||
"shareDeclineStatus": "CONFIRM";
|
||||
"showTrustConsentModal": "done.invoke.OpenID4VP.checkVerifierTrust:invocation[0]" | "error.platform.OpenID4VP.checkVerifierTrust:invocation[0]";
|
||||
"storeShowFaceAuthConsent": "FACE_VERIFICATION_CONSENT";
|
||||
"updateFaceCaptureBannerStatus": "FACE_VALID";
|
||||
"updateShowFaceAuthConsent": "done.invoke.OpenID4VP.checkIfClientValidationIsRequired:invocation[0]";
|
||||
};
|
||||
eventsCausingDelays: {
|
||||
"SHARING_TIMEOUT": "CONFIRM" | "FACE_VALID" | "RETRY";
|
||||
};
|
||||
eventsCausingGuards: {
|
||||
"hasKeyPair": "FACE_VALID" | "done.invoke.OpenID4VP.checkKeyPair:invocation[0]";
|
||||
"isAnyVCHasImage": "CHECK_FOR_IMAGE";
|
||||
"isClientValidationRequred": "done.invoke.OpenID4VP.checkIfClientValidationIsRequired:invocation[0]";
|
||||
"isFaceVerificationRetryAttempt": "FACE_INVALID";
|
||||
"isSelectedVCMatchingRequest": "CHECK_SELECTED_VC";
|
||||
"isShareWithSelfie": "CONFIRM" | "done.invoke.OpenID4VP.sendingVP:invocation[0]";
|
||||
"isSimpleOpenID4VPShare": "CANCEL" | "DISMISS" | "DISMISS_POPUP" | "DOWNLOADED_VCS" | "FACE_VERIFICATION_CONSENT";
|
||||
"showFaceAuthConsentScreen": "CONFIRM";
|
||||
};
|
||||
eventsCausingServices: {
|
||||
"fetchTrustedVerifiers": "done.invoke.OpenID4VP.checkIfClientValidationIsRequired:invocation[0]";
|
||||
"getAuthenticationResponse": "done.invoke.OpenID4VP.checkKeyPair:invocation[0]";
|
||||
"getKeyPair": "done.invoke.OpenID4VP.checkIfClientValidationIsRequired:invocation[0]" | "done.invoke.OpenID4VP.getTrustedVerifiersList:invocation[0]";
|
||||
"getSelectedKey": "FACE_VALID" | "done.invoke.OpenID4VP.getKeyPairFromKeystore:invocation[0]";
|
||||
"isVerifierTrusted": "done.invoke.OpenID4VP.authenticateVerifier:invocation[0]";
|
||||
"sendVP": "CONFIRM" | "FACE_VALID" | "RETRY";
|
||||
"shouldValidateClient": "STORE_RESPONSE";
|
||||
"storeTrustedVerifier": "VERIFIER_TRUST_CONSENT_GIVEN";
|
||||
};
|
||||
matchesStates: "authenticateVerifier" | "checkFaceAuthConsent" | "checkIfAnySelectedVCHasImage" | "checkIfClientValidationIsRequired" | "checkIfMatchingVCsHasSelectedVC" | "checkKeyPair" | "checkVerifierTrust" | "delayBeforeDismissToParent" | "faceVerificationConsent" | "getConsentForVPSharing" | "getKeyPairFromKeystore" | "getTrustedVerifiersList" | "getVCsSatisfyingAuthRequest" | "invalidIdentity" | "requestVerifierConsent" | "selectingVCs" | "sendDismissToParent" | "sendingVP" | "setSelectedVC" | "shareVPDeclineStatusToVerifier" | "showConfirmationPopup" | "showError" | "storeTrustedVerifier" | "success" | "verifyingIdentity" | "waitingForData";
|
||||
tags: never;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
|
||||
// This file was automatically generated. Edits will be overwritten
|
||||
|
||||
export interface Typegen0 {
|
||||
'@@xstate/typegen': true;
|
||||
internalEvents: {
|
||||
"done.invoke._store": { type: "done.invoke._store"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||
"done.invoke.store.checkFreshInstall:invocation[0]": { type: "done.invoke.store.checkFreshInstall:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||
"done.invoke.store.resettingStorage:invocation[0]": { type: "done.invoke.store.resettingStorage:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||
"error.platform._store": { type: "error.platform._store"; data: unknown };
|
||||
"xstate.init": { type: "xstate.init" };
|
||||
};
|
||||
invokeSrcNameMap: {
|
||||
"checkFreshInstall": "done.invoke.store.checkFreshInstall:invocation[0]";
|
||||
"checkStorageInitialisedOrNot": "done.invoke.store.checkStorageInitialisation:invocation[0]";
|
||||
"clear": "done.invoke.store.resettingStorage:invocation[0]";
|
||||
"clearKeys": "done.invoke.store.clearIosKeys:invocation[0]";
|
||||
"generateEncryptionKey": "done.invoke.store.generatingEncryptionKey:invocation[0]";
|
||||
"getEncryptionKey": "done.invoke.store.gettingEncryptionKey:invocation[0]";
|
||||
"hasEncryptionKey": "done.invoke.store.checkEncryptionKey:invocation[0]";
|
||||
"store": "done.invoke._store";
|
||||
};
|
||||
missingImplementations: {
|
||||
actions: never;
|
||||
delays: never;
|
||||
guards: never;
|
||||
services: never;
|
||||
};
|
||||
eventsCausingActions: {
|
||||
"forwardStoreRequest": "APPEND" | "CLEAR" | "EXPORT" | "FETCH_ALL_WELLKNOWN_CONFIG" | "GET" | "GET_VCS_DATA" | "PREPEND" | "REMOVE" | "REMOVE_ITEMS" | "REMOVE_VC_METADATA" | "RESTORE_BACKUP" | "SET" | "UPDATE";
|
||||
"notifyParent": "KEY_RECEIVED" | "READY" | "done.invoke.store.resettingStorage:invocation[0]";
|
||||
"setEncryptionKey": "KEY_RECEIVED";
|
||||
};
|
||||
eventsCausingDelays: {
|
||||
|
||||
};
|
||||
eventsCausingGuards: {
|
||||
"hasData": "done.invoke.store.checkFreshInstall:invocation[0]";
|
||||
"isCustomSecureKeystore": "KEY_RECEIVED";
|
||||
};
|
||||
eventsCausingServices: {
|
||||
"checkFreshInstall": "BIOMETRIC_CANCELLED" | "xstate.init";
|
||||
"checkStorageInitialisedOrNot": "ERROR";
|
||||
"clear": "KEY_RECEIVED";
|
||||
"clearKeys": "done.invoke.store.checkFreshInstall:invocation[0]";
|
||||
"generateEncryptionKey": "ERROR" | "IGNORE" | "READY";
|
||||
"getEncryptionKey": "TRY_AGAIN";
|
||||
"hasEncryptionKey": never;
|
||||
"store": "KEY_RECEIVED" | "READY" | "done.invoke.store.resettingStorage:invocation[0]";
|
||||
};
|
||||
matchesStates: "checkEncryptionKey" | "checkFreshInstall" | "checkStorageInitialisation" | "clearIosKeys" | "failedReadingKey" | "generatingEncryptionKey" | "gettingEncryptionKey" | "ready" | "resettingStorage";
|
||||
tags: never;
|
||||
}
|
||||
|
||||
// This file was automatically generated. Edits will be overwritten
|
||||
|
||||
export interface Typegen0 {
|
||||
'@@xstate/typegen': true;
|
||||
internalEvents: {
|
||||
"done.invoke._store": { type: "done.invoke._store"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||
"done.invoke.store.checkFreshInstall:invocation[0]": { type: "done.invoke.store.checkFreshInstall:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||
"done.invoke.store.resettingStorage:invocation[0]": { type: "done.invoke.store.resettingStorage:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||
"error.platform._store": { type: "error.platform._store"; data: unknown };
|
||||
"xstate.init": { type: "xstate.init" };
|
||||
};
|
||||
invokeSrcNameMap: {
|
||||
"checkFreshInstall": "done.invoke.store.checkFreshInstall:invocation[0]";
|
||||
"checkStorageInitialisedOrNot": "done.invoke.store.checkStorageInitialisation:invocation[0]";
|
||||
"clear": "done.invoke.store.resettingStorage:invocation[0]";
|
||||
"clearKeys": "done.invoke.store.clearIosKeys:invocation[0]";
|
||||
"generateEncryptionKey": "done.invoke.store.generatingEncryptionKey:invocation[0]";
|
||||
"getEncryptionKey": "done.invoke.store.gettingEncryptionKey:invocation[0]";
|
||||
"hasEncryptionKey": "done.invoke.store.checkEncryptionKey:invocation[0]";
|
||||
"store": "done.invoke._store";
|
||||
};
|
||||
missingImplementations: {
|
||||
actions: never;
|
||||
delays: never;
|
||||
guards: never;
|
||||
services: never;
|
||||
};
|
||||
eventsCausingActions: {
|
||||
"forwardStoreRequest": "APPEND" | "CLEAR" | "EXPORT" | "FETCH_ALL_WELLKNOWN_CONFIG" | "GET" | "GET_VCS_DATA" | "PREPEND" | "REMOVE" | "REMOVE_ITEMS" | "REMOVE_VC_METADATA" | "RESTORE_BACKUP" | "SET" | "UPDATE";
|
||||
"notifyParent": "KEY_RECEIVED" | "READY" | "done.invoke.store.resettingStorage:invocation[0]";
|
||||
"setEncryptionKey": "KEY_RECEIVED";
|
||||
};
|
||||
eventsCausingDelays: {
|
||||
|
||||
};
|
||||
eventsCausingGuards: {
|
||||
"hasData": "done.invoke.store.checkFreshInstall:invocation[0]";
|
||||
"isCustomSecureKeystore": "KEY_RECEIVED";
|
||||
};
|
||||
eventsCausingServices: {
|
||||
"checkFreshInstall": "BIOMETRIC_CANCELLED" | "xstate.init";
|
||||
"checkStorageInitialisedOrNot": "ERROR";
|
||||
"clear": "KEY_RECEIVED";
|
||||
"clearKeys": "done.invoke.store.checkFreshInstall:invocation[0]";
|
||||
"generateEncryptionKey": "ERROR" | "IGNORE" | "READY";
|
||||
"getEncryptionKey": "TRY_AGAIN";
|
||||
"hasEncryptionKey": never;
|
||||
"store": "KEY_RECEIVED" | "READY" | "done.invoke.store.resettingStorage:invocation[0]";
|
||||
};
|
||||
matchesStates: "checkEncryptionKey" | "checkFreshInstall" | "checkStorageInitialisation" | "clearIosKeys" | "failedReadingKey" | "generatingEncryptionKey" | "gettingEncryptionKey" | "ready" | "resettingStorage";
|
||||
tags: never;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ export const ViewVcModal: React.FC<ViewVcModalProps> = props => {
|
||||
setLoadingSvg(true);
|
||||
|
||||
const vcJsonString = JSON.stringify(controller.credential.credential);
|
||||
const result = await VcRenderer.getInstance().renderVC(
|
||||
const result = await VcRenderer.getInstance().generateCredentialDisplayContent(
|
||||
controller.verifiableCredentialData.format,
|
||||
wellknown ?? null,
|
||||
vcJsonString,
|
||||
|
||||
@@ -53,7 +53,7 @@ export const ReceiveVcScreen: React.FC = () => {
|
||||
setLoadingSvg(true);
|
||||
|
||||
const vcJsonString = JSON.stringify(controller.credential.credential);
|
||||
const result = await VcRenderer.getInstance().renderVC(
|
||||
const result = await VcRenderer.getInstance().generateCredentialDisplayContent(
|
||||
verifiableCredentialData.vcMetadata.format,
|
||||
wellknown ?? null,
|
||||
vcJsonString,
|
||||
|
||||
@@ -42,14 +42,13 @@ import {selectShareableVcs} from '../../machines/VerifiableCredential/VCMetaMach
|
||||
import {RootRouteProps} from '../../routes';
|
||||
import {BOTTOM_TAB_ROUTES} from '../../routes/routesConstants';
|
||||
import {GlobalContext} from '../../shared/GlobalContext';
|
||||
import {formatTextWithGivenLimit, isMosipVC} from '../../shared/Utils';
|
||||
import {formatTextWithGivenLimit} from '../../shared/Utils';
|
||||
import {VCMetadata} from '../../shared/VCMetadata';
|
||||
import {VPShareOverlayProps} from './VPShareOverlay';
|
||||
import {ActivityLogEvents} from '../../machines/activityLog';
|
||||
import {VPShareActivityLog} from '../../components/VPShareActivityLogEvent';
|
||||
import {SelectedCredentialsForVPSharing} from '../../machines/VerifiableCredential/VCMetaMachine/vc';
|
||||
import {isIOS} from '../../shared/constants';
|
||||
import { verifier } from '../../shared/tuvali';
|
||||
import { getFaceAttribute } from '../../components/VC/common/VCUtils';
|
||||
|
||||
type MyVcsTabNavigation = NavigationProp<RootRouteProps>;
|
||||
|
||||
@@ -98,14 +97,14 @@ export function useSendVPScreen() {
|
||||
return Object.values(vcs)
|
||||
.flatMap(vc => vc)
|
||||
.some(vc => {
|
||||
return isMosipVC(vc.vcMetadata?.issuer);
|
||||
return getFaceAttribute(vc.verifiableCredential,vc.format) != null;
|
||||
});
|
||||
};
|
||||
|
||||
const checkIfAllVCsHasImage = vcs => {
|
||||
return Object.values(vcs)
|
||||
.flatMap(vc => vc)
|
||||
.every(vc => isMosipVC(vc.vcMetadata.issuer));
|
||||
.every(vc => getFaceAttribute(vc.verifiableCredential,vc.format) != null);
|
||||
};
|
||||
|
||||
const getSelectedVCs = (): Record<string, any[]> => {
|
||||
|
||||
@@ -17,7 +17,6 @@ import {
|
||||
import {TelemetryConstants} from '../../shared/telemetry/TelemetryConstants';
|
||||
import {
|
||||
getVCsOrderedByPinStatus,
|
||||
isMosipVC,
|
||||
VCItemContainerFlowType,
|
||||
} from '../../shared/Utils';
|
||||
import {FaceVerificationAlertOverlay} from './FaceVerificationAlertOverlay';
|
||||
@@ -33,7 +32,6 @@ export const SendVcScreen: React.FC = () => {
|
||||
controller.shareableVcsMetadata,
|
||||
);
|
||||
let service;
|
||||
|
||||
if (shareableVcsMetadataOrderedByPinStatus?.length > 0) {
|
||||
const vcMetadata = shareableVcsMetadataOrderedByPinStatus[0];
|
||||
const firstVCMachine = useRef(
|
||||
@@ -102,7 +100,7 @@ export const SendVcScreen: React.FC = () => {
|
||||
<Column
|
||||
style={Theme.SendVcScreenStyles.shareOptionButtonsContainer}
|
||||
backgroundColor={Theme.Colors.whiteBackgroundColor}>
|
||||
{isMosipVC(controller.verifiableCredentialData[0].issuer) && (
|
||||
{controller.verifiableCredentialData[0].face && (
|
||||
<Button
|
||||
type="gradient"
|
||||
title={t('acceptRequestAndVerify')}
|
||||
|
||||
@@ -91,6 +91,7 @@ export function useSendVcScreen() {
|
||||
} = vcRef.getSnapshot().context;
|
||||
const vcData = {
|
||||
...rest,
|
||||
processedCredential,
|
||||
verifiableCredential: filteredVerifiableCredential,
|
||||
};
|
||||
scanService.send(
|
||||
|
||||
@@ -181,7 +181,8 @@ export const CACHED_API = {
|
||||
) =>
|
||||
generateCacheAPIFunction({
|
||||
isCachePreferred,
|
||||
cacheKey: API_CACHED_STORAGE_KEYS.fetchIssuerWellknownConfig(issuerCacheKey),
|
||||
cacheKey:
|
||||
API_CACHED_STORAGE_KEYS.fetchIssuerWellknownConfig(issuerCacheKey),
|
||||
fetchCall: API.fetchIssuerWellknownConfig.bind(null, credentialIssuer),
|
||||
}),
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ class OpenID4VP {
|
||||
disclosureSet.size > 0
|
||||
? [jwt, ...disclosureSet].join('~') + '~'
|
||||
: jwt + '~';
|
||||
|
||||
|
||||
return finalSdJwt;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
import {__AppId} from './GlobalVariables';
|
||||
import {MIMOTO_BASE_URL, REQUEST_TIMEOUT} from './constants';
|
||||
import NetInfo from '@react-native-community/netinfo';
|
||||
import { ErrorMessage } from './openId4VCI/Utils';
|
||||
import {ErrorMessage} from './openId4VCI/Utils';
|
||||
|
||||
export type HTTP_METHOD = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
|
||||
|
||||
@@ -78,16 +78,16 @@ export async function request(
|
||||
throw error;
|
||||
}
|
||||
|
||||
|
||||
let jsonResponse;
|
||||
try {
|
||||
jsonResponse = await response.json();
|
||||
} catch (jsonError) {
|
||||
console.warn(`Failed to parse JSON from ${requestUrl}`, jsonError);
|
||||
throw new Error(ErrorMessage.NETWORK_REQUEST_FAILED+' Invalid JSON response');
|
||||
throw new Error(
|
||||
ErrorMessage.NETWORK_REQUEST_FAILED + ' Invalid JSON response',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (response.status >= 400) {
|
||||
const backendUrl = host + path;
|
||||
const errorMessage =
|
||||
@@ -102,9 +102,8 @@ export async function request(
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
|
||||
|
||||
if (jsonResponse.errors && jsonResponse.errors.length) {
|
||||
const { errorCode, errorMessage } = jsonResponse.errors.shift();
|
||||
const {errorCode, errorMessage} = jsonResponse.errors.shift();
|
||||
console.error(
|
||||
`The backend API ${requestUrl} returned structured error --> error code: ${errorCode}, message: ${errorMessage}`,
|
||||
);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import {NativeModules} from 'react-native';
|
||||
import {MMKVLoader} from 'react-native-mmkv-storage';
|
||||
import {CACHE_TTL} from '../constants';
|
||||
import {__AppId} from '../GlobalVariables';
|
||||
import {isCacheExpired} from '../Utils';
|
||||
|
||||
@@ -31,7 +30,7 @@ class VcRenderer {
|
||||
return `${CACHE_KEY_PREFIX}${vcId}`;
|
||||
}
|
||||
|
||||
async renderVC(
|
||||
async generateCredentialDisplayContent(
|
||||
credentialFormat: string,
|
||||
wellKnown: string,
|
||||
vcJson: string,
|
||||
@@ -56,7 +55,7 @@ class VcRenderer {
|
||||
}
|
||||
|
||||
try {
|
||||
const result: string[] = await this.InjiVcRenderer.renderVC(
|
||||
const result: string[] = await this.InjiVcRenderer.generateCredentialDisplayContent(
|
||||
credentialFormat,
|
||||
wellKnown ? JSON.stringify(wellKnown) : null,
|
||||
vcJson,
|
||||
@@ -79,7 +78,7 @@ class VcRenderer {
|
||||
|
||||
async clearCache(vcId: string) {
|
||||
const cacheKey = this.createCacheKey(vcId);
|
||||
await MMKV.removeItem(cacheKey);
|
||||
MMKV.removeItem(cacheKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user