Documentation ¶
Overview ¶
Package api is a generated protocol buffer package.
It is generated from these files:
librarian/api/documents.proto librarian/api/librarian.proto
It has these top-level messages:
Document Envelope Entry Metadata PageKeys Page RequestMetadata ResponseMetadata IntroduceRequest IntroduceResponse FindRequest FindResponse VerifyRequest VerifyResponse PeerAddress StoreRequest StoreResponse GetRequest GetResponse PutRequest PutResponse SubscribeRequest SubscribeResponse Publication Subscription BloomFilter
Index ¶
- Constants
- Variables
- func GetAuthorPub(d *Document) []byte
- func GetEntryPageKeys(entry *Document) ([]id.ID, error)
- func GetKey(value proto.Message) (id.ID, error)
- func RandBytes(rng *rand.Rand, length int) []byte
- func RegisterLibrarianServer(s *grpc.Server, srv LibrarianServer)
- func ValidateAESKey(value []byte) error
- func ValidateBytes(value []byte, expectedLen int, name string) error
- func ValidateDocument(d *Document) error
- func ValidateEntry(e *Entry) error
- func ValidateEnvelope(e *Envelope) error
- func ValidateHMAC256(value []byte) error
- func ValidateHMACKey(value []byte) error
- func ValidateMetadata(m *Metadata) error
- func ValidateMetadataIV(value []byte) error
- func ValidateNotEmpty(value []byte, name string) error
- func ValidatePage(p *Page) error
- func ValidatePageIVSeed(value []byte) error
- func ValidatePageKeys(pk *PageKeys) error
- func ValidatePublicKey(value []byte) error
- func ValidatePublication(p *Publication) error
- func ValidateSubscription(s *Subscription) error
- type BloomFilter
- type Document
- func (*Document) Descriptor() ([]byte, []int)
- func (m *Document) GetContents() isDocument_Contents
- func (m *Document) GetEntry() *Entry
- func (m *Document) GetEnvelope() *Envelope
- func (m *Document) GetPage() *Page
- func (*Document) ProtoMessage()
- func (m *Document) Reset()
- func (m *Document) String() string
- func (*Document) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, ...)
- type Document_Entry
- type Document_Envelope
- type Document_Page
- type Entry
- func (*Entry) Descriptor() ([]byte, []int)
- func (m *Entry) GetAuthorPublicKey() []byte
- func (m *Entry) GetContents() isEntry_Contents
- func (m *Entry) GetCreatedTime() int64
- func (m *Entry) GetMetadataCiphertext() []byte
- func (m *Entry) GetMetadataCiphertextMac() []byte
- func (m *Entry) GetPage() *Page
- func (m *Entry) GetPageKeys() *PageKeys
- func (*Entry) ProtoMessage()
- func (m *Entry) Reset()
- func (m *Entry) String() string
- func (*Entry) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, ...)
- type Entry_Page
- type Entry_PageKeys
- type Envelope
- func (*Envelope) Descriptor() ([]byte, []int)
- func (m *Envelope) GetAuthorPublicKey() []byte
- func (m *Envelope) GetEekCiphertext() []byte
- func (m *Envelope) GetEekCiphertextMac() []byte
- func (m *Envelope) GetEntryKey() []byte
- func (m *Envelope) GetReaderPublicKey() []byte
- func (*Envelope) ProtoMessage()
- func (m *Envelope) Reset()
- func (m *Envelope) String() string
- type FindRequest
- type FindResponse
- func (*FindResponse) Descriptor() ([]byte, []int)
- func (m *FindResponse) GetMetadata() *ResponseMetadata
- func (m *FindResponse) GetPeers() []*PeerAddress
- func (m *FindResponse) GetValue() *Document
- func (*FindResponse) ProtoMessage()
- func (m *FindResponse) Reset()
- func (m *FindResponse) String() string
- type Finder
- type GetRequest
- type GetResponse
- type Getter
- type IntroduceRequest
- func (*IntroduceRequest) Descriptor() ([]byte, []int)
- func (m *IntroduceRequest) GetMetadata() *RequestMetadata
- func (m *IntroduceRequest) GetNumPeers() uint32
- func (m *IntroduceRequest) GetSelf() *PeerAddress
- func (*IntroduceRequest) ProtoMessage()
- func (m *IntroduceRequest) Reset()
- func (m *IntroduceRequest) String() string
- type IntroduceResponse
- func (*IntroduceResponse) Descriptor() ([]byte, []int)
- func (m *IntroduceResponse) GetMetadata() *ResponseMetadata
- func (m *IntroduceResponse) GetPeers() []*PeerAddress
- func (m *IntroduceResponse) GetSelf() *PeerAddress
- func (*IntroduceResponse) ProtoMessage()
- func (m *IntroduceResponse) Reset()
- func (m *IntroduceResponse) String() string
- type Introducer
- type LibrarianClient
- type LibrarianServer
- type Librarian_SubscribeClient
- type Librarian_SubscribeServer
- type Metadata
- func (*Metadata) Descriptor() ([]byte, []int)
- func (m *Metadata) GetBytes(key string) ([]byte, bool)
- func (m *Metadata) GetCiphertextMAC() ([]byte, bool)
- func (m *Metadata) GetCiphertextSize() (uint64, bool)
- func (m *Metadata) GetMediaType() (string, bool)
- func (m *Metadata) GetProperties() map[string][]byte
- func (m *Metadata) GetString(key string) (string, bool)
- func (m *Metadata) GetUint64(key string) (uint64, bool)
- func (m *Metadata) GetUncompressedMAC() ([]byte, bool)
- func (m *Metadata) GetUncompressedSize() (uint64, bool)
- func (m *Metadata) MarshalLogObject(oe zapcore.ObjectEncoder) error
- func (*Metadata) ProtoMessage()
- func (m *Metadata) Reset()
- func (m *Metadata) SetBytes(key string, value []byte)
- func (m *Metadata) SetString(key string, value string)
- func (m *Metadata) SetUint64(key string, value uint64)
- func (m *Metadata) String() string
- type Page
- type PageKeys
- type PeerAddress
- func (*PeerAddress) Descriptor() ([]byte, []int)
- func (m *PeerAddress) GetIp() string
- func (m *PeerAddress) GetPeerId() []byte
- func (m *PeerAddress) GetPeerName() string
- func (m *PeerAddress) GetPort() uint32
- func (*PeerAddress) ProtoMessage()
- func (m *PeerAddress) Reset()
- func (m *PeerAddress) String() string
- type Publication
- func (*Publication) Descriptor() ([]byte, []int)
- func (m *Publication) GetAuthorPublicKey() []byte
- func (m *Publication) GetEntryKey() []byte
- func (m *Publication) GetEnvelopeKey() []byte
- func (m *Publication) GetReaderPublicKey() []byte
- func (*Publication) ProtoMessage()
- func (m *Publication) Reset()
- func (m *Publication) String() string
- type PutOperation
- type PutRequest
- type PutResponse
- type Putter
- type PutterGetter
- type RequestMetadata
- type ResponseMetadata
- type StoreRequest
- type StoreResponse
- type Storer
- type SubscribeRequest
- type SubscribeResponse
- func (*SubscribeResponse) Descriptor() ([]byte, []int)
- func (m *SubscribeResponse) GetKey() []byte
- func (m *SubscribeResponse) GetMetadata() *ResponseMetadata
- func (m *SubscribeResponse) GetValue() *Publication
- func (*SubscribeResponse) ProtoMessage()
- func (m *SubscribeResponse) Reset()
- func (m *SubscribeResponse) String() string
- type Subscriber
- type Subscription
- type Verifier
- type VerifyRequest
- func (*VerifyRequest) Descriptor() ([]byte, []int)
- func (m *VerifyRequest) GetKey() []byte
- func (m *VerifyRequest) GetMacKey() []byte
- func (m *VerifyRequest) GetMetadata() *RequestMetadata
- func (m *VerifyRequest) GetNumPeers() uint32
- func (*VerifyRequest) ProtoMessage()
- func (m *VerifyRequest) Reset()
- func (m *VerifyRequest) String() string
- type VerifyResponse
- func (*VerifyResponse) Descriptor() ([]byte, []int)
- func (m *VerifyResponse) GetMac() []byte
- func (m *VerifyResponse) GetMetadata() *ResponseMetadata
- func (m *VerifyResponse) GetPeers() []*PeerAddress
- func (*VerifyResponse) ProtoMessage()
- func (m *VerifyResponse) Reset()
- func (m *VerifyResponse) String() string
Constants ¶
const ( // ECPubKeyLength is the length of a 256-bit ECDSA public key point serialized // (uncompressed) to a byte string. ECPubKeyLength = 65 // DocumentKeyLength is the byte length a document's key. DocumentKeyLength = id.Length // AESKeyLength is the byte length of an AES-256 encryption key. AESKeyLength = 32 // PageIVSeedLength is the byte length of the Page block cipher initialization vector (IV) // seed. PageIVSeedLength = 32 // HMACKeyLength is the byte length of the Page HMAC-256 key. HMACKeyLength = 32 // BlockCipherIVLength is the byte length of a block cipher initialization vector. BlockCipherIVLength = 12 // KEKLength is the total byte length of the key encryption keys. KEKLength = AESKeyLength + BlockCipherIVLength + HMACKeyLength // EEKLength is the total byte length of the entry encryption keys. EEKLength = AESKeyLength + PageIVSeedLength + HMACKeyLength + BlockCipherIVLength // EEKCiphertextLength is the length of the EEK ciphertext, which includes 16 bytes of // encryption info. EEKCiphertextLength = EEKLength + 16 // HMAC256Length is the byte length of an HMAC-256. HMAC256Length = sha256.Size )
field lengths
const ( // MetadataEntryMediaType indicates the media type. MetadataEntryMediaType = metadataEntryPrefix + "media_type" // MetadataEntryCiphertextSize indicates the total ciphertext size across all pages. MetadataEntryCiphertextSize = metadataEntryPrefix + "ciphertext_size" // MetadataEntryCiphertextMAC indicates the MAC of the entire ciphertext. MetadataEntryCiphertextMAC = metadataEntryPrefix + "ciphertext_mac" // MetadataEntryUncompressedSize indicates the total size of the entire uncompressed entry. MetadataEntryUncompressedSize = metadataEntryPrefix + "uncompressed_size" // MetadataEntryUncompressedMAC indicates the MAC of the entire uncompressed entry. MetadataEntryUncompressedMAC = metadataEntryPrefix + "uncompressed_mac" )
required Entry metadata fields
const ( // MetadataEntryFilepath indicates the (relative) filepath of the data contained in the // entry. MetadataEntryFilepath = metadataEntryPrefix + "filepath" // MetadataEntrySchema indicates the schema (however defined) of the data contained in the // entry. MetadataEntrySchema = metadataEntryPrefix + "schema" )
optional Entry metadata fields
Variables ¶
var ( // ErrUnexpectedDocumentType indicates when a document type is not expected (e.g., a Page // when expecting an Entry). ErrUnexpectedDocumentType = errors.New("unexpected document type") // ErrUnknownDocumentType indicates when a document type is not known (usually, this // error should never actually be thrown). ErrUnknownDocumentType = errors.New("unknown document type") // ErrUnexpectedKey indicates when a key does not match the expected key (from GetKey) // for a given value. ErrUnexpectedKey = errors.New("unexpected key for value") )
var ErrEmptySubscriptionFilters = errors.New("subscription has empty filters")
ErrEmptySubscriptionFilters indicates when a *Subscription has an empty author or reader public key filter.
var ErrUnexpectedNilValue = errors.New("unexpected nil value")
ErrUnexpectedNilValue indicates when a value is unexpectedly nil.
var ( // ErrUnexpectedZero describes when an error is unexpectedly zero. ErrUnexpectedZero = errors.New("unexpected zero value") )
var PutOperation_name = map[int32]string{
0: "STORED",
1: "LEFT_EXISTING",
}
var PutOperation_value = map[string]int32{
"STORED": 0,
"LEFT_EXISTING": 1,
}
Functions ¶
func GetAuthorPub ¶
GetAuthorPub returns the author public key for a given document.
func GetEntryPageKeys ¶
GetEntryPageKeys returns the []id.ID page keys if the entry is multi-page. It returns nil for single-page entries.
func RegisterLibrarianServer ¶
func RegisterLibrarianServer(s *grpc.Server, srv LibrarianServer)
func ValidateAESKey ¶
ValidateAESKey checks the a value can be a 256-bit AES key.
func ValidateBytes ¶
ValidateBytes returns whether the byte slice is not empty and has an expected length.
func ValidateDocument ¶
ValidateDocument checks that all fields of a Document are populated and have the expected lengths.
func ValidateEntry ¶
ValidateEntry checks that all fields of an Entry are populated and have the expected byte lengths.
func ValidateEnvelope ¶
ValidateEnvelope checks that all fields of an Envelope are populated and have the expected lengths.
func ValidateHMAC256 ¶
ValidateHMAC256 checks that a value can be an HMAC-256.
func ValidateHMACKey ¶
ValidateHMACKey checks that a value can be an HMAC-256 key.
func ValidateMetadata ¶
ValidateMetadata checks that the metadata has all the required non-zero values.
func ValidateMetadataIV ¶
ValidateMetadataIV checks that a value can be a 12-byte GCM initialization vector.
func ValidateNotEmpty ¶
ValidateNotEmpty returns whether the byte slice is not empty.
func ValidatePage ¶
ValidatePage checks that all fields of a Page are populated and have the expected lengths.
func ValidatePageIVSeed ¶
ValidatePageIVSeed checks that a value can be a 256-bit initialization vector seed.
func ValidatePageKeys ¶
ValidatePageKeys checks that all fields of a PageKeys are populated and have the expected lengths.
func ValidatePublicKey ¶
ValidatePublicKey checks that a value can be a 256-bit elliptic curve public key.
func ValidatePublication ¶
func ValidatePublication(p *Publication) error
ValidatePublication validates that a publication has all fields of the correct length.
func ValidateSubscription ¶
func ValidateSubscription(s *Subscription) error
ValidateSubscription validates that a subscription is not missing any required fields. It returns nil if the subscription is valid.
Types ¶
type BloomFilter ¶
type BloomFilter struct { // using https://godoc.org/github.com/willf/bloom#BloomFilter.GobEncode Encoded []byte `protobuf:"bytes,1,opt,name=encoded,proto3" json:"encoded,omitempty"` }
func (*BloomFilter) Descriptor ¶
func (*BloomFilter) Descriptor() ([]byte, []int)
func (*BloomFilter) GetEncoded ¶
func (m *BloomFilter) GetEncoded() []byte
func (*BloomFilter) ProtoMessage ¶
func (*BloomFilter) ProtoMessage()
func (*BloomFilter) Reset ¶
func (m *BloomFilter) Reset()
func (*BloomFilter) String ¶
func (m *BloomFilter) String() string
type Document ¶
type Document struct { // Types that are valid to be assigned to Contents: // *Document_Envelope // *Document_Entry // *Document_Page Contents isDocument_Contents `protobuf_oneof:"contents"` }
Document contains either an Envelope, Entry, or Page message.
func GetPageDocument ¶
GetPageDocument wraps a Page into a Document, returning it and its key.
func NewTestDocument ¶
NewTestDocument generates a dummy Entry document for use in testing.
func (*Document) Descriptor ¶
func (*Document) GetContents ¶
func (m *Document) GetContents() isDocument_Contents
func (*Document) GetEnvelope ¶
func (*Document) ProtoMessage ¶
func (*Document) ProtoMessage()
type Document_Entry ¶
type Document_Entry struct {
Entry *Entry `protobuf:"bytes,2,opt,name=entry,oneof"`
}
type Document_Envelope ¶
type Document_Envelope struct {
Envelope *Envelope `protobuf:"bytes,1,opt,name=envelope,oneof"`
}
type Document_Page ¶
type Document_Page struct {
Page *Page `protobuf:"bytes,3,opt,name=page,oneof"`
}
type Entry ¶
type Entry struct { // ECDSA public key of the entry author AuthorPublicKey []byte `protobuf:"bytes,1,opt,name=author_public_key,json=authorPublicKey,proto3" json:"author_public_key,omitempty"` // contents of the entry, either a single Page or a list of page keys // // Types that are valid to be assigned to Contents: // *Entry_Page // *Entry_PageKeys Contents isEntry_Contents `protobuf_oneof:"contents"` // created epoch time (seconds since 1970-01-01) CreatedTime int64 `protobuf:"varint,4,opt,name=created_time,json=createdTime" json:"created_time,omitempty"` // ciphertext of marshalled Metadata message properties MetadataCiphertext []byte `protobuf:"bytes,5,opt,name=metadata_ciphertext,json=metadataCiphertext,proto3" json:"metadata_ciphertext,omitempty"` // 32-byte MAC of metatadata ciphertext, encrypted with the 32-byte Entry AES-256 key and // 12-byte metadata block cipher IV MetadataCiphertextMac []byte `` /* 126-byte string literal not displayed */ }
Entry is the main unit of storage in the Libri network.
func NewTestMultiPageEntry ¶
NewTestMultiPageEntry generates a dummy Entry document with two page keys for use in testing.
func NewTestSinglePageEntry ¶
NewTestSinglePageEntry generates a dummy Entry document with a single Page for use in testing.
func (*Entry) Descriptor ¶
func (*Entry) GetAuthorPublicKey ¶
func (*Entry) GetContents ¶
func (m *Entry) GetContents() isEntry_Contents
func (*Entry) GetCreatedTime ¶
func (*Entry) GetMetadataCiphertext ¶
func (*Entry) GetMetadataCiphertextMac ¶
func (*Entry) GetPageKeys ¶
func (*Entry) ProtoMessage ¶
func (*Entry) ProtoMessage()
type Entry_Page ¶
type Entry_Page struct {
Page *Page `protobuf:"bytes,2,opt,name=page,oneof"`
}
type Entry_PageKeys ¶
type Entry_PageKeys struct {
PageKeys *PageKeys `protobuf:"bytes,3,opt,name=page_keys,json=pageKeys,oneof"`
}
type Envelope ¶
type Envelope struct { // 32-byte key of the Entry whose encryption keys are being sent EntryKey []byte `protobuf:"bytes,1,opt,name=entry_key,json=entryKey,proto3" json:"entry_key,omitempty"` // ECDH public key of the entry author/sender AuthorPublicKey []byte `protobuf:"bytes,2,opt,name=author_public_key,json=authorPublicKey,proto3" json:"author_public_key,omitempty"` // ECDH public key of the entry reader/recipient ReaderPublicKey []byte `protobuf:"bytes,3,opt,name=reader_public_key,json=readerPublicKey,proto3" json:"reader_public_key,omitempty"` // ciphertext of 108-byte entry encryption key (EEK), encrypted with a KEK from the shared // ECDH shared secret EekCiphertext []byte `protobuf:"bytes,4,opt,name=eek_ciphertext,json=eekCiphertext,proto3" json:"eek_ciphertext,omitempty"` // 32-byte MAC of the EEK EekCiphertextMac []byte `protobuf:"bytes,5,opt,name=eek_ciphertext_mac,json=eekCiphertextMac,proto3" json:"eek_ciphertext_mac,omitempty"` }
Envelope defines the public keys an author uses to share an entry encryption key with a particular reader. The shared ECDH secret is used with a key derivation function to generate the key encryption key (KEK), which contains 2 sub-keys: 1) 32-byte AES-256 key, used for encrypting/decrypting the entry encryption key (EEK) 2) 12-byte EEK block cipher initialization vector 3) 32-byte HMAC-256 key, used for EEK MAC
This AES-256 KEK is then used to decrypt the EEK ciphertext, which contains 4 sub-keys: 1) 32-byte AES-256 key, used to enrypt Pages and Entry metadata 2) 32-byte Page initialization vector (IV) seed 3) 32-byte HMAC-256 key 4) 12-byte metadata block cipher initialization vector
func NewTestEnvelope ¶
NewTestEnvelope generates a dummy Envelope document for use in testing.
func (*Envelope) Descriptor ¶
func (*Envelope) GetAuthorPublicKey ¶
func (*Envelope) GetEekCiphertext ¶
func (*Envelope) GetEekCiphertextMac ¶
func (*Envelope) GetEntryKey ¶
func (*Envelope) GetReaderPublicKey ¶
func (*Envelope) ProtoMessage ¶
func (*Envelope) ProtoMessage()
type FindRequest ¶
type FindRequest struct { Metadata *RequestMetadata `protobuf:"bytes,1,opt,name=metadata" json:"metadata,omitempty"` // 32-byte target to find peers around Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` // the number of closests peers to return NumPeers uint32 `protobuf:"varint,3,opt,name=num_peers,json=numPeers" json:"num_peers,omitempty"` }
func (*FindRequest) Descriptor ¶
func (*FindRequest) Descriptor() ([]byte, []int)
func (*FindRequest) GetKey ¶
func (m *FindRequest) GetKey() []byte
func (*FindRequest) GetMetadata ¶
func (m *FindRequest) GetMetadata() *RequestMetadata
func (*FindRequest) GetNumPeers ¶
func (m *FindRequest) GetNumPeers() uint32
func (*FindRequest) ProtoMessage ¶
func (*FindRequest) ProtoMessage()
func (*FindRequest) Reset ¶
func (m *FindRequest) Reset()
func (*FindRequest) String ¶
func (m *FindRequest) String() string
type FindResponse ¶
type FindResponse struct { Metadata *ResponseMetadata `protobuf:"bytes,1,opt,name=metadata" json:"metadata,omitempty"` // list of peers closest to target Peers []*PeerAddress `protobuf:"bytes,2,rep,name=peers" json:"peers,omitempty"` // value, if found Value *Document `protobuf:"bytes,3,opt,name=value" json:"value,omitempty"` }
func (*FindResponse) Descriptor ¶
func (*FindResponse) Descriptor() ([]byte, []int)
func (*FindResponse) GetMetadata ¶
func (m *FindResponse) GetMetadata() *ResponseMetadata
func (*FindResponse) GetPeers ¶
func (m *FindResponse) GetPeers() []*PeerAddress
func (*FindResponse) GetValue ¶
func (m *FindResponse) GetValue() *Document
func (*FindResponse) ProtoMessage ¶
func (*FindResponse) ProtoMessage()
func (*FindResponse) Reset ¶
func (m *FindResponse) Reset()
func (*FindResponse) String ¶
func (m *FindResponse) String() string
type Finder ¶
type Finder interface { // Find returns the value for a key or the closest peers to it. Find(ctx context.Context, in *FindRequest, opts ...grpc.CallOption) (*FindResponse, error) }
Finder issues Find queries.
type GetRequest ¶
type GetRequest struct { Metadata *RequestMetadata `protobuf:"bytes,1,opt,name=metadata" json:"metadata,omitempty"` // 32-byte key of document to get Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` }
func (*GetRequest) Descriptor ¶
func (*GetRequest) Descriptor() ([]byte, []int)
func (*GetRequest) GetKey ¶
func (m *GetRequest) GetKey() []byte
func (*GetRequest) GetMetadata ¶
func (m *GetRequest) GetMetadata() *RequestMetadata
func (*GetRequest) ProtoMessage ¶
func (*GetRequest) ProtoMessage()
func (*GetRequest) Reset ¶
func (m *GetRequest) Reset()
func (*GetRequest) String ¶
func (m *GetRequest) String() string
type GetResponse ¶
type GetResponse struct { Metadata *ResponseMetadata `protobuf:"bytes,1,opt,name=metadata" json:"metadata,omitempty"` // value to store for key Value *Document `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` }
func (*GetResponse) Descriptor ¶
func (*GetResponse) Descriptor() ([]byte, []int)
func (*GetResponse) GetMetadata ¶
func (m *GetResponse) GetMetadata() *ResponseMetadata
func (*GetResponse) GetValue ¶
func (m *GetResponse) GetValue() *Document
func (*GetResponse) ProtoMessage ¶
func (*GetResponse) ProtoMessage()
func (*GetResponse) Reset ¶
func (m *GetResponse) Reset()
func (*GetResponse) String ¶
func (m *GetResponse) String() string
type Getter ¶
type Getter interface { // Get retrieves a value, if it exists. Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) }
Getter issues Get queries.
type IntroduceRequest ¶
type IntroduceRequest struct { Metadata *RequestMetadata `protobuf:"bytes,1,opt,name=metadata" json:"metadata,omitempty"` // info about the peer making the introduction Self *PeerAddress `protobuf:"bytes,2,opt,name=self" json:"self,omitempty"` // number of peer librarians to request info for NumPeers uint32 `protobuf:"varint,3,opt,name=num_peers,json=numPeers" json:"num_peers,omitempty"` }
func (*IntroduceRequest) Descriptor ¶
func (*IntroduceRequest) Descriptor() ([]byte, []int)
func (*IntroduceRequest) GetMetadata ¶
func (m *IntroduceRequest) GetMetadata() *RequestMetadata
func (*IntroduceRequest) GetNumPeers ¶
func (m *IntroduceRequest) GetNumPeers() uint32
func (*IntroduceRequest) GetSelf ¶
func (m *IntroduceRequest) GetSelf() *PeerAddress
func (*IntroduceRequest) ProtoMessage ¶
func (*IntroduceRequest) ProtoMessage()
func (*IntroduceRequest) Reset ¶
func (m *IntroduceRequest) Reset()
func (*IntroduceRequest) String ¶
func (m *IntroduceRequest) String() string
type IntroduceResponse ¶
type IntroduceResponse struct { Metadata *ResponseMetadata `protobuf:"bytes,1,opt,name=metadata" json:"metadata,omitempty"` // info about the peer receiving the introduction Self *PeerAddress `protobuf:"bytes,2,opt,name=self" json:"self,omitempty"` // info about other peers Peers []*PeerAddress `protobuf:"bytes,3,rep,name=peers" json:"peers,omitempty"` }
func (*IntroduceResponse) Descriptor ¶
func (*IntroduceResponse) Descriptor() ([]byte, []int)
func (*IntroduceResponse) GetMetadata ¶
func (m *IntroduceResponse) GetMetadata() *ResponseMetadata
func (*IntroduceResponse) GetPeers ¶
func (m *IntroduceResponse) GetPeers() []*PeerAddress
func (*IntroduceResponse) GetSelf ¶
func (m *IntroduceResponse) GetSelf() *PeerAddress
func (*IntroduceResponse) ProtoMessage ¶
func (*IntroduceResponse) ProtoMessage()
func (*IntroduceResponse) Reset ¶
func (m *IntroduceResponse) Reset()
func (*IntroduceResponse) String ¶
func (m *IntroduceResponse) String() string
type Introducer ¶
type Introducer interface { // Introduce identifies the node by name and ID. Introduce(ctx context.Context, in *IntroduceRequest, opts ...grpc.CallOption) ( *IntroduceResponse, error) }
Introducer issues Introduce queries.
type LibrarianClient ¶
type LibrarianClient interface { // Introduce identifies the node by name and ID. Introduce(ctx context.Context, in *IntroduceRequest, opts ...grpc.CallOption) (*IntroduceResponse, error) // Find returns the value for a key or the closest peers to it. Find(ctx context.Context, in *FindRequest, opts ...grpc.CallOption) (*FindResponse, error) // Verify checks that a peer has the value for a given key or returns the closest peers to // that value. Verify(ctx context.Context, in *VerifyRequest, opts ...grpc.CallOption) (*VerifyResponse, error) // Store stores a value in a given key. Store(ctx context.Context, in *StoreRequest, opts ...grpc.CallOption) (*StoreResponse, error) // Get retrieves a value, if it exists. Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) // Put stores a value. Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) // Subscribe streams Publications to the client per a subscription filter. Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (Librarian_SubscribeClient, error) }
func NewLibrarianClient ¶
func NewLibrarianClient(cc *grpc.ClientConn) LibrarianClient
type LibrarianServer ¶
type LibrarianServer interface { // Introduce identifies the node by name and ID. Introduce(context.Context, *IntroduceRequest) (*IntroduceResponse, error) // Find returns the value for a key or the closest peers to it. Find(context.Context, *FindRequest) (*FindResponse, error) // Verify checks that a peer has the value for a given key or returns the closest peers to // that value. Verify(context.Context, *VerifyRequest) (*VerifyResponse, error) // Store stores a value in a given key. Store(context.Context, *StoreRequest) (*StoreResponse, error) // Get retrieves a value, if it exists. Get(context.Context, *GetRequest) (*GetResponse, error) // Put stores a value. Put(context.Context, *PutRequest) (*PutResponse, error) // Subscribe streams Publications to the client per a subscription filter. Subscribe(*SubscribeRequest, Librarian_SubscribeServer) error }
type Librarian_SubscribeClient ¶
type Librarian_SubscribeClient interface { Recv() (*SubscribeResponse, error) grpc.ClientStream }
type Librarian_SubscribeServer ¶
type Librarian_SubscribeServer interface { Send(*SubscribeResponse) error grpc.ServerStream }
type Metadata ¶
type Metadata struct {
Properties map[string][]byte `` /* 147-byte string literal not displayed */
}
Metadata is a map of (property, value) combinations.
func NewEntryMetadata ¶
func NewEntryMetadata( mediaType string, ciphertextSize uint64, ciphertextMAC []byte, uncompressedSize uint64, uncompressedMAC []byte, ) (*Metadata, error)
NewEntryMetadata creates a new *Metadata instance with the given (required) fields.
func (*Metadata) Descriptor ¶
func (*Metadata) GetCiphertextMAC ¶
GetCiphertextMAC returns the ciphertext MAC.
func (*Metadata) GetCiphertextSize ¶
GetCiphertextSize returns the size of the ciphertext.
func (*Metadata) GetMediaType ¶
GetMediaType returns the media type.
func (*Metadata) GetProperties ¶
func (*Metadata) GetUncompressedMAC ¶
GetUncompressedMAC returns the MAC of the uncompressed data.
func (*Metadata) GetUncompressedSize ¶
GetUncompressedSize returns the size of the uncompressed data.
func (*Metadata) MarshalLogObject ¶
func (m *Metadata) MarshalLogObject(oe zapcore.ObjectEncoder) error
MarshalLogObject converts the metadata into an object (which will become json) for logging.
func (*Metadata) ProtoMessage ¶
func (*Metadata) ProtoMessage()
type Page ¶
type Page struct { // ECDSA public key of the entry author AuthorPublicKey []byte `protobuf:"bytes,1,opt,name=author_public_key,json=authorPublicKey,proto3" json:"author_public_key,omitempty"` // index of Page within Entry contents Index uint32 `protobuf:"varint,2,opt,name=index" json:"index,omitempty"` // ciphertext of Page contents, encrypted using the 32-byte AES-256 key with the block cipher // initialized by the first 12 bytes of HMAC-256(IV seed, page index) Ciphertext []byte `protobuf:"bytes,3,opt,name=ciphertext,proto3" json:"ciphertext,omitempty"` // 32-byte MAC of ciphertext using the 32-byte Page ciphertext HMAC-256 key CiphertextMac []byte `protobuf:"bytes,4,opt,name=ciphertext_mac,json=ciphertextMac,proto3" json:"ciphertext_mac,omitempty"` }
Page is a portion (possibly all) of an Entry document.
func NewTestPage ¶
NewTestPage generates a dummy Page for use in testing.
func (*Page) Descriptor ¶
func (*Page) GetAuthorPublicKey ¶
func (*Page) GetCiphertext ¶
func (*Page) GetCiphertextMac ¶
func (*Page) ProtoMessage ¶
func (*Page) ProtoMessage()
type PageKeys ¶
type PageKeys struct {
Keys [][]byte `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"`
}
PageKeys is an ordered list of keys to Page documents that comprise an Entry document.
func (*PageKeys) Descriptor ¶
func (*PageKeys) ProtoMessage ¶
func (*PageKeys) ProtoMessage()
type PeerAddress ¶
type PeerAddress struct { // 32-byte peer ID PeerId []byte `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` // self-reported name of the peer PeerName string `protobuf:"bytes,2,opt,name=peer_name,json=peerName" json:"peer_name,omitempty"` // public IP address Ip string `protobuf:"bytes,3,opt,name=ip" json:"ip,omitempty"` // public address TCP port Port uint32 `protobuf:"varint,4,opt,name=port" json:"port,omitempty"` }
func (*PeerAddress) Descriptor ¶
func (*PeerAddress) Descriptor() ([]byte, []int)
func (*PeerAddress) GetIp ¶
func (m *PeerAddress) GetIp() string
func (*PeerAddress) GetPeerId ¶
func (m *PeerAddress) GetPeerId() []byte
func (*PeerAddress) GetPeerName ¶
func (m *PeerAddress) GetPeerName() string
func (*PeerAddress) GetPort ¶
func (m *PeerAddress) GetPort() uint32
func (*PeerAddress) ProtoMessage ¶
func (*PeerAddress) ProtoMessage()
func (*PeerAddress) Reset ¶
func (m *PeerAddress) Reset()
func (*PeerAddress) String ¶
func (m *PeerAddress) String() string
type Publication ¶
type Publication struct { EnvelopeKey []byte `protobuf:"bytes,1,opt,name=envelope_key,json=envelopeKey,proto3" json:"envelope_key,omitempty"` EntryKey []byte `protobuf:"bytes,2,opt,name=entry_key,json=entryKey,proto3" json:"entry_key,omitempty"` AuthorPublicKey []byte `protobuf:"bytes,3,opt,name=author_public_key,json=authorPublicKey,proto3" json:"author_public_key,omitempty"` ReaderPublicKey []byte `protobuf:"bytes,4,opt,name=reader_public_key,json=readerPublicKey,proto3" json:"reader_public_key,omitempty"` }
func GetPublication ¶
func GetPublication(key []byte, value *Document) *Publication
GetPublication returns a *Publication object if one can be made from the given document key and value. If not, it returns nil.
func NewTestPublication ¶
func NewTestPublication(rng *rand.Rand) *Publication
NewTestPublication generates a dummy Publication for use in testing.
func (*Publication) Descriptor ¶
func (*Publication) Descriptor() ([]byte, []int)
func (*Publication) GetAuthorPublicKey ¶
func (m *Publication) GetAuthorPublicKey() []byte
func (*Publication) GetEntryKey ¶
func (m *Publication) GetEntryKey() []byte
func (*Publication) GetEnvelopeKey ¶
func (m *Publication) GetEnvelopeKey() []byte
func (*Publication) GetReaderPublicKey ¶
func (m *Publication) GetReaderPublicKey() []byte
func (*Publication) ProtoMessage ¶
func (*Publication) ProtoMessage()
func (*Publication) Reset ¶
func (m *Publication) Reset()
func (*Publication) String ¶
func (m *Publication) String() string
type PutOperation ¶
type PutOperation int32
const ( // new value was added PutOperation_STORED PutOperation = 0 // value already existed PutOperation_LEFT_EXISTING PutOperation = 1 )
func (PutOperation) EnumDescriptor ¶
func (PutOperation) EnumDescriptor() ([]byte, []int)
func (PutOperation) String ¶
func (x PutOperation) String() string
type PutRequest ¶
type PutRequest struct { Metadata *RequestMetadata `protobuf:"bytes,1,opt,name=metadata" json:"metadata,omitempty"` // key to store value under Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` // value to store for key Value *Document `protobuf:"bytes,3,opt,name=value" json:"value,omitempty"` }
func (*PutRequest) Descriptor ¶
func (*PutRequest) Descriptor() ([]byte, []int)
func (*PutRequest) GetKey ¶
func (m *PutRequest) GetKey() []byte
func (*PutRequest) GetMetadata ¶
func (m *PutRequest) GetMetadata() *RequestMetadata
func (*PutRequest) GetValue ¶
func (m *PutRequest) GetValue() *Document
func (*PutRequest) ProtoMessage ¶
func (*PutRequest) ProtoMessage()
func (*PutRequest) Reset ¶
func (m *PutRequest) Reset()
func (*PutRequest) String ¶
func (m *PutRequest) String() string
type PutResponse ¶
type PutResponse struct { Metadata *ResponseMetadata `protobuf:"bytes,1,opt,name=metadata" json:"metadata,omitempty"` // result of the put operation Operation PutOperation `protobuf:"varint,2,opt,name=operation,enum=api.PutOperation" json:"operation,omitempty"` // number of replicas of the stored value; only populated for operation = STORED NReplicas uint32 `protobuf:"varint,3,opt,name=n_replicas,json=nReplicas" json:"n_replicas,omitempty"` }
func (*PutResponse) Descriptor ¶
func (*PutResponse) Descriptor() ([]byte, []int)
func (*PutResponse) GetMetadata ¶
func (m *PutResponse) GetMetadata() *ResponseMetadata
func (*PutResponse) GetNReplicas ¶
func (m *PutResponse) GetNReplicas() uint32
func (*PutResponse) GetOperation ¶
func (m *PutResponse) GetOperation() PutOperation
func (*PutResponse) ProtoMessage ¶
func (*PutResponse) ProtoMessage()
func (*PutResponse) Reset ¶
func (m *PutResponse) Reset()
func (*PutResponse) String ¶
func (m *PutResponse) String() string
type Putter ¶
type Putter interface { // Put stores a value. Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) }
Putter issues Put queries.
type PutterGetter ¶
PutterGetter issues Put and Get queries.
type RequestMetadata ¶
type RequestMetadata struct { // 32-byte unique request ID RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` // peer's ECDSA public key PubKey []byte `protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` }
RequestMetadata defines metadata associated with every request.
func (*RequestMetadata) Descriptor ¶
func (*RequestMetadata) Descriptor() ([]byte, []int)
func (*RequestMetadata) GetPubKey ¶
func (m *RequestMetadata) GetPubKey() []byte
func (*RequestMetadata) GetRequestId ¶
func (m *RequestMetadata) GetRequestId() []byte
func (*RequestMetadata) ProtoMessage ¶
func (*RequestMetadata) ProtoMessage()
func (*RequestMetadata) Reset ¶
func (m *RequestMetadata) Reset()
func (*RequestMetadata) String ¶
func (m *RequestMetadata) String() string
type ResponseMetadata ¶
type ResponseMetadata struct { // 32-byte request ID that generated this response RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` // peer's ECDSA public key PubKey []byte `protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` }
func (*ResponseMetadata) Descriptor ¶
func (*ResponseMetadata) Descriptor() ([]byte, []int)
func (*ResponseMetadata) GetPubKey ¶
func (m *ResponseMetadata) GetPubKey() []byte
func (*ResponseMetadata) GetRequestId ¶
func (m *ResponseMetadata) GetRequestId() []byte
func (*ResponseMetadata) ProtoMessage ¶
func (*ResponseMetadata) ProtoMessage()
func (*ResponseMetadata) Reset ¶
func (m *ResponseMetadata) Reset()
func (*ResponseMetadata) String ¶
func (m *ResponseMetadata) String() string
type StoreRequest ¶
type StoreRequest struct { Metadata *RequestMetadata `protobuf:"bytes,1,opt,name=metadata" json:"metadata,omitempty"` // key to store value under Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` // value to store for key Value *Document `protobuf:"bytes,3,opt,name=value" json:"value,omitempty"` }
func (*StoreRequest) Descriptor ¶
func (*StoreRequest) Descriptor() ([]byte, []int)
func (*StoreRequest) GetKey ¶
func (m *StoreRequest) GetKey() []byte
func (*StoreRequest) GetMetadata ¶
func (m *StoreRequest) GetMetadata() *RequestMetadata
func (*StoreRequest) GetValue ¶
func (m *StoreRequest) GetValue() *Document
func (*StoreRequest) ProtoMessage ¶
func (*StoreRequest) ProtoMessage()
func (*StoreRequest) Reset ¶
func (m *StoreRequest) Reset()
func (*StoreRequest) String ¶
func (m *StoreRequest) String() string
type StoreResponse ¶
type StoreResponse struct {
Metadata *ResponseMetadata `protobuf:"bytes,1,opt,name=metadata" json:"metadata,omitempty"`
}
func (*StoreResponse) Descriptor ¶
func (*StoreResponse) Descriptor() ([]byte, []int)
func (*StoreResponse) GetMetadata ¶
func (m *StoreResponse) GetMetadata() *ResponseMetadata
func (*StoreResponse) ProtoMessage ¶
func (*StoreResponse) ProtoMessage()
func (*StoreResponse) Reset ¶
func (m *StoreResponse) Reset()
func (*StoreResponse) String ¶
func (m *StoreResponse) String() string
type Storer ¶
type Storer interface { // Store stores a value in a given key. Store(ctx context.Context, in *StoreRequest, opts ...grpc.CallOption) (*StoreResponse, error) }
Storer issues Store queries.
type SubscribeRequest ¶
type SubscribeRequest struct { Metadata *RequestMetadata `protobuf:"bytes,1,opt,name=metadata" json:"metadata,omitempty"` Subscription *Subscription `protobuf:"bytes,2,opt,name=subscription" json:"subscription,omitempty"` }
func (*SubscribeRequest) Descriptor ¶
func (*SubscribeRequest) Descriptor() ([]byte, []int)
func (*SubscribeRequest) GetMetadata ¶
func (m *SubscribeRequest) GetMetadata() *RequestMetadata
func (*SubscribeRequest) GetSubscription ¶
func (m *SubscribeRequest) GetSubscription() *Subscription
func (*SubscribeRequest) ProtoMessage ¶
func (*SubscribeRequest) ProtoMessage()
func (*SubscribeRequest) Reset ¶
func (m *SubscribeRequest) Reset()
func (*SubscribeRequest) String ¶
func (m *SubscribeRequest) String() string
type SubscribeResponse ¶
type SubscribeResponse struct { Metadata *ResponseMetadata `protobuf:"bytes,1,opt,name=metadata" json:"metadata,omitempty"` Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` Value *Publication `protobuf:"bytes,3,opt,name=value" json:"value,omitempty"` }
func (*SubscribeResponse) Descriptor ¶
func (*SubscribeResponse) Descriptor() ([]byte, []int)
func (*SubscribeResponse) GetKey ¶
func (m *SubscribeResponse) GetKey() []byte
func (*SubscribeResponse) GetMetadata ¶
func (m *SubscribeResponse) GetMetadata() *ResponseMetadata
func (*SubscribeResponse) GetValue ¶
func (m *SubscribeResponse) GetValue() *Publication
func (*SubscribeResponse) ProtoMessage ¶
func (*SubscribeResponse) ProtoMessage()
func (*SubscribeResponse) Reset ¶
func (m *SubscribeResponse) Reset()
func (*SubscribeResponse) String ¶
func (m *SubscribeResponse) String() string
type Subscriber ¶
type Subscriber interface { // Subscribe subscribes to a defined publication stream. Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) ( Librarian_SubscribeClient, error) }
Subscriber issues Subscribe queries.
type Subscription ¶
type Subscription struct { AuthorPublicKeys *BloomFilter `protobuf:"bytes,1,opt,name=author_public_keys,json=authorPublicKeys" json:"author_public_keys,omitempty"` ReaderPublicKeys *BloomFilter `protobuf:"bytes,2,opt,name=reader_public_keys,json=readerPublicKeys" json:"reader_public_keys,omitempty"` }
func (*Subscription) Descriptor ¶
func (*Subscription) Descriptor() ([]byte, []int)
func (*Subscription) GetAuthorPublicKeys ¶
func (m *Subscription) GetAuthorPublicKeys() *BloomFilter
func (*Subscription) GetReaderPublicKeys ¶
func (m *Subscription) GetReaderPublicKeys() *BloomFilter
func (*Subscription) ProtoMessage ¶
func (*Subscription) ProtoMessage()
func (*Subscription) Reset ¶
func (m *Subscription) Reset()
func (*Subscription) String ¶
func (m *Subscription) String() string
type Verifier ¶
type Verifier interface { // Verify verifies that a peer has a given value. Verify(ctx context.Context, in *VerifyRequest, opts ...grpc.CallOption) (*VerifyResponse, error) }
Verifier issues Verify queries.
type VerifyRequest ¶
type VerifyRequest struct { Metadata *RequestMetadata `protobuf:"bytes,1,opt,name=metadata" json:"metadata,omitempty"` // 32-byte key of document to verify Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` // 32-byte key to use in HMAC-256 verification MacKey []byte `protobuf:"bytes,3,opt,name=mac_key,json=macKey,proto3" json:"mac_key,omitempty"` // the number of closests peers to return NumPeers uint32 `protobuf:"varint,4,opt,name=num_peers,json=numPeers" json:"num_peers,omitempty"` }
func (*VerifyRequest) Descriptor ¶
func (*VerifyRequest) Descriptor() ([]byte, []int)
func (*VerifyRequest) GetKey ¶
func (m *VerifyRequest) GetKey() []byte
func (*VerifyRequest) GetMacKey ¶
func (m *VerifyRequest) GetMacKey() []byte
func (*VerifyRequest) GetMetadata ¶
func (m *VerifyRequest) GetMetadata() *RequestMetadata
func (*VerifyRequest) GetNumPeers ¶
func (m *VerifyRequest) GetNumPeers() uint32
func (*VerifyRequest) ProtoMessage ¶
func (*VerifyRequest) ProtoMessage()
func (*VerifyRequest) Reset ¶
func (m *VerifyRequest) Reset()
func (*VerifyRequest) String ¶
func (m *VerifyRequest) String() string
type VerifyResponse ¶
type VerifyResponse struct { Metadata *ResponseMetadata `protobuf:"bytes,1,opt,name=metadata" json:"metadata,omitempty"` // nil if the peer does not have the document, otherwise the HMAC-256 of the document's // serialized bytes given the MAC key in the request Mac []byte `protobuf:"bytes,2,opt,name=mac,proto3" json:"mac,omitempty"` // list of peers closest to target Peers []*PeerAddress `protobuf:"bytes,3,rep,name=peers" json:"peers,omitempty"` }
func (*VerifyResponse) Descriptor ¶
func (*VerifyResponse) Descriptor() ([]byte, []int)
func (*VerifyResponse) GetMac ¶
func (m *VerifyResponse) GetMac() []byte
func (*VerifyResponse) GetMetadata ¶
func (m *VerifyResponse) GetMetadata() *ResponseMetadata
func (*VerifyResponse) GetPeers ¶
func (m *VerifyResponse) GetPeers() []*PeerAddress
func (*VerifyResponse) ProtoMessage ¶
func (*VerifyResponse) ProtoMessage()
func (*VerifyResponse) Reset ¶
func (m *VerifyResponse) Reset()
func (*VerifyResponse) String ¶
func (m *VerifyResponse) String() string