kitekey

package
v0.0.0-...-baa1a54 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2018 License: MIT Imports: 9 Imported by: 100

Documentation

Overview

Package kitekey provides method for reading and writing kite.key file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetKontrolKey

func GetKontrolKey(token *jwt.Token) (interface{}, error)

GetKontrolKey is used as key getter func for jwt.Parse() function.

func KiteHome

func KiteHome() (string, error)

KiteHome returns the home path of Kite directory. The returned value can be overridden by setting KITE_HOME environment variable.

func Parse

func Parse() (*jwt.Token, error)

Parse the kite.key file and return it as JWT token.

func ParseFile

func ParseFile(file string) (*jwt.Token, error)

ParseFile reads the given kite key file and parses it as a JWT token.

func Read

func Read() (string, error)

Read the contents of the kite.key file.

func Write

func Write(kiteKey string) error

Write over the kite.key file.

Types

type Extractor

type Extractor struct {
	Token  *jwt.Token
	Claims *KiteClaims
}

Extractor is used to extract kontrol key from JWT token.

func (*Extractor) Extract

func (e *Extractor) Extract(token *jwt.Token) (interface{}, error)

Extract is a keyFunc argument for jwt.Parse function.

type KiteClaims

type KiteClaims struct {
	jwt.StandardClaims
	KontrolKey string `json:"kontrolKey,omitempty"`
	KontrolURL string `json:"kontrolURL,omitempty"`
}

KiteClaims represents JWT token claims extended with kontrolKey claim.

Jump to

Keyboard shortcuts

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