Documentation ¶
Index ¶
- Constants
- func ReadNanoTDFHeader(reader io.Reader) (*nanoTdf, error)
- type Assertion
- type AuthConfig
- type EncryptedMetadata
- type EncryptionInformation
- type Error
- type IDPAccessTokenSource
- type IDPTokenExchangeTokenSource
- type IntegrityAlgorithm
- type IntegrityInformation
- type KASClient
- type KASInfo
- type KeyAccess
- type Manifest
- type Method
- type Option
- func WithAuthConfig(authConfig AuthConfig) Option
- func WithClientCredentials(clientID, clientSecret string, scopes []string) Option
- func WithCustomAuthorizationConnection(conn *grpc.ClientConn) Option
- func WithCustomPolicyConnection(conn *grpc.ClientConn) Option
- func WithExtraDialOptions(dialOptions ...grpc.DialOption) Option
- func WithInsecureConn() Option
- func WithTokenEndpoint(tokenEndpoint string) Option
- func WithTokenExchange(subjectToken string, audience []string) Option
- type Payload
- type PolicyBody
- type PolicyObject
- type Reader
- func (r *Reader) DataAttributes() ([]string, error)
- func (r *Reader) Manifest() Manifest
- func (r *Reader) Policy() (PolicyObject, error)
- func (r *Reader) Read(p []byte) (int, error)
- func (r *Reader) ReadAt(buf []byte, offset int64) (int, error)
- func (r *Reader) UnencryptedMetadata() ([]byte, error)
- func (r *Reader) WriteTo(writer io.Writer) (int64, error)
- type RequestBody
- type RootSignature
- type SDK
- type Segment
- type TDFConfig
- type TDFFormat
- type TDFObject
- type TDFOption
Constants ¶
const ( ErrGrpcDialFailed = Error("failed to dial grpc endpoint") ErrShutdownFailed = Error("failed to shutdown sdk") )
const ( JSONFormat = iota XMLFormat )
const ( HS256 = iota GMAC )
const (
ErrNanoTdfRead = Error("nanotdf read error")
)
Variables ¶
This section is empty.
Functions ¶
func ReadNanoTDFHeader ¶
Types ¶
type AuthConfig ¶
type AuthConfig struct {
// contains filtered or unexported fields
}
func NewAuthConfig ¶
func NewAuthConfig() (*AuthConfig, error)
NewAuthConfig Create a new instance of authConfig
func NewOIDCAuthConfig ¶
func NewOIDCAuthConfig(ctx context.Context, host, realm, clientID, clientSecret, subjectToken string) (*AuthConfig, error)
type EncryptedMetadata ¶
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 IDPAccessTokenSource ¶
type IDPAccessTokenSource struct {
// contains filtered or unexported fields
}
Credentials that allow us to connect to an IDP and obtain an access token that is bound to a DPoP key
func NewIDPAccessTokenSource ¶
func NewIDPAccessTokenSource( credentials oauth.ClientCredentials, idpTokenEndpoint string, scopes []string) (*IDPAccessTokenSource, error)
func (*IDPAccessTokenSource) AccessToken ¶
func (t *IDPAccessTokenSource) AccessToken() (auth.AccessToken, error)
use a pointer receiver so that the token state is shared
type IDPTokenExchangeTokenSource ¶
type IDPTokenExchangeTokenSource struct { IDPAccessTokenSource oauth.TokenExchangeInfo }
func NewIDPTokenExchangeTokenSource ¶
func NewIDPTokenExchangeTokenSource(exchangeInfo oauth.TokenExchangeInfo, credentials oauth.ClientCredentials, idpTokenEndpoint string, scopes []string) (*IDPTokenExchangeTokenSource, error)
func (IDPTokenExchangeTokenSource) AccessToken ¶
func (i IDPTokenExchangeTokenSource) AccessToken() (auth.AccessToken, error)
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 { // URL of the KAS server“ URL string // Public key can be empty. If it is empty, the public key will be fetched from the KAS server. PublicKey string }
KASInfo contains Key Access Server information.
type Manifest ¶
type Manifest struct { EncryptionInformation `json:"encryptionInformation"` Payload `json:"payload"` }
type Option ¶
type Option func(*config)
func WithAuthConfig ¶
func WithAuthConfig(authConfig AuthConfig) Option
temporary option to allow the for token exchange and the use of REST-ful KASs. this will likely change as we make these options more robust
func WithClientCredentials ¶
WithClientCredentials returns an Option that sets up authentication with client credentials.
func WithCustomAuthorizationConnection ¶
func WithCustomAuthorizationConnection(conn *grpc.ClientConn) Option
func WithCustomPolicyConnection ¶
func WithCustomPolicyConnection(conn *grpc.ClientConn) Option
func WithExtraDialOptions ¶
func WithExtraDialOptions(dialOptions ...grpc.DialOption) Option
func WithInsecureConn ¶
func WithInsecureConn() Option
WithInsecureConn returns an Option that sets up an http connection.
func WithTokenEndpoint ¶
When we implement service discovery using a .well-known endpoint this option may become deprecated
func WithTokenExchange ¶
WithTokenExchange specifies that the SDK should obtain its access token by exchanging the given token for a new one
type PolicyBody ¶
type PolicyBody interface {
// contains filtered or unexported methods
}
type PolicyObject ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func (*Reader) DataAttributes ¶
DataAttributes return the data attributes present in tdf.
func (*Reader) Policy ¶
func (r *Reader) Policy() (PolicyObject, error)
Policy returns a copy of the policy object in manifest, if it is valid. Otherwise, returns an error.
func (*Reader) Read ¶
Read reads up to len(p) bytes into p. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. It returns an io.EOF error when the stream ends.
func (*Reader) ReadAt ¶
ReadAt reads len(p) bytes into p starting at offset off in the underlying input source. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. It returns an io.EOF error when the stream ends. NOTE: For larger tdf sizes use sdk.GetTDFPayload for better performance
func (*Reader) UnencryptedMetadata ¶
UnencryptedMetadata return decrypted metadata in manifest.
type RequestBody ¶
type RootSignature ¶
type SDK ¶
type SDK struct { Namespaces namespaces.NamespaceServiceClient Attributes attributes.AttributesServiceClient ResourceMapping resourcemapping.ResourceMappingServiceClient SubjectMapping subjectmapping.SubjectMappingServiceClient KeyAccessServerRegistry kasregistry.KeyAccessServerRegistryServiceClient Authorization authorization.AuthorizationServiceClient // contains filtered or unexported fields }
type TDFConfig ¶
type TDFConfig struct {
// contains filtered or unexported fields
}
TDFConfig Internal config struct for building TDF options.
func NewTDFConfig ¶
NewTDFConfig CreateTDF a new instance of tdf config.
type TDFOption ¶
func WithDataAttributes ¶
WithDataAttributes appends the given data attributes to the bound policy
func WithKasInformation ¶
WithKasInformation adds all the kas urls and their corresponding public keys that is required to create and read the tdf.
func WithMetaData ¶
WithMetaData returns an Option that add metadata to TDF.
func WithSegmentSize ¶
WithSegmentSize returns an Option that set the default segment size to TDF.