fireblocks-typed-raw-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

typed-message-raw-sdk

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

Structure

This SDK exposes two classes, one that handles EIP191 and EIP712 messages signing (FireblocksTypedMessageSigner), and one for arbirtrary messages signing (FireblocksRawMessageSigner).

Installation

Prerequisites

  • Node.js
  • Fireblocks ts-sdk
  • ethers.js

Steps

  • Clone the repository:
git clone https://github.com/fireblocks/typed-message-raw-sdk.git
cd typed-message-raw-sdk
  • Install the dependencies:
npm install

Usage

Enviroment variables

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.

Create a '.env' file

API_KEY_ID = "";
PATH_TO_SECRET = "";

Initialization

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.

Package Sidebar

Install

npm i fireblocks-typed-raw-ts

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

93.5 kB

Total Files

14

Last publish

Collaborators

  • tomerh_fb