From df4dc7b3836359d4249eab3b28d87986eb3b2f4f Mon Sep 17 00:00:00 2001 From: abhip2565 Date: Fri, 19 Sep 2025 13:29:08 +0530 Subject: [PATCH] [INJIMOB-3546] fix es256 based kb-jwt signing for ios ovp (#2085) Signed-off-by: Abhishek Paul --- machines/openID4VP/openID4VPServices.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/machines/openID4VP/openID4VPServices.ts b/machines/openID4VP/openID4VPServices.ts index c37351f5..33573af6 100644 --- a/machines/openID4VP/openID4VPServices.ts +++ b/machines/openID4VP/openID4VPServices.ts @@ -182,8 +182,17 @@ export const openID4VPServices = () => { const header = JSON.parse(atob(unsignedKBJWT.split('.')[0])); const alg = header.alg; const keyType = JWT_ALG_TO_KEY_TYPE[alg]; + + let privateKey: string; + + if (keyType === KeyTypes.ED25519) { + privateKey = context.privateKey; + } else { + const keypair = await fetchKeyPair(keyType); + privateKey = keypair.privateKey; + } const signature = await createSignature( - context.privateKey, + privateKey, unsignedKBJWT, keyType, ); @@ -203,4 +212,3 @@ export const openID4VPServices = () => { }, }; }; -