fix(work): fix typo

This commit is contained in:
Fu Diwei
2021-08-02 21:31:05 +08:00
parent 8323a4c3bf
commit 2e31376048
2 changed files with 8 additions and 10 deletions

View File

@@ -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)
{

View File

@@ -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"));