magic

package module
v0.0.0-...-9c4cf42 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: MIT Imports: 6 Imported by: 0

README

go-magic

Magic admin Golang makes it easy to leverage Decentralized ID tokens to protect routes and restricted resources for your application.

Documentation

Index

Constants

View Source
const DIDTokenNBFGracePeriod = 300

DIDTokenNBFGracePeriod A grace period time in second applied to the nbf field for token validation.

View Source
const ExpectedDIDTokenContentLength = 2

ExpectedDIDTokenContentLength content

Variables

View Source
var RequiredFields = [7]string{
	"iat",
	"ext",
	"nbf",
	"iss",
	"sub",
	"aud",
	"tid",
}

RequiredFields required fields

Functions

This section is empty.

Types

type Token

type Token struct {
	// contains filtered or unexported fields
}

Token struct holding the didToken string, the proof and the claim (once decoded)

func New

func New(didToken string) (*Token, error)

New contructs a new token

func (*Token) Decode

func (t *Token) Decode() (string, map[string]interface{}, error)

Decode decode the didToken

func (*Token) Issuer

func (t *Token) Issuer() string

Issuer Extracts the iss from the DID Token.

func (*Token) PublicAddress

func (t *Token) PublicAddress() (string, error)

PublicAddress public address of the issuer

func (*Token) Validate

func (t *Token) Validate() error

Validate validate

Jump to

Keyboard shortcuts

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