Lit SDK V2
The team behind Lit is always looking for ways to improve the product and make the lives of developers easier. With that in mind, we are excited to announce the Lit SDK V2 (written in Typescript!).
So, what makes this new SDK special?
TypeScript support has been a highly demanded feature! We've taken the feedback we received and created a more intuitive and streamlined development experience. We believe that by providing this upgraded SDK, we can improve the developer experience by enabling better code autocompletion and earlier error detection in the IDE. This not only makes it easier to write and debug code, but also allows developers to catch errors before they become bigger issues.
In addition, TypeScript enables better documentation and scalability in code. As the number of contributors to Lit’s codebase grows, the migration to TypeScript and a monorepo structure enhances maintainability and collaboration among team members working on their own repositories. Enforcing types simplifies the understanding of each other's code for developers. Additionally, it ensures compatibility with the types generated from our Rust nodes, enabling seamless integration between the nodes and the SDK. Finally, the V2 SDK is modular, easier to use, and has a much smaller bundle size than the V1 SDK.
Overall, we are excited to offer this new Lit Typescript SDK to improve the experience and productivity of developers who build with Lit. We believe that this improved SDK will result in better developer experiences.
V2 SDK
Deprecated V1 SDK
How to import the V2 SDK
There aren't many changes in terms of installing it, but rather importing it.
Instead of importing it like this:
import LitJsSdk from 'lit-js-sdk';
You will now need to import like this:
import * as LitJsSdk from '@lit-protocol/lit-node-client';
Yes, you will have to type few more characters, but you can now also decide to use a particular module instead of the whole bundled package.
For example, if you only want to get the authSig from the browser, you can use this:
import { checkAndSignAuthMessage } from '@lit-protocol/auth-browser';
More modules can be found in the JS SDK docs.
If you want to do a simple encryption and decryption, check out this example:
Demo: demo-encrypt-decrypt-react, Codebase to reference
You can use the following to import the SDK:
import LitJsSdk from "@lit-protocol/lit-node-client";
For more references on how to install the V2 SDK, check out the developer docs.
Changelog
It's important to stay updated with the latest changes to the SDK, as it can affect how you develop and interact with Lit. The changelog serves as the source of truth for all notable changes and updates to the SDK, including bug fixes, new features, and enhancements. By referring to the changelog, you can ensure that you're using the most up-to-date version of the SDK and can take advantage of all of its features.
You can find the changelog on the Lit Protocol GitHub repo.
Conclusion
This new SDK is a testament to our commitment to developers who use Lit. We would love to hear about how you have incorporated Lit's SDK into your applications.
Were there any particular challenges you faced while integrating it? What benefits have you seen after using it?
Feel free to share your thoughts with us by commenting on this blog or by posting on Lit's Discord. Additionally, if you encounter any issues or have any suggestions for improvements, please don't hesitate to open an issue or pull request on GitHub. We appreciate all feedback and look forward to hearing from you!