mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-09-19 18:22:24 +08:00
fix(work): fix typo
This commit is contained in:
@@ -299,7 +299,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
/// <param name="callbackTimestamp">微信回调通知中的 timestamp 字段。</param>
|
||||
/// <param name="callbackNonce">微信回调通知中的 nonce 字段。</param>
|
||||
/// <param name="callbackJson">微信回调通知中请求正文(JSON 格式)。</param>
|
||||
/// <param name="callbackSignature">微信回调通知中的 signature 字段。</param>
|
||||
/// <param name="callbackSignature">微信回调通知中的 msg_signature 字段。</param>
|
||||
/// <returns></returns>
|
||||
public static bool VerifyEventSignatureFromJson(this WechatApiClient client, string callbackTimestamp, string callbackNonce, string callbackJson, string callbackSignature)
|
||||
{
|
||||
@@ -331,7 +331,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
/// <param name="callbackTimestamp">微信回调通知中的 timestamp 字段。</param>
|
||||
/// <param name="callbackNonce">微信回调通知中的 nonce 字段。</param>
|
||||
/// <param name="callbackXml">微信回调通知中请求正文(XML 格式)。</param>
|
||||
/// <param name="callbackSignature">微信回调通知中的 signature 字段。</param>
|
||||
/// <param name="callbackSignature">微信回调通知中的 msg_signature 字段。</param>
|
||||
/// <returns></returns>
|
||||
public static bool VerifyEventSignatureFromXml(this WechatApiClient client, string callbackTimestamp, string callbackNonce, string callbackXml, string callbackSignature)
|
||||
{
|
||||
|
@@ -7,9 +7,9 @@ using System.Xml.Serialization;
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work
|
||||
{
|
||||
/// <summary>
|
||||
/// 为 <see cref="WechatWorkClient"/> 提供回调通知事件序列化相关的扩展方法。
|
||||
/// 为 <see cref="WechatWorkClient"/> 提供回调通知事件的扩展方法。
|
||||
/// </summary>
|
||||
public static class WechatWorkClientEventSerializationExtensions
|
||||
public static class WechatWorkClientEventExtensions
|
||||
{
|
||||
private class EncryptedWechatWorkEvent
|
||||
{
|
||||
@@ -46,11 +46,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
||||
if (string.IsNullOrEmpty(encryptedEvent.EncryptedData))
|
||||
throw new Exceptions.WechatWorkEventSerializationException("Encrypt event failed, because of empty encrypted data.");
|
||||
|
||||
callbackJson = Utilities.WxBizMsgCryptor.AESDecrypt(
|
||||
cipherText: encryptedEvent.EncryptedData,
|
||||
encodingAESKey: client.Credentials.PushEncodingAESKey!,
|
||||
out _
|
||||
);
|
||||
callbackJson = Utilities.WxBizMsgCryptor.AESDecrypt(cipherText: encryptedEvent.EncryptedData, encodingAESKey: client.Credentials.PushEncodingAESKey!, out _);
|
||||
|
||||
return client.JsonSerializer.Deserialize<TEvent>(callbackJson);
|
||||
}
|
||||
@@ -72,9 +68,11 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
||||
|
||||
try
|
||||
{
|
||||
if (!Utilities.WxBizMsgCryptor.TryParseXml(callbackXml, out callbackXml!))
|
||||
if (!Utilities.WxBizMsgCryptor.TryParseXml(callbackXml, out string? encryptedXml))
|
||||
throw new Exceptions.WechatWorkEventSerializationException("Encrypt event failed, because of empty encrypted data.");
|
||||
|
||||
callbackXml = Utilities.WxBizMsgCryptor.AESDecrypt(cipherText: encryptedXml!, encodingAESKey: client.Credentials.PushEncodingAESKey!, out _);
|
||||
|
||||
using var reader = new StringReader(callbackXml);
|
||||
|
||||
XmlSerializer xmlSerializer = new XmlSerializer(typeof(TEvent), new XmlRootAttribute("xml"));
|
Reference in New Issue
Block a user