listSecretInfo( )


Gets a list of objects containing information about all secrets stored in the Secrets Manager.

The listSecretInfo() function returns a Promise that resolves to a list containing information about all secrets stored on your site. The secret's value is omitted for security reasons, and can be retrieved using the getSecret() function for each individual secret.

Note: Do not use 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.

Method Declaration
Copy
function listSecretInfo(): Promise<Array<SecretInfo>>;
Request
This method does not take any parameters
Returns
Return Type:Promise<Array<SecretInfo>>
JavaScript
import wixSecretsBackend from "wix-secrets-backend"; export function getSecretInfo() { return wixSecretsBackend .listSecretInfo() .then((secrets) => { return secrets; }) .catch((error) => { console.error(error); }); } /* Returns a Promise that resolves to: * * [ * { * "id": "2eebccce-6c01-469d-a278-433fd96ba111", * "createdDate": "2020-05-26T06:16:46.000Z", * "updatedDate": "2020-05-28T12:21:10.000Z", * "name": "MyFirstSecret", * "description": "This is my first secret" * }, * { * "id": "ef4b43d4-851d-4b52-a07f-9a500a888371", * "createdDate": "2020-06-02T08:23:54.000Z", * "updatedDate": "2020-06-02T08:23:54.000Z", * "name": "MySecondSecret", * "description": "This is my second secret" * } * ] */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?