Skip to content

add methods and struct for e2ee#788

Closed
mikelodder7 wants to merge 7 commits intofeat/rc-naga-2025-04-07from
ml/e2ee
Closed

add methods and struct for e2ee#788
mikelodder7 wants to merge 7 commits intofeat/rc-naga-2025-04-07from
ml/e2ee

Conversation

@mikelodder7
Copy link
Copy Markdown
Contributor

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

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.

Signed-off-by: Michael Lodder <mike@litprotocol.com>
Comment thread packages/crypto/src/lib/crypto.ts Outdated
message: Uint8Array
): Promise<WalletEncryptedPayload> => {
const random = new Uint8Array(16);
window.crypto.getRandomValues(random);
Copy link
Copy Markdown
Contributor

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

Comment thread packages/crypto/src/lib/crypto.ts Outdated
timestamp.writeBigUInt64BE(BigInt(createdAt), 0);

const myWalletPublicKey = new Uint8Array(32);
nacl.crypto_scalarmult_base(myWalletPublicKey, myWalletSecretKey);
Copy link
Copy Markdown
Contributor

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)

Copy link
Copy Markdown
Contributor

@Ansonhkg Ansonhkg left a 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:

Comment thread packages/crypto/src/lib/crypto.ts Outdated
@Ansonhkg Ansonhkg changed the base branch from feat/rc-naga-2025-01-30b to feat/rc-naga-2025-04-07 April 9, 2025 16:36
@Ansonhkg Ansonhkg mentioned this pull request Apr 9, 2025
6 tasks
Signed-off-by: Michael Lodder <mike@litprotocol.com>
@Ansonhkg Ansonhkg closed this Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants