Skip to content
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

fix(key/gen): use correct key type casing #145

Merged
merged 2 commits into from
Feb 13, 2023
Merged

fix(key/gen): use correct key type casing #145

merged 2 commits into from
Feb 13, 2023

Conversation

SgtPooki
Copy link
Member

@SgtPooki SgtPooki commented Feb 9, 2023

see https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-key-gen

fixes #143

local changes:

diff --git a/node_modules/kubo-rpc-client/src/key/gen.js b/node_modules/kubo-rpc-client/src/key/gen.js
index 18eaf08..3015851 100644
--- a/node_modules/kubo-rpc-client/src/key/gen.js
+++ b/node_modules/kubo-rpc-client/src/key/gen.js
@@ -4,7 +4,7 @@ import { toUrlSearchParams } from '../lib/to-url-search-params.js'
 
 /** @type {import('ipfs-core-types/src/key').GenOptions} */
 const defaultOptions = {
-  type: 'Ed25519'
+  type: 'ed25519'
 }
 
 export const createGen = configure(api => {
@@ -12,6 +12,8 @@ export const createGen = configure(api => {
    * @type {import('../types').KeyAPI["gen"]}
    */
   async function gen (name, options = defaultOptions) {
+    console.log(`name: `, name);
+    console.log(`options: `, options);
     const res = await api.post('key/gen', {
       signal: options.signal,
       searchParams: toUrlSearchParams({

Local output of test run:

╰─ ✘ 1 ❯ DEBUG="ipfs:*" npm run test:e2e -- test/e2e/ipns.test.js -g 'should support removing keys'

> ipfs-webui@2.22.0 test:e2e
> cross-env REACT_APP_ENV=test npx playwright test -c ./test/e2e "test/e2e/ipns.test.js" "-g" "should support removing keys"


Running 1 test using 1 worker

[WebServer] (node:22953) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
(Use `node --trace-deprecation ...` to show where the warning was created)
  ✓  1 ipns.test.js:52:5 › IPNS publishing › Settings screen › should support removing keys (1.9s)
name:  rm-key-test-1675979020698
options:  { type: 'ed25519' }


  1 passed (7.0s)

@SgtPooki
Copy link
Member Author

SgtPooki commented Feb 9, 2023

Note that this PR is now removing key.info, because it doesn't exist in the RPC endpoints listed at https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-key-gen, and also removes the types (for key rpc apis only) from ipfs-core-types that we get from js-ipfs, which is now deprecated.

@SgtPooki
Copy link
Member Author

only one CI job failed: test-firefox with unrelated error so i restarted it

        1) moves a file from a sharded directory to a sharded directory
[JavaScript Error: "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://127.0.0.1:33075/api/v0/files/mv?arg=%2Fsharded-dir-0.7846095527039747%2Ffile-0.5759900410914469.txt&arg=%2Fsharded-dir-0.3874999221674885. (Reason: CORS request did not succeed). Status code: (null)."]
  328 passing (1m)
  32 pending
  1 failing
  1) kubo RPC client interface tests
       .files.mv
         with sharding
           moves a file from a sharded directory to a sharded directory:
     NetworkError when attempting to fetch resource.

@SgtPooki
Copy link
Member Author

SgtPooki commented Feb 10, 2023

test-firefox failed again seemingly at 'pin-remote-add ':

Error [HTTPError]: failed to check pin status for requestid="req-3" due to error: reason: "NotFound", details: "Error\n    at notFound (/home/runner/work/js-kubo-rpc-client/js-kubo-rpc-client/node_modules/mock-ipfs-pinning-service/service/util.js:25:52)\n    at getPin (/home/runner/work/js-kubo-rpc-client/js-kubo-rpc-client/node_modules/mock-ipfs-pinning-service/service/pins.js:141:18)\n    at /home/runner/work/js-kubo-rpc-client/js-kubo-rpc-client/node_modules/mock-ipfs-pinning-service/service/util.js:69:43\n    at OASRouter (/home/runner/work/js-kubo-rpc-client/js-kubo-rpc-client/node_modules/oas-tools/common/middleware/oas-router.js:322:22)\n    at Layer.handle [as handle_request] (/home/runner/work/js-kubo-rpc-client/js-kubo-rpc-client/node_modules/express/lib/router/layer.js:95:5)\n    at next (/home/runner/work/js-kubo-rpc-client/js-kubo-rpc-client/node_modules/express/lib/router/route.js:144:13)\n    at Route.dispatch (/home/runner/work/js-kubo-rpc-client/js-kubo-rpc-client/node_modules/express/lib/router/route.js:114:3)\n    at Layer.handle [as handle_request] (/home/runner/work/js-kubo-rpc-client/js-kubo-rpc-client/node_modules/express/lib/router/layer.js:95:5)\n    at /home/runner/work/js-kubo-rpc-client/js-kubo-rpc-client/node_modules/express/lib/router/index.js:284:15\n    at param (/home/runner/work/js-kubo-rpc-client/js-kubo-rpc-client/node_modules/express/lib/router/index.js:365:14)": 404 Not Found

SgtPooki added a commit to ipfs/ipfs-webui that referenced this pull request Feb 10, 2023
SgtPooki added a commit to ipfs/ipfs-webui that referenced this pull request Feb 10, 2023
Copy link
Member

@hacdias hacdias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm approving this now, even though it is part of #128 - it's on halt right now. This is an important fix nevertheless. Thanks @SgtPooki!

Regarding the failing test: since it's not related to the key namespace, let's get this merged. There's a few other flaky tests on our test suite unfortunately.

@hacdias hacdias merged commit 8b24a94 into master Feb 13, 2023
@hacdias hacdias deleted the fix/key-gen branch February 13, 2023 08:43
github-actions bot pushed a commit that referenced this pull request Feb 13, 2023
## [3.0.1](v3.0.0...v3.0.1) (2023-02-13)

### Bug Fixes

* **key/gen:** use correct key type casing ([#145](#145)) ([8b24a94](8b24a94))

### Documentation

* fix global variable for CDN version [ci skip] ([2b129c7](2b129c7))
@github-actions
Copy link
Contributor

🎉 This PR is included in version 3.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

SgtPooki added a commit to ipfs/ipfs-webui that referenced this pull request Mar 13, 2023
* feat!: ipfs-http-client -> kubo-rpc-client

fix: error rendering peerId

fix: peers table on peerspage

fix: statusPage -> advanced -> addresses

fix: most e2e tests working with kubo-rpc-client

chore: update to go-ipfsv0.18.1

* chore: fix key.gen with patch

needed until kubo-rpc-client fix is merged

see ipfs/js-kubo-rpc-client#143
see ipfs/js-kubo-rpc-client#145

* fix: use ipld-explorer-components patch temporarily

see https://github.com/ipfs/ipfs-webui/issues/2079\#issuecomment-1426219633
see #2079 (comment)

must use until ipfs/ipld-explorer-components#356

* chore: fix ipld-explorer-components patch

not needed once ipfs/ipld-explorer-components#356 is merged

* test: add tests to explore.test.js

* tmp: trying to navigate the undocumented world of parsing CIDs

* chore: working on getting tests fully tied up

* test(e2e): finish updating explore.test.js

* chore: lint fixes

* chore: remove debugging code

* test: test clicking children links on explore page

* tmp: fix children explore views

* test: e2e explore test traverses children

* Update test/e2e/explore.test.js

Co-authored-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>

* chore: address PR comments

---------

Co-authored-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: HTTPError: unrecognized key type: Ed25519
2 participants