Skip to content

Commit

Permalink
refactor(identity): convert priv key buffer to bigint
Browse files Browse the repository at this point in the history
  • Loading branch information
cedoor committed Jan 23, 2024
1 parent 364977d commit 27df0d5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/identity/src/identity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion packages/identity/tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 27df0d5

Please sign in to comment.