Retrieves a list of objects containing information about all secrets.
The listSecretInfo()
function returns a Promise that resolves to a list containing information about all secrets stored on your site.
Note:
getSecretValue()
function.This function requires elevated permissions and runs only on the backend and on dashboard pages.
function listSecretInfo(): Promise<ListSecretInfoResponse>;
import { secrets } from "wix-secrets-backend.v2";
import { elevate } from "wix-auth";
const elevatedListSecretInfo = elevate(secrets.listSecretInfo);
export function getSecretInfo() {
return elevatedListSecretInfo()
.then((secrets) => {
return secrets;
})
.catch((error) => {
console.error(error);
});
}
/* Returns a Promise that resolves to:
* {
* "secrets": [
* {
* "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"
* }
* ]
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.