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

[privatekey] Fix AIP-80 strictness warnings #588

Merged
merged 3 commits into from
Nov 26, 2024

Conversation

GhostWalker562
Copy link
Contributor

@GhostWalker562 GhostWalker562 commented Nov 20, 2024

Description

Allow support for formatting existing AIP-80 strings and remove strictness warnings for bytes.

Test Plan

  • Tests pass
  • Cucumber specs pass

Related Links

https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md

Checklist

  • Have you ran pnpm fmt?
  • Have you updated the CHANGELOG.md?

@GhostWalker562 GhostWalker562 self-assigned this Nov 20, 2024
@GhostWalker562 GhostWalker562 requested a review from a team as a code owner November 20, 2024 20:31
let formattedPrivateKey = privateKey;
if (typeof formattedPrivateKey === "string" && formattedPrivateKey.startsWith(aip80Prefix)) {
// eslint-disable-next-line prefer-destructuring
formattedPrivateKey = formattedPrivateKey.split("-")[2];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we check the length? And if we have an item in index 2?

Copy link
Contributor Author

@GhostWalker562 GhostWalker562 Nov 26, 2024

Choose a reason for hiding this comment

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

I don't want to overdo these functions with logic since its just string manipulation. Its similar to appending secp256k1- and ed25519-. I would prefer that the Ed25519/Secp256k1 classes do the checking when they consume these AIP-80 strings to make sure that they're okay.

Let me know your thoughts here, if you prefer to abstract all the length checking then we could.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Going to merge for now. We can do the refactor if you have further comments here :)

@GhostWalker562 GhostWalker562 merged commit 3d1fe1b into main Nov 26, 2024
8 checks passed
@GhostWalker562 GhostWalker562 deleted the fix-aip80-strictness branch November 26, 2024 03:06
kaw2k pushed a commit that referenced this pull request Dec 19, 2024
* Fix AIP-80 strictness warnings

* Update changelog

---------

Co-authored-by: Greg Nazario <greg@gnazar.io>
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.

3 participants