Dart - secret.version()

Returns a reference to a known version of a secret.

import 'package:nitric_sdk/nitric.dart';

final keyRef = Nitric.secret("encryptionKey").allow([
  SecretPermission.access,
]);

final keyVersionRef = keyRef.version("the-version-id");

Parameters

  • Name
    version
    Required
    Required
    Type
    String
    Description

    The version ID. This value is returned from secret.put().

Examples

Return a reference to a known secret version

import 'package:nitric_sdk/nitric.dart';

final keyRef = Nitric.secret("encryptionKey").allow([
  SecretPermission.access,
]);

final keyVersionRef = keyRef.version("the-version-id");

Access the value of a known secret version

import 'package:nitric_sdk/nitric.dart';

final keyRef = Nitric.secret("encryptionKey").allow([
  SecretPermission.access,
]);

final keyValue = await keyRef.version("the-version-id").access();

See also