我有以下代码:
<html>
<head>
</head>
<body>
<!-- some more CSHTML code here -->
<script src="https://js.braintreegateway.com/v1/braintree.js"></script>
<script>
var braintree = Braintree.create("SOME RANDOM KEY");
braintree.onSubmitEncryptForm('braintree-payment-form');
</script>
</body>
</html>
我希望能够在不泄露源代码的情况下执行脚本。我有一把钥匙,但我不希望它被泄露。是否有一种安全可靠的方法来通过引用访问字符串(最好是从 C# 文件中)?有点像:
<script>
var braintree = Braintree.create(somefile.getString("string_key"));
braintree.onSubmitEncryptForm('braintree-payment-form');
</script>