encoding

package
v0.0.0-...-7eb8b13 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2021 License: NCSA Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChallengeResponse

type ChallengeResponse struct {
	Challenge string `json:"challenge"`
	Response  string `json:"response"`
	Algorithm string `json:"algorithm"`
}

type CompositeKey

type CompositeKey struct {
	// Name of the composite key.
	Name string `json:"composite"`

	// Created time.
	Created time.Time `json:"created"`

	// Cipher key.
	Cipher *Key `json:"cipher"`

	// HMAC key.
	HMAC *Key `json:"hmac"`
}

CompositeKey is a helper type for encoding composite keys.

type Encodable

type Encodable struct {
	KeyRing   *api.KeyRing
	Keys      []*api.Key
	Key       *api.Key
	Composite *api.CompositeKey
}

type Encoded

type Encoded struct {
	KeyRing *KeyRing `json:"keyring,omitempty"`

	Key *Key `json:"key,omitempty"`

	Keys []*Key `json:"keys,omitempty"`

	Composite *CompositeKey `json:"composite,omitempty"`
}

func Encode

func Encode(data Encodable) *Encoded

func EncodeKeys

func EncodeKeys(data Encodable) *Encoded

type Key

type Key struct {
	// Name of the key.
	Name string `json:"key"`

	// Length indicates the key length requested by the client.
	Length int `json:"length"`

	// Created time.
	Created time.Time `json:"created"`

	// Encoded data in base64 format. Ordinarily this is ignored, but may be
	// supplied by the client. If the key is flagged as containing custom data,
	// this value may be used to set it. Otherwise it is ignored.
	Encoded string `json:"encoded"`

	// IsComposite key.
	IsComposite bool `json:"composite,omitempty"`

	// Custom key.
	Custom bool `json:"custom,omitempty"`
}

Key encapsulates server-encodable keys.

type KeyData

type KeyData struct {
	// Name of the key for which this data should be applied. This is not required
	// for all requests (PUT requests don't need it) but may be specified if
	// unsure.
	Name string `json:"name,omitempty"`

	// KeyRing name.
	KeyRing string `json:"keyring,omitempty"`

	// Type of key. Default is "key" but may be "composite" to indicate the
	// requested key should be created as a composite key. Composite types require
	// the presence of the fields CipherLength and HMACLength. "custom" may also
	// be specified for custom keys but is not currently supported.
	Type string `json:"type,omitempty"`

	// Created timestamp indicating when the key itself was created. This value
	// may reflect either key ring creation times or individual key creations.
	// This value is not changed when the key is rotated.
	Created time.Time `json:"created"`

	// Rotated timestamp indicating when the key ring was rotated. If this value
	// IsZero() it will be omitted.
	Rotated time.Time `json:"rotated,omitempty"`

	// TTL, or time to live, of the key ring before it is considered expired. For
	// PUT requests, this only affects key rings that haven't been created; for
	// POST requests, this will overwrite the previous value.
	TTL int `json:"ttl,omitempty"`

	// DeleteAfter is a hint for the system to determine after which time this key
	// ring should be removed after expiration. For PUT requests, this only
	// affects key rings that haven't been created; for POST requests, this will
	// overwrite the previous value.
	DeleteAfter int `json:"delete_after,omitempty"`

	// RotateAfter is a hint for the system to determine when a key ring should
	// have all of its keys automatically rotated. For PUT requests, this only
	// affects key rings that haven't been created; for POST requests, this will
	// overwrite the previous value.
	RotateAfter int `json:"rotate_after,omitempty"`

	// Length indicates the key length requested by the client.
	Length int `json:"length,omitempty"`

	// CipherLength indicates the length requested by the client for a composite
	// cipher key.
	CipherLength int `json:"cipher_length,omitempty"`

	// HMACLength indicates the length requested by the client for a composite
	// HMAC key.
	HMACLength int `json:"hmac_length,omitempty"`

	// Encoded data in base64 format. Ordinarily this is ignored, but may be
	// supplied by the client. If the key is flagged as containing custom data,
	// this value may be used to set it. Otherwise it is ignored.
	Encoded string `json:"encoded,omitempty"`

	// Keys contains a list of key definitions for endpoints that can accept
	// multiple keys for creation. If defined, only the Name, Length,
	// CipherLength, and HMACLength attributes will be read.
	Keys *KeyData `json:"keys,omitempty"`
}

Key data as derived from client-submitted data.

type KeyRing

type KeyRing struct {
	// Name of the key ring.
	Name string `json:"keyring"`

	// Created timestamp indicating when the key itself was created. This value
	// may reflect either key ring creation times or individual key creations.
	// This value is not changed when the key is rotated.
	Created time.Time `json:"created"`

	// Rotated timestamp indicating when the key ring was rotated. If this value
	// IsZero() it will be omitted.
	Rotated time.Time `json:"rotated,omitempty"`

	// TTL, or time to live, of the key ring before it is considered expired. For
	// PUT requests, this only affects key rings that haven't been created; for
	// POST requests, this will overwrite the previous value.
	TTL int `json:"ttl,omitempty"`

	// DeleteAfter is a hint for the system to determine after which time this key
	// ring should be removed after expiration. For PUT requests, this only
	// affects key rings that haven't been created; for POST requests, this will
	// overwrite the previous value.
	DeleteAfter int `json:"delete_after,omitempty"`

	// RotateAfter is a hint for the system to determine when a key ring should
	// have all of its keys automatically rotated. For PUT requests, this only
	// affects key rings that haven't been created; for POST requests, this will
	// overwrite the previous value.
	RotateAfter int `json:"rotate_after,omitempty"`

	// Key contains singular key data for the requested key ring.
	Key *Key `json:"key,omitempty"`

	// Composite contains singular composite key data for the requested key ring.
	Composite *CompositeKey `json:"composite,omitempty"`

	// Keys contains a list of key definitions for endpoints that can accept
	// multiple keys for creation. If defined, only the Name, Length,
	// CipherLength, and HMACLength attributes will be read.
	Keys []*Key `json:"keys,omitempty"`
}

KeyRing encapsulates server-encodable properties for individual key rings.

type Patch

type Patch struct {
	Op    string `json:"op"`
	Path  string `json:"path"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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