加解密性能优化,预埋
This commit is contained in:
@@ -99,8 +99,24 @@ final apiConfigProvider = Provider<ApiConfig>((ref) {
|
||||
tokenStream.add(newToken);
|
||||
},
|
||||
onCheckNetworkAvailable: () async => networkMonitor.isConnected,
|
||||
onEncryptRequest: null, // TODO: 接入 cipher_guard_sdk 后注入请求加密回调
|
||||
onDecryptResponse: null, // TODO: 接入 cipher_guard_sdk 后注入响应解密回调
|
||||
// TODO: 接入 cipher_guard_sdk 后注入请求加密回调。
|
||||
// 前提:AuthNotifier.login() 中已完成 cipherSdk.setActiveKeyPair(pub, priv)。
|
||||
// 示例:
|
||||
// onEncryptRequest: (path, headers, body) async {
|
||||
// final encryptedKey = await cipherSdk.encryptSessionKeyWithActiveKey(
|
||||
// sessionKey: currentSessionKey,
|
||||
// );
|
||||
// return EncryptedRequest(body: encryptedBody, headers: {'X-Key': encryptedKey});
|
||||
// },
|
||||
onEncryptRequest: null,
|
||||
// TODO: 接入 cipher_guard_sdk 后注入响应解密回调。
|
||||
// 前提:与 onEncryptRequest 配套,服务端响应同样加密时启用。
|
||||
// 示例:
|
||||
// onDecryptResponse: (data) async {
|
||||
// final plaintext = await cipherSdk.decryptMessage(encryptedData: data as String, ...);
|
||||
// return jsonDecode(plaintext) as Map<String, dynamic>;
|
||||
// },
|
||||
onDecryptResponse: null,
|
||||
onBusinessError: null, // TODO: 接入业务错误统一处理(弹窗 / Toast / 跳转等)
|
||||
onTransformResponse:
|
||||
null, // TODO: 如后端响应格式非标准,在此归一化为 { code, data, message }
|
||||
|
||||
Reference in New Issue
Block a user