authsdk

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPError

type HTTPError struct {
	StatusCode int
	Message    string
}

func (*HTTPError) Error

func (e *HTTPError) Error() string

type RPCError

type RPCError struct {
	Code    int
	Message string
	Data    any
}

func (*RPCError) Error

func (e *RPCError) Error() string

type Session

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

func NewSession

func NewSession(didDocumentPath string, privateKeyPath string, identityName string, did string, jwtToken string, persistToken func(string) error) *Session

func (*Session) CaptureToken

func (s *Session) CaptureToken(serverURL string, headers http.Header) string

func (*Session) ChallengeHeaders

func (s *Session) ChallengeHeaders(serverURL string, headers http.Header, method string, body []byte) (map[string]string, error)

func (*Session) ClearToken

func (s *Session) ClearToken(serverURL string)

func (*Session) CurrentJWT

func (s *Session) CurrentJWT() string

func (*Session) DoJSON

func (s *Session) DoJSON(ctx context.Context, client *http.Client, method string, requestURL string, payload any, out any) error

func (*Session) DoJSONRPC

func (s *Session) DoJSONRPC(ctx context.Context, client *http.Client, requestURL string, method string, rpcMethod string, params any, out any) error

func (*Session) EnsureJWT

func (s *Session) EnsureJWT(ctx context.Context, client *http.Client, requestURL string) (string, error)

func (*Session) Headers

func (s *Session) Headers(serverURL string, method string, body []byte, forceNew bool) (map[string]string, error)

func (*Session) RememberScope

func (s *Session) RememberScope(serverURL string)

RememberScope marks a server scope as safe to persist bearer tokens returned by that scope. It is intentionally separate from SetBearer so first-time signed requests without an existing JWT can still store the token returned in Authentication-Info.

func (*Session) SetBearer

func (s *Session) SetBearer(serverURL string, token string)

func (*Session) ShouldRetryAfter401

func (s *Session) ShouldRetryAfter401(headers http.Header) bool

Jump to

Keyboard shortcuts

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