Skip to content

Conversation

@nimish-ks
Copy link
Member

@nimish-ks nimish-ks commented May 4, 2024

Overview

This PR overhauls the Phase Python SDK, transitioning from encryption-focused functionality to comprehensive secret management. The new implementation provides a more intuitive and flexible interface for managing secrets across various Python applications.

Key Changes

  • Removed encryption/decryption methods in favor of secret management operations
  • Introduced new classes for different secret operations (Create, Read, Update, Delete)
  • Implemented support for personal secret overrides
  • Added functionality for secret reference resolution
  • Improved error handling and type hinting

New Features

  1. Secret Creation: Users can now create multiple secrets at once with customizable paths and tags.
  2. Secret Retrieval: Added options to fetch all secrets or specific ones, with support for filtering by tags and paths.
  3. Secret Update Operations: Users can update secret values, move secrets to different paths, and toggle personal overrides with PATs.
  4. Secret Deletion: Delete one or more secrets across any path or environments
  5. Secret References & Resolution: Functionality to automatically resolve references between secrets.

API Changes

  • Phase class now initializes with init, pss (token), and host parameters
  • New option classes for each operation: CreateSecretsOptions, GetAllSecretsOptions, GetSecretOptions, SecretUpdateOptions, DeleteSecretOptions
  • Removed encrypt and decrypt methods

Usage Example

from src.phase import Phase, CreateSecretsOptions

phase = Phase(init=False, pss='your-token', host='https://console.phase.dev')

create_options = CreateSecretsOptions(
    env_name="Development",
    app_name="MyApp",
    key_value_pairs=[{"API_KEY": "secret-value"}],
    secret_path="/api"
)
result = phase.create_secrets(create_options)

Testing

  • Added comprehensive unit tests for all new functionality
  • Included integration tests

Documentation

  • Updated README with new installation and usage instructions
  • Added inline documentation for all new classes and methods

@nimish-ks nimish-ks marked this pull request as draft May 4, 2024 10:02
@nimish-ks nimish-ks marked this pull request as ready for review August 1, 2024 06:57
@nimish-ks nimish-ks merged commit 685f090 into main Aug 7, 2024
@nimish-ks nimish-ks deleted the feat--secrets branch August 7, 2024 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants