Nitric logo

Secrets

secret.version.access()

Retrieves the value from a version of a secret.

import { secret } from '@nitric/sdk';

const keyRef = secret('apiKey').for('access');

const keyValue = await keyRef.latest().access();

keyValue.asString();

Examples

Access the latest version of a secret

import { secret } from '@nitric/sdk';

const keyRef = secret('apiKey').for('access');

const keyValue = await keyRef.latest().access();

keyValue.asString();

Access a specific version of a secret

import { secret } from '@nitric/sdk';

const keyRef = secret('apiKey').for('access');

const keyValue = await keyRef.version('the-version-id').access();

keyValue.asString();
Previous
secret.latest()