authsdk

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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