Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INJIMOB-2091] update OpenID4VP swift library version #1815

Merged
merged 2 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ public void init(String appId) {
}

@ReactMethod
public void authenticateVerifier(String encodedAuthorizationRequest, ReadableArray trustedVerifiers,
public void authenticateVerifier(String urlEncodedAuthorizationRequest, ReadableArray trustedVerifiers,
Boolean shouldValidateClient,
Promise promise) {
try {
AuthorizationRequest authenticationResponse = openID4VP.authenticateVerifier(encodedAuthorizationRequest,
AuthorizationRequest authenticationResponse = openID4VP.authenticateVerifier(urlEncodedAuthorizationRequest,
convertReadableArrayToVerifierArray(trustedVerifiers), shouldValidateClient);
String authenticationResponseAsJson = gson.toJson(authenticationResponse, AuthorizationRequest.class);
promise.resolve(authenticationResponseAsJson);
Expand Down
65 changes: 36 additions & 29 deletions ios/Inji.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
1E6875EB2CA554FD0086D870 /* RNOpenID4VPModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E6875EA2CA554FD0086D870 /* RNOpenID4VPModule.m */; };
1E6875ED2CA5550F0086D870 /* RNOpenID4VPModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E6875EC2CA5550F0086D870 /* RNOpenID4VPModule.swift */; };
1EC395242D50C89C0022D979 /* VCIClient in Frameworks */ = {isa = PBXBuildFile; productRef = 1EC395232D50C89C0022D979 /* VCIClient */; };
1EC395272D50C9150022D979 /* OpenID4VP in Frameworks */ = {isa = PBXBuildFile; productRef = 1EC395262D50C9150022D979 /* OpenID4VP */; };
3403A56C2D6C79EB00AD64DE /* OpenID4VP in Frameworks */ = {isa = PBXBuildFile; productRef = 3403A56B2D6C79EB00AD64DE /* OpenID4VP */; };
1EC3952A2D50C9470022D979 /* pixelpass in Frameworks */ = {isa = PBXBuildFile; productRef = 1EC395292D50C9470022D979 /* pixelpass */; };
1EC3952D2D50C9820022D979 /* ios-tuvali-library in Frameworks */ = {isa = PBXBuildFile; productRef = 1EC3952C2D50C9820022D979 /* ios-tuvali-library */; };
1EC395302D50C99E0022D979 /* securekeystore in Frameworks */ = {isa = PBXBuildFile; productRef = 1EC3952F2D50C99E0022D979 /* securekeystore */; };
Expand Down Expand Up @@ -115,7 +115,7 @@
files = (
1EC395242D50C89C0022D979 /* VCIClient in Frameworks */,
1EC3952A2D50C9470022D979 /* pixelpass in Frameworks */,
1EC395272D50C9150022D979 /* OpenID4VP in Frameworks */,
3403A56C2D6C79EB00AD64DE /* OpenID4VP in Frameworks */,
1EC395302D50C99E0022D979 /* securekeystore in Frameworks */,
96905EF65AED1B983A6B3ABC /* libPods-Inji.a in Frameworks */,
1EC3952D2D50C9820022D979 /* ios-tuvali-library in Frameworks */,
Expand Down Expand Up @@ -273,7 +273,7 @@
1E55884F2CC0EF2C00CF55B4 /* Copy FaceSDK Model */,
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
800E24972A6A228C8D4807E9 /* [CP] Copy Pods Resources */,
D11A8C363B4A5B625DB10379 /* [CP] Embed Pods Frameworks */,
0F2FCBA5E4517C72775B53F7 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand All @@ -282,7 +282,7 @@
name = Inji;
packageProductDependencies = (
1EC395232D50C89C0022D979 /* VCIClient */,
1EC395262D50C9150022D979 /* OpenID4VP */,
3403A56B2D6C79EB00AD64DE /* OpenID4VP */,
1EC395292D50C9470022D979 /* pixelpass */,
1EC3952C2D50C9820022D979 /* ios-tuvali-library */,
1EC3952F2D50C99E0022D979 /* securekeystore */,
Expand Down Expand Up @@ -315,7 +315,7 @@
mainGroup = 83CBB9F61A601CBA00E9B192;
packageReferences = (
1EC395222D50C89C0022D979 /* XCRemoteSwiftPackageReference "inji-vci-client-ios-swift.git" */,
1EC395252D50C9150022D979 /* XCRemoteSwiftPackageReference "inji-openid4vp-ios-swift.git" */,
3403A56A2D6C79EB00AD64DE /* XCRemoteSwiftPackageReference "inji-openid4vp-ios-swift.git" */,
1EC395282D50C9470022D979 /* XCRemoteSwiftPackageReference "pixelpass-ios-swift.git" */,
1EC3952B2D50C9820022D979 /* XCRemoteSwiftPackageReference "tuvali-ios-swift.git" */,
1EC3952E2D50C99E0022D979 /* XCRemoteSwiftPackageReference "secure-keystore-ios-swift.git" */,
Expand Down Expand Up @@ -471,24 +471,24 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Inji/Pods-Inji-resources.sh\"\n";
showEnvVarsInLog = 0;
};
D11A8C363B4A5B625DB10379 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Inji/Pods-Inji-frameworks.sh",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/Pre-built/hermes.framework/hermes",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/hermes.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Inji/Pods-Inji-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
0F2FCBA5E4517C72775B53F7 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Inji/Pods-Inji-frameworks.sh",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/Pre-built/hermes.framework/hermes",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/hermes.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Inji/Pods-Inji-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
FD10A7F022414F080027D42C /* Start Packager */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -574,7 +574,6 @@
PRODUCT_BUNDLE_IDENTIFIER = io.mosip.inji.wallet.mobileid;
PRODUCT_NAME = Inji;
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "";
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -803,6 +802,14 @@
kind = branch;
};
};
3403A56A2D6C79EB00AD64DE /* XCRemoteSwiftPackageReference "inji-openid4vp-ios-swift" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/mosip/inji-openid4vp-ios-swift";
requirement = {
branch = "release-0.2.x";
kind = branch;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
Expand All @@ -811,11 +818,11 @@
package = 1EC395222D50C89C0022D979 /* XCRemoteSwiftPackageReference "inji-vci-client-ios-swift.git" */;
productName = VCIClient;
};
1EC395262D50C9150022D979 /* OpenID4VP */ = {
isa = XCSwiftPackageProductDependency;
package = 1EC395252D50C9150022D979 /* XCRemoteSwiftPackageReference "inji-openid4vp-ios-swift.git" */;
productName = OpenID4VP;
};
3403A56B2D6C79EB00AD64DE /* OpenID4VP */ = {
isa = XCSwiftPackageProductDependency;
package = 3403A56A2D6C79EB00AD64DE /* XCRemoteSwiftPackageReference "inji-openid4vp-ios-swift" */;
productName = OpenID4VP;
};
1EC395292D50C9470022D979 /* pixelpass */ = {
isa = XCSwiftPackageProductDependency;
package = 1EC395282D50C9470022D979 /* XCRemoteSwiftPackageReference "pixelpass-ios-swift.git" */;
Expand Down
123 changes: 0 additions & 123 deletions ios/Inji.xcworkspace/xcshareddata/swiftpm/Package.resolved

This file was deleted.

2 changes: 1 addition & 1 deletion ios/RNOpenID4VPModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ @interface RCT_EXTERN_MODULE(InjiOpenID4VP, NSObject)

RCT_EXTERN_METHOD(init:(NSString *)appId)

RCT_EXTERN_METHOD(authenticateVerifier:(NSString *)encodedAuthorizationRequest
RCT_EXTERN_METHOD(authenticateVerifier:(NSString *)urlEncodedAuthorizationRequest
trustedVerifierJSON:(id)trustedVerifierJSON
shouldValidateClient:(BOOL)shouldValidateClient
resolver:(RCTPromiseResolveBlock)resolve
Expand Down
4 changes: 2 additions & 2 deletions ios/RNOpenID4VPModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class RNOpenId4VpModule: NSObject, RCTBridgeModule {
}

@objc
func authenticateVerifier(_ encodedAuthorizationRequest: String,
func authenticateVerifier(_ urlEncodedAuthorizationRequest: String,
trustedVerifierJSON: AnyObject,
shouldValidateClient: Bool,
resolver resolve: @escaping RCTPromiseResolveBlock,
Expand All @@ -37,7 +37,7 @@ class RNOpenId4VpModule: NSObject, RCTBridgeModule {
return Verifier(clientId: clientId, responseUris: responseUris)
}

let authenticationResponse: AuthorizationRequest = try await openID4VP!.authenticateVerifier(encodedAuthorizationRequest: encodedAuthorizationRequest, trustedVerifierJSON: trustedVerifiersList, shouldValidateClient: shouldValidateClient)
let authenticationResponse: AuthorizationRequest = try await openID4VP!.authenticateVerifier(urlEncodedAuthorizationRequest: urlEncodedAuthorizationRequest, trustedVerifierJSON: trustedVerifiersList, shouldValidateClient: shouldValidateClient)

let response = try toJsonString(jsonObject: authenticationResponse)
resolve(response)
Expand Down
4 changes: 2 additions & 2 deletions machines/openID4VP/openID4VPActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export const openID4VPActions = (model: any) => {
authenticationResponse: (_, event) => event.data,
}),

setEncodedAuthorizationRequest: model.assign({
encodedAuthorizationRequest: (_, event) => event.encodedAuthRequest,
setUrlEncodedAuthorizationRequest: model.assign({
urlEncodedAuthorizationRequest: (_, event) => event.encodedAuthRequest,
}),

setFlowType: model.assign({
Expand Down
2 changes: 1 addition & 1 deletion machines/openID4VP/openID4VPMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const openID4VPMachine = model.createMachine(
on: {
AUTHENTICATE: {
actions: [
'setEncodedAuthorizationRequest',
'setUrlEncodedAuthorizationRequest',
'setFlowType',
'setMiniViewShareSelectedVC',
'setIsShareWithSelfie',
Expand Down
2 changes: 1 addition & 1 deletion machines/openID4VP/openID4VPModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const openID4VPEvents = {
export const openID4VPModel = createModel(
{
serviceRefs: {} as AppServices,
encodedAuthorizationRequest: '' as string,
urlEncodedAuthorizationRequest: '' as string,
authenticationResponse: {},
vcsMatchingAuthRequest: {} as Record<string, VC[]>,
checkedAll: false as boolean,
Expand Down
2 changes: 1 addition & 1 deletion machines/openID4VP/openID4VPServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const openID4VPServices = () => {
getAuthenticationResponse: (context: any) => async () => {
OpenID4VP.initialize();
const serviceRes = await OpenID4VP.authenticateVerifier(
context.encodedAuthorizationRequest,
context.urlEncodedAuthorizationRequest,
context.trustedVerifiers,
);
return serviceRes;
Expand Down
5 changes: 2 additions & 3 deletions shared/openID4VP/OpenID4VP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ export class OpenID4VP {
}

static async authenticateVerifier(
encodedAuthorizationRequest: string,
urlEncodedAuthorizationRequest: string,
trustedVerifiersList: any,
) {
const shouldValidateClient = await isClientValidationRequired();

const authenticationResponse =
await OpenID4VP.InjiOpenID4VP.authenticateVerifier(
encodedAuthorizationRequest,
urlEncodedAuthorizationRequest,
trustedVerifiersList,
shouldValidateClient,
);
Expand Down