token

package
v0.0.0-...-30b4a77 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2016 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package token implements token type and handling functions.

Index

Constants

View Source
const (
	// KeyIDSize is the length of the KeyID
	KeyIDSize = 32
	// NonceSize is the size of the nonce
	NonceSize = 16
	// OwnerSize is the length of the Owner key
	OwnerSize = ed25519.PublicKeySize
)

Variables

View Source
var Rand = rand.Reader

Rand is the random number source.

Functions

This section is empty.

Types

type Token

type Token struct {
	KeyID []byte // The ID of the KeyID, 32 byte
	Flag  bool   // Flag. 0x01 == verify signature
	Nonce []byte // Random nonce
	Owner []byte // Key for owner verification

	PointRX []byte // PointR, X coordinate
	PointRY []byte // PointR, Y coordinate
	ScalarS []byte // S Scalar
	ScalarR []byte // R Scalar
}

Token without signature.

func New

func New(KeyID *[signkeys.KeyIDSize]byte, Owner *[ed25519.PublicKeySize]byte) *Token

New creates a new Token.

func Unmarshal

func Unmarshal(d []byte) (*Token, error)

Unmarshal an encoded token.

func (*Token) AddSignature

func (t *Token) AddSignature(signature *jjm.ClearSignature)

AddSignature adds the signature to the token.

func (*Token) GetSignature

func (t *Token) GetSignature() *jjm.ClearSignature

GetSignature returns the signature that is part of the token.

func (Token) HasOwner

func (t Token) HasOwner() bool

HasOwner returns true if the Token is owned.

func (Token) Hash

func (t Token) Hash() []byte

Hash returns the hash of the token.

func (Token) Marshal

func (t Token) Marshal() ([]byte, error)

Marshal a token.

func (Token) Properties

func (t Token) Properties() (keyid *[signkeys.KeyIDSize]byte, owner *[ed25519.PublicKeySize]byte)

Properties returns the owner and keyID of a token.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL