Help with script migration Javascript -> CF worker

Hey i can do it in CF workers, but it’s hard for me… i trying Web Crypto, but stil have errors.

In JavaScript i have only password and text to encrypt and it’s all, in CF… i don’t know what’s going on.

Someone can convert my script to CF worker? I wanna get simple effect, every request i will get encrypted password.

<script src=""></script>
    var key = "pass123";
    var toen = 'testvaluetoencrypt';
    var encrypted = CryptoJS.AES.encrypt(toen, key);
    var output = encrypted.toString();

Best Regards