Skip to content

Commit 6512131

Browse files
committed
feat: Log encryption metadata to compare against node logs
1 parent eb62bc2 commit 6512131

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1525,6 +1525,7 @@ export class LitNodeClientNodeJs
15251525
// hash the access control conditions
15261526
const hashOfConditions: ArrayBuffer | undefined =
15271527
await this.getHashedAccessControlConditions(params);
1528+
log('hashOfConditions', hashOfConditions);
15281529

15291530
if (!hashOfConditions) {
15301531
return throwError({
@@ -1538,6 +1539,7 @@ export class LitNodeClientNodeJs
15381539
new Uint8Array(hashOfConditions),
15391540
'base16'
15401541
);
1542+
log('hashOfConditionsStr', hashOfConditionsStr);
15411543

15421544
// ========== Hashing Private Data ==========
15431545
// hash the private data
@@ -1549,12 +1551,14 @@ export class LitNodeClientNodeJs
15491551
new Uint8Array(hashOfPrivateData),
15501552
'base16'
15511553
);
1554+
log('hashOfPrivateDataStr', hashOfPrivateDataStr);
15521555

15531556
// ========== Assemble identity parameter ==========
15541557
const identityParam = this._getIdentityParamForEncryption(
15551558
hashOfConditionsStr,
15561559
hashOfPrivateDataStr
15571560
);
1561+
log('identityParam', identityParam);
15581562

15591563
// ========== Encrypt ==========
15601564
const ciphertext = encrypt(
@@ -1613,6 +1617,7 @@ export class LitNodeClientNodeJs
16131617
// hash the access control conditions
16141618
const hashOfConditions: ArrayBuffer | undefined =
16151619
await this.getHashedAccessControlConditions(params);
1620+
log('hashOfConditions', hashOfConditions);
16161621

16171622
if (!hashOfConditions) {
16181623
return throwError({
@@ -1626,7 +1631,7 @@ export class LitNodeClientNodeJs
16261631
new Uint8Array(hashOfConditions),
16271632
'base16'
16281633
);
1629-
1634+
log('hashOfConditionsStr', hashOfConditionsStr);
16301635
// ========== Formatting Access Control Conditions =========
16311636
const {
16321637
error,
@@ -1734,17 +1739,20 @@ export class LitNodeClientNodeJs
17341739
new Uint8Array(hashOfConditions),
17351740
'base16'
17361741
);
1742+
log('hashOfConditionsStr', hashOfConditionsStr);
17371743

17381744
// ========== Hashing Private Data ==========
17391745
// hash the private data
17401746
const hashOfPrivateData = await crypto.subtle.digest(
17411747
'SHA-256',
17421748
params.dataToEncrypt
17431749
);
1750+
log('hashOfPrivateData', hashOfPrivateData);
17441751
const hashOfPrivateDataStr = uint8arrayToString(
17451752
new Uint8Array(hashOfPrivateData),
17461753
'base16'
17471754
);
1755+
log('hashOfPrivateDataStr', hashOfPrivateDataStr);
17481756

17491757
return new LitAccessControlConditionResource(
17501758
`${hashOfConditionsStr}/${hashOfPrivateDataStr}`

0 commit comments

Comments
 (0)