func AuthReadAsyncReplyByUUID(ctx context.Context) error {
	if securityModule != nil && !IsSystemContext(ctx) {
		authCtx := GetAuthContext(ctx)
		if authCtx == nil {
			return errors.Errorf(errors.SecurityModuleNoAuthContext)
		}
		return securityModule.AuthReadAsyncReplyByUUID(authCtx)
	}
	return nil
}
AuthReadAsyncReplyByUUID authorize the query of an invidual reply by UUID
package auth
import (
	"context"
	"github.com/hyperledger/firefly-ethconnect/internal/errors"
	"github.com/hyperledger/firefly-ethconnect/pkg/plugins"
)
type ContextKey int
const (
	ContextKeySystemAuth ContextKey = iota
	ContextKeyAuthContext
	ContextKeyAccessToken
)
var securityModule plugins.SecurityModule
func RegisterSecurityModule(sm plugins.SecurityModule) {
	securityModule = sm
}
func NewSystemAuthContext() context.Context {
	return context.WithValue(context.Background(), ContextKeySystemAuth, true)
}
func IsSystemContext(ctx context.Context) bool {
	b, ok := ctx.Value(ContextKeySystemAuth).(bool)
	return ok && b
}
func WithAuthContext(ctx context.Context, token string) (context.Context, error) {
	if securityModule != nil {
		ctxValue, err := securityModule.VerifyToken(token)
		if err != nil {
			return nil, err
		}
		ctx = context.WithValue(ctx, ContextKeyAccessToken, token)
		ctx = context.WithValue(ctx, ContextKeyAuthContext, ctxValue)
		return ctx, nil
	}
	return ctx, nil
}
func GetAuthContext(ctx context.Context) interface{} {
	return ctx.Value(ContextKeyAuthContext)
}
func GetAccessToken(ctx context.Context) string {
	v, ok := ctx.Value(ContextKeyAccessToken).(string)
	if ok {
		return v
	}
	return ""
}
func AuthRPC(ctx context.Context, method string, args ...interface{}) error {
	if securityModule != nil && !IsSystemContext(ctx) {
		authCtx := GetAuthContext(ctx)
		if authCtx == nil {
			return errors.Errorf(errors.SecurityModuleNoAuthContext)
		}
		return securityModule.AuthRPC(authCtx, method, args...)
	}
	return nil
}
func AuthRPCSubscribe(ctx context.Context, namespace string, channel interface{}, args ...interface{}) error {
	if securityModule != nil && !IsSystemContext(ctx) {
		authCtx := GetAuthContext(ctx)
		if authCtx == nil {
			return errors.Errorf(errors.SecurityModuleNoAuthContext)
		}
		return securityModule.AuthRPCSubscribe(authCtx, namespace, channel, args...)
	}
	return nil
}
func AuthEventStreams(ctx context.Context) error {
	if securityModule != nil && !IsSystemContext(ctx) {
		authCtx := GetAuthContext(ctx)
		if authCtx == nil {
			return errors.Errorf(errors.SecurityModuleNoAuthContext)
		}
		return securityModule.AuthEventStreams(authCtx)
	}
	return nil
}
func AuthListAsyncReplies(ctx context.Context) error {
	if securityModule != nil && !IsSystemContext(ctx) {
		authCtx := GetAuthContext(ctx)
		if authCtx == nil {
			return errors.Errorf(errors.SecurityModuleNoAuthContext)
		}
		return securityModule.AuthListAsyncReplies(authCtx)
	}
	return nil
}