Overview
The Storage Service is a microservice designed to manage document storage across various cloud platforms as well as personal storage. It simplifies the process for developers by providing APIs for uploading and downloading documents/files.
Features
Simplifies integration with various cloud storage providers.
User-friendly and straightforward setup.
Secure.
Setup
Client Configuration
Provide clientId.
Specify the tool name.
Choose preferred cloud storage or use Legistify Cloud Storage.
Supply cloud storage keys.
The service is ready for use.
Key Features
File Upload Formats: Accepts files in either base64 format or form-data.
Storage Options: Upload files to Client storage or Legistify storage.
Cloud Storage Integration:
Integrates seamlessly with any cloud storage service.
Users can provide integration keys or APIs for various cloud storage services.
Authentication Structures:
AWS S3 Storage
GCP Storage
Azure Blob Storage
Document Transfer: The ability to send documents over the client network depends on the client’s API structure, which may vary based on specific requirements.
Security:
Files are securely accepted from different services using JWT Authorization.
Authorization Header: Bearer TOKEN
Detailed Functionality
Client API
Security:
Protected by an internal token.
Operations:
Retrieve or update details using Client Code or id (_id).
Auto-generate a client code if not provided.
Format for client code: Client code + tool + uuid or tool + uuid if no client code is supplied.
Store the client code in the user service and include it in the token payload to configure the storage service.
Storage API
Security:
Protected by Bearer token.
Authorization:
Bearer token must be included in the Authorization header along with the required payload.
Use Cases
With the evolution of tools, managing features across all tools individually can be challenging. Centralizing document storage through a single service via API or SDK simplifies this management. Legistify currently operates four tools, each storing data separately in the cloud. Using a centralized service for document management streamlines development and enhances efficiency.
Authorization Strategy
JSON Web Tokens (JWT): An open standard (RFC 7519) for securely transmitting claims between parties. The User service needs to include specific details in the JWT payload:
key: Mandatory
storageId: Mandatory
module: Mandatory
userId: Mandatory
clientId: Mandatory
filePath: Optional (if not provided, files are saved to a default miscellaneous folder with a random name)
expiresIn: Optional (used when downloading)
isPublic: Mandatory (indicates whether the file is stored in a public or private bucket)
File Naming
Unique file names are generated as: Math.floor(Math.random() * 1e9) + '-' + Date.now().
Files are stored in folders based on the module, with a default path if none is specified:
contract: 'contract-management'
notice: 'notice-management'
ipr: 'ipr'
litigation: 'litigation-management'
Private Key for Storage
JWT_PRIVATE_KEY_STORAGE='PrivateKeyForStorage'