<commit_before>[![GoDoc](https://godoc.org/github.com/yarf-framework/extras/auth?status.svg)](https://godoc.org/github.com/yarf-framework/extras/auth)

# Auth package

Super-simple, yet secure, token-based auth package for Go's http.Request. 
Compatible with Yarf framework, includes Middleware ready to insert into your Yarf router. 


### Create token:

```go
import (<commit_msg>Improve auth docs<commit_after>[![GoDoc](https://godoc.org/github.com/yarf-framework/extras/auth?status.svg)](https://godoc.org/github.com/yarf-framework/extras/auth)

# Auth package

Super-simple, yet secure, token-based auth package for Go's http.Request. 
Compatible with Yarf framework, includes Middleware ready to insert into your Yarf router. 


## Tokens

Tokens are generated from calculating the SHA512 hash from 256 bytes randomly generated and returned as a string encoded in UTF-8.
The result is a 128 characters long string all lower case representing the hash like: 

```
b6e184525010a39057878fb7d7eca73c39dde0ac8b2bcff26acd71034e5922d6b5a9e30923d5d35482df396e11e57df9adc085cdd47cd2b1095b1d2880f38d01
```


## Examples

### Create token:

```go
import (
{'fraction_non_alphanumeric': 0.10173913043478261, 'fraction_numerical': 0.07739130434782608, 'mean_word_length': 5.466292134831461, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7006889', 'n_tokens_mistral': 446, 'n_tokens_neox': 376, 'n_words': 99}