Skip to content

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

Open
wants to merge 6 commits into
base: feat/rc-naga-2025-04-07
Choose a base branch
from

Conversation

mikelodder7
Copy link
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>
message: Uint8Array
): Promise<WalletEncryptedPayload> => {
const random = new Uint8Array(16);
window.crypto.getRandomValues(random);
Copy link
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

timestamp.writeBigUInt64BE(BigInt(createdAt), 0);

const myWalletPublicKey = new Uint8Array(32);
nacl.crypto_scalarmult_base(myWalletPublicKey, myWalletSecretKey);
Copy link
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
Collaborator

@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:

@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
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