Repository navigation
Add an encrypted-values collection flow alongside the default example - #1
Merged
Merged
Conversation
Contributor
Author
|
@cursor review |
|
Skipping Bugbot: Bugbot is disabled for this repository. Visit the Bugbot dashboard to update your settings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
summary
Adds a second collection flow that encrypts credential values in the browser to the vault's Kernel-managed public key, so this app's backend only relays ciphertext and Kernel decrypts it. The existing plaintext flow is unchanged.
/credentials/collect/credentials/collect-encrypted/api/credential-requests/current/api/credential-requests/current-encryptedbun run create-requestbun run create-request -- --encryptedvalueencrypted_value(compact JWE,ECDH-ES+A256GCM)Uses
GET /vaults/{id_or_name}/encryption_keyandencrypted_value, available in@onkernel/sdk0.122.0.Earlier revisions of this PR replaced the default flow and used app-held per-request keys. Both are gone: the default flow's page, API route and page test are identical to
main, and there is no decryption in this repo.how the encrypted flow works
{ item, encryption_key }; the backend fetches the key withkernel.vaults.retrieveEncryptionKey(vaultId).jose(lib/encrypted-submission.ts). Clearing an optional field stays{ "value": null }.valuestrings.kernel.vaults.items.updateforwards eachencrypted_valueunchanged.Shared code changes are additive:
createCollectionHandlertakesencrypted?: boolean,CredentialVaultClientgainsencryptionKey(), and the mock vault generates a key pair and decrypts the way Kernel does.validation
bun run typecheck,bun run test(22 tests across both flows),bun run build.MOCK_VAULT=false, reached from a Kernel browser through a private tunnelvaluefields, itemreadyencrypted_valuefields and no plaintext in the request body, itemready