Node.js - secret.version.access()

Retrieves the value from a version of a secret.

import { secret } from '@nitric/sdk'
const keyRef = secret('apiKey').allow('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').allow('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').allow('access')
const keyValue = await keyRef.version('the-version-id').access()
keyValue.asString()
Last updated on Nov 8, 2024