Store auth info in a JWT token in a cookie

This commit is contained in:
Ken-Håvard Lieng 2016-01-15 02:27:30 +01:00
parent 3e0a1be6bc
commit fb54d4966c
18 changed files with 499 additions and 331 deletions

View file

@ -1,8 +1,8 @@
package storage
import (
"encoding/binary"
"log"
"os"
"github.com/khlieng/dispatch/Godeps/_workspace/src/github.com/boltdb/bolt"
)
@ -20,11 +20,6 @@ var (
func Initialize(dir string) {
Path = directory(dir)
err := os.MkdirAll(Path.Logs(), 0700)
if err != nil {
log.Fatal(err)
}
}
func Open() {
@ -46,3 +41,13 @@ func Open() {
func Close() {
db.Close()
}
func idToBytes(i uint64) []byte {
b := make([]byte, 8)
binary.BigEndian.PutUint64(b, i)
return b
}
func idFromBytes(b []byte) uint64 {
return binary.BigEndian.Uint64(b)
}