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

Redesign steel_crypt API with a host of new features (steel_crypt 2.0) #22

Open
jonas-zebari opened this issue Feb 20, 2020 · 12 comments
Open
Labels
enhancement New feature or request in progress Enhancement is being worked on for next release

Comments

@jonas-zebari
Copy link

jonas-zebari commented Feb 20, 2020

This message has been hijacked to tell you that this issue is not just about the below. Instead,
it's an issue for Steel Crypt 2.0, a comprehensive revamp of steel_crypt which factors in user feedback. If you have something to add, comment at the very end. Otherwise, monitor the project board and #22 (comment) for progress on the TODO's.


Original Text:

Several areas of the package use strings to determine what type of encryption, padding, etc. to use. Although each possibility is well documented I wonder if it would be more user-friendly to provide these values as enums, or perhaps named constructors?

For example, we could go from:

final aesCbc = AesCrypt('cbc');

to

final aesCbc = AesCrypt(AesMode.cbc);

OR

final aesCbc = AesCrypt.cbc(otherParams);

As a new user of this plugin I'm willing to make these changes but I wanted to know your thoughts before starting the work.

@AKushWarrior
Copy link
Owner

AKushWarrior commented Feb 22, 2020

Ironically, I started this already.

The way I designed the classes to revolve around strings instead of enums/named constructors is terrifyingly archaic, and I've been itching to redo it for a while. What's been stopping me is the deprecated code and lack of backwards-compatibility that a new API would cause. My current solution is to publish the changes under steel_crypt 2.0.0, and add notices about the lack of backwards compatibility.

Some other tidbits that I want to include in this 'redesign':

  • Named parameters: positional params with 3+ positions is untenable.
  • switch statements instead of if (mode == x) {} else if (mode == y) {} else if (mode == z) {} ... else {}

However, you don't have to do these changes. I'll do them myself; I already have them started.

@jonas-zebari TLDR: I've decided I definitely want this and some other changes done to the API. I'll be doing those personally...

@AKushWarrior AKushWarrior changed the title Should the string-based keys be replaced with enum values? Named constructors? Redesign steel_crypt API with enums, named parameters, and switch statements Feb 22, 2020
@AKushWarrior
Copy link
Owner

I'm turning this into a general issue for steel_crypt 2.0 redesign progress. Post any updates/PRs here...

@jonas-zebari
Copy link
Author

Fantastic! Thanks for the response.

@AKushWarrior
Copy link
Owner

AKushWarrior commented Mar 14, 2020

New updates for steel_crypt 2.0:

@AKushWarrior AKushWarrior changed the title Redesign steel_crypt API with enums, named parameters, and switch statements Redesign steel_crypt API with enums, named parameters, switch statements, raw classes, and ECC Mar 14, 2020
This was referenced Mar 14, 2020
@AKushWarrior AKushWarrior added enhancement New feature or request in progress Enhancement is being worked on for next release labels Mar 14, 2020
@denis-evteev
Copy link

I think that for the PassCrypt version 2.0 one can make the following set of constructors:

PassCrypt(AlgoNameEnum algoName, [CipherParameters cipherParameters])
//…

PassCrypt.pbkdf2([Pbkdf2Parameters pbkdf2parameters])
//…

PassCrypt.scrypt([ScryptParameters scryptParameters])
//…

In this case one could tweak the hashing parameters, including salt, number of iterations (for PBKDF2), cost (for Scrypt), etc. If no parameters are provided, then existing defaults with no salt could be applied.

@AKushWarrior
Copy link
Owner

That makes sense. I have them set to 'sane defaults', but I can just make those the default values.

The other thing I could to is to make each param of ScryptParameters/Pbkdf2Parameters a named parameter in the login. That way, users could choose what params to edit, and the rest would be the defaults that I choose.

Will edit a code snippet when I'm at my computer.

@AKushWarrior
Copy link
Owner

I should formalize base64 as the method for encoding/decoding everything (in the encoded/non-raw classes).

In raw classes, obviously, everything is Uint8Lists.

@AKushWarrior
Copy link
Owner

AKushWarrior commented Mar 20, 2020

I'll be updating this with the latest progress...

If you prefer a project board view, https://github.com/AKushWarrior/steel_crypt/projects/1. I personally think this is less cluttered.

@denis-evteev @jonas-zebari @cailetech @note8g2018 @s349856186 and everyone else who has issues, monitor this checklist.

Progress Report/TODO:

@AKushWarrior
Copy link
Owner

I should add Poly1305 and ChaCha20-Poly1305, because those are becoming standardized.

@AKushWarrior AKushWarrior changed the title Redesign steel_crypt API with enums, named parameters, switch statements, raw classes, and ECC Redesign steel_crypt API with a host of new features (steel_crypt 2.0) Mar 20, 2020
@AKushWarrior AKushWarrior pinned this issue Mar 20, 2020
@AKushWarrior
Copy link
Owner

AKushWarrior commented Mar 31, 2020

I've started writing a bootstrapped website which will host the new docs. Eventually, this will go on Github Pages:

@AKushWarrior
Copy link
Owner

Screen Shot 2020-03-31 at 4 38 34 PM

@AKushWarrior
Copy link
Owner

@denis-evteev @jonas-zebari @cailetech @note8g2018 @s349856186 Many of the features have been published in a 2.0 beta. See https://pub.dev/packages/steel_crypt.

The checklist above is still where I'm documenting progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request in progress Enhancement is being worked on for next release
Projects
None yet
Development

No branches or pull requests

3 participants