servicekey

package
v0.2.92 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resource

type Resource struct {
	// Type is the resource's type
	//
	// This can be customized to the application that is using the Service Key
	Type string `json:"type"`

	// ID is the resource's unique identifier
	ID string `json:"id"`
}

Resource represents a resource that a Service Key is authorized to access

type ServiceKey

type ServiceKey struct {
	// Identifier is the Service Key's unique identifier
	Identifier string `json:"identifier"`

	// Salt is the Service Key's salt
	//
	// This is meant to be randomly generated for each Service Key
	Salt []byte `json:"salt"`

	// Hash is the hashed secret of the Service Key session
	//
	// This is generated from the service key's identifier, secret, and salt.
	// The secret is never stored.
	Hash []byte `json:"hash"`

	// Creator is the creator's unique identifier
	Creator string `json:"creator"`

	// Organization is the organization that the Service Key is scoped to
	Organization string `json:"organization"`

	// Resources are the resources that the Service Key is authorized to access (optional)
	Resources []Resource `json:"resources"`

	// MaxUses is the maximum number of times the Service Key can be used (optional)
	MaxUses int64 `json:"max_uses"`

	// NumUsed is the number of times the Service Key has been used (optional unless MaxUses is set)
	NumUsed int64 `json:"num_used"`

	// Expires is the time at which the Service Key expires (optional)
	Expires time.Time `json:"expires"`
}

ServiceKey represents a Service Key

Jump to

Keyboard shortcuts

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