LIT-Protocol / js-sdk

The Lit Protocol SDK provides developers with a framework for implementing Lit functionality into their own applications.
https://developer.litprotocol.com
MIT License
92 stars 55 forks source link

Wrapped Keys #513

Closed MaximusHaximus closed 5 days ago

MaximusHaximus commented 1 week ago

Description

e.g.:

import { getPrivateKeyMetadata } from '@lit-protocol/wrapped-keys'

import { litNodeClient } from '@lit-protocol/lit-node-client'

await litNodeClient.connect({litNetwork: 'cayenne'});
const sessionSigs = await litNodeClient.getSessionSigs(...);
const keyMetadata = await getPrivateKeyMetadata({ litNodeClient, sessionSigs})
const customLitActionWithWrappedKeyResponse = await litNodeClient.executeJs({
  sessionSigs,
  ipfsId: litActionIpfsCid, // OR
  code: litActionCode, 
  jsParams: {
    accessControlConditions,
    keyMetadata,
  },
});

// Do whatever you want to with `customLitActionWithWrappedKeyResponse

Type of change

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Checklist:

spacesailor24 commented 1 week ago

The local-tests/tests/testImportWrappedKey.ts test is importing a Solana key but says the keyType is K256

This test also isn't really testing if the key was imported correctly, but I think we'd have to use either getEncryptedKeyMetadata or the sign methods to verify it was

spacesailor24 commented 1 week ago

Are there tests for getEncryptedKeyMetadata and storeEncryptedKeyMetadata?

CLAassistant commented 1 week ago

CLA assistant check
All committers have signed the CLA.

MaximusHaximus commented 1 week ago

Are there tests for getEncryptedKeyMetadata and storeEncryptedKeyMetadata?

Not directly; they are used by all of the other tests, so are extensively tested alreeady

MaximusHaximus commented 6 days ago

Addressed feedback and responded to some questions with questions @DashKash54 :)