Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/lit 305 additional explicit log levels #325

107 changes: 17 additions & 90 deletions apps/html/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- (DO NOT EDIT!) (HTML) THIS FILE IS AUTOMATICALLY GENERATED FROM tools/scripts/gen-html.mjs Fri, 26 Jan 2024 19:51:34 GMT -->
<!-- (DO NOT EDIT!) (HTML) THIS FILE IS AUTOMATICALLY GENERATED FROM tools/scripts/gen-html.mjs Sat, 27 Jan 2024 13:48:38 GMT -->
<!DOCTYPE html>
<html lang="en">
<head>
Expand Down Expand Up @@ -62,7 +62,7 @@
</style>
</head>
<body>
(HTML) THIS FILE IS AUTOMATICALLY GENERATED FROM tools/scripts/gen-html.mjs Fri, 26 Jan 2024 19:51:34 GMT
(HTML) THIS FILE IS AUTOMATICALLY GENERATED FROM tools/scripts/gen-html.mjs Sat, 27 Jan 2024 13:48:38 GMT

<!-- ==================== ALL EXPORTED VANILLA LIBRARIES ==================== -->
<script src="dist/packages/access-control-conditions-vanilla/access-control-conditions.js"></script>
Expand All @@ -75,7 +75,6 @@
<script src="dist/packages/crypto-vanilla/crypto.js"></script>
<script src="dist/packages/ecdsa-sdk-vanilla/ecdsa-sdk.js"></script>
<script src="dist/packages/encryption-vanilla/encryption.js"></script>
<script src="dist/packages/lit-auth-client-vanilla/lit-auth-client.js"></script>
<script src="dist/packages/lit-node-client-nodejs-vanilla/lit-node-client-nodejs.js"></script>
<script src="dist/packages/lit-node-client-vanilla/lit-node-client.js"></script>
<script src="dist/packages/lit-third-party-libs-vanilla/lit-third-party-libs.js"></script>
Expand Down Expand Up @@ -814,79 +813,7 @@ <h1>LitJsSdk_encryption has ${entries.length} functions</h1>
</script>


<!-- (11): LITAUTHCLIENT -->
<script>
if(typeof LitJsSdk_litAuthClient === 'undefined') {
console.error("LitJsSdk_litAuthClient:", LitJsSdk_litAuthClient);
}else{
console.warn("LitJsSdk_litAuthClient:", LitJsSdk_litAuthClient);
window.LitJsSdk_litAuthClient = LitJsSdk_litAuthClient;
}
window.addEventListener('load', function() {

var root = document.getElementById('root');
var result = document.getElementById('result');
var entries = Object.entries(LitJsSdk_litAuthClient);
var lis = entries.map(([key, value]) => `
<li>
<div id="LitJsSdk_litAuthClient_${key}" class="key" onClick="(async (e) => {
var fn = LitJsSdk_litAuthClient['${key}'];
var fnType = typeof fn;
console.warn('[${key}] is type of [' + fnType + ']');

if ( fnType === 'string' ) return;

if( fnType === 'function' ){
try{
console.log('params:', globalThis.params);

var res;
try{
res = new fn(globalThis.params);
}catch{
res = await fn(globalThis.params);
}
window.output = res;
res = JSON.stringify(res, null, 2);
result.innerText = res;
console.log(res);
}catch(e){
console.error('Please set the [params] variable in the console then click again');
console.log(e);
}
return;
}

if( fnType === 'object' ){
var res = await fn;
window.output = res;
res = JSON.stringify(res, null, 2);
result.innerText = res;
console.log(res);
return;
}


})();">${key}</div>
<pre class="code">
<code>${(typeof value === 'function' ? value : JSON.stringify(value, null, 2))}</code>
</pre>
</li>`);
lis = lis.join(' ');
var template = `
<div class="cat">
<h1>LitJsSdk_litAuthClient has ${entries.length} functions</h1>
<ul>
${ lis }
</ul>
</div>
`;
root.insertAdjacentHTML('beforeend', template);
});
</script>


<!-- (12): LITNODECLIENTNODEJS -->
<!-- (11): LITNODECLIENTNODEJS -->
<script>
if(typeof LitJsSdk_litNodeClientNodejs === 'undefined') {
console.error("LitJsSdk_litNodeClientNodejs:", LitJsSdk_litNodeClientNodejs);
Expand Down Expand Up @@ -958,7 +885,7 @@ <h1>LitJsSdk_litNodeClientNodejs has ${entries.length} functions</h1>
</script>


<!-- (13): LITNODECLIENT -->
<!-- (12): LITNODECLIENT -->
<script>
if(typeof LitJsSdk_litNodeClient === 'undefined') {
console.error("LitJsSdk_litNodeClient:", LitJsSdk_litNodeClient);
Expand Down Expand Up @@ -1030,7 +957,7 @@ <h1>LitJsSdk_litNodeClient has ${entries.length} functions</h1>
</script>


<!-- (14): LITTHIRDPARTYLIBS -->
<!-- (13): LITTHIRDPARTYLIBS -->
<script>
if(typeof LitJsSdk_litThirdPartyLibs === 'undefined') {
console.error("LitJsSdk_litThirdPartyLibs:", LitJsSdk_litThirdPartyLibs);
Expand Down Expand Up @@ -1102,7 +1029,7 @@ <h1>LitJsSdk_litThirdPartyLibs has ${entries.length} functions</h1>
</script>


<!-- (15): MISCBROWSER -->
<!-- (14): MISCBROWSER -->
<script>
if(typeof LitJsSdk_miscBrowser === 'undefined') {
console.error("LitJsSdk_miscBrowser:", LitJsSdk_miscBrowser);
Expand Down Expand Up @@ -1174,7 +1101,7 @@ <h1>LitJsSdk_miscBrowser has ${entries.length} functions</h1>
</script>


<!-- (16): MISC -->
<!-- (15): MISC -->
<script>
if(typeof LitJsSdk_misc === 'undefined') {
console.error("LitJsSdk_misc:", LitJsSdk_misc);
Expand Down Expand Up @@ -1246,7 +1173,7 @@ <h1>LitJsSdk_misc has ${entries.length} functions</h1>
</script>


<!-- (17): NACL -->
<!-- (16): NACL -->
<script>
if(typeof LitJsSdk_nacl === 'undefined') {
console.error("LitJsSdk_nacl:", LitJsSdk_nacl);
Expand Down Expand Up @@ -1318,7 +1245,7 @@ <h1>LitJsSdk_nacl has ${entries.length} functions</h1>
</script>


<!-- (18): PKPBASE -->
<!-- (17): PKPBASE -->
<script>
if(typeof LitJsSdk_pkpBase === 'undefined') {
console.error("LitJsSdk_pkpBase:", LitJsSdk_pkpBase);
Expand Down Expand Up @@ -1390,7 +1317,7 @@ <h1>LitJsSdk_pkpBase has ${entries.length} functions</h1>
</script>


<!-- (19): PKPCLIENT -->
<!-- (18): PKPCLIENT -->
<script>
if(typeof LitJsSdk_pkpClient === 'undefined') {
console.error("LitJsSdk_pkpClient:", LitJsSdk_pkpClient);
Expand Down Expand Up @@ -1462,7 +1389,7 @@ <h1>LitJsSdk_pkpClient has ${entries.length} functions</h1>
</script>


<!-- (20): PKPCOSMOS -->
<!-- (19): PKPCOSMOS -->
<script>
if(typeof LitJsSdk_pkpCosmos === 'undefined') {
console.error("LitJsSdk_pkpCosmos:", LitJsSdk_pkpCosmos);
Expand Down Expand Up @@ -1534,7 +1461,7 @@ <h1>LitJsSdk_pkpCosmos has ${entries.length} functions</h1>
</script>


<!-- (21): PKPETHERS -->
<!-- (20): PKPETHERS -->
<script>
if(typeof LitJsSdk_pkpEthers === 'undefined') {
console.error("LitJsSdk_pkpEthers:", LitJsSdk_pkpEthers);
Expand Down Expand Up @@ -1606,7 +1533,7 @@ <h1>LitJsSdk_pkpEthers has ${entries.length} functions</h1>
</script>


<!-- (22): PKPSUI -->
<!-- (21): PKPSUI -->
<script>
if(typeof LitJsSdk_pkpSui === 'undefined') {
console.error("LitJsSdk_pkpSui:", LitJsSdk_pkpSui);
Expand Down Expand Up @@ -1678,7 +1605,7 @@ <h1>LitJsSdk_pkpSui has ${entries.length} functions</h1>
</script>


<!-- (23): PKPWALLETCONNECT -->
<!-- (22): PKPWALLETCONNECT -->
<script>
if(typeof LitJsSdk_pkpWalletconnect === 'undefined') {
console.error("LitJsSdk_pkpWalletconnect:", LitJsSdk_pkpWalletconnect);
Expand Down Expand Up @@ -1750,7 +1677,7 @@ <h1>LitJsSdk_pkpWalletconnect has ${entries.length} functions</h1>
</script>


<!-- (24): SEVSNPUTILSSDK -->
<!-- (23): SEVSNPUTILSSDK -->
<script>
if(typeof LitJsSdk_sevSnpUtilsSdk === 'undefined') {
console.error("LitJsSdk_sevSnpUtilsSdk:", LitJsSdk_sevSnpUtilsSdk);
Expand Down Expand Up @@ -1822,7 +1749,7 @@ <h1>LitJsSdk_sevSnpUtilsSdk has ${entries.length} functions</h1>
</script>


<!-- (25): TYPES -->
<!-- (24): TYPES -->
<script>
if(typeof LitJsSdk_types === 'undefined') {
console.error("LitJsSdk_types:", LitJsSdk_types);
Expand Down Expand Up @@ -1894,7 +1821,7 @@ <h1>LitJsSdk_types has ${entries.length} functions</h1>
</script>


<!-- (26): UINT8ARRAYS -->
<!-- (25): UINT8ARRAYS -->
<script>
if(typeof LitJsSdk_uint8arrays === 'undefined') {
console.error("LitJsSdk_uint8arrays:", LitJsSdk_uint8arrays);
Expand Down
2 changes: 1 addition & 1 deletion apps/react/src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1879,7 +1879,7 @@ pre {
`,
}}
/>
(REACT) THIS FILE IS AUTOMATICALLY GENERATED FROM tools/scripts/gen-react.mjs Fri, 26 Jan 2024 19:51:35 GMT
(REACT) THIS FILE IS AUTOMATICALLY GENERATED FROM tools/scripts/gen-react.mjs Sat, 27 Jan 2024 13:48:39 GMT
<div id="root"></div>
<pre><code id="result"></code></pre>
</>
Expand Down
24 changes: 12 additions & 12 deletions lit.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
"debug": true,
"sevAttestation": false,
"CONTROLLER_AUTHSIG": {
"sig": "0x1620fb611ab3dc6ac1388feea6edc4cec973a23b280ed0f41440ca602807914e2c57238bf72695b9f6971a470a871d10fe17d9fc6c11ce5ed5f00489dd456dfe1c",
"sig": "0x1f49eaa6c63c18a03a4a74b4090974c2705a68c9e2df2eee43d1e6a2d11949825a591e8dda0d2302180930a35a7032b4a98d598a1ee655d18e3fa47b82a801ba1c",
"derivedVia": "web3.eth.personal.sign",
"signedMessage": "localhost wants you to sign in with your Ethereum account:\n0xeF71c2604f17Ec6Fc13409DF24EfdC440D240d37\n\nThis is a test statement. You can put anything you want here.\n\nURI: https://localhost/login\nVersion: 1\nChain ID: 1\nNonce: 0xb75ade4f99b009febf749ec834cf50a98a1adb620cdc8b36815af17360f2038e\nIssued At: 2024-01-26T19:47:49.093Z\nExpiration Time: 2024-01-26T20:47:49.090Z",
"signedMessage": "localhost wants you to sign in with your Ethereum account:\n0xeF71c2604f17Ec6Fc13409DF24EfdC440D240d37\n\nThis is a test statement. You can put anything you want here.\n\nURI: https://localhost/login\nVersion: 1\nChain ID: 1\nNonce: 0x0b8232eedb4f74cdb8a3c713ba5660444e9bcf8269b70638acdd2e8836f5d2bf\nIssued At: 2024-01-27T13:50:29.962Z\nExpiration Time: 2024-01-27T14:50:29.957Z",
"address": "0xeF71c2604f17Ec6Fc13409DF24EfdC440D240d37"
},
"CONTROLLER_WALLET": {
Expand All @@ -59,8 +59,8 @@
"_events": [],
"_emitted": {
"block": -2,
"t:0x462949f6b15916679ee0064c8c8727be8fccfe8f0152961b0e84058ce09c67fe": 1603412,
"t:0x614657b89a19ed2f67a214da6c9643e5ec964c1d2ea8a874a50b64778b586133": 1603413
"t:0x0c780870f84b4d97f45bc2edc765fe48481e2488d450c26f1d98b911ccf70ae4": 1611078,
"t:0x5fbf628c9f191f5e2b87a2f042dff0bedbf1fb148e5b274649033a8162923577": 1611079
},
"disableCcipRead": false,
"formatter": {
Expand All @@ -77,11 +77,11 @@
},
"anyNetwork": false,
"_networkPromise": {},
"_maxInternalBlockNumber": 1603411,
"_maxInternalBlockNumber": 1611077,
"_lastBlockNumber": -2,
"_maxFilterBlockRange": 10,
"_pollingInterval": 4000,
"_fastQueryDate": 1706298471023,
"_fastQueryDate": 1706363433237,
"connection": {
"url": "https://chain-rpc.litprotocol.com/http"
},
Expand All @@ -96,18 +96,18 @@
"name": "unknown"
},
"_internalBlockNumber": {},
"_fastBlockNumber": 1603411,
"_fastBlockNumber": 1611077,
"_fastBlockNumberPromise": {}
}
},
"PKP_INFO": {
"tokenId": "0x3e3c60f0463a34bd09a44718981bd730690472e2599e050efa92d4969598bed8",
"publicKey": "04de7a670e32bd9cf043f29ea259e5ba50d5ed85fc146478bca9552bfd5f7d6fee9bb377438c25c8fffd5874eb0ede9ea7e594da0f49221d7024b5fdf0577c212a",
"ethAddress": "0xE7cF6e45927E36D70dc727cAD96240217aBC7A9D"
"tokenId": "0x408df5964e027ae367e0f2c5f5b3cb19ac20f2eda938892adb351dd43331af1f",
"publicKey": "04b3a617cd763c2ab457ddb9437c42ec517c24baeadf12447968f340c9fbce9a44998d0fcf44fadc40b9179554aa3a6049159122050f982f00c9ec039c27597116",
"ethAddress": "0x50065066a15eFa339994A8bee118B35942360E50"
},
"AUTH_METHOD_PKP_INFO": {
"publicKey": "04d92c9302266d6c9ac5b66feb1355fb910910d43664ef15e52925fd9dcd8228f224956633ab30be19b5293a9d3c1bc2e7a8d110d33757de32ed505911ecafdc38",
"ethAddress": "0xAdd686B8A662Ed22dDAF3966b95fF7eeC34B363f",
"publicKey": "04fc7f3b46a3d38dc2ee64c071cb076c47e0003cfb4eef892878b3c67bd3945c4a28182b5326d871e8645bb4253e9cb3df62a284f3605750be0d603956546cdfaf",
"ethAddress": "0xe0A515A13A73300f051D7c2C734757F79aFA413F",
"authMethod": {
"authMethodId": "0x170d13600caea2933912f39a0334eca3d22e472be203f937c4bad0213d92ed71",
"authMethodType": 1
Expand Down
14 changes: 7 additions & 7 deletions packages/access-control-conditions/src/lib/hashing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
UnifiedAccessControlConditions,
} from '@lit-protocol/types';

import { log, throwError } from '@lit-protocol/misc';
import { logDebug, throwError } from '@lit-protocol/misc';
import {
canonicalAccessControlConditionFormatter,
canonicalEVMContractConditionFormatter,
Expand Down Expand Up @@ -89,14 +89,14 @@ import { uint8arrayToString } from '@lit-protocol/uint8arrays';
export const hashUnifiedAccessControlConditions = (
unifiedAccessControlConditions: UnifiedAccessControlConditions
): Promise<ArrayBuffer> => {
log('unifiedAccessControlConditions:', unifiedAccessControlConditions);
logDebug('unifiedAccessControlConditions:', unifiedAccessControlConditions);

const conditions = unifiedAccessControlConditions.map(
(condition: ConditionItem) => {
return canonicalUnifiedAccessControlConditionFormatter(condition);
}
);
log('conditions:', conditions);
logDebug('conditions:', conditions);

// check if there's any undefined in the conditions
const hasUndefined = conditions.some((c) => c === undefined);
Expand All @@ -117,7 +117,7 @@ export const hashUnifiedAccessControlConditions = (
}
const toHash = JSON.stringify(conditions);

log('Hashing unified access control conditions: ', toHash);
logDebug('Hashing unified access control conditions: ', toHash);

const encoder = new TextEncoder();
const data = encoder.encode(toHash);
Expand Down Expand Up @@ -176,7 +176,7 @@ export const hashAccessControlConditions = (
);

const toHash = JSON.stringify(conds);
log('Hashing access control conditions: ', toHash);
logDebug('Hashing access control conditions: ', toHash);
const encoder = new TextEncoder();
const data = encoder.encode(toHash);

Expand All @@ -200,7 +200,7 @@ export const hashEVMContractConditions = (
);

const toHash = JSON.stringify(conds);
log('Hashing evm contract conditions: ', toHash);
logDebug('Hashing evm contract conditions: ', toHash);
const encoder = new TextEncoder();
const data = encoder.encode(toHash);
return crypto.subtle.digest('SHA-256', data);
Expand All @@ -223,7 +223,7 @@ export const hashSolRpcConditions = (
);

const toHash = JSON.stringify(conds);
log('Hashing sol rpc conditions: ', toHash);
logDebug('Hashing sol rpc conditions: ', toHash);
const encoder = new TextEncoder();
const data = encoder.encode(toHash);

Expand Down
Loading
Loading