1- import { getEoaSessionSigs } from " local-tests/setup/session-sigs/get-eoa-session-sigs" ;
2- import { getPkpSessionSigs } from " local-tests/setup/session-sigs/get-pkp-session-sigs" ;
3- import { TinnyEnvironment } from " local-tests/setup/tinny-environment"
4- import { TinnyPerson } from " local-tests/setup/tinny-person" ;
1+ import { getEoaSessionSigs } from ' local-tests/setup/session-sigs/get-eoa-session-sigs' ;
2+ import { getPkpSessionSigs } from ' local-tests/setup/session-sigs/get-pkp-session-sigs' ;
3+ import { TinnyEnvironment } from ' local-tests/setup/tinny-environment' ;
4+ import { TinnyPerson } from ' local-tests/setup/tinny-person' ;
55import { LIT_ABILITY } from '@lit-protocol/constants' ;
66import { ILitNodeClient } from '@lit-protocol/types' ;
77import { AccessControlConditions } from 'local-tests/setup/accs/accs' ;
88import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers' ;
99import { encryptString , decryptToString } from '@lit-protocol/encryption' ;
1010
1111export class DatilHealthManager {
12-
1312 env : TinnyEnvironment ;
1413 alice : TinnyPerson ;
1514 eoaSessionSigs : any ;
1615
17- constructor ( ) {
16+ constructor ( ) {
1817 this . env = new TinnyEnvironment ( ) ;
1918 }
2019
21- async init ( ) {
20+ async init ( ) {
2221 await this . env . init ( ) ;
2322 }
2423
@@ -27,58 +26,57 @@ export class DatilHealthManager {
2726 // this action contains chain & rpc interactions
2827 // best to cache it, but for the time being, we will create a new person for each test, since we are only running this test
2928 // once in every 30 minutes.
30- async initPerson ( ) {
31- this . alice = await this . env . createNewPerson ( " Alice" ) ;
29+ async initPerson ( ) {
30+ this . alice = await this . env . createNewPerson ( ' Alice' ) ;
3231 this . eoaSessionSigs = await getEoaSessionSigs ( this . env , this . alice ) ;
3332 }
3433
35- validatePrerequisites ( ) {
36- if ( ! this . alice ) {
37- throw new Error ( " ❌ Person not initialized" ) ;
34+ validatePrerequisites ( ) {
35+ if ( ! this . alice ) {
36+ throw new Error ( ' ❌ Person not initialized' ) ;
3837 }
39- if ( ! this . eoaSessionSigs ) {
40- throw new Error ( " ❌ EOA Session Sigs not initialized" ) ;
38+ if ( ! this . eoaSessionSigs ) {
39+ throw new Error ( ' ❌ EOA Session Sigs not initialized' ) ;
4140 }
4241 }
4342
44-
4543 // ========== Endpoint Tests ==========
4644 handshakeTest = async ( ) => {
47- try {
45+ try {
4846 await this . env . setupLitNodeClient ( ) ;
49- } catch ( e ) {
50- console . error ( " ❌ Failed to setup Lit Node Client" ) ;
47+ } catch ( e ) {
48+ console . error ( ' ❌ Failed to setup Lit Node Client' ) ;
5149 throw e ;
5250 }
53- }
51+ } ;
5452
5553 pkpSignTest = async ( ) => {
5654 this . validatePrerequisites ( ) ;
57- try {
55+ try {
5856 await this . env . litNodeClient . pkpSign ( {
5957 toSign : this . alice . loveLetter ,
6058 pubKey : this . alice . pkp . publicKey ,
6159 sessionSigs : this . eoaSessionSigs ,
62- } )
63- } catch ( e ) {
64- console . error ( " ❌ Failed to run pkpSign" ) ;
60+ } ) ;
61+ } catch ( e ) {
62+ console . error ( ' ❌ Failed to run pkpSign' ) ;
6563 throw e ;
6664 }
67- }
65+ } ;
6866
6967 signSessionKeyTest = async ( ) => {
7068 this . validatePrerequisites ( ) ;
71- try {
69+ try {
7270 await getPkpSessionSigs ( this . env , this . alice ) ;
73- } catch ( e ) {
74- console . error ( " ❌ Failed to run signSessionKey" ) ;
71+ } catch ( e ) {
72+ console . error ( ' ❌ Failed to run signSessionKey' ) ;
7573 throw e ;
7674 }
77- }
75+ } ;
7876
7977 executeJsTest = async ( ) => {
8078 this . validatePrerequisites ( ) ;
81- try {
79+ try {
8280 await this . env . litNodeClient . executeJs ( {
8381 sessionSigs : this . eoaSessionSigs ,
8482 code : `(async () => {
@@ -91,17 +89,17 @@ export class DatilHealthManager {
9189 jsParams : {
9290 dataToSign : this . alice . loveLetter ,
9391 publicKey : this . alice . pkp . publicKey ,
94- }
95- } )
96- } catch ( e ) {
97- console . error ( " ❌ Failed to run executeJs" ) ;
92+ } ,
93+ } ) ;
94+ } catch ( e ) {
95+ console . error ( ' ❌ Failed to run executeJs' ) ;
9896 throw e ;
9997 }
100- }
98+ } ;
10199
102100 decryptTest = async ( ) => {
103101 this . validatePrerequisites ( ) ;
104- try {
102+ try {
105103 // Set access control conditions for encrypting and decrypting
106104 const accs = AccessControlConditions . getEmvBasicAccessControlConditions ( {
107105 userAddress : this . alice . wallet . address ,
@@ -156,9 +154,9 @@ export class DatilHealthManager {
156154 `Expected decryptRes to be 'Hello world' but got ${ decryptRes } `
157155 ) ;
158156 }
159- } catch ( e ) {
160- console . error ( " ❌ Failed to run decrypt" ) ;
157+ } catch ( e ) {
158+ console . error ( ' ❌ Failed to run decrypt' ) ;
161159 throw e ;
162160 }
163- }
164- }
161+ } ;
162+ }
0 commit comments