Skip to content

Commit 1cddb53

Browse files
chore: add storage provider (#1494)
Co-authored-by: Aimen Sahnoun <aimensahnoun@outlook.com>
1 parent d54df7f commit 1cddb53

File tree

17 files changed

+712
-1190
lines changed

17 files changed

+712
-1190
lines changed

packages/epk-cipher/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"clean": "rm -rf dist tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo",
3838
"lint": "eslint . --fix",
3939
"lint:check": "eslint .",
40+
"prepare": "yarn run build",
4041
"test": "jest",
4142
"test:watch": "yarn test --watch"
4243
},

packages/epk-cipher/src/ethereum-private-key-cipher-provider.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,41 @@ export default class EthereumPrivateKeyCipherProvider
2020
/** Dictionary containing all the private keys indexed by address */
2121
private decryptionParametersDictionary: IDecryptionParametersDictionary;
2222

23+
private isDecryptionOn = false;
24+
2325
constructor(decryptionParameters?: EncryptionTypes.IDecryptionParameters) {
2426
this.decryptionParametersDictionary = new Map<string, EncryptionTypes.IDecryptionParameters>();
2527
if (decryptionParameters) {
2628
this.addDecryptionParameters(decryptionParameters);
2729
}
2830
}
2931

32+
/**
33+
* Check if encryption is available
34+
*
35+
* @returns true if encryption is available
36+
*/
37+
public isEncryptionAvailable(): boolean {
38+
return true;
39+
}
40+
41+
/**
42+
* Check if decryption is available
43+
*
44+
* @returns true if decryption is available
45+
*/
46+
public isDecryptionAvailable(): boolean {
47+
return this.decryptionParametersDictionary.size > 0 && this.isDecryptionOn;
48+
}
49+
50+
/**
51+
* Switches on decryption
52+
*
53+
* @param option
54+
*/
55+
public switchOnOffDecryption(option: boolean): void {
56+
this.isDecryptionOn = option;
57+
}
3058
/**
3159
* Encrypts data
3260
*

packages/integration-test/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"@requestnetwork/epk-decryption": "0.7.1",
4747
"@requestnetwork/epk-signature": "0.9.1",
4848
"@requestnetwork/ethereum-storage": "0.36.1",
49+
"@requestnetwork/lit-protocol-cipher": "0.1.0",
4950
"@requestnetwork/multi-format": "0.19.1",
5051
"@requestnetwork/payment-detection": "0.45.1",
5152
"@requestnetwork/payment-processor": "0.48.0",
@@ -55,6 +56,7 @@
5556
"@requestnetwork/transaction-manager": "0.36.1",
5657
"@requestnetwork/types": "0.45.1",
5758
"@requestnetwork/utils": "0.45.1",
59+
"@requestnetwork/web3-signature": "0.8.1",
5860
"@types/jest": "29.5.6",
5961
"@types/node": "18.11.9",
6062
"ethers": "5.7.2",

packages/lit-protocol-cipher/package.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,27 @@
3535
"clean": "rm -rf dist tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo",
3636
"lint": "eslint . --fix",
3737
"lint:check": "eslint .",
38-
"test": "jest",
38+
"prepare": "yarn run build",
39+
"test": "yarn node --experimental-vm-modules $(yarn bin jest)",
3940
"test:watch": "yarn test --watch"
4041
},
4142
"dependencies": {
42-
"@lit-protocol/auth-browser": "6.11.2",
43-
"@lit-protocol/auth-helpers": "6.11.2",
44-
"@lit-protocol/constants": "6.11.2",
45-
"@lit-protocol/lit-node-client": "6.11.2",
46-
"@lit-protocol/types": "6.11.2",
43+
"@lit-protocol/auth-helpers": "7.0.0",
44+
"@lit-protocol/constants": "7.0.0",
45+
"@lit-protocol/contracts": "0.0.74",
46+
"@lit-protocol/encryption": "7.0.0",
47+
"@lit-protocol/lit-node-client": "7.0.0",
48+
"@lit-protocol/lit-node-client-nodejs": "7.0.0",
49+
"@lit-protocol/types": "7.0.0",
4750
"@requestnetwork/request-client.js": "0.50.0",
4851
"@requestnetwork/types": "0.45.1",
49-
"ethers": "5.7.2"
52+
"@walletconnect/modal": "2.7.0",
53+
"ethers": "5.7.2",
54+
"node-localstorage": "3.0.5"
5055
},
5156
"devDependencies": {
5257
"@types/node": "18.11.9",
58+
"@types/node-localstorage": "1.3.3",
5359
"jest-junit": "16.0.0",
5460
"ts-node": "10.9.1",
5561
"typescript": "5.1.3"

0 commit comments

Comments
 (0)