From 76330b931f370f8516ae33af719a3cfebdbe6852 Mon Sep 17 00:00:00 2001 From: Fran Domovic Date: Tue, 18 Jun 2024 15:59:20 +0200 Subject: [PATCH] fix: replace headers map with axios header --- packages/calimero-sdk/src/crypto/crypto.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/calimero-sdk/src/crypto/crypto.ts b/packages/calimero-sdk/src/crypto/crypto.ts index a36058bfe..ff5d34c46 100644 --- a/packages/calimero-sdk/src/crypto/crypto.ts +++ b/packages/calimero-sdk/src/crypto/crypto.ts @@ -4,11 +4,14 @@ import bs58 from 'bs58'; import { WalletType } from '../api/nodeApi'; import { ClientKey } from '../types/storage'; import { getStorageClientKey } from '../storage/storage'; -import { Header } from '../api/httpClient'; + +export interface AxiosHeader { + [key: string]: string; +} export async function createAuthHeader( payload: string, -): Promise { +): Promise { const privateKey: PrivateKey = await getPrivateKey(); if (!privateKey) { @@ -27,12 +30,12 @@ export async function createAuthHeader( const signatureBase58 = bs58.encode(signature); const contentBase58 = bs58.encode(hashArray); - const headers: Header[] = [ - { key: 'wallet_type', value: JSON.stringify(WalletType.NEAR) }, - { key: 'signing_key', value: signing_key }, - { key: 'signature', value: signatureBase58 }, - { key: 'challenge', value: contentBase58 }, - ]; + const headers: AxiosHeader = { + wallet_type: JSON.stringify(WalletType.NEAR), + signing_key: signing_key, + signature: signatureBase58, + challenge: contentBase58, + }; return headers; }