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

Introduce GrumpkinScalar type #1912

Closed
benesjan opened this issue Aug 31, 2023 · 0 comments · Fixed by #1919
Closed

Introduce GrumpkinScalar type #1912

benesjan opened this issue Aug 31, 2023 · 0 comments · Fixed by #1919
Assignees

Comments

@benesjan
Copy link
Contributor

benesjan commented Aug 31, 2023

Introduce a GrumpkinScalar type and use it to represent encryption private key.

Requirements:
Create a GrumpkinScalar type in both Noir and TS. In Noir, the scalar should be represented as 2 fields because the Field type native in Noir is "smaller" than the scalar field of grumpkin. The struct should look like this:

struct GrumpkinScalar {
  low : Field,
  high : Field
}

The get_secret_key oracle call should return it instead of Field.

@benesjan benesjan self-assigned this Aug 31, 2023
@benesjan benesjan changed the title Private key used with grumpkin curve should fit into Fr Introduce GrumpkinScalar type Sep 4, 2023
PhilWindle added a commit that referenced this issue Sep 7, 2023
Fixes #1912 

**Note 1**: I removed the Signer interface as the difference in private
key types between `Grumpkin` and `secp256k1` made it impractical. Now we
have a special type only for the "`Grumpkin` key" and the `secp256k1`
key is represented as either as a `Buffer` or as `0x${string}` (in case
of publisher private key).

**Note 2**: I changed some of the hardcoded private keys because they
didn't fit to `GrumpkinScalar` and auto-reduction is no longer allowed.

**Note 3**: The way we get Grumpkin private key from mnemonic is
insecure so I've created [this
issue](#2052) for
it.

# Checklist:
Remove the checklist to signal you've completed it. Enable auto-merge if
the PR is ready to merge.
- [ ] If the pull request requires a cryptography review (e.g.
cryptographic algorithm implementations) I have added the 'crypto' tag.
- [ ] I have reviewed my diff in github, line by line and removed
unexpected formatting changes, testing logs, or commented-out code.
- [ ] Every change is related to the PR description.
- [ ] I have
[linked](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)
this pull request to relevant issues (if any exist).

---------

Co-authored-by: spypsy <spypsy@outlook.com>
Co-authored-by: PhilWindle <philip.windle@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant