listSecretInfo( )


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:

  • The secret's value does not get returned for security reasons. To retrieve a secret's value, use the getSecretValue() function.
Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Secrets
Learn more about app permissions.
Method Declaration
Copy
function listSecretInfo(): Promise<ListSecretInfoResponse>;
Request
This method does not take any parameters
Returns
Return Type:Promise<ListSecretInfoResponse>
JavaScript
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" * } * ] * } */
Errors

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

Did this help?