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 = () => { }, }; }; -