Skip to main content

Official Python SDK for EasyOne API with client-side encryption

Project description

EasyOne Python SDK

Official Python SDK for interacting with EasyOne API. Provides client-side AES-GCM encryption and chunked upload functionality.

Installation

pip install easyone-sdk

Quick Start

from easyone import EasyOneClient

client = EasyOneClient(
    api_key='up_live_YOUR_KEY_HERE',  # Replace with your actual API key
    base_url='https://easyone.io',  # optional
)

# Upload a file
result = client.upload_file(
    'my-file.pdf',
    options={
        'fileName': 'my-file.pdf',
        'mimeType': 'application/pdf',
        'retentionDays': 30,  # Days to keep the file (default: 30)
        # Set to 0 for indefinite retention (requires unlimited retention permission)
    }
)

print(f"CID: {result['cid']}")
print(f"Decryption Key: {result['decryptionKey']}")

Downloading a File

# Download and decrypt a file
data = client.download_file(
    result['cid'],
    result['decryptionKey'],
    output_path='downloaded-file.pdf'
)

Listing Files

files = client.list_files(limit=20)

for file in files['files']:
    print(f"{file['filename']} - {file['size']} bytes")

Encryption Only

# Encrypt data without uploading
message = b'Secret message'
encrypted = client.encrypt_data(message)

# Decrypt later
decrypted = client.decrypt_data(encrypted['encrypted'], encrypted['key'])
print(decrypted.decode('utf-8'))

API Reference

EasyOneClient

Constructor

EasyOneClient(
    api_key: str,
    base_url: str = None,
    chunk_size: int = None,
)

Methods

  • upload_file(file_path, options=None) - Upload a file with encryption
  • download_file(cid, decryption_key, output_path=None) - Download and decrypt a file
  • get_download_info(cid) - Get download URL and metadata
  • get_metadata(cid) - Get file metadata
  • list_files(limit=50, offset=0) - List user's files
  • encrypt_data(data) - Encrypt data without uploading
  • decrypt_data(encrypted_data, key) - Decrypt data

Security Best Practices

API Key Storage

  • Store API keys in environment variables
  • Never commit keys to version control
  • Use different keys for development/staging/production
  • Rotate keys regularly (recommended: every 90 days)
# .env file
EASYONE_API_KEY=up_live_YOUR_KEY_HERE

Decryption Key Management

  • Store decryption keys in encrypted storage (e.g., AWS KMS, Azure Key Vault)
  • Never log decryption keys
  • Implement key rotation for encrypted files

Client-Side Validation

The SDK now includes:

  • API key format validation (must start with up_live_ or up_test_)
  • File size validation (max 100GB)
  • File type validation (blocks executable files)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ez1_python_sdk-1.0.0.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ez1_python_sdk-1.0.0-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

Details for the file ez1_python_sdk-1.0.0.tar.gz.

File metadata

  • Download URL: ez1_python_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for ez1_python_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0a9afa5ff6cf8f85975cc89cea8ead865f08a074a151239dc2a544b9eb7b7a22
MD5 cdcd2607c771a75e0f45e25d6dba5567
BLAKE2b-256 7b8dfb1abdae9a228080d50cf33db276d6fa8d231d0eafae39b30621ba3c6e34

See more details on using hashes here.

File details

Details for the file ez1_python_sdk-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ez1_python_sdk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 24.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for ez1_python_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1adc29e764277ad94d7a4bc795f1366e68c81381bf6f08934991bfbcc314d342
MD5 da150a7f024d42c679300723580e70fe
BLAKE2b-256 993d8fe5739b9ea6f4da12dee05ed515084440595e532a2f84574e7cfba6beaa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page