strongdoc.api package

Submodules

strongdoc.api.account module

strongdoc.api.account.register_organization(org_name, org_addr, admin_name, admin_password, admin_email)[source]

Registers a new organization. A new administrator user will also be created. New users can be added using this administrator account. A gRPC connection timeout will be implemented.

Parameters
  • org_name (string) – The organization name to create.

  • org_addr (string) – The organization address.

  • admin_name (string) – The organization administrator name.

  • admin_password (string) – The organization administrator password.

  • admin_email (string) – The organization administrator email.

Raises

grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.

Returns

  • orgID (string) – The newly created organization ID.

  • userID (string) – The newly created user ID.

strongdoc.api.account.remove_organization(token, force)[source]

Removes an organization, deleting all data stored with the organization. This requires an administrator priviledge. A gRPC connection timeout will be implemented.

Parameters
  • token (string) – The user JWT token.

  • force (bool) – If this is false, removal will fail if there are still data stored with the organization. This prevents accidental deletion.

Raises

grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.

Returns

Whether the removal was a success.

Return type

bool

strongdoc.api.document module

strongdoc.api.document.decrypt_document(token, docid, ciphertext)[source]

Decrypt a document using the service. The user must provide the ciphertext returned during the encryptDocument API call.

Parameters
  • token (string) – The user JWT token.

  • docid (string) – The ID of the document.

  • ciphertext (bye array) – The document ciphertext to be decrypted.

Returns

The decrypted plaintext content of the document.

Return type

byte array

strongdoc.api.document.download_document(token, docid)[source]

Download a document from the service.

Parameters
  • token (string) – The user JWT token.

  • docid (string) – The ID of the document.

Returns

The downloaded document.

Return type

byte array

strongdoc.api.document.encrypt_document(token, doc_name, plaintext)[source]

Encrypts a document using the service, but do not store it. Instead return the encrypted ciphertext.

Parameters
  • token (string) – The user JWT token.

  • doc_name (string) – The name of the document.

  • plaintext (byte array) – The text of the document.

Returns

  • docID (string) – The document ID for the uploaded document. This ID is needed to decrypt the document.

  • ciphertext (byte array) – The encrypted ciphertext of the document.

strongdoc.api.document.remove_document(token, docid)[source]

Remove a document from the service.

Parameters
  • token (string) – The user JWT token.

  • docid (string) – The ID of the document.

Returns

Whether the removal was a success.

Return type

bool

strongdoc.api.document.upload_document(token, doc_name, plaintext)[source]

Uploads a document to the service for storage.

Parameters
  • token (string) – The user JWT token.

  • doc_name (string) – The name of the document.

  • plaintext (byte array) – The text of the document.

Returns

The uploaded document ID.

Return type

string

strongdoc.api.login module

strongdoc.api.login.login(userid, password, orgid)[source]

Verify the user and organization identity, and returns a JWT token for future API use. A gRPC connection timeout will be implemented.

Parameters
  • userid (string) – The login user ID

  • password (string) – The ogin user password

  • orgid (string) – The login organization ID

Raises

grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.

Returns

The JWT token used to authenticate user/org when using StrongDoc APIs.

Return type

string

strongdoc.api.search module

class strongdoc.api.search.DocumentResult(docid, score)[source]

Bases: object

A class that will hold a single document that matches the search result from the Search query.

property docid

Get the matching document ID

Returns

The matching document ID

Return type

string

property score

Get the score of the matching document

Returns

The score of the matching document

Return type

float

strongdoc.api.search.search(token, query)[source]

Search for document that contains a specific word. A gRPC connection timeout will be implemented.

Parameters
  • token (string) – The user JWT token.

  • query (string) – The query string.

Raises

grpc.RpcError – Raised by the gRPC library to indicate non-OK-status RPC termination.

Returns

The hit list of the search.

Return type

Array of DocumentResult

Module contents