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

Can't create new ipns record #23

Closed
darkrain opened this issue Jul 16, 2019 · 5 comments
Closed

Can't create new ipns record #23

darkrain opened this issue Jul 16, 2019 · 5 comments

Comments

@darkrain
Copy link

I try this code but my callback is not executed.

Why? may be i generate keys incorrectly?

const ipns = require('ipns');
const crypto = require('libp2p-crypto');


async function async(){
	const keys = await crypto.keys.generateKeyPair('RSA', 2048)

	ipns.create(keys, '/ipfs/QmNjRHSsT4Tj2nrvjaaGC1DmkQaV7Ec6gxZ34Qsrvqc2Zf', 0,'10000', (err, entryData) => {
		console.log(err)
		console.log(ipnsEntry);
	})

	
};

async()
@vasco-santos
Copy link
Member

Hey @darkrain

Can you confirm me that you are using libp2p-crypto@0.17.0?

@darkrain
Copy link
Author

Hey @darkrain

Can you confirm me that you are using libp2p-crypto@0.17.0?

Yep

@vasco-santos
Copy link
Member

So, the problem is that libp2p-crypto@0.17.0 uses the newest async API:

https://github.com/libp2p/js-libp2p-crypto/blob/master/CHANGELOG.md#features

In this context, when you do generateKeyPair, the resulting keys will have the sign function, which uses the new API. This way, js-ipns tries to sign using the oldest libp2p-crypto API, that is, using a callback. If you check the package.json in this repo, you can see that we have libp2p-crypto@0.16.0, which still works on a callback way.

TLDR: we are on a process of refactoring all our codebase to use an async API and get rid of callbacks.
Apparently, all the blocking dependencies to get this module refactored are already merged and released, so we will move with ipfs/js-ipns#19, which will fix this issue for you

@darkrain
Copy link
Author

@vasco-santos Thank you form Russia and our team)

@vasco-santos
Copy link
Member

@darkrain just released the new version of js-ipns@0.6.0.

Will close the issue now, but let me know if this did not solve your problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants