Skip to content

Commit

Permalink
refactor: 微信支付秘钥通过路径加载
Browse files Browse the repository at this point in the history
  • Loading branch information
dmzlingyin committed Jun 18, 2024
1 parent cc42c6a commit c092796
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions payment/wechat.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package pay
import (
"context"
"crypto/rsa"
"encoding/base64"
"errors"
"fmt"
"github.com/dmzlingyin/utils/config"
Expand Down Expand Up @@ -100,9 +99,8 @@ func NewWechatPay() (*WechatPay, error) {
NotifyURL: config.GetString("pay.wechat.notify_url"),
}

privateKey, err := base64.StdEncoding.DecodeString(cfg.PrivateKeyPath)
// 加载私钥
key, err := utils.LoadPrivateKey(string(privateKey))
key, err := utils.LoadPrivateKeyWithPath(cfg.PrivateKeyPath)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit c092796

Please sign in to comment.