Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to unseal a vault that is already initialized? #211

Open
CoinCoderBuffalo opened this issue Dec 20, 2022 · 2 comments
Open

How to unseal a vault that is already initialized? #211

CoinCoderBuffalo opened this issue Dec 20, 2022 · 2 comments

Comments

@CoinCoderBuffalo
Copy link

Basic question. I don't see any examples on handling this scenario.
Thanks

@CoinCoderBuffalo
Copy link
Author

CoinCoderBuffalo commented Dec 20, 2022

I figured out how to do this. I added an async run command to the client to handle this.

vaultClient.run = async () => {
  try {
    const status = await vaultClient.status()
    if (!status.initialized) {
      await vaultClient.init({ secret_shares: 1, secret_threshold: 1 })
    }
    if (status.sealed) {
      await vaultClient.unseal({ secret_shares: 1, key: config.vault.key })
    }
    logger.success('node-vault', 'Vault initialized and unsealed')
  } catch (err) {
    logger.error('node-vault', err.message)
  }
}

@jeghers
Copy link

jeghers commented Jun 12, 2023

Please add this to the documentation. There are lots of missing things in the docs that leaves us lost and unsure what to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants