auth

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: May 11, 2022 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Name represents name of the service
	Name = "authorization-service"
	// AuthorizationRequestMessageType defines auth request type of the communication protocol
	AuthorizationRequestMessageType types.ProtocolMessage = protocol.ProtocolName + "/authorization-request/v1"
	// AuthorizationResponseMessageType defines auth response type of the communication protocol
	AuthorizationResponseMessageType types.ProtocolMessage = protocol.ProtocolName + "/authorization-response/v1"
)

Variables

This section is empty.

Functions

func CreateAuthorizationRequest

func CreateAuthorizationRequest(challenge int64, aud, callbackURL string) *types.AuthorizationMessageRequest

CreateAuthorizationRequest creates new authorization request message

func VerifyProofs added in v0.0.13

func VerifyProofs(message types.Message) (err error)

VerifyProofs verifies only zk proofs of authorization response message

Types

type UserToken

type UserToken struct {
	ID        string                            `json:"id"`
	Challenge string                            `json:"challenge"`
	State     string                            `json:"state"`
	Scope     map[string]map[string]interface{} `json:"scope"`
}

UserToken is token that can be used for user authorization

func ExtractMetadata

func ExtractMetadata(message types.Message) (token *UserToken, err error)

ExtractMetadata extract userToken from provided proofs

func (*UserToken) Update added in v0.0.5

func (token *UserToken) Update(scopeID string, metadata types.ProofMetadata) error

Update adds new metadata to user token

func (*UserToken) VerifyState

func (token *UserToken) VerifyState(ctx context.Context, url, addr string) (verification.StateVerificationResult, error)

VerifyState verifies state that is stored in the token

Jump to

Keyboard shortcuts

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