-
Notifications
You must be signed in to change notification settings - Fork 92
feat: add lit protocol provider and capacity credits delegation #1475
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
Merged
Merged
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 eeba42a
feat: add cypher providers and intergrate them with trasaction manager
rodrigopavezi 85c50cc
fix: typing issues
rodrigopavezi 49392bb
Merge branch 'master' into feat/lit-encryption
rodrigopavezi 40fc362
fix: build
rodrigopavezi fafe82c
update: epk cypher tests
rodrigopavezi 662a5a8
add: dummy test
rodrigopavezi 92038e4
fix: build
rodrigopavezi 6fb0e4f
Upgrade ethers to 5.7.2 and @ethersproject/experimental to 5.7.0
MantisClone c79d991
Restore original yarn.lock instead of fully regenerating it
MantisClone 0d2c303
fix: build
rodrigopavezi c9b79e0
fix: provider tests
rodrigopavezi ea181c9
Merge branch 'upgrade-ethers' into feat/lit-encryption
rodrigopavezi 55c0cce
Merge branch 'master' into feat/lit-encryption
rodrigopavezi 0e92bb8
fix: build
rodrigopavezi cacc5c4
fix: typing errors
rodrigopavezi 93317f9
fix: decryption
rodrigopavezi b4880bd
fix: lit disconnections and sign session
rodrigopavezi bf87710
fix: linting
rodrigopavezi cffcde1
Merge branch 'master' into feat/lit-encryption
rodrigopavezi cfdc5f7
Update packages/request-client.js/src/http-data-access.ts
rodrigopavezi 1166f79
fix: delegateeAddress eth address validation
rodrigopavezi a21f19f
Merge branch 'feat/lit-encryption' of https://github.com/RequestNetwo…
rodrigopavezi 4697e40
fix: delegateeAddress typing
rodrigopavezi 527c0ee
fix: add check for cypherProvider
rodrigopavezi 9e87557
fix: instanceOf issue
rodrigopavezi a4606bd
fix: coderabitai changes
rodrigopavezi 1506bb9
fix: encapsulate HttpDataAccess
rodrigopavezi f230538
fix: version and readme
rodrigopavezi 1722c04
fix: per coderabitai review
rodrigopavezi 94056e2
fix: fresh install
rodrigopavezi be1bdcf
fix: build types issues
rodrigopavezi ef8f741
fix: package lint
rodrigopavezi 2029434
fix: removed check for back compatibility
rodrigopavezi 2eb360a
fix: replace cypher word with cipher word
rodrigopavezi 05289b7
fix: transaction parser
rodrigopavezi c06c2fc
fix: try finally in the lit-protocol provider
rodrigopavezi ed489e6
fix: another catch finally issue
rodrigopavezi fbf2115
fix: decryption in the transaction parser
rodrigopavezi 5392686
fix: string in tests
rodrigopavezi 3c5285d
fix: as per coderabitai reviews
rodrigopavezi 6877d5e
fix: as per coderabitai new reviews
rodrigopavezi ca7c749
fix: package lint
rodrigopavezi f3755f5
fix: add env var for lit protocol network
rodrigopavezi 1160635
fix: types
rodrigopavezi 846a810
feat: add epk and lit cipher tests to circleci script
rodrigopavezi adcad4b
fix: transaction manager with tests
rodrigopavezi 22f6b2e
feat: add lit protocol provider tests
rodrigopavezi d48536f
fix: missing encryptionMethod in the createEncryptedTransaction
rodrigopavezi 1fbae2f
fix: per coderabitai reviews
rodrigopavezi 0d9c91e
fix: test as per coderabitai review
rodrigopavezi 24af827
fix: tests issues
rodrigopavezi f5b0022
fix: tests again
rodrigopavezi 914a6c8
fix: reveted misisng changes
rodrigopavezi 3c70c2b
Merge branch 'master' into feat/lit-encryption
rodrigopavezi 4556833
fix: add lit protocol package usage in the README
rodrigopavezi 5f86484
fix: merging issue
rodrigopavezi ce0d955
fix: missing assertion
rodrigopavezi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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": "../.." | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.