James ZHANG

Results 9 issues of James ZHANG

- [x] 移除对`axios/lib/util` 内置方法的依赖 - [ ] 刨除废弃的方法,如`Hash.hmacSha256`, `Aes.encrypt`, `Aes.decrypt` - [ ] 调整 `AesGcm.encrypt`, `AesGcm.decrypt` 型参顺序 - [ ] 调整repo及包名,相应地调整`user-agent` - [x] 搭建 wechatpay.js.org 作为library的主站

feature

**PHP version**: 8.3.0 **Description** A community user was reported that, it was used the Laravel with Guzzle PSR7 packages, while these wanna tracing the `RequestException` by the `dd` function, they...

https://github.com/pleaseyang/Ity/blob/b626989e45a02f5cb220514702d57564a076d249/app/Http/Controllers/Controller.php#L107-L108 当然这里的拼接方式是可以工作的,不过仍然建议用标准用法来构造请求,形如: ```php ->chain('v3/pay/transactions/id/{transaction_id}') ->get(['query' => ['mchid' => $merchantId], 'transaction_id' => $transactionId]) ``` 另外建议增加依赖 [iwechatpay/openapi](https://github.com/TheNorthMemory/wechatpay-openapi) dev包,上述代码即可以在`JB` IDE上书写成 ```php ->v3->pay->transactions->id->_transaction_id_ ->get(['query' => ['mchid' => $merchantId], 'transaction_id' => $transactionId]) ``` 即带请求数据结构基础语法提示。

https://github.com/pleaseyang/Ity/blob/b626989e45a02f5cb220514702d57564a076d249/app/Models/Config.php#L190-L202 `web`的根目录是在`public`,如果没做安全防范,恶意请求可以通过web方式直接下载到商户私钥文件`cert/apiclient_key.pem`,存在安全隐患。 项目用到了`Redis`,建议抛弃文件存储,商户私钥、商户证书、平台证书均可以以`base64-string`形式存储在库中,`\WeChatPay\Rsa::from` 支持无感加载,详情可参考: - https://github.com/wechatpay-apiv3/wechatpay-php/blob/main/tests/Crypto/RsaTest.php#L45-L53 - https://github.com/wechatpay-apiv3/wechatpay-php/blob/main/tests/Crypto/RsaTest.php#L148-L149 从证书中提取`公钥` 详见 PHP [openssl_x509_parse](https://www.php.net/manual/zh/function.openssl-x509-parse.php) 返回值。 加载时仅需增加协议即形如 `Rsa::from('public.spki://' . $i_am_a_base64_string_without_envelope, Rsa::KEY_TYPE_PUBLIC)`。 当然`Rsa::from`也支持原样以文件内容为字符串形式加载私钥及证书,详细用法可参考上述 `RsaTest`测试用例覆盖方法。

see https://pay.weixin.qq.com/wiki/doc/apiv3/open/pay/wechatpay5_0.shtml > 由于旧证书过期前的5天内,微信支付会同时使用新旧证书,因此为实现新老证书的平滑切换,商户系统需支持多平台证书。 https://github.com/pleaseyang/Ity/blob/b626989e45a02f5cb220514702d57564a076d249/app/Http/Controllers/Controller.php#L47-L49 建议上述程序逻辑设计,支持多证书加载。

**PHP version**: 8.1.3 **Description** As of a community reporting, while the uri was already contains the `pct-encoded`(reserved characters) component, eg: `AIO%2FFR`. The `{+var}` syntax is explained this one as of...

### 运行环境 ```Markdown - OS:MacOS - PHP: 8.3.7 - wechatpay-php: 1.4.9 ``` ### 描述你的问题现象 这可能不应该是件公开讨论的事宜,有关应用安全的问题可能需要具有专业知识的人来共同探讨,然而此问题在开源社区有了许多公开讨论,暂且先把问题及可能的解决方案记录于此。 ## 缘由 在例行性更新本地PHP版本的时候,按操作习惯,会`run`一遍测试用例,然而有许久如下测试用例有一条**F**一直悬而未决: https://github.com/wechatpay-apiv3/wechatpay-php/blob/2cabc8a15136050c4ee61083cd24959114756a03/tests/Crypto/RsaTest.php#L307-L321 ## 现状 翻阅了PHP的更新历史及OpenSSL的更新历史,发现如下两条重要更新: - [Use EVP_PKEY API for openssl_public_encrypt/private_decrypt](https://github.com/php/php-src/commit/0233afae2762a7e7be49935ebbb981783c471d13) - [Make...

相关research,先记着,充电中 - [Typescript can't infer types when using Proxy](https://github.com/microsoft/TypeScript/issues/20846) - [Fix definition of `ProxyHandler`](https://github.com/microsoft/TypeScript/pull/35594) - [TypeScript 4.0 Iteration Plan](https://github.com/microsoft/TypeScript/issues/38510)