diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index 193b717b36..1ae66e3eb6 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -28,7 +28,7 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.
**Environment:**
- - Lit SDK version (including the network (ie, "serrano") if different, and type - browser or backend)
+ - Lit SDK version (including the network (ie, "cayenne") if different, and type - browser or backend)
- Node version
- Framework (React, Vue, Angular, Svelte - just Plain HTML!, etc)
- Specific tooling (Webpack, Vite, browserify, etc)
diff --git a/apps/demo-email-sms-auth/src/Otp.js b/apps/demo-email-sms-auth/src/Otp.js
index 9ac4d4b1a4..79ad2ba74d 100644
--- a/apps/demo-email-sms-auth/src/Otp.js
+++ b/apps/demo-email-sms-auth/src/Otp.js
@@ -10,7 +10,7 @@ import {newSessionCapabilityObject, LitAccessControlConditionResource, LitAbilit
export function Otp() {
let [state, setState] = useState('start');
const litNodeClient = new LitNodeClient({
- litNetwork: "serrano",
+ litNetwork: "cayenne",
debug: true
});
const authClient = new LitAuthClient({
diff --git a/apps/demo-encrypt-decrypt-react/package.json b/apps/demo-encrypt-decrypt-react/package.json
index 043d0f6f34..19efb2041f 100644
--- a/apps/demo-encrypt-decrypt-react/package.json
+++ b/apps/demo-encrypt-decrypt-react/package.json
@@ -4,13 +4,18 @@
"private": true,
"dependencies": {
"@lit-protocol/lit-node-client": "^2.1.158",
- "@monaco-editor/react": "^4.4.6",
+ "@monaco-editor/react": "^4.5.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
+ "@types/jest": "^29.4.0",
+ "@types/node": "^18.11.19",
+ "@types/react": "^18.0.27",
+ "@types/react-dom": "^18.0.10",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
+ "typescript": "^4.9.5",
"web-vitals": "^2.1.4"
},
"scripts": {
diff --git a/apps/demo-encrypt-decrypt-react/src/App.js b/apps/demo-encrypt-decrypt-react/src/App.js
deleted file mode 100644
index b9e3ffd049..0000000000
--- a/apps/demo-encrypt-decrypt-react/src/App.js
+++ /dev/null
@@ -1,331 +0,0 @@
-import './App.css';
-import { useState } from 'react';
-import LitLogo from './LitLogo';
-import Editor from '@monaco-editor/react';
-import { benchmark } from './utils';
-import * as LitJsSdk from '@lit-protocol/lit-node-client';
-
-function App() {
-
- // ----- autogen:app-name:start -----
- const [appName, setAppName] = useState('Simple Encrypt Decrypt');
- // ----- autogen:app-name:end -----
-
- const [npmRepo, setNpmRepo] = useState('https://github.com/LIT-Protocol/js-sdk/tree/master/packages/lit-node-client');
- const [demoRepo, setDemoRepo] = useState('https://github.com/LIT-Protocol/js-sdk/tree/master/apps/demo-encrypt-decrypt-react');
- const [lang, setLang] = useState('json');
- const [data, setData] = useState({
- data: {
- name: 'Lit Protocol',
- description: 'Threadshold cryptography for the win!',
- }
- });
- const [str, setStr] = useState('This test is working! Omg!');
-
- const go = async () => {
- let code = `import * as LitJsSdk from '@lit-protocol/lit-node-client';
-
-const litNodeClient = new LitJsSdk.LitNodeClient({
- litNetwork: 'serrano',
-});
-await litNodeClient.connect();
-
-// { ms }
-// { Loading... }
-const authSig = await LitJsSdk.checkAndSignAuthMessage({
- chain: 'ethereum'
-});
-
-const accs = [
- {
- contractAddress: '',
- standardContractType: '',
- chain: 'ethereum',
- method: 'eth_getBalance',
- parameters: [':userAddress', 'latest'],
- returnValueTest: {
- comparator: '>=',
- value: '0',
- },
- },
-];
-
-// { ms }
-const res = await LitJsSdk.encryptString('${str}');
-
-// { Loading... }
-const encryptedString = res.encryptedString;
-
-// { Loading... }
-const symmetricKey = res.symmetricKey;
-
-// { ms }
-// { Loading... }
-const base64EncryptedString = await LitJsSdk.blobToBase64String(
- encryptedString
-);
-
-// { ms }
-// { Loading... }
-const encryptedSymmetricKey =
- await litNodeClient.saveEncryptionKey({
- accessControlConditions: accs,
- symmetricKey: symmetricKey,
- authSig: authSig,
- chain: 'ethereum',
- });
-
-// { ms }
-// { Loading... }
-const toDecrypt = await LitJsSdk.uint8arrayToString(
- encryptedSymmetricKey,
- 'base16'
-);
-
-// { ms }
-// { Loading... }
-const encryptionKey = await litNodeClient.getEncryptionKey({
- accessControlConditions: accs,
- toDecrypt: toDecrypt,
- authSig: authSig,
- chain: 'ethereum',
-});
-
-// { ms }
-// { Loading... }
-const blob = LitJsSdk.base64StringToBlob(base64EncryptedString);
-
-// { ms }
-// { Loading... }
-const decryptedString = await LitJsSdk.decryptString(
- blob,
- encryptionKey
-);
-
-console.log("decryptedString:", "Loading...");
-
-`;
-
- setLang('javascript')
- setData(code);
-
- const litNodeClient = new LitJsSdk.LitNodeClient({
- litNetwork: 'serrano',
- });
- await litNodeClient.connect();
-
-
- // --------- NEXT STEP ---------
- let authSig;
-
- await benchmark(async () => {
- authSig = await LitJsSdk.checkAndSignAuthMessage({
- chain: 'ethereum'
- });
- return authSig
- }, (ms, res) => {
- code = code.replace('// { ms }', `// { ${ms} }`);
- code = code.replace('// { Loading... }', `// { ${JSON.stringify(res)} }`);
- setData(code);
- });
-
- const accs = [
- {
- contractAddress: '',
- standardContractType: '',
- chain: 'ethereum',
- method: 'eth_getBalance',
- parameters: [':userAddress', 'latest'],
- returnValueTest: {
- comparator: '>=',
- value: '0',
- },
- },
- ];
-
-
- // --------- NEXT STEP ---------
- let res;
- let encryptedString;
- let symmetricKey;
-
- await benchmark(async () => {
- res = await LitJsSdk.encryptString(str);
- return res
- }, (ms, res) => {
- encryptedString = res.encryptedString;
- symmetricKey = res.symmetricKey;
-
-
- code = code.replace('// { ms }', `// { ${ms} }`);
- code = code.replace('// { Loading... }', `// [Blob] { ${JSON.stringify(encryptedString)} }`);
- code = code.replace('// { Loading... }', `// [Uint8Array] { ${JSON.stringify(symmetricKey)} }`);
- setData(code);
- });
-
-
- // --------- NEXT STEP ---------
- let base64EncryptedString;
- await benchmark(async () => {
- base64EncryptedString = await LitJsSdk.blobToBase64String(
- encryptedString
- );
- return base64EncryptedString
- }, (ms, base64EncryptedString) => {
-
- code = code.replace('// { ms }', `// { ${ms} }`);
- code = code.replace('// { Loading... }', `// [string] ${base64EncryptedString}`);
- // code = code.replace('// { Loading... }', `// [Uint8Array] { ${JSON.stringify(symmetricKey)} }`);
- setData(code);
- });
-
-
- // --------- NEXT STEP ---------
- let encryptedSymmetricKey;
- await benchmark(async () => {
- encryptedSymmetricKey =
- await litNodeClient.saveEncryptionKey({
- accessControlConditions: accs,
- symmetricKey: symmetricKey,
- authSig: authSig,
- chain: 'ethereum',
- });
- return encryptedSymmetricKey
- }, (ms, encryptedSymmetricKey) => {
-
- console.log("encryptedSymmetricKey:", encryptedSymmetricKey)
-
- code = code.replace('// { ms }', `// { ${ms} }`);
- code = code.replace('// { Loading... }', `// [Uint8Array] ${encryptedSymmetricKey}`);
- setData(code);
- });
-
-
- // --------- NEXT STEP ---------
- let toDecrypt;
-
- await benchmark(async () => {
- toDecrypt = await LitJsSdk.uint8arrayToString(
- encryptedSymmetricKey,
- 'base16'
- );
- return toDecrypt
- }, (ms, toDecrypt) => {
-
- console.log("toDecrypt:", toDecrypt)
-
- code = code.replace('// { ms }', `// { ${ms} }`);
- code = code.replace('// { Loading... }', `// [string] ${toDecrypt}`);
- setData(code);
- });
-
-
- // --------- NEXT STEP ---------
- let encryptionKey;
-
- await benchmark(async () => {
- encryptionKey = await litNodeClient.getEncryptionKey({
- accessControlConditions: accs,
- toDecrypt: toDecrypt,
- authSig: authSig,
- chain: 'ethereum',
- });
- return encryptionKey
- }, (ms, encryptionKey) => {
-
- console.log("encryptionKey:", encryptionKey)
-
- code = code.replace('// { ms }', `// { ${ms} }`);
- code = code.replace('// { Loading... }', `// [Uint8Array(32)] ${encryptionKey}`);
- setData(code);
- });
-
-
- // --------- NEXT STEP ---------
- let blob;
-
- await benchmark(async () => {
- blob = LitJsSdk.base64StringToBlob(base64EncryptedString);
- return blob
- }, (ms, blob) => {
-
- console.log("blob:", blob)
-
- code = code.replace('// { ms }', `// { ${ms} }`);
- code = code.replace('// { Loading... }', `// ${blob}`);
- setData(code);
- });
-
-
- // --------- NEXT STEP ---------
- let decryptedString;
-
- await benchmark(async () => {
- decryptedString = await LitJsSdk.decryptString(
- blob,
- encryptionKey
- );
- return decryptedString;
- }, (ms, decryptedString) => {
-
- console.log("decryptedString:", decryptedString)
-
- code = code.replace('// { ms }', `// { ${ms} }`);
- code = code.replace('// { Loading... }', `// [string] ${decryptedString}`);
- code = code.replace('"Loading..."', `"${decryptedString}"`);
- setData(code);
- });
-
-
-
- }
-
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
- );
-}
-
-
-export default App;
diff --git a/apps/demo-encrypt-decrypt-react/src/App.tsx b/apps/demo-encrypt-decrypt-react/src/App.tsx
new file mode 100644
index 0000000000..e22064fc27
--- /dev/null
+++ b/apps/demo-encrypt-decrypt-react/src/App.tsx
@@ -0,0 +1,196 @@
+import * as LitJsSdk from '@lit-protocol/lit-node-client';
+import Editor from '@monaco-editor/react';
+import { useState } from 'react';
+import './App.css';
+import LitLogo from './LitLogo';
+import { benchmark } from './utils';
+
+function App() {
+
+ // ----- autogen:app-name:start -----
+ const [appName, setAppName] = useState('Simple Encrypt Decrypt');
+ // ----- autogen:app-name:end -----
+
+ const [npmRepo, setNpmRepo] = useState('https://github.com/LIT-Protocol/js-sdk/tree/master/packages/lit-node-client');
+ const [demoRepo, setDemoRepo] = useState('https://github.com/LIT-Protocol/js-sdk/tree/master/apps/demo-encrypt-decrypt-react');
+ const [lang, setLang] = useState('json');
+ const [data, setData] = useState