This is an SDK developed to simplify the work with the Fireblocks TypeScript SDK for Typed Message (EIP712) signing, structured data (EIP191) signing, and arbitrary payload (RAW) signing. More information on Typed Messaged and Raw message siging with Fireblocks can be found here: https://developers.fireblocks.com/docs/typed-message-signing-overview
This SDK exposes two classes, one that handles EIP191 and EIP712 messages signing (FireblocksTypedMessageSigner), and one for arbirtrary messages signing (FireblocksRawMessageSigner).
- Node.js
- Fireblocks ts-sdk
- ethers.js
- Clone the repository:
git clone https://github.com/fireblocks/typed-message-raw-sdk.git
cd typed-message-raw-sdk
- Install the dependencies:
npm install
This library supports configuration through environment variables. To manage these variables, we recommend using a '.env' file. Below are the steps to set up and use environment variables in your project.
API_KEY_ID = "";
PATH_TO_SECRET = "";
execute the following code to initialize the Fireblocks SDK and the TypedMessageSigner instances:
import { BasePath, Fireblocks } from "@fireblocks/ts-sdk";
import { FireblocksTypedMessageSigner } from "../src/";
require("dotenv").config();
const pathToSecret = process.env.PATH_TO_SECRET;
const secretKey = readFileSync(pathToSecret!, "utf8");
const apiKey = process.env.API_KEY_ID;
const config = {
apiKey,
secretKey,
basePath: BasePath.US,
};
const txParams: TypedTxParameters = {
vaultAccountId: "<VAULT_ACCOUNT_ID>",
isTestnet: false,
txNote: "<YOUR_CUSTOM_NOTE>",
};
const fireblocks = new Fireblocks(config);
const fireblocksTypedSigner = new FireblocksTypedMessageSigner(
fireblocks,
txParams
);
execute the following code to initialize the Fireblocks SDK and the RawMessageSigner instances:
import { BasePath, Fireblocks } from "@fireblocks/ts-sdk";
import { FireblocksRawMessageSigner } from "../src/";
require("dotenv").config();
const pathToSecret = process.env.PATH_TO_SECRET;
const secretKey = readFileSync(pathToSecret, "utf8");
const apiKey = process.env.API_KEY_ID;
const config = {
apiKey,
secretKey,
basePath: BasePath.US,
};
const fireblocks = new Fireblocks({
secretKey: config.secretKey,
apiKey: config.apiKey,
basePath: config.basePath,
});
const fireblocksRawSigner = new FireblocksRawMessageSigner(fireblocks);
Once the instances are initialized, you may use the public methods to sign and validate typed and arbitrary messages with Fireblocks TypeScript SDK.