1 Star 0 Fork 0

eden-w2w / wechatpay-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
mock_decryptor.go 596 Bytes
一键复制 编辑 原始数据 按行查看 历史
EmmetZC 提交于 2021-07-13 21:45 . refactor(core/cipher): 更新错误处理
// Copyright 2021 Tencent Inc. All rights reserved.
package decryptors
import (
"context"
"fmt"
"strings"
)
// MockDecryptor 模拟字符串解密器
type MockDecryptor struct {
}
// Decrypt 对字符串进行模拟解密
func (d *MockDecryptor) Decrypt(ctx context.Context, ciphertext string) (plaintext string, err error) {
fmt.Printf("[MockDecryptor] Decrypting `%v`\n", ciphertext)
if !strings.HasPrefix(ciphertext, "Encrypted") {
return ciphertext, fmt.Errorf("cannot decrypt invalid cipher string:`%v`", ciphertext)
}
return strings.TrimPrefix(ciphertext, "Encrypted"), nil
}
1
https://gitee.com/eden-w2w/wechatpay-go.git
git@gitee.com:eden-w2w/wechatpay-go.git
eden-w2w
wechatpay-go
wechatpay-go
v0.2.12

搜索帮助

53164aa7 5694891 3bd8fe86 5694891