-
Notifications
You must be signed in to change notification settings - Fork 76
add methods and struct for e2ee #788
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
base: feat/rc-naga-2025-04-07
Are you sure you want to change the base?
Conversation
Signed-off-by: Michael Lodder <mike@litprotocol.com>
packages/crypto/src/lib/crypto.ts
Outdated
message: Uint8Array | ||
): Promise<WalletEncryptedPayload> => { | ||
const random = new Uint8Array(16); | ||
window.crypto.getRandomValues(random); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using window
won't work on node side, neither deno if we want to put the SDK in LAs. However the method exists on nodes and denos crypto module
packages/crypto/src/lib/crypto.ts
Outdated
timestamp.writeBigUInt64BE(BigInt(createdAt), 0); | ||
|
||
const myWalletPublicKey = new Uint8Array(32); | ||
nacl.crypto_scalarmult_base(myWalletPublicKey, myWalletSecretKey); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: if we can use @noble curves and hashes way better so we move towards lib unification (and drop tweetnacl)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to handle node environment and unit test is required
Update:
- Fixed them here Anson/propose change for 788 #815, review needed @DashKash54 @mikelodder7
Anson/propose change for 788
Description
This adds the methods that will be necessary for End-to-End Encryption with lit-node coming shortly after Naga release.
This only uses tweet-nacl and thus no new dependencies are added.
Type of change
How Has This Been Tested?
I'm not familiar with how to test in the SDK but would love help in adding unit tests for this.