Metadata-Version: 2.5
Name: atsh
Version: 0.1.1
Summary: Python SDK for the developer tools at atsh.in.
Project-URL: Homepage, https://atsh.in
Project-URL: Documentation, https://env.atsh.in
Project-URL: Repository, https://github.com/atsh-here/atsh-env-py
Project-URL: Issues, https://github.com/atsh-here/atsh-env-py/issues
Author-email: Atsh <contact@atsh.in>
License: MIT License
        
        Copyright (c) 2026 atsh.in
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: aes-gcm,argon2id,atsh,developer-tools,dotenv,e2e-encryption,env,secrets,vault,zero-knowledge
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
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: Topic :: Security :: Cryptography
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.9
Requires-Dist: argon2-cffi>=23.1
Requires-Dist: cryptography>=42.0
Requires-Dist: httpx>=0.27
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Description-Content-Type: text/markdown

# atsh

Python SDK for the developer tools at [atsh.in](https://atsh.in).

    pip install atsh

Requires Python 3.9+.

## What's in this package

`atsh` is the Python home for atsh.in's developer tools. Each tool
lives in its own subpackage and imports independently:

    from atsh.env import Env

More subpackages are added as the tools they wrap are released. The
list below reflects what is actually shipped in this version.

| Subpackage | What it does |
|---|---|
| `atsh.env` | SDK for the zero-knowledge secret manager at [env.atsh.in](https://env.atsh.in) |

---

## atsh.env

Zero-knowledge secret manager SDK. Every project has its own master
pass; the server stores only ciphertext it cannot read.

Source: [github.com/atsh-here/atsh-env-py](https://github.com/atsh-here/atsh-env-py)

### Quick start

    import os
    from atsh.env import Env

    with Env.connect(
        base_url="https://env.atsh.in/api/v1",
        project="acme",
        environment="dev",
        token=os.environ["ATSH_ENV_TOKEN"],
        master_pass=os.environ["ATSH_ENV_MASTER_PASS"],
    ) as env:
        print(env.get("DATABASE_URL"))
        print(env.get("Configs/APP_CONFIG"))
        print(env.get("Configs/stripe/SECRET_KEY"))

### How it works

Every project has a master pass chosen at init. It never leaves the
client. Argon2id(master_pass, kekSalt) derives a KEK, which unwraps a
per-project DEK. Every secret, file, store entry, and certificate blob
is encrypted with AES-256-GCM under that DEK before it reaches the
server.

The envelope is byte-compatible with the browser, the CLI, and the
TypeScript SDK (`@atsh/env`).

### Path addressing

| Path | What it addresses |
|---|---|
| `DATABASE_URL` | Environment-root secret |
| `Configs/APP_CONFIG` | Secret in folder `Configs` |
| `Configs/stripe/SECRET_KEY` | Entry in store `stripe` (folder `Configs`) |

### Env

Connect:

    env = Env.connect(
        base_url="https://env.atsh.in/api/v1",
        project="acme",
        environment="dev",
        token="atsh_env_...",
        master_pass="...",
    )

Also accepts `dek_override=b"..."` to skip the crypto when you already
have the DEK (vault-cache path). Mutually exclusive with `master_pass`.

Secrets:

    env.get("KEY")
    env.set("KEY", "value")
    env.set("KEY", "value", comment="rotated")
    env.delete("KEY")
    env.pull(scope="all")
    env.pull(scope="global")

Files:

    env.upload_file("app.json", json_bytes, folder_id=None)
    env.file("Configs/app.json").bytes()
    env.file("Configs/app.json").text()
    env.file("Configs/app.json").json()
    env.file("app.json").replace(new_bytes)

Stores:

    store = env.store("Configs/stripe")
    store.entries()
    store.set("KEY", "value")
    store.delete("KEY")
    store.versions("KEY")
    store.revert("KEY", to=3)

Certificates:

    cert = env.certificate("wildcard-acme")
    cert.cert(); cert.key(); cert.chain()
    cert.upload_cert(pem_bytes)
    cert.upload_key(key_bytes)
    cert.upload_chain(chain_bytes)
    cert.versions()
    cert.revert(to=3)

Universal secrets (account-scoped, server-readable):

    u = env.universal()
    u.list()
    u.get("SHARED_TOKEN")
    u.set("SHARED_TOKEN", "value")
    u.delete("SHARED_TOKEN")

Folders:

    env.list_folders()
    env.create_folder("Configs")
    env.create_folder("Sub", parent_id=folder_id)
    env.delete_folder("Configs")

Utilities:

    env.manifest_tree()
    env.refresh_manifest()
    env.snapshot()
    env.close()

### AtshEnvClient

Low-level REST client. No crypto, no state.

    from atsh.env import AtshEnvClient

    with AtshEnvClient("https://env.atsh.in/api/v1", "atsh_env_...") as c:
        projects = c.projects.list()
        manifest = c.projects.manifest("acme", environment="dev")
        secrets = c.secrets.list(project_id, env="env_...")

### Workflows

    from atsh.env import (
        AtshEnvClient,
        create_and_initialize_project,
        initialize_project,
    )

    client = AtshEnvClient(base_url, account_token)

    result = create_and_initialize_project(
        client=client,
        name="acme",
        master_pass="...",
    )
    print(result.project["slug"], result.project_token)

    initialize_project(
        client=client,
        project_id="p_...",
        init_token="atsh_init_...",
        master_pass="...",
        mint={"name": "cli"},
    )

### Errors

    from atsh.env import (
        AtshEnvError,
        VaultLockedError,
        ApprovalRequiredError,
        NotFoundError,
        ConflictError,
        ProtectedEnvironmentError,
    )

### Protected environments

If the environment has `protected: true` on the server, every write
raises `ProtectedEnvironmentError` unless you pass
`allow_protected=True`:

    env.set("KEY", "value", allow_protected=True)

---

## License

MIT — see [LICENSE](./LICENSE).
