From 29478de5a93743a87e143ef5467bbe201d442ded Mon Sep 17 00:00:00 2001 From: samuel Date: Thu, 4 Apr 2024 11:09:43 +0200 Subject: [PATCH] Bug fixes --- apps/devtool/src/app/_hooks/useAccountSignature.tsx | 2 +- .../src/engine/core/service/engine-signer-config.service.ts | 3 ++- .../src/engine/http/rest/controller/client.controller.ts | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/devtool/src/app/_hooks/useAccountSignature.tsx b/apps/devtool/src/app/_hooks/useAccountSignature.tsx index 486b9ffec..e247749ea 100644 --- a/apps/devtool/src/app/_hooks/useAccountSignature.tsx +++ b/apps/devtool/src/app/_hooks/useAccountSignature.tsx @@ -54,7 +54,7 @@ const useAccountSignature = () => { htm: 'POST', uri: 'https://armory.narval.xyz/sign', created: new Date().getTime(), - ath: hexToBase64Url(`0x${hash(accessToken)}`) + ath: hexToBase64Url(hash(accessToken)) } const signature = await signJwsd(payload, jwsdHeader, signer).then((jws) => { diff --git a/apps/policy-engine/src/engine/core/service/engine-signer-config.service.ts b/apps/policy-engine/src/engine/core/service/engine-signer-config.service.ts index b3159dcef..63da1f173 100644 --- a/apps/policy-engine/src/engine/core/service/engine-signer-config.service.ts +++ b/apps/policy-engine/src/engine/core/service/engine-signer-config.service.ts @@ -19,8 +19,9 @@ export class EngineSignerConfigService { async getPublicJwkOrThrow(): Promise { const signerConfig = await this.getSignerConfigOrThrow() + const hex = await privateKeyToHex(signerConfig.key) - return secp256k1PrivateKeyToPublicJwk(privateKeyToHex(signerConfig.key)) + return secp256k1PrivateKeyToPublicJwk(hex) } async getSignerConfigOrThrow(): Promise { diff --git a/apps/policy-engine/src/engine/http/rest/controller/client.controller.ts b/apps/policy-engine/src/engine/http/rest/controller/client.controller.ts index 65281f4e6..e1a8f47d4 100644 --- a/apps/policy-engine/src/engine/http/rest/controller/client.controller.ts +++ b/apps/policy-engine/src/engine/http/rest/controller/client.controller.ts @@ -33,7 +33,9 @@ export class ClientController { updatedAt: now }) - const publicKey = secp256k1PrivateKeyToPublicJwk(privateKeyToHex(client.signer.key)) + const hex = await privateKeyToHex(client.signer.key) + + const publicKey = secp256k1PrivateKeyToPublicJwk(hex) return { ...client,