Metadata-Version: 2.1
Name: securden-sdk
Version: 1.0.2
Summary: Using functions which use Securden APIs, developers can retrieve credentials programmatically from Securden server.
Home-page: https://www.securden.com
Author: Securden Dev
Author-email: devops-support@securden.com
License: MIT
Keywords: Securden,Securden SDK,Credential Retrieval APIs as functions
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >= 3.9
Description-Content-Type: text/markdown
Provides-Extra: testing
Provides-Extra: dev

# Securden Software Development Kit - Python

This guide will take you through the process of installing and integrating Securden Python SDK for secure programmatic access to credentials.

## Summary of Steps

1. Installation
3. Fetch credential using pre-defined commands

## 1. Installation

```hcl
pip install securden_sdk
```

## 3. Fetch credential via CLI commands

### Required

- `server_url` (String) Securden Server URL. Example: https://company.securden.com:5454.
- `authtoken` (String) Securden API Authentication Token.

```hcl
from securden_sdk import ApiClient
from securden_sdk import Configuration
from securden_sdk.api import DefaultApi 

config = Configuration(
    host="<your_securden_server_url>",
)
api = ApiClient(configuration=config)
api.authtoken = "<your_api_key>"
securden_instance = DefaultApi(api)

try:
    password = securden_instance.get_password(account_id=<your_account_id>)
    print("Response:", password)

    account_details = securden_instance.get_account_details(account_id=<your_account_id>)
    print("Account details:", account_details)

    generated_password = securden_instance.generate_password(policy_id=<your_policy_id>)
    print("Generated password:", generated_password)

    policy_details = securden_instance.get_policy_details(policy_id=<your_policy_id>)
    print("Policy details:", policy_details)
except Exception as e:
    print(e)
```

## CRUD Examples

```python
from securden_sdk import ApiClient, Configuration
from securden_sdk.api import DefaultApi

config = Configuration(
    host="https://ArryamanF0JJSL3:8000",
    verify_ssl=False,
)

api_client = ApiClient(configuration=config)
api_client.authtoken = "a8deffe7-5301-4034-ade8-1ba73f72e262"

api = DefaultApi(api_client)

add_account_payload = {
    "account_title": "test_title",
    "account_name": "test_name",
    "account_type": "Web Account",
    "ipaddress": "www.google.com",
    "notes": "test_notes",
    "tags": "test_tag",
    "folder_id": 1000000027879,
    "password": "Test",
}

add_folder_payload = {
    "folder_name": "Testfolder",
    "description": "sample",
    "notes": "sample_notes",
    "parent_folder_id": 1000000009229,
    "inherit_parentshare": False,
}

edit_account_payload = {
    "account_id": 1000000027879,
    "account_title": "test_title",
    "account_name": "test_name",
    "account_type": "Web Account",
    "ipaddress": "www.google.com",
    "notes": "test_notes",
    "tags": "test_tag",
    "folder_id": 1000000027879,
    "overwrite_additional_fields": False,
}

edit_folder_payload = {
    "folder_id": 1000000009229,
    "folder_name": "Testfolder",
    "description": "sample",
    "notes": "sample_notes",
    "parent_folder_id": 1000000009229,
    "inherit_parentshare": False,
}

print(api.add_account(add_account_payload))
print(api.add_folder(add_folder_payload))
print(api.edit_account(edit_account_payload))
print(api.edit_folder(edit_folder_payload))
print(api.delete_accounts(
    account_ids=[1000000027879],
    reason="Test",
    delete_permanently=False,
))
```

## Secrets Management Wrapper Operations

`DefaultApi` includes the `/secretsmanagement/*` wrapper endpoints:

- `get_account_details(account_id=...)`
- `add_account(payload=...)`
- `edit_account(payload=...)`
- `delete_accounts(account_ids=[...], reason=..., delete_permanently=...)`
- `get_folders(...)`
- `add_folder(payload=...)`
- `edit_folder(payload=...)`
- `delete_folders(folder_ids=[...], reason=...)`
- `generate_password(policy_id=... | policy_name=...)`
- `get_policy_details(policy_id=...)`

For file-based account types such as `File Store`, `SSH Key`, `License Key`, and `Personal SSH Key`, `payload["accounts_file"]` can be provided in either of these forms:

- `{"file_name": "...", "file_content": ...}` for the existing JSON-style payload
- a direct file input for `add_account`, such as a file path, a `(file_name, bytes)` tuple, or a binary file-like object

---
-> If you have general questions or issues in using Securden SDK, you may raise a support request to devops-support@securden.com. Our support team will get back to you at the earliest and provide a timeline if there are issue fixes involved.
