MCPcopy
hub / github.com/pocketbase/pocketbase / TestSecurityEncryptAndDecryptBinds

Function TestSecurityEncryptAndDecryptBinds

plugins/jsvm/binds_test.go:978–997  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

976}
977
978func TestSecurityEncryptAndDecryptBinds(t *testing.T) {
979 vm := goja.New()
980 BindCore(vm)
981 BindSecurity(vm)
982
983 _, err := vm.RunString(`
984 const key = "abcdabcdabcdabcdabcdabcdabcdabcd"
985
986 const encrypted = $security.encrypt("123", key)
987
988 const decrypted = $security.decrypt(encrypted, key)
989
990 if (decrypted != "123") {
991 throw new Error("Expected decrypted '123', got " + decrypted)
992 }
993 `)
994 if err != nil {
995 t.Fatal(err)
996 }
997}
998
999func TestBindFilesystem(t *testing.T) {
1000 app, _ := tests.NewTestApp()

Callers

nothing calls this directly

Calls 2

BindCoreFunction · 0.85
BindSecurityFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…