-
Notifications
You must be signed in to change notification settings - Fork 88
Feature/jss 35 naga js sdk wrapped keys implementation #972
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: naga
Are you sure you want to change the base?
Feature/jss 35 naga js sdk wrapped keys implementation #972
Conversation
…-function-to-take Signed-off-by: Anson <[email protected]>
…-function-to-take
…o-take' of github.com:LIT-Protocol/js-sdk into feature/jss-36-naga-sdk-add-a-make-a-request-function-to-take
…-function-to-take
…auth signature and check expiration
…-function-to-take
…ure validation. This is similar to the existing `validateSessionSig` function.
…o-take' of github.com:LIT-Protocol/js-sdk into feature/jss-36-naga-sdk-add-a-make-a-request-function-to-take
…-function-to-take
…o-take' of github.com:LIT-Protocol/js-sdk into feature/jss-36-naga-sdk-add-a-make-a-request-function-to-take
…pt parameters directly
…s-35-naga-js-sdk-wrapped-keys-implementation
…s-35-naga-js-sdk-wrapped-keys-implementation
glitch003
left a comment
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.
just a question about SIWE parsing, otherwise looks good!
| @@ -0,0 +1,126 @@ | |||
| --- | |||
| title: "Server Sessions" | |||
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.
nice to see docs on this - i know we've informally explained it to a bunch of teams
| const siweMessage = delegationAuthSig.signedMessage; | ||
|
|
||
| // Extract domain | ||
| const domainMatch = siweMessage.match(/^([^\s]+) wants you to sign in/m); |
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.
if it's an SIWE message then you can parse using the SIWE lib, right? like i think this works const message = new SiweMessage(siweMessageString); and then you can do like message.domain etc
| ); | ||
| const expectedSignature = await signBytes(signingKey, messageBytes); | ||
|
|
||
| expect(Array.from(decodedSignatureBytes)).toEqual( |
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.
i was surprised this would work but i looked it up and ed25519 signatures are deterministic, so it does work. neat.
WHAT
✨ Wrapped keys for Naga (v8+) networks
Also...
Features
Internally
Build Lit Action
nx run wrapped-keys-lit-actions:generate-lit-actionsSync the lit actions to IPFS
pnpm sync:wkExternally
New
authpackage APIsvalidateDelegationAuthSig- sanity-checks a delegation signature before accepting session materials from another party.generatePkpDelegationAuthSig- asks the Lit network to delegate a PKP to a session keypair with scoped resources/expiration.generateEoaDelegationAuthSig- has an EOA wallet sign the delegation message directly for client-generated sessions.createPkpAuthContextFromPreGenerated- hydrates a PKP auth context from pre-generated session materials.createPkpSessionSigs- creates fresh session signatures from a pre-generated auth context.New
wrapped-keyspackage APIsgeneratePrivateKey- creates and stores a new wrapped key for EVM or Solana.importPrivateKey- encrypts an existing key (K256 or ed25519) and persists it as a wrapped key.exportPrivateKey- decrypts a wrapped key inside a Lit Action and returns the plaintext key plus metadata.listEncryptedKeyMetadata- lists wrapped key metadata linked to the PKP without fetching ciphertext.getEncryptedKey- retrieves ciphertext and metadata for a specific wrapped key.storeEncryptedKey- saves third-party ciphertext/metadata as a wrapped key entry.storeEncryptedKeyBatch- stores multiple ciphertext payloads in a single request.batchGeneratePrivateKeys- runs multiple generation/signing actions in one call.signMessageWithEncryptedKey- signs arbitrary data using the stored wrapped key.signTransactionWithEncryptedKey- signs (and optionally broadcasts) EVM or Solana transactions with the wrapped key.Meine Checklist