Closed Asguho closed 1 month ago
This is an ongoing implementation you can track here https://github.com/denoland/deno/issues/18455
Some of this work will land in a PR in the coming days :-)
@levex it's been a few months since your comment. Any updates here?
Any updates? This is still an issue.
Unfortunately, I no longer have time to spare on contributing to Deno - please raise this with the team. cc @bartlomieju you can probably assist in redirecting this ticket.
Is there any news on redirecting this issue?
KeyObject#asymmetricKeyType
was added in #20981
We're tracking other node:crypto APIs in #18455 and private key APIs in #21124.
@littledivy I'm still seeing this issue as of today.
[uncaught application error]: Error - connect: getConnection: Not implemented: crypto.KeyObject.prototype.asymmetricKeyType
at SftpClient.fmtError (file:///Users/bob/Library/Caches/deno/npm/registry.npmjs.org/ssh2-sftp-client/9.1.0/src/index.js:82:22)
at SftpClient.connect (file:///Users/bob/Library/Caches/deno/npm/registry.npmjs.org/ssh2-sftp-client/9.1.0/src/index.js:219:37)
at eventLoopTick (ext:core/01_core.js:189:11)
at async SFTPStorageClient.save (file:///Users/bob/workspace/bank-api/api/storage.ts:41:5)
at async FileService.create (file:///Users/bob/workspace/bank-api/api/service.ts:37:5)
at async file:///Users/bob/workspace/bank-api/api/main.ts:44:23
at async dispatch (https://deno.land/x/oak@v12.6.1/middleware.ts:80:7)
at async dispatch (https://deno.land/x/oak@v12.6.1/middleware.ts:80:7)
at async dispatch (https://deno.land/x/oak@v12.6.1/middleware.ts:80:7)
at async dispatch (https://deno.land/x/oak@v12.6.1/middleware.ts:80:7)
deno 1.38.1 (release, aarch64-apple-darwin)
v8 12.0.267.1
typescript 5.2.2
@littledivy PTAL
Here is some more information if it's helpful:
$ deno --version
deno 1.38.1 (release, aarch64-apple-darwin)
v8 12.0.267.1
typescript 5.2.2
Minimal test case. I'm trying to use the ssh2 npm module (in my previous comment I was using the ssh2-sftp-client
npm module which uses ssh2
under the hood):
import { Client } from "npm:ssh2";
const client = new Client();
const p = client
.on("ready", () => {
console.log("ready");
})
.on("error", (e: Error) => {
console.log(e);
})
.connect({ host: "127.0.0.1", port: 2022, username: "username", password: "*******" });
More informative stack trace:
Error: Not implemented: crypto.KeyObject.prototype.asymmetricKeyType
at notImplemented (ext:deno_node/_utils.ts:9:9)
at KeyObject.export (ext:deno_node/internal/crypto/keys.ts:79:5)
at Curve25519Exchange.getPublicKey (file:///Users/bob/Library/Caches/deno/npm/registry.npmjs.org/ssh2/1.14.0/lib/protocol/kex.js:1268:46)
at Curve25519Exchange.start (file:///Users/bob/Library/Caches/deno/npm/registry.npmjs.org/ssh2/1.14.0/lib/protocol/kex.js:996:29)
at handleKexInit (file:///Users/bob/Library/Caches/deno/npm/registry.npmjs.org/ssh2/1.14.0/lib/protocol/kex.js:486:13)
at Protocol.onKEXPayload (file:///Users/bob/Library/Caches/deno/npm/registry.npmjs.org/ssh2/1.14.0/lib/protocol/kex.js:1777:14)
at NullDecipher.decrypt (file:///Users/bob/Library/Caches/deno/npm/registry.npmjs.org/ssh2/1.14.0/lib/protocol/crypto.js:612:26)
at Protocol.parsePacket [as _parse] (file:///Users/bob/Library/Caches/deno/npm/registry.npmjs.org/ssh2/1.14.0/lib/protocol/Protocol.js:2021:25)
at Protocol.parse (file:///Users/bob/Library/Caches/deno/npm/registry.npmjs.org/ssh2/1.14.0/lib/protocol/Protocol.js:306:16)
at Socket.<anonymous> (file:///Users/bob/Library/Caches/deno/npm/registry.npmjs.org/ssh2/1.14.0/lib/client.js:775:21)
I dug into this a little bit deeper. The error should reference crypto.KeyObject.prototype.export
and not crypto.KeyObject.prototype.asymmetricKeyType
. I believe there's a copy pasta bug there.
It also looks like this is unimplemented because in nodejs KeyObject.export
is implemented in C++. How should node compatibility modules that have C++ bindings be implemented in deno? In this case, the nodejs C++ implementations have a dependency on openssl.
I also have the same issue with Deno and libp2p. Is there any solution?
The same problem with packeage tunnel-ssh
Would like to see this to get ssh2
to work in Deno as well. It's the only SSH2/SFTP solution that we could use at the moment.
Hit a related:
ERROR Not implemented: crypto.PrivateKeyObject.prototype.export
in the
Looks like now the error is: TypeError: exporting ec is not implemented
Using the latest canary (deno 1.45.5+507e5b7) i now get
error: Uncaught (in promise) Error: Not implemented: jwk public key export not implemented
Can't tell if the exporting ec is not implemented
issue is resolved, or if this jwk issue appear before it. @kt3k , can you tell?
@birkskyum Thanks for checking! I confirmed the same error. Updated the title.
(I think the previous issue was resolved in https://github.com/denoland/deno/pull/24463)
Describe the bug
Using mineflayer from npm causes a "not implemented" error with the crypto module from the node compatibility layer
Steps to Reproduce
Running the code in this index.ts file
Results in this error
Update (@kt3k): Now the error is:
Expected behavior
Environment
OS: Windows 11 deno version: 1.31.1