Documentation ¶
Index ¶
- Constants
- Variables
- func CreateAuthorizationRequest(reason, sender, callbackURL string) protocol.AuthorizationRequestMessage
- func CreateAuthorizationRequestWithMessage(reason, message, sender, callbackURL string) protocol.AuthorizationRequestMessage
- func VerifyState(ctx context.Context, id, s *big.Int, opts state.ExtendedVerificationsOptions) error
- type Verifier
- func (v *Verifier) FullVerify(ctx context.Context, token string, ...) (*protocol.AuthorizationResponseMessage, error)
- func (v *Verifier) SetPackageManager(manager iden3comm.PackageManager)
- func (v *Verifier) SetPacker(packer iden3comm.Packer) error
- func (v *Verifier) SetupAuthV2ZKPPacker() error
- func (v *Verifier) SetupJWSPacker(didResolver packers.DIDResolverHandlerFunc) error
- func (v *Verifier) VerifyAuthResponse(ctx context.Context, response protocol.AuthorizationResponseMessage, ...) error
- func (v *Verifier) VerifyJWZ(ctx context.Context, token string, opts ...pubsignals.VerifyOpt) (t *jwz.Token, err error)
Constants ¶
const UniversalResolverURL = "https://dev.uniresolver.io/1.0/identifiers"
UniversalResolverURL is a url for universal resolver
Variables ¶
var UniversalDIDResolver = packers.DIDResolverHandlerFunc(func(did string) (*verifiable.DIDDocument, error) { didDoc := &verifiable.DIDDocument{} resp, err := http.Get(fmt.Sprintf("%s/%s", UniversalResolverURL, did)) if err != nil { return nil, err } defer func() { err := resp.Body.Close() if err != nil { log.Fatal(err) } }() body, err := io.ReadAll(resp.Body) if err != nil { return nil, err } var didMetadata map[string]interface{} err = json.Unmarshal(body, &didMetadata) if err != nil { return nil, err } doc, ok := didMetadata["didDocument"] if !ok { return nil, errors.New("did document not found") } docBts, err := json.Marshal(doc) if err != nil { return nil, err } err = json.Unmarshal(docBts, &didDoc) if err != nil { return nil, err } return didDoc, nil })
UniversalDIDResolver is a resolver for universal resolver
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 map[string]pubsignals.StateResolver, ) *Verifier
NewVerifier returns setup instance of auth library Deprecated: NewVerifier now return nil it can't set up default package manager for verifier, in future major release it will return error
func NewVerifierWithExplicitError ¶ added in v1.1.0
func NewVerifierWithExplicitError( keyLoader loaders.VerificationKeyLoader, claimSchemaLoader loaders.SchemaLoader, resolver map[string]pubsignals.StateResolver, ) (*Verifier, error)
NewVerifierWithExplicitError returns verifier instance with default package manager and explicit error if it couldn't register default packers in future major release it will be renamed to NewVerifier
func (*Verifier) FullVerify ¶
func (v *Verifier) FullVerify( ctx context.Context, token string, request protocol.AuthorizationRequestMessage, opts ...pubsignals.VerifyOpt, ) (*protocol.AuthorizationResponseMessage, error)
FullVerify performs verification of jwz token and auth request
func (*Verifier) SetPackageManager ¶ added in v1.1.0
func (v *Verifier) SetPackageManager(manager iden3comm.PackageManager)
SetPackageManager sets the package manager for the VerifierBuilder.
func (*Verifier) SetPacker ¶ added in v1.1.0
SetPacker sets the custom packer manager for the VerifierBuilder.
func (*Verifier) SetupAuthV2ZKPPacker ¶ added in v1.1.0
SetupAuthV2ZKPPacker sets the custom packer manager for the VerifierBuilder.
func (*Verifier) SetupJWSPacker ¶ added in v1.1.0
func (v *Verifier) SetupJWSPacker(didResolver packers.DIDResolverHandlerFunc) error
SetupJWSPacker sets the JWS packer for the VerifierBuilder.
func (*Verifier) VerifyAuthResponse ¶
func (v *Verifier) VerifyAuthResponse( ctx context.Context, response protocol.AuthorizationResponseMessage, request protocol.AuthorizationRequestMessage, opts ...pubsignals.VerifyOpt, ) error
VerifyAuthResponse performs verification of auth response based on auth request