Comments (6)
Hello ivankustera
Example code should work with both localConfigStorage
and loadJsonConfig
.
What is your Node version?
What is the version of Keeper Secrets Manager JavaScript SDK?
"@keeper-security/secrets-manager-core": "^16.3.1",
A few suggestions that may help in resolving the issue:
- Try using absolute path for the config file.
- Debug print the JSON text before loading it into
loadJsonConfig
to make sureappKey
is present - you should see a line like this:"appKey": "xXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXx=",
...
const configJson = require('fs').readFileSync('./ksm-config.json').toString()
console.log(configJson)
const storage = loadJsonConfig(configJson)
...
Please do not post actual config file contents in this thread.
from secrets-manager.
Hi,
I have verified that config file and string I am passing to loadJsonConfig
have all needed keys. This config was produced by the following CLI command:
secrets-manager client add --app MyApp --config-init json --unlock-ip
Also, I added some logging into storage's getValue
and getBytes
methods and I can see that at some point it gets value for appKey
but later it fails. So the storage is at least initialised with it.
My node version is v16.13.0
and the sdk is "@keeper-security/secrets-manager-core": "^16.3.1"
.
from secrets-manager.
from secrets-manager.
Thanks for your reply, but I am still having troubles to make it work. Here are all the details:
node v16.13.0
@keeper-security/secrets-manager-core: "^16.3.1"
Keeper Commander v16.6.6 (Current version)
Python Version: 3.9.13
Here's the helper code:
const oneTimeToken = 'xxx'
module.exports.getKeeperRecords2 = async () => {
const storage = localConfigStorage("ksm-config-2.json")
await initializeStorage(storage, oneTimeToken)
const { records } = await getSecrets({ storage: storage })
console.log({records})
}
The initial run is fine, I get empty array as expected. But the next run fails with the error:
/Users/ivan/keeper-poc/node_modules/@keeper-security/secrets-manager-core/dist/index.cjs.js:266
throw new Error(`Unable to load the key ${keyId}`);
^
Error: Unable to load the key appKey
at /Users/ivan/keeper-poc/node_modules/@keeper-security/secrets-manager-core/dist/index.cjs.js:266:15
at Generator.next (<anonymous>)
at /Users/ivan/keeper-poc/node_modules/@keeper-security/secrets-manager-core/dist/index.cjs.js:54:71
at new Promise (<anonymous>)
at __awaiter (/Users/ivan/keeper-poc/node_modules/@keeper-security/secrets-manager-core/dist/index.cjs.js:50:12)
at loadKey (/Users/ivan/keeper-poc/node_modules/@keeper-security/secrets-manager-core/dist/index.cjs.js:257:37)
at /Users/ivan/keeper-poc/node_modules/@keeper-security/secrets-manager-core/dist/index.cjs.js:360:23
at Generator.next (<anonymous>)
at /Users/ivan/keeper-poc/node_modules/@keeper-security/secrets-manager-core/dist/index.cjs.js:54:71
at new Promise (<anonymous>)
I verified that the config generated using one time token was identical as the one that was initialised from the commander.
from secrets-manager.
After a short consultation with Max we figured out the the issue is an empty vault. When I added an empty secret it worked immediately. I am renaming this issue to be more clear what the problem is.
from secrets-manager.
@ivankustera thank you working with us and trying to get to bottom of this issue. We will try to fix this issue soon and also will add a better error messaging.
from secrets-manager.
Related Issues (20)
- SSL Error with .exe File Not Occurring in IDE HOT 3
- java.security.NoSuchAlgorithmException: Cannot find any provider supporting AES/CBC/PKCS7Padding HOT 7
- Issue with Encrypting and Decrypting config.json Content Directly in Code HOT 2
- Hashicorp Vault integration error HOT 3
- Ansible module fails when using keeper_config variable HOT 3
- Supported Python Version? HOT 1
- Different behaviour between different `ksm secret list` invocations HOT 1
- There is no way to share secret with another Keeper user via SDK HOT 1
- Retrieve Folder Name from Filtered custom entry in Secrets Manager HOT 2
- Python SDK unable to clone custom record type
- Latest (1.1.3) macos installer broken?
- Hashicorp Vault plugin does not execute when Vault deployed via container HOT 1
- KSM CLI cannot delete records HOT 2
- python - KSMCache doesn't use cache on server HTTP errors HOT 1
- github action init error
- Python: URI error when downloading a file that was just uploaded HOT 1
- unexpected passkey entry when adding a login type record via CLI
- Keeper Vault failing in powershell HOT 2
- Cannot access Keeper secret in PowerShell by name HOT 7
- Add the possibility to remove a file uploaded to a secret
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from secrets-manager.