storage

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Unlicense Imports: 19 Imported by: 0

Documentation

Overview

Package storage provides an encrypted key value store and an RPC service for remote unlocking to prevent secrets being stored on remote nonvolatile storage.

Index

Constants

This section is empty.

Variables

View Source
var File_unlock_proto protoreflect.FileDescriptor
View Source
var UnlockService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "rpc.UnlockService",
	HandlerType: (*UnlockServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Unlock",
			Handler:    _UnlockService_Unlock_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "unlock.proto",
}

UnlockService_ServiceDesc is the grpc.ServiceDesc for UnlockService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func DB

func DB() *badger.DB

func InitFlags

func InitFlags(cmd *cobra.Command)

func RegisterUnlockServiceServer

func RegisterUnlockServiceServer(s grpc.ServiceRegistrar, srv UnlockServiceServer)

func Run

func Run()

Run is the main entry point for the storage service.

func Shutdown

func Shutdown() (err error)

func Txn

func Txn(tx func(txn *badger.Txn) error, update bool) (err error)

func Update

func Update(fn func(txn *badger.Txn) error) error

func View

func View(fn func(txn *badger.Txn) error) error

func WhenIsLocked

func WhenIsLocked() chan bool

func WhenIsUnlocked

func WhenIsUnlocked() chan bool

func WhenReady

func WhenReady() chan bool

func WhenStartFailed

func WhenStartFailed() chan error

Types

type Key

type Key [32]byte

func KeyGen

func KeyGen() (Key, error)

func (Key) Bytes

func (k Key) Bytes() []byte

func (*Key) Decode

func (k *Key) Decode(key string)

func (Key) Encode

func (k Key) Encode() string

type Service

type Service struct{}

func NewUnlockService

func NewUnlockService() *Service

func (*Service) Unlock

func (s *Service) Unlock(ctx context.Context, req *UnlockRequest) (res *UnlockResponse, err error)

type UnimplementedUnlockServiceServer

type UnimplementedUnlockServiceServer struct {
}

UnimplementedUnlockServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedUnlockServiceServer) Unlock

type UnlockRequest

type UnlockRequest struct {
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// contains filtered or unexported fields
}

func (*UnlockRequest) Descriptor deprecated

func (*UnlockRequest) Descriptor() ([]byte, []int)

Deprecated: Use UnlockRequest.ProtoReflect.Descriptor instead.

func (*UnlockRequest) GetKey

func (x *UnlockRequest) GetKey() string

func (*UnlockRequest) ProtoMessage

func (*UnlockRequest) ProtoMessage()

func (*UnlockRequest) ProtoReflect

func (x *UnlockRequest) ProtoReflect() protoreflect.Message

func (*UnlockRequest) Reset

func (x *UnlockRequest) Reset()

func (*UnlockRequest) String

func (x *UnlockRequest) String() string

type UnlockResponse

type UnlockResponse struct {
	Success bool    `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
	Message *string `protobuf:"bytes,2,opt,name=message,proto3,oneof" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*UnlockResponse) Descriptor deprecated

func (*UnlockResponse) Descriptor() ([]byte, []int)

Deprecated: Use UnlockResponse.ProtoReflect.Descriptor instead.

func (*UnlockResponse) GetMessage

func (x *UnlockResponse) GetMessage() string

func (*UnlockResponse) GetSuccess

func (x *UnlockResponse) GetSuccess() bool

func (*UnlockResponse) ProtoMessage

func (*UnlockResponse) ProtoMessage()

func (*UnlockResponse) ProtoReflect

func (x *UnlockResponse) ProtoReflect() protoreflect.Message

func (*UnlockResponse) Reset

func (x *UnlockResponse) Reset()

func (*UnlockResponse) String

func (x *UnlockResponse) String() string

type UnlockServiceClient

type UnlockServiceClient interface {
	Unlock(ctx context.Context, in *UnlockRequest, opts ...grpc.CallOption) (*UnlockResponse, error)
}

UnlockServiceClient is the client API for UnlockService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type UnlockServiceServer

type UnlockServiceServer interface {
	Unlock(context.Context, *UnlockRequest) (*UnlockResponse, error)
	// contains filtered or unexported methods
}

UnlockServiceServer is the server API for UnlockService service. All implementations must embed UnimplementedUnlockServiceServer for forward compatibility

type UnsafeUnlockServiceServer

type UnsafeUnlockServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeUnlockServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to UnlockServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

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