taolib.testing.oauth.crypto.token_encryption#
Token 加密模块。
使用 Fernet 对称加密安全存储 OAuth Token。
Classes#
Token 加密器。 |
Functions#
|
生成新的 Fernet 加密密钥。 |
Module Contents#
- taolib.testing.oauth.crypto.token_encryption.generate_encryption_key() str#
生成新的 Fernet 加密密钥。
- 返回:
Base64 编码的 32 字节密钥字符串
- class taolib.testing.oauth.crypto.token_encryption.TokenEncryptor(encryption_key: str)#
Token 加密器。
使用 Fernet 对称加密对 OAuth Token 进行加密和解密。
- 参数:
encryption_key -- Fernet 兼容的加密密钥(Base64 编码的 32 字节)
- _fernet#
- decrypt(ciphertext: str) str#
解密密文。
- 参数:
ciphertext -- Base64 编码的密文字符串
- 返回:
解密后的明文字符串
- 抛出:
OAuthTokenDecryptionError -- 解密失败