Main Content

isSecret

Determine if secret exists in MATLAB vault

Since R2024a

Description

example

tf = isSecret(secretname) returns logical 1 (true) if the specified secret exists in your MATLAB® vault. Otherwise, it returns logical 0 (false). Your MATLAB vault is accessible only from the exact combination of your operating system account and local machine.

Examples

collapse all

Determine if a secret exists in your vault.

tf = isSecret("SFTPpassword")
tf =

  logical

   1

Connect to an SFTP server if the password exists as a secret value in your MATLAB vault.

if (isSecret("SFTPpassword"))
    s = sftp("sftp.example.net","adam", ...
        Password=getSecret("SFTPpassword"));
end

Input Arguments

collapse all

Unique case-sensitive text identifier for the secret, specified as a string scalar or character vector. You can use a secret to hold sensitive information, such as passwords, certificates, credentials, OAuth tokens, and other configuration data for:

  • SFTP and FTP servers

  • Password-protected files, such as PDFs

  • Password-protected archives, such as zip files

  • Cloud providers, such as Amazon S3™ and Windows Azure® Blob Storage

  • API keys, SSH keys, and encryption keys

  • Databases and applications

The forward slash character (/) is not supported in secretname.

More About

collapse all

MATLAB Vault

Your secrets are stored in your MATLAB vault, which is accessible only from the exact combination of your operating system account and local machine. Your vault and secrets, which do not leave your local machine, persist across MATLAB sessions. Each secret consists of a name, value, and optional metadata.

  • Secret name – A unique case-sensitive text identifier for the secret. The secret name is stored unencrypted in your vault as a string scalar.

  • Secret value – A text value associated with the secret. The Secret Prompt dialog box, where you enter the secret value, supports copy-paste functionality. The secret value is stored encrypted in your vault using industry standard AES-256 encryption. The secret value is returned as a string scalar.

  • Secret metadata – A dictionary containing additional information associated with the secret. The optional secret metadata is stored unencrypted in your vault.

To set a secret, use setSecret.

Version History

Introduced in R2024a