Metadata-Version: 2.4
Name: ash-kms
Version: 0.1.3
Summary: 
Author: Raman Shakun
Author-email: shakunroman@gmail.com
Requires-Python: >=3.11,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Dist: crcmod (>=1.7,<2.0)
Requires-Dist: google-cloud-kms (>=3.10.0,<4.0.0)
Requires-Dist: protobuf (>=6.33.5)
Requires-Dist: six (>=1.16.0,<2.0.0)
Description-Content-Type: text/markdown

# ash-kms
The library provides functionality to handle GCP KMS encryption keys and operations

- The library allows the creation of a new key-ring within GCP KMS.
- The library allows the creation of a new encryption key within GCP KMS.
- The library provides functionality to encrypt secrets using the specified encryption key.
- Users can decrypt secrets using the specified encryption key.

## Installation

```python
pip install ash-kms
```

## Usage
```python
from ash_kms import EncryptionService

key_ring_id = "test_key_ring_id"
key_id = "test_key"
location_id = "global"
plaintext = "asdf1234"

service = EncryptionService(project_id="ash-dev-273120")

key_ring_name = service.create_key_ring(location_id=location_id, key_ring_id=key_ring_id)
print(key_ring_name)

key = service.create_key_symmetric_encrypt_decrypt(location_id=location_id, key_ring_id=key_ring_id, key_id=key_id)
print(key.name)

ciphertext = service.encrypt_symmetric(location_id=location_id, key_ring_id=key_ring_id, key_id=key_id,
                                       plaintext=plaintext)

print(f"{ciphertext=}")
decrypted_plaintext = service.decrypt_symmetric(location_id=location_id, key_ring_id=key_ring_id, key_id=key_id,
                                                ciphertext=ciphertext)

print(f"{plaintext=}")

assert decrypted_plaintext == plaintext

```
