https://github.com/matthewhartstonge/hasher
An Argon2 Hasher for https://github.com/ory/fosite
https://github.com/matthewhartstonge/hasher
argon2 argon2id fosite go golang hasher oauth2
Last synced: 3 months ago
JSON representation
An Argon2 Hasher for https://github.com/ory/fosite
- Host: GitHub
- URL: https://github.com/matthewhartstonge/hasher
- Owner: matthewhartstonge
- License: apache-2.0
- Created: 2017-05-21T23:06:24.000Z (about 9 years ago)
- Default Branch: main
- Last Pushed: 2026-03-26T22:26:38.000Z (4 months ago)
- Last Synced: 2026-03-27T09:44:47.877Z (4 months ago)
- Topics: argon2, argon2id, fosite, go, golang, hasher, oauth2
- Language: Go
- Homepage:
- Size: 323 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Notice: NOTICE
Awesome Lists containing this project
- awesome-ory - Argon2 Hasher for Ory Fosite
README
# fosite-hasher-argon2
[](https://pkg.go.dev/github.com/matthewhartstonge/hasher) [](https://goreportcard.com/report/github.com/matthewhartstonge/hasher) [](https://app.fossa.io/projects/git%2Bgithub.com%2Fmatthewhartstonge%2Fhasher?ref=badge_shield)
fosite-hasher-argon2 provides an Argon2 based password hasher that conforms to
the hasher interface required by fosite.
**Table of contents**
- [Example](#example)
- [Compatibility](#compatibility)
- [Development](#development)
- [Installation](#installation)
## Example
Following the [fosite-example/authorizationserver](https://github.com/ory/fosite-example/blob/master/authorizationserver/oauth2.go)
example, we can extend this to add support for the argon2 hasher via the compose
configuration.
```go
// ...
var (
// You'll probably want this somewhere to hash user passwords
argonHasher := &hasher.Argon2{
Config: argon2.DefaultConfig(),
}
// Check the api documentation of `compose.Config` for further configuration options.
config = &fosite.Config{
AccessTokenLifespan: time.Minute * 30,
GlobalSecret: secret,
// Hash client secrets with argon2id!
ClientSecretsHasher: argonHasher,
// ...
}
)
// ...
```
## Compatibility
The following table lists the compatible versions of hasher with fosite.
If you are currently using this in production, it would be awesome to
know what versions you are successfully paired with.
| hasher version | minimum fosite version | maximum fosite version |
|---------------:|-----------------------:|-----------------------:|
| `v5.1.X` | `v0.49.X` | `v0.49.X` |
| `v5.X.X` | `v0.25.X` | `v0.40.X` |
### Installation
- Install [Go](https://go.dev/dl/)
- Create a new go project `go mod init`
- Run `go get github.com/matthewhartstonge/hasher/v5`
- `go build` successfully!
## Licensing
hasher is under the Apache 2.0 License.
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fmatthewhartstonge%2Fhasher?ref=badge_large)