SecretKeyMissing (core/crypto.py)

Douyin_TikTok_Download_API · src/dtk/core/crypto.py · python · Apache-2.0
database

Credential encryption at rest. Cookies and proxy URLs are stored as AES-256-GCM ciphertext. The master key never reaches the database: it decrypts the database, so storing it there would be circular. See docs/design/08-security.md and docs/design/10-configuration.md.

# Source: https://github.com/Evil0ctal/Douyin_TikTok_Download_API | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
"""Credential encryption at rest.

Cookies and proxy URLs are stored as AES-256-GCM ciphertext. The master key
never reaches the database: it decrypts the database, so storing it there would
be circular. See docs/design/08-security.md and docs/design/10-configuration.md.
"""

from __future__ import annotations

import base64
import hashlib
import hmac
import os
import secrets

from cryptography.hazmat.primitives.ciphers.aead import AESGCM

NONCE_BYTES = 12
KEY_BYTES = 32
MIN_SECRET_LEN = 32


class SecretKeyMissing(RuntimeError):
    """Raised at startup when DTK_SECRET

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key