diff --git a/packages/identity/src/identity.ts b/packages/identity/src/identity.ts index 3f64bb07b..24f585cc6 100644 --- a/packages/identity/src/identity.ts +++ b/packages/identity/src/identity.ts @@ -20,7 +20,7 @@ export default class Identity { * Initializes the class attributes based on the parameters. * @param privateKey The secret value used to generate an EdDSA public key. */ - constructor(privateKey: BigNumberish = randomBytes(32)) { + constructor(privateKey: BigNumberish = BigInt(`0x${randomBytes(32).toString("hex")}`).toString()) { this._privateKey = privateKey this._secretScalar = deriveSecretScalar(privateKey) diff --git a/packages/identity/tests/index.test.ts b/packages/identity/tests/index.test.ts index 4ccbe09e9..261914189 100644 --- a/packages/identity/tests/index.test.ts +++ b/packages/identity/tests/index.test.ts @@ -7,7 +7,7 @@ describe("Identity", () => { it("Should create a random identity", () => { const identity = new Identity() - expect(Buffer.isBuffer(identity.privateKey)).toBeTruthy() + expect(typeof identity.privateKey).toBe("string") expect(typeof identity.secretScalar).toBe("string") expect(identity.publicKey).toHaveLength(2) expect(typeof identity.commitment).toBe("string")