Repository navigation
v1.0.0
·
30 commits
to main
since this release
Version 1.0.0: Add concurrent support
Previously the code didn't support concurrent instances of the lib.
Imagine a place where there are two instances of lib called.
Where the first one uses jwt, so the jwt_init_check would be marked true.
But then in the second instance, same would continue as we use a mere
global state and have no past context what so ever.
Now here we bring all the global vars and return that structure at the
very start.
/*
Auth is a struct that holds the internal state of the library.
Unlike the previous global-variable approach,
this design allows the library to be safely used concurrently.
*/
type Auth struct {
conn *pgxpool.Pool
argon_params argon_parameters
pepper string
pepper_once sync.Once
jwt_secret []byte
jwt_once sync.Once
}
The Auth type is created to store init_check, the
init_check and jwt_init_check are completely ditched because,
it again introduces the same issues.
We rather use properly returned structures within structures and then
combine it to neatly return them back to the user.
This marks as the v1.0.0 of Auth, a much more matured library compared to
the past versions.
This also marks the start of detailed docs on how this library can be
used with best practices and industry standards.
This once again also marks the beginning of a lot of micro optimizations
as we move forward.
Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>