func ValidateToken(tokenString string) (*Token, error) {
	if len(tokenString) == 0 {
		return nil, ERR_TokenEmpty
	}
	var token *Token
	var err error
	if token, err = Store.GetToken(tokenString); err != nil {
		return nil, err
	}
	if token == nil || len(token.Value) == 0 {
		return nil, ERR_InvalidateToken
	}
	if token.Expired() {
		if err = Store.DeleteToken(token.Value); err != nil {
			return nil, err
		}
		return token, ERR_TokenExpired
	}
	return token, nil
}
Returns Exist tokenstring or error.
If token is exist but  expired, then delete token and return TokenExpired error.
package tokenauth
import (
	"errors"
	"time"
)
var TokenPeriod uint64 = 7200  
var Store TokenStore
func ChangeTokenStore(newStore TokenStore) error {
	if newStore == nil {
		return errors.New("tokenauth: new store is nil.")
	}
	if Store != nil {
		if err := Store.Close(); err != nil {
			return err
		}
	}
	Store = newStore
	return nil
}
func UseDeaultStore() error {
	s, err := NewStore("default", `{"path":"./data/tokendb.bolt"}`)
	if err != nil {
		return err
	}
	return ChangeTokenStore(s)
}
type GenerateSecretString func(clientID string) (secretString string)  
type GenerateTokenString func(audience *Audience) string  
func NewAudience(name string, secretFunc GenerateSecretString) (*Audience, error) {
	audience := NewAudienceNotStore(name, secretFunc)
	if err := Store.SaveAudience(audience); err != nil {
		return nil, err
	} else {
		return audience, nil
	}
}
func NewAudienceNotStore(name string, secretFunc GenerateSecretString) *Audience {
	audience := &Audience{
		Name:        name,
		ID:          NewObjectId().Hex(),
		TokenPeriod: TokenPeriod,
	}
	audience.Secret = secretFunc(audience.ID)
	return audience
}
func NewToken(a *Audience, tokenFunc GenerateTokenString) (*Token, error) {
	token := &Token{
		ClientID: a.ID,
		Value:    tokenFunc(a),
	}
	if a.TokenPeriod == 0 {
		token.DeadLine = 0
	} else {
		token.DeadLine = time.Now().Unix() + int64(a.TokenPeriod)
	}
	if err := Store.SaveToken(token); err != nil {
		return nil, err
	} else {
		return token, nil
	}
}
func NewSingleToken(singleID string, a *Audience, tokenFunc GenerateTokenString) (*Token, error) {
	token := &Token{
		SingleID: singleID,
		Value:    tokenFunc(a),
		DeadLine: time.Now().Unix() + int64(a.TokenPeriod),
	}
	if err := Store.SaveToken(token); err != nil {
		return nil, err
	} else {
		return token, nil
	}
}