File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change 22
33import passlib .hash
44
5- from dependency_injector import providers
5+ from dependency_injector import containers , providers
66
77
8- password_hasher = providers .Callable (
9- passlib .hash .sha256_crypt .hash ,
10- salt_size = 16 ,
11- rounds = 10000 ,
12- )
13- password_verifier = providers .Callable (passlib .hash .sha256_crypt .verify )
8+ class Container (containers .DeclarativeContainer ):
9+
10+ password_hasher = providers .Callable (
11+ passlib .hash .sha256_crypt .hash ,
12+ salt_size = 16 ,
13+ rounds = 10000 ,
14+ )
15+
16+ password_verifier = providers .Callable (passlib .hash .sha256_crypt .verify )
1417
1518
1619if __name__ == '__main__' :
17- hashed_password = password_hasher ('super secret' )
18- assert password_verifier ('super secret' , hashed_password )
20+ container = Container ()
21+
22+ hashed_password = container .password_hasher ('super secret' )
23+ assert container .password_verifier ('super secret' , hashed_password )
You can’t perform that action at this time.
0 commit comments