All Projects → hako → Branca

hako / Branca

Licence: mit
🔑 Secure alternative to JWT. Authenticated Encrypted API Tokens for Go.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Branca

Demo Twilio Backend Nodejs
A sample backend that demonstrates how to generate a Virgil JWT and Twilio token used for authentication with the Virgil and Twilio services
Stars: ✭ 128 (-12.93%)
Mutual labels:  jwt, cryptography, crypto
Noise
.NET Standard 1.3 implementation of the Noise Protocol Framework (revision 33 of the spec)
Stars: ✭ 124 (-15.65%)
Mutual labels:  cryptography, crypto
Cryptogotchas
A collection of common (interesting) cryptographic mistakes.
Stars: ✭ 118 (-19.73%)
Mutual labels:  cryptography, crypto
Botan
Cryptography Toolkit
Stars: ✭ 1,798 (+1123.13%)
Mutual labels:  cryptography, crypto
Streamcryptor
Stream encryption & decryption with libsodium and protobuf
Stars: ✭ 112 (-23.81%)
Mutual labels:  cryptography, crypto
Golang Gin Realworld Example App
Exemplary real world application built with Golang + Gin
Stars: ✭ 1,780 (+1110.88%)
Mutual labels:  api, jwt
Torchbear
🔥🐻 The Speakeasy Scripting Engine Which Combines Speed, Safety, and Simplicity
Stars: ✭ 128 (-12.93%)
Mutual labels:  cryptography, crypto
Cryfs
Cryptographic filesystem for the cloud
Stars: ✭ 1,560 (+961.22%)
Mutual labels:  cryptography, crypto
Padding Oracle Attacker
🔓 CLI tool and library to execute padding oracle attacks easily, with support for concurrent network requests and an elegant UI.
Stars: ✭ 136 (-7.48%)
Mutual labels:  cryptography, crypto
Tink
Tink is a multi-language, cross-platform, open source library that provides cryptographic APIs that are secure, easy to use correctly, and hard(er) to misuse.
Stars: ✭ 11,855 (+7964.63%)
Mutual labels:  cryptography, crypto
Simon Speck
The SIMON and SPECK families of lightweight block ciphers. #nsacyber
Stars: ✭ 146 (-0.68%)
Mutual labels:  cryptography, crypto
Iextrading4j
IEX Cloud open source API wrapper
Stars: ✭ 112 (-23.81%)
Mutual labels:  api, crypto
Tools For Cryptanalysis
A repository that aims to provide tools for cryptography and cryptanalysis
Stars: ✭ 112 (-23.81%)
Mutual labels:  cryptography, crypto
Charm
A really tiny crypto library.
Stars: ✭ 116 (-21.09%)
Mutual labels:  cryptography, crypto
Libsodium Go
A complete overhaul of the Golang wrapper for libsodium
Stars: ✭ 105 (-28.57%)
Mutual labels:  cryptography, crypto
Go Jose
An implementation of JOSE standards (JWE, JWS, JWT) in Go
Stars: ✭ 1,849 (+1157.82%)
Mutual labels:  jwt, crypto
Hs Jose
Haskell JOSE and JWT library
Stars: ✭ 100 (-31.97%)
Mutual labels:  jwt, cryptography
Cfrpki
Cloudflare's RPKI Toolbox
Stars: ✭ 104 (-29.25%)
Mutual labels:  cryptography, crypto
Cryptocurrency Portfolio
Google Sheets automatic creation with Google Apps Script (GAS) for managing a cryptocurrency tracking spreadsheet with multi exchanges
Stars: ✭ 134 (-8.84%)
Mutual labels:  api, crypto
Cli
🧰 A zero trust swiss army knife for working with X509, OAuth, JWT, OATH OTP, etc.
Stars: ✭ 2,151 (+1363.27%)
Mutual labels:  jwt, cryptography

branca

Build Status Go Report Card GoDoc

branca is a secure alternative to JWT, This implementation is written in pure Go (no cgo dependencies) and implements the branca token specification.

Requirements

Go 1.13+

Install

go get -u github.com/hako/branca

Example

package main

import (
	"fmt"
	"github.com/hako/branca"
)

func main() {
	b := branca.NewBranca("supersecretkeyyoushouldnotcommit") // This key must be exactly 32 bytes long.
	
	// Encode String to Branca Token.
	token, err := b.EncodeToString("Hello world!")
	if err != nil {
		fmt.Println(err)
	}
				
    //b.SetTTL(3600) // Uncomment this to set an expiration (or ttl) of the token (in seconds).
    //token = "87y8daMzSkn7PA7JsvrTT0JUq1OhCjw9K8w2eyY99DKru9FrVKMfeXWW8yB42C7u0I6jNhOdL5ZqL" // This token will be not allowed if a ttl is set.
	
	// Decode Branca Token.
	message, err := b.DecodeToString(token)
	if err != nil {
		fmt.Println(err) // token is expired.
		return
	}
	fmt.Println(token) // 87y8da....
	fmt.Println(message) // Hello world!
}

Todo

Here are a few things that need to be done:

  • [x] Remove cgo dependencies.
  • [x] Move to a pure XChaCha20 algorithm in Go.
  • [x] Add more tests than just acceptance tests.
  • [x] Increase test coverage.
  • [ ] Additional Methods. (Encode, Decode []byte)
  • [ ] Performance benchmarks.
  • [ ] More comments, examples and documentation.

Contributing

Contributions are welcome! Fork this repo and add your changes and submit a PR.

If you would like to fix a bug, add a feature or provide feedback you can do so in the issues section.

You can run tests by runnning go test. Running go test; go vet; golint is recommended.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].