• Stars
    star
    75
  • Rank 409,892 (Top 9 %)
  • Language
    Go
  • License
    MIT License
  • Created over 5 years ago
  • Updated 27 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Authenticated encrypted API tokens (IETF XChaCha20-Poly1305 AEAD) for Golang

PkgGoDev GoReportCard Code Climate Maintainability Codebeat badge
Coverage Status GitHub Actions CI Status GitHub Actions CodeQL Status

Installation • Usage example • Benchmarks • Build Status • License


branca.go is branca token specification implementation for Golang 1.18+.

Features and benefits:

  • Pure Go implementation;
  • No third-party dependencies at all;
  • 100% code coverage;
  • Fuzz tests.

Installation

Make sure you have a working Go 1.18+ workspace (instructions), then:

go get -u github.com/essentialkaos/branca/v2

Usage example

package main

import (
  "fmt"
  
  "github.com/essentialkaos/branca/v2"
)

func main() {
  key := "abcd1234abcd1234abcd1234abcd1234"
  brc, err := branca.NewBranca([]byte(key))

  if err != nil {
    fmt.Printf("Error: %v\n", err)
    return
  }

  payload := "MySuperSecretData"
  token, err := brc.EncodeToString([]byte(payload))

   if err != nil {
    fmt.Printf("Error: %v\n", err)
    return
  }

  fmt.Printf("Token: %s\n", token)
}

Benchmarks

You can run benchmarks by yourself using make benchmark command.

BrancaSuite.BenchmarkBase62Decoding             1000000   1097 ns/op   408 B/op    7 allocs/op
BrancaSuite.BenchmarkBase62Encoding             1000000   1745 ns/op   512 B/op    6 allocs/op
BrancaSuite.BenchmarkBrancaDecoding             5000000    375 ns/op    48 B/op    2 allocs/op
BrancaSuite.BenchmarkBrancaDecodingFromString   1000000   1523 ns/op   456 B/op    9 allocs/op
BrancaSuite.BenchmarkBrancaEncoding             1000000   1781 ns/op   152 B/op    4 allocs/op
BrancaSuite.BenchmarkBrancaEncodingToString      500000   4072 ns/op   664 B/op   10 allocs/op

Build Status

Branch Status
master CI
develop CI

License

MIT

More Repositories

1

aligo

Utility for checking and viewing Golang struct alignment info
Go
50
star
2

ek

Auxiliary packages for Golang
Go
40
star
3

go-confluence

Go package for working with Atlassian Confluence Server REST API
Go
31
star
4

translit

Go package for Russian text transliteration
Go
30
star
5

sslscan

Go package for working with SSLLabs API
Go
19
star
6

sslcli

Pretty awesome command-line client for public SSLLabs API
Go
19
star
7

bibop

Utility for testing command-line tools, daemons, and packages
Go
18
star
8

gomakegen

Utility for generating makefiles for Golang applications
Go
17
star
9

zip7

Go package with p7zip wrapper for working with 7z files
Go
17
star
10

webkaos

WEBKAOS is a web-server based on latest version of Nginx with many improvements
Shell
14
star
11

z7

Go package with p7zip wrapper for working with 7z files
12
star
12

shdoc

Tool for viewing and exporting docs for shell scripts
Go
12
star
13

go-badge

Go package for generating SVG badges
Go
10
star
14

7zcat

Utility for uncompressing data from 7z archive to stdout
Shell
10
star
15

kaos-repo

Spec files and patches for ESSENTIAL KAOS public YUM/DNF repository
Shell
8
star
16

redis-latency-monitor

Tiny Redis client for latency measurement
Go
7
star
17

rbinstall

Utility for installing prebuilt Ruby versions to RBEnv
Go
7
star
18

perfecto

Utility for linting RPM spec files
Go
7
star
19

pkgre

Versioned import paths for Go language
Go
7
star
20

atlassian-remixed-theme

Remixed theme for Atlassian JIRA 9.x and Confluence 7.x
CSS
6
star
21

go-crowd

Go package for working with Atlassian Crowd REST API
Go
6
star
22

go-icecast

Go package for working with Icecast API
Go
6
star
23

rpmbuilder

RPM package build helper
Shell
6
star
24

imc

Icecast Mission Control (IMC)
Go
5
star
25

mdtoc

Utility for generating table of contents for markdown files
Go
5
star
26

mockka

Utility for mocking and testing HTTP API's
Go
4
star
27

gopack

A simple tool for packing Go packages sources with all dependencies
Shell
4
star
28

repoview-kaos

repoview creates a set of static HTML pages in a yum repository for easy browsing
Python
4
star
29

bash-parsers

A collection of bash code snippets used in different projects
Shell
4
star
30

redis-monitor-top

Tiny Redis client for aggregating stats from MONITOR flow
Go
4
star
31

redis-cli-monitor

Tiny Redis client for renamed MONITOR commands
Go
4
star
32

honeypot-data

Logins and passwords from our honeypots
3
star
33

go-linenoise

Go package wrapping the linenoise C library
C
3
star
34

sonar

Service for showing Slack status in Jira
Go
2
star
35

go-zabbix-jmx

Go package for retrieving and parsing data from Zabbix Java Gateway
Go
2
star
36

blackhole-theme-sublime

BLACKHâš«LE Theme for Sublime Text 3/4
2
star
37

npck

Go package for unpacking various types of archives
Go
2
star
38

shellcheck-action

GitHub action for checking scripts with Shellcheck
2
star
39

rbbuild

Utility for compiling and installing different Ruby versions
Shell
2
star
40

blackhole-theme-nano

BLACKHâš«LE Theme for Nano
2
star
41

yo

Command-line YAML processor
Go
2
star
42

logcat

Utility for log viewing with additional access control mechanism
Shell
2
star
43

go-zabbix

Go package for sending metrics to Zabbix Server
Go
2
star
44

ftllister

Utility for listing directories with huge amounts of files (several billion)
C
2
star
45

go-jira

Go package for working with Atlassian JIRA REST API
Go
2
star
46

icecli

Command-line tools for working with Icecast Admin API
Go
2
star
47

deadline

Simple utility for controlling application working time
Go
2
star
48

rds

Tool for Redis orchestration
Go
2
star
49

contributing-guidelines

Contributing guidelines for open-source EK projects
1
star
50

web-utils

Helpers for working with web server
Shell
1
star
51

webkaos-fancy-errors

Fancy error pages for WEBKAOS/Nginx
HTML
1
star
52

jira-reindex-runner

Application for periodical running Jira re-index process
Go
1
star
53

go-simpleyaml

A Go package to interact with arbitrary YAML
Go
1
star
54

swptop

Utility for viewing swap consumption of processes
Go
1
star
55

fz

Tool for fuzzing with style 👌
Go
1
star
56

rsz

Simple utility for image resizing
Go
1
star
57

slacker

Simple go package for bootstraping Slack bots
Go
1
star
58

yum-plugin-fromrepo

Yum plugin to simplify working with only one repository
Python
1
star
59

perfecto-action

GitHub action for checking RPM spec files with Perfecto
1
star
60

go-jar

Very simple Go package for reading manifest data from JAR files
Go
1
star
61

anicorn

Simple utility for starting/restarting Unicorn
Shell
1
star
62

go-nginx

Go package for reading NGINX configuration files
Go
1
star
63

mkcryptpasswd

Utility for hashing passwords
Shell
1
star
64

librato

Package for working with Librato Metrics API from go code
Go
1
star
65

goheft

Utility for listing sizes of used static libraries
Go
1
star
66

kaosv

Bash lib for SysV init scripts
Shell
1
star
67

htmlcov

Utility for converting Go coverage profiles into HTML pages
Go
1
star
68

go-keepalived

Go package for reading virtual IP info from keepalived configuration file
Go
1
star
69

oraclelinux

Dockerfiles for the latest versions of Oracle Linux with the latest updates
Shell
1
star