token

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package token provides keychain storage for token.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithTokenStorage

func WithTokenStorage(options ...StorageOption) moneyloverapi.Option

WithTokenStorage sets keychain as a token storage for moneylover client.

Types

type KeychainStorage

type KeychainStorage interface {
	auth.TokenStorage

	// Delete deletes the token in keychain.
	Delete(ctx context.Context, key string) error
}

KeychainStorage manages credentials in keychain.

type Storage

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

Storage provides token from keychain.

func NewStorage

func NewStorage(options ...StorageOption) *Storage

NewStorage returns keychain as a token storage.

func (*Storage) Delete

func (s *Storage) Delete(_ context.Context, key string) error

Delete deletes the token in keychain.

func (*Storage) Get

func (s *Storage) Get(ctx context.Context, key string) (auth.OAuthToken, error)

Get gets token from keychain.

func (*Storage) Set

func (s *Storage) Set(ctx context.Context, key string, token auth.OAuthToken) error

Set persists token to keychain.

type StorageOption

type StorageOption func(s *Storage)

StorageOption configures Storage.

func WithKeyring

func WithKeyring(storage moneyloverkeychain.Storage) StorageOption

WithKeyring sets keychain storage for Storage.

Directories

Path Synopsis
Package mock provides mocks for keychain token storage.
Package mock provides mocks for keychain token storage.

Jump to

Keyboard shortcuts

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