api: {
    batchGeneratePrivateKeys: ((params: BatchGeneratePrivateKeysParams) => Promise<BatchGeneratePrivateKeysResult>);
    exportPrivateKey: ((params: ExportPrivateKeyParams) => Promise<ExportPrivateKeyResult>);
    generatePrivateKey: ((params: GeneratePrivateKeyParams) => Promise<GeneratePrivateKeyResult>);
    getEncryptedKey: ((params: GetEncryptedKeyDataParams) => Promise<StoredKeyData>);
    importPrivateKey: ((params: ImportPrivateKeyParams) => Promise<ImportPrivateKeyResult>);
    listEncryptedKeyMetadata: ((params: BaseApiParams) => Promise<StoredKeyMetadata[]>);
    signMessageWithEncryptedKey: ((params: SignMessageWithEncryptedKeyParams) => Promise<string>);
    signTransactionWithEncryptedKey: ((params: SignTransactionWithEncryptedKeyParams) => Promise<string>);
    storeEncryptedKey: ((params: StoreEncryptedKeyParams) => Promise<StoreEncryptedKeyResult>);
    storeEncryptedKeyBatch: ((params: StoreEncryptedKeyBatchParams) => Promise<StoreEncryptedKeyBatchResult>);
} = ...

Type declaration

  • batchGeneratePrivateKeys: ((params: BatchGeneratePrivateKeysParams) => Promise<BatchGeneratePrivateKeysResult>)
      • (params): Promise<BatchGeneratePrivateKeysResult>
      • TODO: Document batch behaviour

        Parameters

        • params: BatchGeneratePrivateKeysParams

          Parameters to use for generating keys and optionally signing messages

        Returns Promise<BatchGeneratePrivateKeysResult>

        • The generated keys and, optionally, signed messages
  • exportPrivateKey: ((params: ExportPrivateKeyParams) => Promise<ExportPrivateKeyResult>)
      • (params): Promise<ExportPrivateKeyResult>
      • Exports a previously persisted private key from the wrapped keys service for direct use by the caller, along with the keys metadata. This method fetches the encrypted key from the wrapped keys service, then executes a Lit Action that decrypts the key inside the LIT action and removes the salt from the decrypted key.

        Parameters

        Returns Promise<ExportPrivateKeyResult>

        • The decrypted private key of the Wrapped Key along with all the associated key info and LIT PKP Address associated with the Wrapped Key
  • generatePrivateKey: ((params: GeneratePrivateKeyParams) => Promise<GeneratePrivateKeyResult>)
      • (params): Promise<GeneratePrivateKeyResult>
      • Generates a random private key inside a Lit Action, and persists the key and its metadata to the wrapped keys service. Returns the public key of the random private key, and the PKP address that it was associated with. We don't return the generated wallet address since it can be derived from the publicKey

        The key will be associated with the PKP address embedded in the pkpSessionSigs you provide. One and only one wrapped key can be associated with a given LIT PKP.

        Parameters

        Returns Promise<GeneratePrivateKeyResult>

        • The publicKey of the generated random private key and the LIT PKP Address associated with the Wrapped Key
  • getEncryptedKey: ((params: GetEncryptedKeyDataParams) => Promise<StoredKeyData>)
      • (params): Promise<StoredKeyData>
      • Get a previously encrypted and persisted private key and its metadata. Note that this method does not decrypt the private key; only the encrypted key and its metadata will be returned to the caller.

        Parameters

        Returns Promise<StoredKeyData>

        The encrypted private key and its associated metadata

  • importPrivateKey: ((params: ImportPrivateKeyParams) => Promise<ImportPrivateKeyResult>)
      • (params): Promise<ImportPrivateKeyResult>
      • Import a provided private key into the wrapped keys service backend. First, the key is pre-pended with LIT_PREFIX for security reasons, then the salted key is encrypted and stored in the backend service. The key will be associated with the PKP address embedded in the pkpSessionSigs you provide. One and only one wrapped key can be associated with a given LIT PKP.

        Parameters

        • params: ImportPrivateKeyParams

          The parameters required to import the private key into the wrapped keys backend service

        Returns Promise<ImportPrivateKeyResult>

        • The LIT PKP Address associated with the Wrapped Key
  • listEncryptedKeyMetadata: ((params: BaseApiParams) => Promise<StoredKeyMetadata[]>)
      • (params): Promise<StoredKeyMetadata[]>
      • Get list of metadata for previously encrypted and persisted private keys Note that this method does include the ciphertext or dataToEncryptHash values necessary to decrypt the keys. To get those values, call getEncryptedKey() with the id for the appropriate key returned by this method.

        Parameters

        • params: BaseApiParams

          Parameters required to fetch the encrypted private key metadata

        Returns Promise<StoredKeyMetadata[]>

        The encrypted private key and its associated metadata

  • signMessageWithEncryptedKey: ((params: SignMessageWithEncryptedKeyParams) => Promise<string>)
      • (params): Promise<string>
      • Signs a message inside the Lit Action using the previously persisted wrapped key associated with the current LIT PK. This method fetches the encrypted key from the wrapped keys service, then executes a Lit Action that decrypts the key inside the LIT action and uses the decrypted key to sign the provided transaction

        Parameters

        Returns Promise<string>

        • The signed message
  • signTransactionWithEncryptedKey: ((params: SignTransactionWithEncryptedKeyParams) => Promise<string>)
      • (params): Promise<string>
      • Signs a transaction inside the Lit Action using the previously persisted wrapped key associated with the current LIT PK. This method fetches the encrypted key from the wrapped keys service, then executes a Lit Action that decrypts the key inside the LIT action and uses the decrypted key to sign the provided transaction Optionally, if you pass broadcast: true, the LIT action will also submit the signed transaction to the associated RPC endpoint on your behalf

        Parameters

        Returns Promise<string>

        The signed transaction OR its transaction hash if you set broadcast: true and the LIT action supports this functionality.

  • storeEncryptedKey: ((params: StoreEncryptedKeyParams) => Promise<StoreEncryptedKeyResult>)
  • storeEncryptedKeyBatch: ((params: StoreEncryptedKeyBatchParams) => Promise<StoreEncryptedKeyBatchResult>)