Skip to content

Commit

Permalink
fix bs58 import
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu committed Aug 2, 2024
1 parent 8cb3ed6 commit d3b60d8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/helpers/keyUtils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { INodePub, KEY_TYPE } from "@toruslabs/constants";
import { Ecies, encrypt } from "@toruslabs/eccrypto";
import BN from "bn.js";
import base58 from "bs58";
import * as base58 from "bs58";
import { curve, ec as EC } from "elliptic";
import { keccak256 as keccakHash } from "ethereum-cryptography/keccak";
import { sha512 } from "ethereum-cryptography/sha512";
Expand Down Expand Up @@ -142,7 +142,7 @@ function generateAddressFromEcKey(keyType: KeyType, key: EC.KeyPair): string {
return toChecksumAddress(evmAddressLower);
} else if (keyType === KEY_TYPE.ED25519) {
const publicKey = encodeEd25519Point(key.getPublic());
const address = base58.encode(publicKey);
const address = base58.default.encode(publicKey);
return address;
}
throw new Error(`Invalid keyType: ${keyType}`);
Expand Down
4 changes: 2 additions & 2 deletions test/sapphire_devnet_ed25519.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TORUS_SAPPHIRE_NETWORK } from "@toruslabs/constants";
import { NodeDetailManager } from "@toruslabs/fetch-node-details";
import BN from "bn.js";
import base58 from "bs58";
import * as base58 from "bs58";
import { expect } from "chai";
import faker from "faker";

Expand Down Expand Up @@ -74,7 +74,7 @@ describe("torus utils ed25519 sapphire devnet", function () {
const nodeDetails = await TORUS_NODE_MANAGER.getNodeDetails({ verifier: TORUS_TEST_VERIFIER, verifierId: email });
const torusNodeEndpoints = nodeDetails.torusNodeSSSEndpoints;

const decodedKey = Buffer.from(base58.decode(privB58));
const decodedKey = Buffer.from(base58.default.decode(privB58));
const seedKey = decodedKey.subarray(0, 32).toString("hex");
const result = await torus.importPrivateKey(
getImportKeyParams(
Expand Down

0 comments on commit d3b60d8

Please sign in to comment.