Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(identity)!: update type of private key #803

Merged
merged 4 commits into from
Jun 18, 2024
Merged

Conversation

cedoor
Copy link
Member

@cedoor cedoor commented Jun 13, 2024

Description

This fixes #799 by updating the @zk-kit/eddsa-poseidon dependency and adds two methods to export/import encoded (base64) private keys.

The type of the private key in the Identity constructor has also been changed. Now, it must be one of the following: Uint8Array, Buffer, string, i.e. bytes or text, exactly the same as the types supported by @zk-kit/eddsa-poseidon.

This should eliminate the ambiguity of having a string that can be either text or hexadecimal, as it was before.

Related Issue(s)

Fixes #799

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have run yarn format and yarn lint without getting any errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

The new types support buffers and text, so that there is less ambiguity on strings.
@cedoor cedoor requested a review from a team as a code owner June 13, 2024 12:40
Copy link
Contributor

@0xjei 0xjei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amazing

Copy link
Contributor

@artwyman artwyman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionality looks good. I have some suggestions for additional testing.

packages/identity/src/index.ts Outdated Show resolved Hide resolved
packages/identity/src/index.ts Show resolved Hide resolved
packages/identity/tests/index.test.ts Show resolved Hide resolved
packages/identity/tests/index.test.ts Outdated Show resolved Hide resolved
packages/identity/tests/index.test.ts Outdated Show resolved Hide resolved
packages/identity/tests/index.test.ts Show resolved Hide resolved
@cedoor cedoor merged commit 3572f44 into main Jun 18, 2024
5 checks passed
@cedoor cedoor deleted the fix/identity-generation branch June 18, 2024 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generating a new identity with a user-provided private key results in inconsistent behavior
4 participants