even if i have added right api keys and right secret file iam getting 401 error from the backend side
here is the nodejs code -
// Import required modules
const { FireblocksSDK } = require(“fireblocks-sdk”); // Correct way to import Fireblocks SDK
const fs = require(“fs”);
// Initialize Fireblocks Client with API Key and Secret
const apiSecret = fs.readFileSync(“src/utils/fireblock/fireblock.pem”, “utf8”); // Replace with your actual file path
const apiKey = “786fe7bf-0e26-448f-806e-e7c1ca5b8e6d”; // Replace with your actual Fireblocks API Key
const fireblocks = new FireblocksSDK(apiSecret, apiKey);
// Function to Create a New Customer Wallet
async function createNewCustomerWallet(walletName, assets = ) {
try {
// Create wallet options
const options = {
name: walletName,
assets: assets, // Array of asset symbols you want to include in the wallet (e.g., [“BTC”, “ETH”])
};
// Call the Fireblocks API to create a new wallet
const response = await fireblocks.createVaultAccount(walletName); // Correct function to create a vault account
console.log("Customer Wallet Created:", response);
return response;
} catch (error) {
console.error("Error creating customer wallet:", error.message);
}
}
// Example usage of the function
(async() => {
const walletName = “My New Customer Wallet”; // Replace with your desired wallet name
const assets = [“BTC”, “ETH”]; // Specify assets for the wallet (optional)
// Create the customer wallet
await createNewCustomerWallet(walletName, assets);
})();