Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@azure/keyvault-secrets

Package Overview
Dependencies
Maintainers
2
Versions
422
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azure/keyvault-secrets

Isomorphic client library for Azure KeyVault's secrets.

  • 4.9.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is @azure/keyvault-secrets?

@azure/keyvault-secrets is an npm package that allows you to manage secrets in Azure Key Vault. It provides functionalities to store, retrieve, update, and delete secrets securely.

What are @azure/keyvault-secrets's main functionalities?

Store a Secret

This code demonstrates how to store a secret in Azure Key Vault using the @azure/keyvault-secrets package. It uses DefaultAzureCredential for authentication and SecretClient to interact with the Key Vault.

const { DefaultAzureCredential } = require('@azure/identity');
const { SecretClient } = require('@azure/keyvault-secrets');

const credential = new DefaultAzureCredential();
const url = `https://<Your-Key-Vault-Name>.vault.azure.net`;
const client = new SecretClient(url, credential);

async function setSecret() {
  const result = await client.setSecret('mySecretName', 'mySecretValue');
  console.log('Secret set: ', result);
}

setSecret();

Retrieve a Secret

This code demonstrates how to retrieve a secret from Azure Key Vault using the @azure/keyvault-secrets package. It uses DefaultAzureCredential for authentication and SecretClient to interact with the Key Vault.

const { DefaultAzureCredential } = require('@azure/identity');
const { SecretClient } = require('@azure/keyvault-secrets');

const credential = new DefaultAzureCredential();
const url = `https://<Your-Key-Vault-Name>.vault.azure.net`;
const client = new SecretClient(url, credential);

async function getSecret() {
  const result = await client.getSecret('mySecretName');
  console.log('Secret retrieved: ', result.value);
}

getSecret();

Update a Secret

This code demonstrates how to update a secret's properties in Azure Key Vault using the @azure/keyvault-secrets package. It uses DefaultAzureCredential for authentication and SecretClient to interact with the Key Vault.

const { DefaultAzureCredential } = require('@azure/identity');
const { SecretClient } = require('@azure/keyvault-secrets');

const credential = new DefaultAzureCredential();
const url = `https://<Your-Key-Vault-Name>.vault.azure.net`;
const client = new SecretClient(url, credential);

async function updateSecret() {
  const result = await client.updateSecretProperties('mySecretName', { enabled: false });
  console.log('Secret updated: ', result);
}

updateSecret();

Delete a Secret

This code demonstrates how to delete a secret from Azure Key Vault using the @azure/keyvault-secrets package. It uses DefaultAzureCredential for authentication and SecretClient to interact with the Key Vault.

const { DefaultAzureCredential } = require('@azure/identity');
const { SecretClient } = require('@azure/keyvault-secrets');

const credential = new DefaultAzureCredential();
const url = `https://<Your-Key-Vault-Name>.vault.azure.net`;
const client = new SecretClient(url, credential);

async function deleteSecret() {
  const result = await client.beginDeleteSecret('mySecretName');
  console.log('Secret deletion started: ', result);
}

deleteSecret();

Other packages similar to @azure/keyvault-secrets

Keywords

FAQs

Package last updated on 17 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc