423baff73b
- Docker bridge 网络隔离(8000 端口封死) - Gunicorn 4 Worker 多进程 - Alembic 数据库迁移基线 - 日志轮转 20m×3 - JWT 密钥 + DB 密码 + CORS 收紧 - 3-2-1 备份链路(NAS + R740-B 冷备) - 连接池 pool_pre_ping + pool_recycle=3600
32 lines
1.3 KiB
Cython
32 lines
1.3 KiB
Cython
# Copyright (C) 2016-present the asyncpg authors and contributors
|
|
# <see AUTHORS file>
|
|
#
|
|
# This module is part of asyncpg and is released under
|
|
# the Apache 2.0 License: http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
cdef class SCRAMAuthentication:
|
|
cdef:
|
|
readonly bytes authentication_method
|
|
readonly bytes authorization_message
|
|
readonly bytes client_channel_binding
|
|
readonly bytes client_first_message_bare
|
|
readonly bytes client_nonce
|
|
readonly bytes client_proof
|
|
readonly bytes password_salt
|
|
readonly int password_iterations
|
|
readonly bytes server_first_message
|
|
# server_key is an instance of hmac.HAMC
|
|
readonly object server_key
|
|
readonly bytes server_nonce
|
|
|
|
cdef create_client_first_message(self, str username)
|
|
cdef create_client_final_message(self, str password)
|
|
cdef parse_server_first_message(self, bytes server_response)
|
|
cdef verify_server_final_message(self, bytes server_final_message)
|
|
cdef _bytes_xor(self, bytes a, bytes b)
|
|
cdef _generate_client_nonce(self, int num_bytes)
|
|
cdef _generate_client_proof(self, str password)
|
|
cdef _generate_salted_password(self, str password, bytes salt, int iterations)
|
|
cdef _normalize_password(self, str original_password)
|