Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
33d8a29
feat: add lit protocol provider and capacity credits delegation
rodrigopavezi Oct 24, 2024
eeba42a
feat: add cypher providers and intergrate them with trasaction manager
rodrigopavezi Oct 28, 2024
85c50cc
fix: typing issues
rodrigopavezi Oct 30, 2024
49392bb
Merge branch 'master' into feat/lit-encryption
rodrigopavezi Oct 30, 2024
40fc362
fix: build
rodrigopavezi Oct 31, 2024
fafe82c
update: epk cypher tests
rodrigopavezi Nov 1, 2024
662a5a8
add: dummy test
rodrigopavezi Nov 1, 2024
92038e4
fix: build
rodrigopavezi Nov 1, 2024
6fb0e4f
Upgrade ethers to 5.7.2 and @ethersproject/experimental to 5.7.0
MantisClone Nov 1, 2024
c79d991
Restore original yarn.lock instead of fully regenerating it
MantisClone Nov 1, 2024
0d2c303
fix: build
rodrigopavezi Nov 4, 2024
c9b79e0
fix: provider tests
rodrigopavezi Nov 4, 2024
ea181c9
Merge branch 'upgrade-ethers' into feat/lit-encryption
rodrigopavezi Nov 4, 2024
55c0cce
Merge branch 'master' into feat/lit-encryption
rodrigopavezi Nov 7, 2024
0e92bb8
fix: build
rodrigopavezi Nov 7, 2024
cacc5c4
fix: typing errors
rodrigopavezi Nov 7, 2024
93317f9
fix: decryption
rodrigopavezi Nov 13, 2024
b4880bd
fix: lit disconnections and sign session
rodrigopavezi Nov 15, 2024
bf87710
fix: linting
rodrigopavezi Nov 15, 2024
cffcde1
Merge branch 'master' into feat/lit-encryption
rodrigopavezi Nov 15, 2024
cfdc5f7
Update packages/request-client.js/src/http-data-access.ts
rodrigopavezi Nov 15, 2024
1166f79
fix: delegateeAddress eth address validation
rodrigopavezi Nov 15, 2024
a21f19f
Merge branch 'feat/lit-encryption' of https://github.com/RequestNetwo…
rodrigopavezi Nov 15, 2024
4697e40
fix: delegateeAddress typing
rodrigopavezi Nov 15, 2024
527c0ee
fix: add check for cypherProvider
rodrigopavezi Nov 15, 2024
9e87557
fix: instanceOf issue
rodrigopavezi Nov 15, 2024
a4606bd
fix: coderabitai changes
rodrigopavezi Nov 15, 2024
1506bb9
fix: encapsulate HttpDataAccess
rodrigopavezi Nov 18, 2024
f230538
fix: version and readme
rodrigopavezi Nov 18, 2024
1722c04
fix: per coderabitai review
rodrigopavezi Nov 18, 2024
94056e2
fix: fresh install
rodrigopavezi Nov 18, 2024
be1bdcf
fix: build types issues
rodrigopavezi Nov 18, 2024
ef8f741
fix: package lint
rodrigopavezi Nov 18, 2024
2029434
fix: removed check for back compatibility
rodrigopavezi Nov 18, 2024
2eb360a
fix: replace cypher word with cipher word
rodrigopavezi Nov 20, 2024
05289b7
fix: transaction parser
rodrigopavezi Nov 20, 2024
c06c2fc
fix: try finally in the lit-protocol provider
rodrigopavezi Nov 20, 2024
ed489e6
fix: another catch finally issue
rodrigopavezi Nov 20, 2024
fbf2115
fix: decryption in the transaction parser
rodrigopavezi Nov 20, 2024
5392686
fix: string in tests
rodrigopavezi Nov 20, 2024
3c5285d
fix: as per coderabitai reviews
rodrigopavezi Nov 21, 2024
6877d5e
fix: as per coderabitai new reviews
rodrigopavezi Nov 21, 2024
ca7c749
fix: package lint
rodrigopavezi Nov 21, 2024
f3755f5
fix: add env var for lit protocol network
rodrigopavezi Nov 21, 2024
1160635
fix: types
rodrigopavezi Nov 21, 2024
846a810
feat: add epk and lit cipher tests to circleci script
rodrigopavezi Nov 21, 2024
adcad4b
fix: transaction manager with tests
rodrigopavezi Nov 21, 2024
22f6b2e
feat: add lit protocol provider tests
rodrigopavezi Nov 22, 2024
d48536f
fix: missing encryptionMethod in the createEncryptedTransaction
rodrigopavezi Nov 22, 2024
1fbae2f
fix: per coderabitai reviews
rodrigopavezi Nov 22, 2024
0d9c91e
fix: test as per coderabitai review
rodrigopavezi Nov 22, 2024
24af827
fix: tests issues
rodrigopavezi Nov 22, 2024
f5b0022
fix: tests again
rodrigopavezi Nov 22, 2024
914a6c8
fix: reveted misisng changes
rodrigopavezi Nov 22, 2024
3c70c2b
Merge branch 'master' into feat/lit-encryption
rodrigopavezi Nov 26, 2024
4556833
fix: add lit protocol package usage in the README
rodrigopavezi Nov 26, 2024
5f86484
fix: merging issue
rodrigopavezi Nov 26, 2024
ce0d955
fix: missing assertion
rodrigopavezi Nov 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,36 @@ jobs:
command: 'yarn workspace @requestnetwork/epk-signature run test --ci --maxWorkers=1'
- store_test_results:
path: packages/epk-signature/reports/
test-epk-cipher:
docker:
- *node_image
working_directory: *working_directory
steps:
- attach_workspace:
at: *working_directory
- run:
name: 'Build epk-cipher'
command: 'yarn workspace @requestnetwork/epk-cipher run build'
- run:
name: 'Test epk-cipher'
command: 'yarn workspace @requestnetwork/epk-cipher run test --ci --maxWorkers=1'
- store_test_results:
path: packages/epk-cipher/reports/
test-lit-protocol-cipher:
docker:
- *node_image
working_directory: *working_directory
steps:
- attach_workspace:
at: *working_directory
- run:
name: 'Build lit-protocol-cipher'
command: 'yarn workspace @requestnetwork/lit-protocol-cipher run build'
- run:
name: 'Test lit-protocol-cipher'
command: 'yarn workspace @requestnetwork/lit-protocol-cipher run test --ci --maxWorkers=1'
- store_test_results:
path: packages/lit-protocol-cipher/reports/
test-epk-decryption:
docker:
- *node_image
Expand Down Expand Up @@ -558,6 +588,12 @@ workflows:
- test-currency:
requires:
- build
- test-epk-cipher:
requires:
- build
- test-lit-protocol-cipher:
requires:
- build
- test-epk-signature:
requires:
- build
Expand Down Expand Up @@ -591,6 +627,8 @@ workflows:
- test-currency
- test-data-access
- test-data-format
- test-epk-cipher
- test-lit-protocol-cipher
- test-epk-decryption
- test-epk-signature
- test-ethereum-storage
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ Join the [Request Discord][request-discord-url] to get in touch with us.
| [`@requestnetwork/request-client.js`](/packages/request-client.js) | [![npm](https://img.shields.io/npm/v/@requestnetwork/request-client.js.svg)](https://www.npmjs.com/package/@requestnetwork/request-client.js) | Library to use Request nodes as servers |
| [`@requestnetwork/data-access`](/packages/data-access) | [![npm](https://img.shields.io/npm/v/@requestnetwork/data-access.svg)](https://www.npmjs.com/package/@requestnetwork/data-access) | Indexing an batching of transactions |
| [`@requestnetwork/data-format`](/packages/data-format) | [![npm](https://img.shields.io/npm/v/@requestnetwork/data-format.svg)](https://www.npmjs.com/package/@requestnetwork/data-format) | Standards for data stored on Request, like invoices format |
| [`@requestnetwork/epk-cipher`](/packages/epk-cipher) | [![npm](https://img.shields.io/npm/v/@requestnetwork/epk-cipher.svg)](https://www.npmjs.com/package/@requestnetwork/epk-cipher) | Encrypt /Decrypt requests using Ethereum private keys |
| [`@requestnetwork/epk-signature`](/packages/epk-signature) | [![npm](https://img.shields.io/npm/v/@requestnetwork/epk-signature.svg)](https://www.npmjs.com/package/@requestnetwork/epk-signature) | Sign requests using Ethereum private keys |
| [`@requestnetwork/ethereum-storage`](/packages/ethereum-storage) | [![npm](https://img.shields.io/npm/v/@requestnetwork/ethereum-storage.svg)](https://www.npmjs.com/package/@requestnetwork/ethereum-storage) | Storage of Request data on Ethereum and IPFS, with custom indexing |
| [`@requestnetwork/epk-decryption`](/packages/epk-decryption) | [![npm](https://img.shields.io/npm/v/@requestnetwork/epk-decryption.svg)](https://www.npmjs.com/package/@requestnetwork/epk-decryption) | Decrypt encrypted requests using Ethereum private keys |
| [`@requestnetwork/lit-protocol-cipher`](/packages/lit-protocol-cipher) | [![npm](https://img.shields.io/npm/v/@requestnetwork/lit-protocol-cipher.svg)](https://www.npmjs.com/package/@requestnetwork/lit-protocol-cipher) | Encrypt / Decrypt requests using Lit Protocol |
| [`@requestnetwork/payment-detection`](/packages/payment-detection) | [![npm](https://img.shields.io/npm/v/@requestnetwork/payment-detection.svg)](https://www.npmjs.com/package/@requestnetwork/payment-detection) | Client-side payment detection, to compute the balance. |
| [`@requestnetwork/payment-processor`](/packages/payment-processor) | [![npm](https://img.shields.io/npm/v/@requestnetwork/payment-processor.svg)](https://www.npmjs.com/package/@requestnetwork/payment-processor) | Pay a request using a web3 wallet |
| [`@requestnetwork/request-logic`](/packages/request-logic) | [![npm](https://img.shields.io/npm/v/@requestnetwork/request-logic.svg)](https://www.npmjs.com/package/@requestnetwork/request-logic) | The Request business logic: properties and actions of requests |
Expand Down
8 changes: 8 additions & 0 deletions packages/epk-cipher/.nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extension": [".ts"],
"include": ["src/*.ts", "src/**/*.ts"],
"require": ["ts-node/register"],
"reporter": ["text-summary", "json", "html"],
"sourceMap": true,
"all": true
}
5 changes: 5 additions & 0 deletions packages/epk-cipher/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"mochaExplorer.files": "**/test/**/*.ts",
"mochaExplorer.require": "ts-node/register",
"mochaExplorer.cwd": "../.."
}
63 changes: 63 additions & 0 deletions packages/epk-cipher/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# @requestnetwork/epk-cipher

Ethereum Private Key Cipher Provider.

`@requestnetwork/epk-cipher` is a typescript library part of the [Request Network protocol](https://github.com/RequestNetwork/requestNetwork).

Implementation of the cipher provider from the private keys.
The cipher provider is used to make encryption and decryption in the Request Network Protocol (e.g.: see [Transaction Manager](/packages/transaction-manager)).

It uses the Request Network Protocol concept of `Identity` described in the [request logic specification](/packages/request-logic/specs/request-logic-specification.md).

## Installation

```bash
npm install @requestnetwork/epk-cipher
```

## Usage

```javascript
import { EncryptionTypes, IdentityTypes } from '@requestnetwork/types'

import EthereumPrivateKeyCipherProvider from '@requestnetwork/epk-cipher'

const cipherParametersExample: EncryptionTypes.ICipherParameters = {
key: '0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3',
method: EncryptionTypes.METHOD.ECIES,
};

// Identity from the previous signature parameter
const identityExample: IdentityTypes.IIdentity = {
type: IdentityTypes.TYPE.ETHEREUM_ADDRESS,
value: '0x627306090abab3a6e1400e9345bc60c78a8bef57'
};

// Construct the provider with a
const cipherProvider = new EthereumPrivateKeyCipherProvider(cipherParametersExample);

// can list the identity usable
const listOfAvailableIdentity = cipherProvider.getAllRegisteredIdentities(); // [identityExample]

// can decrypt data with identity
const dataToDecrypt = "02....";
const decryptedData = await cipherProvider.decrypt(dataToDecrypt, identityExample); // "Decrypted data..."

// can add a new decryption parameters
cipherProvider.addDecryptionParameters({method: EncryptionTypes.METHOD.ECIES, key: ...});

// can remove a cipher parameters from its identity
cipherProvider.removeRegisteredIdentity({type: IdentityTypes.TYPE.ETHEREUM_ADDRESS, value: ...});

// can remove all cipher parameters
cipherProvider.clearAllRegisteredIdentities();
```

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
[Read the contributing guide](/CONTRIBUTING.md)

## License

[MIT](/LICENSE)
6 changes: 6 additions & 0 deletions packages/epk-cipher/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const jestCommonConfig = require('../../jest.config');

/** @type {import('jest').Config} */
module.exports = {
...jestCommonConfig,
};
68 changes: 68 additions & 0 deletions packages/epk-cipher/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"name": "@requestnetwork/epk-cipher",
"version": "0.1.0",
"publishConfig": {
"access": "public"
},
"description": "Cipher provider using ethereum private keys.",
"keywords": [
"requestnetwork",
"cipher-provider"
],
"repository": {
"type": "git",
"url": "git+https://github.com/RequestNetwork/requestNetwork.git"
},
"homepage": "https://github.com/RequestNetwork/requestNetwork/tree/master/packages/epk-cipher#readme",
"bugs": {
"url": "https://github.com/RequestNetwork/requestNetwork/issues"
},
"license": "MIT",
"engines": {
"node": ">=18.0.0"
},
"main": "dist/index.js",
"types": "dist/index.d.ts",
"directories": {
"lib": "src",
"test": "test"
},
"files": [
"dist"
],
"scripts": {
"build": "run-s build:commonjs build:umd",
"build:commonjs": "tsc -b tsconfig.build.json",
"build:umd": "webpack",
"clean": "rm -rf dist tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo",
"lint": "eslint . --fix",
"lint:check": "eslint .",
"test": "jest",
"test:watch": "yarn test --watch"
},
"dependencies": {
"@requestnetwork/multi-format": "0.19.1",
"@requestnetwork/types": "0.45.1",
"@requestnetwork/utils": "0.45.1",
"tslib": "2.5.0"
},
"devDependencies": {
"@types/jest": "29.5.6",
"amd-loader": "0.0.8",
"crypto-browserify": "3.12.0",
"duplicate-package-checker-webpack-plugin": "3.0.0",
"jest": "29.5.0",
"jest-junit": "16.0.0",
"npm-run-all": "4.1.5",
"source-map-support": "0.5.19",
"stream-browserify": "3.0.0",
"terser-webpack-plugin": "4.2.3",
"ts-jest": "29.1.0",
"ts-loader": "8.4.0",
"ts-node": "10.9.1",
"typescript": "5.1.3",
"webpack": "5.94.0",
"webpack-bundle-analyzer": "4.2.0",
"webpack-cli": "3.3.12"
}
}
Loading