feat(crypto): rewrite verifyAccess to support asymmetric E2EE signatures (#93)#96
Open
annukumar123 wants to merge 3 commits into
Open
feat(crypto): rewrite verifyAccess to support asymmetric E2EE signatures (#93)#96annukumar123 wants to merge 3 commits into
annukumar123 wants to merge 3 commits into
Conversation
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.
🎯 Overview
This PR addresses Issue #93 by upgrading the
verifyAccesspipeline in the SDK from a plain JSON pass-through to a secure, asymmetric End-to-End Encryption (E2EE) cryptographic verification protocol.🛠️ Changes Implemented
src/config-validation.mjs: Extended the client configuration validator schema to recognize and validate the optional, PEM-encodedprivateKeyproperty.src/client.mjs: Rewrote theverifyAccessmethod to check for aprivateKey. If present, it wraps the options payload with an automated validation timestamp, signs it using Node's nativecryptoengine (RSA-PSS-SHA256), and securely structures the outbound body withencrypted_payload,signature, andalgokeys.test/sdk.test.mjs: Added an isolated integration unit test suite that generates a mock RSA key pair to fully verify signature generation, cryptographic algorithm headers, and inner payload binding functionality.🧪 Test Results
All 9 core tests and verification suites are passing successfully locally without errors: