Discover Packages
github.com/grackleclub/auth
package
module
Version:
v0.1.0
Opens a new window with list of versions in this module.
Published: Sep 14, 2024
License: MIT
Opens a new window with license information.
Imports: 7
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
README
¶
auth
bcrypt wrapper to provide auth structs and methods
Expand ▾
Collapse ▴
Documentation
¶
package auth wraps bcrypt to provide some basic functionality,
adding a Token object which combines a distinct user id
with that users secret to make a token in format <id>:<secret>
Compare compares a provided string to an expected string.
NOTE: make sure you're comparing *tokens* (<id>:<secret>)
and not just the secret
Cost calculates the cost of the hash
Hash uses bcrypt to create a Hash from plaintext password
NewSecret creates a new base64 encoded secret
NewToken formats into standard '<id>:<secret>'
ParseToken takes a token in '<id>:<secret>' format
and returns a Token struct
Format takes 'id' and 'secret' and formats a string as '<id>:<secret>'
Source Files
¶
Click to show internal directories.
Click to hide internal directories.