feat: add aispeech dialog APIs (#887)

* feat: add aispeech dialog APIs

* test: fix aispeech lint failures

* test: satisfy aispeech interfacer lint
This commit is contained in:
GargantuaX authored and GitHub committed 2026-07-20 14:10:56 +08:00
1 parent 0e34286d78
commit 2bc22dc4ae
18 files changed
+1562 -3

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
package encryptor
import "testing"
func TestSign(t *testing.T) {
sign := Sign("YV78Pyj1VvqdNGpMJ1pHic0bIBOWMv", 1711001766, "abc", nil)
if sign != "fff8dae1356e7867ea98743439f0e9f8" {
t.Fatalf("bad sign: %s", sign)
}
}
func TestEncryptDecrypt(t *testing.T) {
aesKey := "q1Os1ZMe0nG28KUEx9lg3HjK7V5QyXvi212fzsgDqgz"
plainText := []byte(`{"query":"hello"}`)
cipherText, err := Encrypt(aesKey, plainText)
if err != nil {
t.Fatalf("Encrypt error: %v", err)
}
got, err := Decrypt(aesKey, cipherText)
if err != nil {
t.Fatalf("Decrypt error: %v", err)
}
if string(got) != string(plainText) {
t.Fatalf("bad plaintext: %s", got)
}
}
func TestDecryptInvalidKey(t *testing.T) {
if _, err := Encrypt("bad-key", []byte("hello")); err == nil {
t.Fatal("Encrypt should return error")
}
}