Hi Everyone! Currently I am trying to import user ...
# talk-kratos
h
Hi Everyone! Currently I am trying to import user identities using hashed passwords. Kratos accepts the importing of the user however the user cannot sign in as it says invalid credentials. Currently the hashing is done in a perl giving me a hash like this
SCRYPT:16384:8:1:zQ8fEjjxdpQYfc9c/FV+5xsgnknGqcgB3vqtGFIWsOc=:31JXNWdr6zNRWgmfrszTdiW2Tv3NNspnAiyugtfgc8I=
I convert to how kratos wants
$pbkdf2-sha256$i=100000,l=32$zQ8fEjjxdpQYfc9c/FV+5xsgnknGqcgB3vqtGFIWsOc$31JXNWdr6zNRWgmfrszTdiW2Tv3NNspnAiyugtfgc8I
and the user gets created but has invalid credentials. Anyone know what I'm doing wrong?
b
Hi Landon, it looks like the passwords have been encrypted using the Scrypt algorithm? Unfortunately, kratos currently does not support Scrypt imports. We have an issue open for that here: https://github.com/ory/kratos/issues/2422 Contributions are welcome, though. This should be fairly straight forward as the logic should be quite similar to the existing Bcrypt import process.
h
I'll be happy to contribute, I'll check it out👍
Hi @bland-eye-99092 I was trying to find where the importing logic is happening, I see that there is hash_comparator.go and also that each algorithm has its own file. Could you point me in the direction of the bcrypt import implementation? Thanks!
b
The import code is mainly in this file: https://github.com/ory/kratos/blob/master/identity/handler_import.go You probably only need to adjust this line https://github.com/ory/kratos/blob/master/identity/handler_import.go#L48 to include a check for Scrypt passwords. Let me know if you need anything else.
h
Hi@bland-eye-99092 I've made a draft PR for importing SCRYPT, If you could suggest any changes and guide me on what to do next I would appreciate it. Thank you!