auth

package module
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: AGPL-3.0 Imports: 16 Imported by: 1

README

go-iden3-auth

Go Reference Go Report Card Test Lint

Library for verification of authorization response messages of communication protocol in JWZ format

go get github.com/iden3/go-iden3-auth

General description:

The goal of iden3auth libraries is to handle authentication messages of communication protocol.

Currently, library implementation includes support of next message types

  1. https://iden3-communication.io/authorization/1.0/request
  2. https://iden3-communication.io/authorization/1.0/response

Auth verification procedure:

  1. JWZ token verification
  2. Zero-knowledge proof verification of request proofs
  3. Query request verification for atomic circuits
  4. Verification of identity and issuer states for atomic circuits
Zero-knowledge proof verification

Groth16 proof are supported by auth library

Verification keys must be provided using KeyLoader interface

Query verification

Proof for each atomic circuit contains public signals that allow extracting user and issuer identifiers, states, signature challenges, etc.

Circuit public signals marshallers are defined in the go-circuits library.

Verification of user / issuer identity states

The blockchain verification algorithm is used

  1. Gets state from the blockchain (address of id state contract and URL must be provided by the caller of the library):

  2. Empty state is returned - it means that identity state hasn’t been updated or updated state hasn’t been published. We need to compare id and state. If they are different it’s not a genesis state of identity then it’s not valid.

  3. The non-empty state is returned and equals to the state in provided proof which means that the user state is fresh enough and we work with the latest user state.

  4. The non-empty state is returned and it’s not equal to the state that the user has provided. Gets the transition time of the state. The verification party can make a decision if it can accept this state based on that time frame

  5. Only latest states for user are valid. Any existing issuer state for claim issuance is valid.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAuthorizationRequest

func CreateAuthorizationRequest(reason, sender, callbackURL string) protocol.AuthorizationRequestMessage

CreateAuthorizationRequest creates new authorization request message sender - client identifier reason - describes purpose of request callbackURL - url for authorization response

func CreateAuthorizationRequestWithMessage

func CreateAuthorizationRequestWithMessage(reason, message, sender, callbackURL string) protocol.AuthorizationRequestMessage

CreateAuthorizationRequestWithMessage creates new authorization request with message for signing with jwz

func VerifyState

func VerifyState(ctx context.Context, id, s *big.Int, opts state.ExtendedVerificationsOptions) error

VerifyState allows to verify state without binding to verifier instance

Types

type Verifier

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

Verifier is a struct for auth instance

func NewVerifier

func NewVerifier(keyLoader loaders.VerificationKeyLoader, claimSchemaLoader loaders.SchemaLoader, resolver pubsignals.StateResolver) *Verifier

NewVerifier returns setup instance of auth library

func (*Verifier) FullVerify

FullVerify performs verification of jwz token and auth request

func (*Verifier) VerifyAuthResponse

VerifyAuthResponse performs verification of auth response based on auth request

func (*Verifier) VerifyJWZ

func (v *Verifier) VerifyJWZ(ctx context.Context, token string) (t *jwz.Token, err error)

VerifyJWZ performs verification of jwz token

Directories

Path Synopsis
mock
Package mock_verification is a generated GoMock package.
Package mock_verification is a generated GoMock package.

Jump to

Keyboard shortcuts

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