Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 8 additions & 15 deletions examples/docs/encryption.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,22 @@ async def main():
raise RuntimeError("S2_ENCRYPTION_KEY is required")

async with S2(access_token) as client:
basin = client.basin(basin_name)
stream_name = f"docs-encryption-{int(time.time())}"

# ANCHOR: basin-cipher
try:
await client.create_basin(
basin_name,
config=BasinConfig(stream_cipher=Encryption.AEGIS_256),
)
except Exception:
pass
await client.create_basin(
basin_name,
config=BasinConfig(stream_cipher=Encryption.AEGIS_256),
)
Comment thread
quettabit marked this conversation as resolved.

await client.reconfigure_basin(
basin_name,
config=BasinConfig(stream_cipher=Encryption.AES_256_GCM),
)
# ANCHOR_END: basin-cipher

# Ensure stream exists
try:
await basin.create_stream(stream_name)
except Exception:
pass
basin = client.basin(basin_name)
stream_name = f"docs-encryption-{int(time.time())}"

await basin.ensure_stream(stream_name)

# ANCHOR: append-read
stream = basin.stream(
Expand Down
Loading