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

Remove the non raw structs from the library #1

Open
blabug opened this issue Jan 30, 2024 · 0 comments
Open

Remove the non raw structs from the library #1

blabug opened this issue Jan 30, 2024 · 0 comments

Comments

@blabug
Copy link

blabug commented Jan 30, 2024

Used the library today, but I had to go through some difficulties to get it working.
To make it easier to use correctly, I suggest to remove the non raw structs.

Structs like PublicKey have a Base64 field for the user and a Raw field for the actual library. This has multiple disadvantages:

  • Redundant information: The user may change the Base64 part later, which won't automatically update the Raw part and could cause weird behaviour (like GetSigFile() using the new signature value, while in the background the old one is used by the rest of the code)
  • The user has to first create the type and then assign the Base64 value to make it usable
  • Functions need to check, if the Raw part is filled and call decode (which is btw. currently bugged)

I would suggest replacing them with the raw counterparts and having a function to create the struct from a Base64 value (ParsePublicKey or similar).

This change will also eliminate the need for the NewXXX calls to create instances of structs. And the Decode and Encode functions will be embedded in the actual parsing and generation of the textual versions.

I know that this is basically a big API break and before wasting effort creating a PR, I want to know, if this has a chance to be merged.

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

No branches or pull requests

1 participant