Documentation ¶
Overview ¶
Package api exposes the functions that comprise the Strongsalt Go API. It consists of high-level wrapper functions around GRPC function calls.
Index ¶
- Constants
- func AddSharableOrg(token, orgId string) (success bool, err error)
- func DecryptDocument(token, docID string, ciphertext []byte) (plaintext []byte, err error)
- func DecryptDocumentStream(token string, docId string) (ec decryptStream, err error)
- func DemoteUser(token, userId string) (success bool, err error)
- func DownloadDocument(token string, docID string) (plaintext []byte, err error)
- func EncryptDocument(token string, docName string, plaintext []byte) (docID string, ciphertext []byte, err error)
- func EncryptDocumentStream(token string, docName string) (ec encryptStream, err error)
- func GetConfiguration(token string) (config string, err error)
- func GetDocumentsSize(token string) (size uint64, err error)
- func GetIndexSize(token string) (size int64, err error)
- func Login(userID, password, orgID string) (string, error)
- func Logout(token string) (status string, err error)
- func PromoteUser(token, userId string) (success bool, err error)
- func RegisterOrganization(orgName, orgAddr, adminName, adminPassword, adminEmail string) (orgID, adminID string, err error)
- func RegisterUser(token, user, pass, email string, admin bool) (userId string, err error)
- func RemoveDocument(token, docID string) error
- func RemoveOrganization(token string) (success bool, err error)
- func RemoveSharableOrg(token, orgId string) (success bool, err error)
- func RemoveUser(token, user string) (count int64, err error)
- func Search(token, query string) ([]*proto.DocumentResult, error)
- func SetMultiLevelSharing(token string, enable bool) (success bool, err error)
- func ShareDocument(token, docId, userId string) (success bool, err error)
- func UnshareDocument(token, docId, userId string) (count int64, err error)
- func UploadDocument(token string, docName string, plaintext []byte) (docID string, err error)
- func UploadDocumentStream(token string, docName string, reader *bytes.Reader) (docID string, err error)
- type BillingDetails
- func (bd *BillingDetails) CurrentPeriod() (CurrentPeriod *BillingPeriod, err error)
- func (bd *BillingDetails) Documents() (bdoc *BillingDocuments, err error)
- func (bd *BillingDetails) Index() (bi *BillingIndex, err error)
- func (bd *BillingDetails) NextPeriod() (bp *BillingPeriod, err error)
- func (bd *BillingDetails) TotalCost() (TotalCost int32, err error)
- func (bd *BillingDetails) Traffic() (bt *BillingTraffic, err error)
- type BillingDocuments
- type BillingIndex
- type BillingPeriod
- type BillingTraffic
- type Documents
- type S3Stream
- Bugs
Constants ¶
const ( AdminName = "adminUserName" AdminPassword = "adminUserPassword" AdminEmail = "[email protected]" Organization = "OrganizationOne" )
Variables ¶
This section is empty.
Functions ¶
func AddSharableOrg ¶ added in v0.1.8
AddSharableOrg adds a sharable Organization.
func DecryptDocument ¶
DecryptDocument encrypts a document with Strongdoc. It requires original ciphertext, since the document is not stored
func DecryptDocumentStream ¶ added in v0.1.8
func DemoteUser ¶ added in v0.1.8
DemoteUser demotes an administrator to regular user level. privilege level.
Requires administrator privileges.
func DownloadDocument ¶
DownloadDocument downloads a document stored in Strongdoc-provided storage.
func EncryptDocument ¶
func EncryptDocument(token string, docName string, plaintext []byte) (docID string, ciphertext []byte, err error)
EncryptDocument encrypts a document with Strongdoc and returns the encrypted ciphertext. No data is ever written to storage on Strongdoc servers.
func EncryptDocumentStream ¶ added in v0.1.8
EncryptDocument returns an object that implements io.Reader and io.Writer. Write your document and Read the returned encrypted ciphertext. No data is ever written to storage on Strongdoc servers.
func GetConfiguration ¶ added in v0.1.8
GetConfiguration returns a string representing the configurations set.
func GetDocumentsSize ¶ added in v0.1.8
GetDocumentsSize returns the size of all the documents of the organization.
func GetIndexSize ¶ added in v0.1.8
GetIndexSize returns the size of all the indexes of the organization.
func Login ¶
Login logs the user in, returning a Bearer Token. This token must henceforth be sent with all requests in the same session.
func PromoteUser ¶ added in v0.1.8
PromoteUser promotes a regular user to administrator privilege level.
Requires administrator privileges.
func RegisterOrganization ¶
func RegisterOrganization(orgName, orgAddr, adminName, adminPassword, adminEmail string) (orgID, adminID string, err error)
RegisterOrganization creates an organization. The user who created the organization is automatically an administrator.
func RegisterUser ¶ added in v0.1.8
Creates new user if it doesn't already exist. Trying to create a user with an existing username throws an error.
Requires administrator privileges.
func RemoveDocument ¶
RemoveDocument deletes a document from Strongdoc-provided storage. If you are a regular user, you may only remove a document that belongs to you. If you are an administrator, you can remove all the documents of the organization for which you are an administrator.
func RemoveOrganization ¶
RemoveOrganization removes an organization, and all of its users, documents, and other data that it owns.
Requires administrator privileges.
func RemoveSharableOrg ¶ added in v0.1.8
RemoveSharableOrg removes a sharable Organization.
func RemoveUser ¶ added in v0.1.8
func Search ¶
func Search(token, query string) ([]*proto.DocumentResult, error)
Search searches for the queries in the uploaded and encrypted documents. The list of document IDs and scores are included in the result.
func SetMultiLevelSharing ¶ added in v0.1.8
SetMultiLevelSharing sets MultiLevel Sharing.
func ShareDocument ¶ added in v0.1.8
func UnshareDocument ¶ added in v0.1.8
UnshareDocument rescinds permission earlier granted for other users to access their documents.
func UploadDocument ¶
UploadDocument uploads a document to Strongdoc-provided storage.
Types ¶
type BillingDetails ¶ added in v0.1.8
type BillingDetails struct {
// contains filtered or unexported fields
}
func Billing ¶ added in v0.1.8
func Billing(token string) (bd BillingDetails)
func (*BillingDetails) CurrentPeriod ¶ added in v0.1.8
func (bd *BillingDetails) CurrentPeriod() (CurrentPeriod *BillingPeriod, err error)
func (*BillingDetails) Documents ¶ added in v0.1.8
func (bd *BillingDetails) Documents() (bdoc *BillingDocuments, err error)
func (*BillingDetails) Index ¶ added in v0.1.8
func (bd *BillingDetails) Index() (bi *BillingIndex, err error)
func (*BillingDetails) NextPeriod ¶ added in v0.1.8
func (bd *BillingDetails) NextPeriod() (bp *BillingPeriod, err error)
func (*BillingDetails) TotalCost ¶ added in v0.1.8
func (bd *BillingDetails) TotalCost() (TotalCost int32, err error)
func (*BillingDetails) Traffic ¶ added in v0.1.8
func (bd *BillingDetails) Traffic() (bt *BillingTraffic, err error)
type BillingDocuments ¶ added in v0.1.8
type BillingDocuments struct {
// contains filtered or unexported fields
}
func (*BillingDocuments) Cost ¶ added in v0.1.8
func (d *BillingDocuments) Cost() int32
func (*BillingDocuments) Size ¶ added in v0.1.8
func (d *BillingDocuments) Size() float64
type BillingIndex ¶ added in v0.1.8
type BillingIndex struct {
// contains filtered or unexported fields
}
func (*BillingIndex) Cost ¶ added in v0.1.8
func (i *BillingIndex) Cost() int32
func (*BillingIndex) Size ¶ added in v0.1.8
func (i *BillingIndex) Size() int64
type BillingPeriod ¶ added in v0.1.8
type BillingPeriod struct {
// contains filtered or unexported fields
}
func (*BillingPeriod) Frequency ¶ added in v0.1.8
func (bp *BillingPeriod) Frequency() string
func (*BillingPeriod) PeriodEnd ¶ added in v0.1.8
func (bp *BillingPeriod) PeriodEnd() *timestamp.Timestamp
func (*BillingPeriod) PeriodStart ¶ added in v0.1.8
func (bp *BillingPeriod) PeriodStart() *timestamp.Timestamp
type BillingTraffic ¶ added in v0.1.8
type BillingTraffic struct {
// contains filtered or unexported fields
}
func (*BillingTraffic) Cost ¶ added in v0.1.8
func (t *BillingTraffic) Cost() int32
func (*BillingTraffic) Incoming ¶ added in v0.1.8
func (t *BillingTraffic) Incoming() float64
func (*BillingTraffic) Outgoing ¶ added in v0.1.8
func (t *BillingTraffic) Outgoing() float64
type Documents ¶ added in v0.1.8
type Documents struct {
// contains filtered or unexported fields
}
func ListDocuments ¶ added in v0.1.8
ListDocuments returns a slice of Document objects, representing the documents accessible by the user.
type S3Stream ¶ added in v0.1.8
type S3Stream struct {
// contains filtered or unexported fields
}
func DownloadDocumentStream ¶ added in v0.1.8
DownloadDocumentStream generates an S3Stream object, which implements the io.Reader interface. It contains a client which maintains a connection to Strongdoc-provided storage. Returns 0, EOF iff the stream has been exhausted.
Notes ¶
Bugs ¶
for some reason, stream crashes when 0 bytes are available in the stream.