Documentation ¶
Index ¶
Constants ¶
View Source
const ( KeyAlgo = 1 KeyAccountId = 100 KeyAccountNamespace = 101 KeyCapabilities = 110 )
View Source
const ( ValueHMAC = 1 ValueED25519 = 2 )
View Source
const (
Magic = 0x47
)
Variables ¶
View Source
var ( ErrBadToken = errors.New("bad token") ErrNoLongerValid = errors.New("token no longer valid") )
Functions ¶
func RemoveArmor ¶
Types ¶
type TokenCreator ¶
type TokenCreator struct { Role pb.TokenRole Issuer string AccountId *pb.ULID AccuntNamespace string Capabilities map[pb.Capability]string Metadata map[string]string ValidDuration time.Duration RawCapabilities []pb.TokenCapability }
func (*TokenCreator) EncodeED25519 ¶
func (c *TokenCreator) EncodeED25519(key ed25519.PrivateKey, keyId string) (string, error)
func (*TokenCreator) EncodeED25519WithVault ¶
func (*TokenCreator) EncodeHMAC ¶
func (c *TokenCreator) EncodeHMAC(key []byte, keyId string) (string, error)
type ValidToken ¶
func CheckTokenED25519 ¶
func CheckTokenED25519(stoken string, key ed25519.PublicKey) (*ValidToken, error)
func CheckTokenHMAC ¶
func CheckTokenHMAC(stoken string, key []byte) (*ValidToken, error)
func (*ValidToken) Account ¶
func (t *ValidToken) Account() *pb.Account
func (*ValidToken) AllowAccount ¶
func (t *ValidToken) AllowAccount(ns string) bool
func (*ValidToken) HasCapability ¶
func (t *ValidToken) HasCapability(target pb.Capability) (bool, string)
Click to show internal directories.
Click to hide internal directories.