The Wix Secrets Backend v2 API contains functionality for managing secrets on your site. Secrets managed by this API are available in the Secrets Manager section of your site's dashboard. You can securely store API keys and other secrets on your site. Each secret's value is encrypted, and assigned a name of your choice and an ID. You can then use the name or ID to refer to the secret in your backend code rather than hardcoding its value.
Learn more about Velo's Secrets Manager.
With the Secrets API, you can safely:
To use the Secrets API, import { secrets }
from the wix-secrets-backend.v2
module:
Learn more about the Wix Secrets API in Secrets Manager in the Velo API Reference, and on Wix Learn.
It's important to note the following:
getSecretValue()
.Security considerations
listSecretInfo()
in a .jsw file with anonymous permissions. This is a serious security risk which exposes your secrets to potential leaks. To prevent this, implement listSecretInfo()
in a separate .js file to block frontend access. If you must include listSecretInfo()
in a .jsw file, make sure the exported function has permissions set to Admin. ",The following functions in Secrets are restricted and only run if you elevate permissions
using the wix-auth
elevate()
function:
Warning: Elevating a function allows it to be called by any site visitor. Exercise caution to prevent security vulnerabilities.