sdk

package module
v0.0.0-...-112638b Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: BSD-3-Clause-Clear Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrGrpcDialFailed = Error("failed to dial grpc endpoint")
	ErrShutdownFailed = Error("failed to shutdown sdk")
)
View Source
const (
	JSONFormat = iota
	XMLFormat
)
View Source
const (
	HS256 = iota
	GMAC
)

Variables

This section is empty.

Functions

func Create

func Create(tdfConfig TDFConfig, reader io.ReadSeeker, writer io.Writer) (int64, error)

Create tdf

func GetAttributes

func GetAttributes(reader io.ReadSeeker) ([]string, error)

GetAttributes return the attributes present in tdf.

func GetMetadata

func GetMetadata(authConfig AuthConfig, reader io.ReadSeeker) (string, error)

GetMetadata return the meta present in tdf.

func GetPayload

func GetPayload(authConfig AuthConfig, reader io.ReadSeeker, writer io.Writer) (int64, error)

GetPayload decrypt the tdf and write the data to writer.

Types

type Assertion

type Assertion struct {
}

type AuthConfig

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

func NewAuthConfig

func NewAuthConfig() (*AuthConfig, error)

NewAuthConfig Create a new instance of authConfig

type EncryptionInformation

type EncryptionInformation struct {
	KeyAccessType        string      `json:"type"`
	Policy               string      `json:"policy"`
	KeyAccessObjs        []KeyAccess `json:"keyAccess"`
	Method               Method      `json:"method"`
	IntegrityInformation `json:"integrityInformation"`
}

type Error

type Error string

func (Error) Error

func (c Error) Error() string

type IntegrityAlgorithm

type IntegrityAlgorithm = int

type IntegrityInformation

type IntegrityInformation struct {
	RootSignature           `json:"rootSignature"`
	SegmentHashAlgorithm    string    `json:"segmentHashAlg"`
	DefaultSegmentSize      int64     `json:"segmentSizeDefault"`
	DefaultEncryptedSegSize int64     `json:"encryptedSegmentSizeDefault"`
	Segments                []Segment `json:"segments"`
}

type KASInfo

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

type KeyAccess

type KeyAccess struct {
	KeyType           string `json:"type"`
	KasURL            string `json:"url"`
	Protocol          string `json:"protocol"`
	WrappedKey        string `json:"wrappedKey"`
	PolicyBinding     string `json:"policyBinding"`
	EncryptedMetadata string `json:"encryptedMetadata"`
}

type Manifest

type Manifest struct {
	EncryptionInformation `json:"encryptionInformation"`
	Payload               `json:"payload"`
}

type Method

type Method struct {
	Algorithm    string `json:"algorithm"`
	IV           string `json:"iv"`
	IsStreamable bool   `json:"isStreamable"`
}

type Option

type Option func(*config)

func WithClientCredentials

func WithClientCredentials(clientID, clientSecret string) Option

WithClientCredentials returns an Option that sets up authentication with client credentials.

func WithInsecureConn

func WithInsecureConn() Option

WithInsecureConn returns an Option that sets up an http connection.

func WithToken

func WithToken(token string) Option

WithToken returns an Option that sets up authentication with a access token.

type Payload

type Payload struct {
	Type        string `json:"type"`
	URL         string `json:"url"`
	Protocol    string `json:"protocol"`
	MimeType    string `json:"mimeType"`
	IsEncrypted bool   `json:"isEncrypted"`
}

type RootSignature

type RootSignature struct {
	Algorithm string `json:"alg"`
	Signature string `json:"sig"`
}

type SDK

type SDK struct {
	Namespaces              namespaces.NamespaceServiceClient
	Attributes              attributes.AttributesServiceClient
	ResourceMapping         resourcemapping.ResourceMappingServiceClient
	SubjectMapping          subjectmapping.SubjectMappingServiceClient
	KeyAccessServerRegistry kasregistry.KeyAccessServerRegistryServiceClient
	// contains filtered or unexported fields
}

func New

func New(platformEndpoint string, opts ...Option) (*SDK, error)

func (SDK) Close

func (s SDK) Close() error

Close closes the underlying grpc.ClientConn.

func (SDK) Conn

func (s SDK) Conn() *grpc.ClientConn

Conn returns the underlying grpc.ClientConn.

func (SDK) TokenExchange

func (s SDK) TokenExchange(token string) (string, error)

ExchangeToken exchanges a access token for a new token. https://datatracker.ietf.org/doc/html/rfc8693

type Segment

type Segment struct {
	Hash          string `json:"hash"`
	Size          int64  `json:"segmentSize"`
	EncryptedSize int64  `json:"encryptedSegmentSize"`
}

type TDFConfig

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

func NewTDFConfig

func NewTDFConfig() (*TDFConfig, error)

NewTDFConfig Create a new instance of tdf config.

func (*TDFConfig) AddAttributes

func (tdfConfig *TDFConfig) AddAttributes(attributes []string)

AddAttributes Add all the attributes used to create and read the tdf.

func (*TDFConfig) AddKasInformation

func (tdfConfig *TDFConfig) AddKasInformation(kasInfoList []KASInfo) error

AddKasInformation Add all the kas urls and their corresponding public keys that is required to create and read the tdf.

func (*TDFConfig) DisableEncryption

func (tdfConfig *TDFConfig) DisableEncryption()

DisableEncryption TDFs create with this config will not be encrypted.

func (*TDFConfig) SetDefaultSegmentSize

func (tdfConfig *TDFConfig) SetDefaultSegmentSize(size int64)

SetDefaultSegmentSize Set the default segment size.

func (*TDFConfig) SetMetaData

func (tdfConfig *TDFConfig) SetMetaData(metaData string)

SetMetaData Set the meta data.

func (*TDFConfig) SetXMLFormat

func (tdfConfig *TDFConfig) SetXMLFormat()

SetXMLFormat TDFs created with this config will be in XML format.

type TDFFormat

type TDFFormat = int

Directories

Path Synopsis
Package attributes is a reverse proxy.
Package attributes is a reverse proxy.
Package authorization is a reverse proxy.
Package authorization is a reverse proxy.
Package kasregistry is a reverse proxy.
Package kasregistry is a reverse proxy.
Package namespaces is a reverse proxy.
Package namespaces is a reverse proxy.
Package resourcemapping is a reverse proxy.
Package resourcemapping is a reverse proxy.
Package subjectmapping is a reverse proxy.
Package subjectmapping is a reverse proxy.

Jump to

Keyboard shortcuts

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