tokens

package
v0.31.0-rc.6 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEmptyPublicKeys is returned when no HCS keys are provided.
	ErrEmptyPublicKeys = errors.New("HCS public keys could not be empty")
	// ErrEmptyBearerToken is returned when no bearer token is provided.
	ErrEmptyBearerToken = errors.New("Bearer token could not be empty")
)
View Source
var ErrCustomAccessKeyIDNotFound = errors.New("custom AccessKeyId not found")

Functions

This section is empty.

Types

type Box added in v0.31.0

type Box struct {
	AccessBox  *accessbox.AccessBox
	Attributes []object.Attribute
	Address    *oid.Address
}

type Config added in v0.29.0

type Config struct {
	FrostFS                     FrostFS
	Key                         *keys.PrivateKey
	CacheConfig                 *cache.Config
	RemovingCheckAfterDurations time.Duration
}

type Credentials

Credentials is a bearer token get/put interface.

func New

func New(cfg Config) Credentials

New creates a new Credentials instance using the given cli and key.

type CredentialsParam added in v0.29.0

type CredentialsParam struct {
	Container        cid.ID
	AccessKeyID      string
	AccessBox        *accessbox.AccessBox
	Expiration       uint64
	Keys             keys.PublicKeys
	CustomAttributes []object.Attribute
}

type FrostFS

type FrostFS interface {
	// CreateObject creates and saves a parameterized object in the specified
	// FrostFS container from a specific user. It sets 'Timestamp' attribute to the current time.
	// It returns the ID of the saved object.
	//
	// It returns exactly one non-nil value. It returns any error encountered which
	// prevented the object from being created.
	CreateObject(context.Context, PrmObjectCreate) (oid.ID, error)

	// GetCredsObject gets the credential object from FrostFS network.
	// It uses search by system name and select using CRDT 2PSet. In case of absence CRDT header
	// it heads object by address.
	//
	// It returns exactly one non-nil value. It returns any error encountered which
	// prevented the object payload from being read.
	// Returns ErrCustomAccessKeyIDNotFound if provided AccessKey is custom, and it was not found.
	// Object must contain full payload.
	GetCredsObject(context.Context, PrmGetCredsObject) (*object.Object, error)
}

FrostFS represents virtual connection to FrostFS network.

type PrmGetCredsObject added in v0.31.0

type PrmGetCredsObject struct {
	// FrostFS container to get the object.
	Container cid.ID

	// S3 access key id.
	AccessKeyID string

	// FallbackAddress is an address that should be used to get creds if we couldn't find it by AccessKeyID.
	// Optional.
	FallbackAddress *oid.Address
}

PrmGetCredsObject groups parameters of getting credential object.

type PrmObjectCreate

type PrmObjectCreate struct {
	// FrostFS container to store the object.
	Container cid.ID

	// File path.
	Filepath string

	// Optional.
	// If provided cred object will be created using crdt approach.
	NewVersionForAccessKeyID string

	// Optional.
	// If provided cred object will contain specific crdt name attribute for first accessbox object version.
	// If NewVersionForAccessKeyID is provided this field isn't used.
	CustomAccessKey string

	// Last FrostFS epoch of the object lifetime.
	ExpirationEpoch uint64

	// Object payload.
	Payload []byte

	// CustomAttributes are additional user provided attributes for box object.
	CustomAttributes []object.Attribute
}

PrmObjectCreate groups parameters of objects created by credential tool.

Jump to

Keyboard shortcuts

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