Documentation ¶
Index ¶
- Variables
- type DDBBatchWriteItemApi
- type DDBClient
- type DDBGetItemApi
- type DDBPutItemApi
- type DDBQueryApi
- type DDBTransactWriteItemsApi
- type DynamoDbStore
- func (d *DynamoDbStore) AddEncryptedToc(id string, encryptedToc string) error
- func (d *DynamoDbStore) CreateSession(session *api.Session, encryptedTEK []byte, encryptedTocZero string) error
- func (d *DynamoDbStore) GarbageCollect(func(session *api.Session) bool)
- func (d *DynamoDbStore) GetEncryptedTocs(id string) ([]string, error)
- func (d *DynamoDbStore) GetSession(id string) (*api.Session, error)
- func (d *DynamoDbStore) GetTEK(id string) ([]byte, error)
- type InMemoryStore
- func (i *InMemoryStore) AddEncryptedToc(id string, encryptedToc string) error
- func (i *InMemoryStore) CreateSession(session *api.Session, encryptedTEK []byte, encryptedTocZero string) error
- func (i *InMemoryStore) GarbageCollect(shouldDelete func(session *api.Session) bool)
- func (i *InMemoryStore) GetEncryptedTocs(id string) ([]string, error)
- func (i *InMemoryStore) GetSession(id string) (*api.Session, error)
- func (i *InMemoryStore) GetTEK(id string) ([]byte, error)
- type Oracle
- type Store
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrEmptyToc = errors.New("the provided Toc is empty")
View Source
var ErrKekInvalidLength = errors.New("the provided kek has an invalid length")
View Source
var ErrNotEnoughTocs = errors.New("the provided Tocs are less than the threshold")
View Source
var ErrSessionAlreadyExists = errors.New("a session with the requested ID already exists")
View Source
var ErrSessionNotFound = errors.New("session not found")
View Source
var ErrTocAlreadyExists = errors.New("the provided Toc already exists")
View Source
var ErrTocIsNotEncrypted = errors.New("the provided Toc is not a valid age armored string")
Functions ¶
This section is empty.
Types ¶
type DDBBatchWriteItemApi ¶
type DDBBatchWriteItemApi interface {
BatchWriteItem(ctx context.Context, params *ddb.BatchWriteItemInput, optFns ...func(*ddb.Options)) (*ddb.BatchWriteItemOutput, error)
}
type DDBClient ¶
type DDBClient interface { DDBGetItemApi DDBQueryApi DDBPutItemApi DDBBatchWriteItemApi DDBTransactWriteItemsApi }
type DDBGetItemApi ¶
type DDBGetItemApi interface {
GetItem(ctx context.Context, params *ddb.GetItemInput, optFns ...func(*ddb.Options)) (*ddb.GetItemOutput, error)
}
type DDBPutItemApi ¶
type DDBPutItemApi interface {
PutItem(ctx context.Context, params *ddb.PutItemInput, optFns ...func(*ddb.Options)) (*ddb.PutItemOutput, error)
}
type DDBQueryApi ¶
type DDBQueryApi interface {
Query(ctx context.Context, params *ddb.QueryInput, optFns ...func(*ddb.Options)) (*ddb.QueryOutput, error)
}
type DDBTransactWriteItemsApi ¶
type DDBTransactWriteItemsApi interface {
TransactWriteItems(ctx context.Context, params *ddb.TransactWriteItemsInput, optFns ...func(*ddb.Options)) (*ddb.TransactWriteItemsOutput, error)
}
type DynamoDbStore ¶
type DynamoDbStore struct {
// contains filtered or unexported fields
}
func (*DynamoDbStore) AddEncryptedToc ¶
func (d *DynamoDbStore) AddEncryptedToc(id string, encryptedToc string) error
func (*DynamoDbStore) CreateSession ¶
func (*DynamoDbStore) GarbageCollect ¶
func (d *DynamoDbStore) GarbageCollect(func(session *api.Session) bool)
func (*DynamoDbStore) GetEncryptedTocs ¶
func (d *DynamoDbStore) GetEncryptedTocs(id string) ([]string, error)
func (*DynamoDbStore) GetSession ¶
func (d *DynamoDbStore) GetSession(id string) (*api.Session, error)
type InMemoryStore ¶
type InMemoryStore struct {
// contains filtered or unexported fields
}
InMemoryStore simply stores session in the process memory. If HA or reliability in the event of failure is needed, this is clearly not a great option...
func (*InMemoryStore) AddEncryptedToc ¶
func (i *InMemoryStore) AddEncryptedToc(id string, encryptedToc string) error
func (*InMemoryStore) CreateSession ¶
func (*InMemoryStore) GarbageCollect ¶
func (i *InMemoryStore) GarbageCollect(shouldDelete func(session *api.Session) bool)
func (*InMemoryStore) GetEncryptedTocs ¶
func (i *InMemoryStore) GetEncryptedTocs(id string) ([]string, error)
func (*InMemoryStore) GetSession ¶
func (i *InMemoryStore) GetSession(id string) (*api.Session, error)
type Oracle ¶
type Oracle struct {
// contains filtered or unexported fields
}
func (*Oracle) CreateSession ¶
func (*Oracle) GenerateTOTP ¶
type Store ¶
type Store interface { // CreateSession is used to persist a new session. // It may return ErrSessionAlreadyExists if the ID in session has been already used CreateSession(session *api.Session, encryptedTEK []byte, encryptedTocZero string) error // GetSession retrieves a session by its ID. // ErrSessionNotFound may be returned if the provided ID does not exist. GetSession(id string) (*api.Session, error) // AddEncryptedToc is used to append a Toc to an existing session. // It may return ErrTocAlreadyExists if the provided value has already been seen // ErrSessionNotFound may also be returned. AddEncryptedToc(id string, encryptedToc string) error // GetEncryptedTocs returns a slice of strings with the encrypted Tocs GetEncryptedTocs(id string) ([]string, error) // GetTEK is used to retrieve the Toc encryption key GetTEK(id string) ([]byte, error) // GarbageCollect should process all sessions by sending them to the shouldDelete func; // if it returns true, remove the given session from storage GarbageCollect(shouldDelete func(session *api.Session) bool) }
Store is used to keep track of Sessions, and their Tocs ErrSessionNotFound may be returned by any method where a session is referenced by ID
func NewDynamoDbStore ¶
func NewInMemoryStore ¶
func NewInMemoryStore() Store
Click to show internal directories.
Click to hide internal directories.