Skip to content

Commit

Permalink
[INJIMOB-2550]: encode ed25519 public key and pass to library
Browse files Browse the repository at this point in the history
Signed-off-by: adityankannan-tw <[email protected]>
  • Loading branch information
Adityankannan committed Dec 18, 2024
1 parent 1894287 commit fcb5b4d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion machines/openID4VP/openID4VPServices.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {CACHED_API} from '../../shared/api';
import {fetchKeyPair} from '../../shared/cryptoutil/cryptoUtil';
import {hasKeyPair} from '../../shared/openId4VCI/Utils';
import base64url from 'base64url';
import {
constructProofJWT,
isClientValidationRequired,
Expand Down Expand Up @@ -53,7 +54,7 @@ export const openID4VPServices = () => {
const vpResponseMetadata = {
jws: proofJWT,
signatureAlgorithm: OpenID4VP_Proof_Algo_Type,
publicKey: context.publicKey,
publicKey: base64url(context.publicKey),
domain: OpenID4VP_Domain,
};
return await OpenID4VP.shareVerifiablePresentation(vpResponseMetadata);
Expand Down
5 changes: 4 additions & 1 deletion screens/Scan/SendVPScreenController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@ export function useSendVPScreen() {
secondaryButtonEvent: CANCEL,
title: t('consentDialog.title'),
titleTestID: 'consentTitle',
message: t('consentDialog.message', {verifierName: vpVerifierName}),
message: t('consentDialog.message', {
verifierName: vpVerifierName,
interpolation: {escapeValue: false},
}),
messageTestID: 'consentMsg',
onCancel: DISMISS_POPUP,
};
Expand Down
9 changes: 5 additions & 4 deletions shared/openID4VP/OpenID4VP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import {getJWK} from '../openId4VCI/Utils';
import getAllConfigurations from '../api';

export const OpenID4VP_Key_Ref = 'OpenID4VP_KeyPair';
export const OpenID4VP_Proof_Algo_Type = 'RsaSignature2018';
export const OpenID4VP_Proof_Algo_Type = 'Ed25519Signature2018';
export const OpenID4VP_Domain = 'OpenID4VP';
export const OpenID4VP_Proof_Algo = 'EdDSA';

export class OpenID4VP {
static InjiOpenID4VP = NativeModules.InjiOpenID4VP;
Expand Down Expand Up @@ -62,13 +63,13 @@ export class OpenID4VP {
}

export async function constructProofJWT(
publicKey: string,
privateKey: string,
publicKey: any,
privateKey: any,
vpToken: Object,
keyType: string,
): Promise<string> {
const jwtHeader = {
alg: keyType,
alg: OpenID4VP_Proof_Algo,
jwk: await getJWK(publicKey, keyType),
};

Expand Down

0 comments on commit fcb5b4d

Please sign in to comment.