[🚀] add crypto pkg

This commit is contained in:
2026-01-21 16:40:26 +08:00
parent 424ad78a7e
commit 078967c601
5 changed files with 283 additions and 0 deletions

22
pkg/crypto/interface.go Normal file
View File

@@ -0,0 +1,22 @@
package crypto
// Encryptor 加密器接口
type Encryptor interface {
// Encrypt 加密数据
Encrypt(plaintext []byte) ([]byte, error)
// Decrypt 解密数据
Decrypt(ciphertext []byte) ([]byte, error)
// Name 返回加密算法名称
Name() string
}
// Signer 签名器接口
type Signer interface {
// Sign 生成签名
Sign(data []byte) ([]byte, error)
// Verify 验证签名
Verify(data, signature []byte) error
}