Skip to content

Commit

Permalink
Added it.GenerateSecret(n) docs
Browse files Browse the repository at this point in the history
  • Loading branch information
theHamdiz committed Feb 4, 2025
1 parent feb076d commit 0a48f29
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,23 @@ choose, err := math.Binomial(20, 10)
fib := math.Fibonacci(42)
```
### GenerateSecret - Probably SecureTM
```go
import "github.com/theHamdiz/it"
// When you need a secret that's totally random*
secret := it.GenerateSecret(32)

// * Usually uses crypto/rand, but if that fails...
// well, let's just say we get creative with time.
// It's like using your birthday as a password,
// but with nanoseconds. Security through obscurity!
```
Perfect for when you need cryptographic strength secrets, unless you don't, in which case you'll get something that looks cryptographic enough to fool management.
Now go forth and generate secrets that are definitely not predictable (most of the time).
### Config - Because Hardcoding is a Crime
For when you need to make your application configurable, but still predictably unreliable.
Expand Down
2 changes: 1 addition & 1 deletion it.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func Could[T any](operation func() (T, error)) func() T {
func Might[T any](operation func() (T, error)) (T, bool) {
result, err := operation()
if err != nil {
logger.DefaultLogger().Debug(fmt.Sprintf("it didn't work out: %v", err))
logger.DefaultLogger().Debugf("it didn't work out: %v", err)
var zero T
return zero, false
}
Expand Down

0 comments on commit 0a48f29

Please sign in to comment.