-
Notifications
You must be signed in to change notification settings - Fork 1
API RFC #2
Comments
Thoughts on moving the endspoints to something like this? /envs/:namespace/:id/:key Where these could be the
This would allow access to either a user's personal keys, a single services, a teams or org wide envs. |
When a user authenticates let's use the user's ID + password for the auth via basic auth header. When we get the userId + password use them to lookup the encrypted password for the namespace + key they're accessing. Something like this. const userId = '123';
const password = '123';
const namespace = 'service';
const namespaceId = 'c7001d79-9803-448e-af21-bee8b494d9e6';
const key = 'NODE_ENV';
const namespacePassword = db
.selectFrom('namespace_passwords')
.select('iv')
.select('salt')
.select('data')
.where('userId', '=', userId)
.where('namespace', '=', namespace)
.where('namespaceId', '=', namespaceId)
.executeTakeFirst();
// Now that we have the password for the service we can decrypt it.
const encryptedEnv = await db
.selectFrom('envs')
.select('iv')
.select('salt')
.select('data')
.where('namespace', '=', namespace)
.where('namespaceId', '=', namespaceId)
.where('key', '=', key)
.executeTakeFirst();
if (!encryptedEnv) throw new Error('Not found');
const decryptedEnv = {
key,
value: decryptEnv(encryptedEnv, namespacePassword),
}; |
Hmm, issue with the above is how do we share keys to the other user without knowing their password in advance. 🤔 |
Thoughts? 🤔 I haven't added anything about encryption since it's all client side now.
|
// Create token[body:username,body:password] -> { token } |
structure
The text was updated successfully, but these errors were encountered: