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: adding backwards compatibility to manage key curve Secp256k1 and… #372

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

elribonazo
Copy link
Contributor

@elribonazo elribonazo commented Feb 4, 2025

Description:

Adding backwards compatible key curve Secp256k1 and secp256k1, but forcing from now on to use it in lowercase as stated in the specs.

Checklist:

  • My PR follows the contribution guidelines of this project
  • My PR is free of third-party dependencies that don't comply with the Allowlist
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked the PR title to follow the conventional commit specification

@elribonazo elribonazo requested a review from a team as a code owner February 4, 2025 12:56
@elribonazo elribonazo linked an issue Feb 4, 2025 that may be closed by this pull request
@elribonazo elribonazo force-pushed the feature/368-curve-values branch from 2105532 to 81ce220 Compare February 4, 2025 12:57
Copy link

github-actions bot commented Feb 4, 2025

Lines Statements Branches Functions
Coverage: 77%
78.15% (3743/4789) 68.24% (1734/2541) 82.15% (893/1087)

@coveralls
Copy link

coveralls commented Feb 4, 2025

Coverage Status

coverage: 74.532% (+0.09%) from 74.442%
when pulling ae9c758 on feature/368-curve-values
into dc47f0a on main.

… secp256k1 but forcing lowercase for newly created ones

Signed-off-by: Francisco Javier Ribo Labrador <[email protected]>
Signed-off-by: Francisco Javier Ribo Labrador <[email protected]>

Signed-off-by: Francisco Javier Ribo Labrador <[email protected]>
…wards compatibility

Signed-off-by: Francisco Javier Ribo Labrador <[email protected]>
@elribonazo elribonazo force-pushed the feature/368-curve-values branch from 1fccb9c to 00d8346 Compare February 4, 2025 13:14
Signed-off-by: Francisco Javier Ribo Labrador <[email protected]>
Signed-off-by: Francisco Javier Ribo Labrador <[email protected]>
@elribonazo elribonazo requested a review from curtis-h February 4, 2025 14:38
Comment on lines +7 to +10
export function isCurve(curve: string, curveEnum: Curve): boolean {
return curve === curveEnum ||
// For backwards compatibility
curve === 'Secp256k1';
Copy link
Contributor

Choose a reason for hiding this comment

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

this doesn't look right, I don't think we should have hardcoded conditionals like this.
wouldn't this incorrectly evaluate, ie:

// curve value from somewhere
const crv = "Secp256k1"

if(isCurve(crv, Curve.ED25519)) {
  ... do something ed25519 related
}

@@ -188,7 +188,8 @@ export enum Usage {
UNKNOWN_KEY = "unknownKey",
}
export function curveToAlg(curve: string) {
if (curve === Curve.SECP256K1) {
// For backwards compatibility
Copy link
Contributor

Choose a reason for hiding this comment

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

what is this aiming for backwards compatibility with? I'd expect to see some tests that demonstrate and prove it?

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.

Curve values
4 participants