-
Notifications
You must be signed in to change notification settings - Fork 50
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(js)!: add argon2i(mod|int) support #127
fix(js)!: add argon2i(mod|int) support #127
Conversation
Signed-off-by: blu3beri <blu3beri@proton.me>
private argon2Level?: Argon2Level | ||
|
||
public constructor(method: KdfMethod, argon2Level?: Argon2Level) { | ||
if (method == KdfMethod.Kdf && !argon2Level) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (method == KdfMethod.Kdf && !argon2Level) { | |
if (method === KdfMethod.Kdf && !argon2Level) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a check if kdf level is Raw and argon2level is defined? Also should we just add more enum values instead? What's the benefit of having kdf and then mod/int instaed of having kdf_mod and kdf_int?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mainly did it to be inline with how it is done in askar itself and this allows, although not quite good, more kdfs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will change it to Argon2IMod
and Argon2IInt
as growing with more kdfs would also not be a breaking change then.
Signed-off-by: blu3beri <blu3beri@proton.me>
Signed-off-by: blu3beri <blu3beri@proton.me>
export enum KdfMethod { | ||
Raw = 'raw', | ||
None = 'none', | ||
Argon2IMod = 'kdf:argon2i:mod', | ||
Argon2IInt = 'kdf:argon2i:int', | ||
} | ||
|
||
export class StoreKeyMethod { | ||
private method: KdfMethod | ||
|
||
public constructor(method: KdfMethod) { | ||
this.method = method | ||
} | ||
|
||
public toUri() { | ||
return this.method.toString() | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this for future proofing? We could just use the enum value directly right?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is for future proofing. Argon could have a salt or other kdf methods might need some custom logic.
Signed-off-by: blu3beri blu3beri@proton.me
argon2i