Skip to content

Commit

Permalink
chore: add storage provider (#1494)
Browse files Browse the repository at this point in the history
Co-authored-by: Aimen Sahnoun <[email protected]>
  • Loading branch information
rodrigopavezi and aimensahnoun authored Nov 30, 2024
1 parent d54df7f commit 1cddb53
Show file tree
Hide file tree
Showing 17 changed files with 712 additions and 1,190 deletions.
1 change: 1 addition & 0 deletions packages/epk-cipher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"clean": "rm -rf dist tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo",
"lint": "eslint . --fix",
"lint:check": "eslint .",
"prepare": "yarn run build",
"test": "jest",
"test:watch": "yarn test --watch"
},
Expand Down
28 changes: 28 additions & 0 deletions packages/epk-cipher/src/ethereum-private-key-cipher-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,41 @@ export default class EthereumPrivateKeyCipherProvider
/** Dictionary containing all the private keys indexed by address */
private decryptionParametersDictionary: IDecryptionParametersDictionary;

private isDecryptionOn = false;

constructor(decryptionParameters?: EncryptionTypes.IDecryptionParameters) {
this.decryptionParametersDictionary = new Map<string, EncryptionTypes.IDecryptionParameters>();
if (decryptionParameters) {
this.addDecryptionParameters(decryptionParameters);
}
}

/**
* Check if encryption is available
*
* @returns true if encryption is available
*/
public isEncryptionAvailable(): boolean {
return true;
}

/**
* Check if decryption is available
*
* @returns true if decryption is available
*/
public isDecryptionAvailable(): boolean {
return this.decryptionParametersDictionary.size > 0 && this.isDecryptionOn;
}

/**
* Switches on decryption
*
* @param option
*/
public switchOnOffDecryption(option: boolean): void {
this.isDecryptionOn = option;
}
/**
* Encrypts data
*
Expand Down
2 changes: 2 additions & 0 deletions packages/integration-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"@requestnetwork/epk-decryption": "0.7.1",
"@requestnetwork/epk-signature": "0.9.1",
"@requestnetwork/ethereum-storage": "0.36.1",
"@requestnetwork/lit-protocol-cipher": "0.1.0",
"@requestnetwork/multi-format": "0.19.1",
"@requestnetwork/payment-detection": "0.45.1",
"@requestnetwork/payment-processor": "0.48.0",
Expand All @@ -55,6 +56,7 @@
"@requestnetwork/transaction-manager": "0.36.1",
"@requestnetwork/types": "0.45.1",
"@requestnetwork/utils": "0.45.1",
"@requestnetwork/web3-signature": "0.8.1",
"@types/jest": "29.5.6",
"@types/node": "18.11.9",
"ethers": "5.7.2",
Expand Down
20 changes: 13 additions & 7 deletions packages/lit-protocol-cipher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,27 @@
"clean": "rm -rf dist tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo",
"lint": "eslint . --fix",
"lint:check": "eslint .",
"test": "jest",
"prepare": "yarn run build",
"test": "yarn node --experimental-vm-modules $(yarn bin jest)",
"test:watch": "yarn test --watch"
},
"dependencies": {
"@lit-protocol/auth-browser": "6.11.2",
"@lit-protocol/auth-helpers": "6.11.2",
"@lit-protocol/constants": "6.11.2",
"@lit-protocol/lit-node-client": "6.11.2",
"@lit-protocol/types": "6.11.2",
"@lit-protocol/auth-helpers": "7.0.0",
"@lit-protocol/constants": "7.0.0",
"@lit-protocol/contracts": "0.0.74",
"@lit-protocol/encryption": "7.0.0",
"@lit-protocol/lit-node-client": "7.0.0",
"@lit-protocol/lit-node-client-nodejs": "7.0.0",
"@lit-protocol/types": "7.0.0",
"@requestnetwork/request-client.js": "0.50.0",
"@requestnetwork/types": "0.45.1",
"ethers": "5.7.2"
"@walletconnect/modal": "2.7.0",
"ethers": "5.7.2",
"node-localstorage": "3.0.5"
},
"devDependencies": {
"@types/node": "18.11.9",
"@types/node-localstorage": "1.3.3",
"jest-junit": "16.0.0",
"ts-node": "10.9.1",
"typescript": "5.1.3"
Expand Down
Loading

0 comments on commit 1cddb53

Please sign in to comment.