You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
so I've been exploring using a secp256k1 private for architectural reasons.
I managed to get as far as generating the DID with a couple of tweaks in the code.
I did go to the extent of converting the private key to pem with key-encoder-js, but that still fails since it's not RSA, but EC.
Here is the stacktrace, more for reference than anything:
Error: Invalid PEM formatted message.
at Object.pem.decode (/Users/julien/work/did-blockcerts-poc/node_modules/libp2p/node_modules/node-forge/lib/pem.js:188:11)
at Object.pki.decryptRsaPrivateKey (/Users/julien/work/did-blockcerts-poc/node_modules/libp2p/node_modules/node-forge/lib/pbe.js:540:23)
at Object.importKey [as import] (/Users/julien/work/did-blockcerts-poc/node_modules/libp2p/node_modules/libp2p-crypto/src/keys/index.js:119:25)
at Keychain.importKey (/Users/julien/work/did-blockcerts-poc/node_modules/libp2p/src/keychain/index.js:423:20)
at Ipid.value (/Users/julien/work/js-did-ipid/lib/index.js:78:9)
at Ipid.value (/Users/julien/work/js-did-ipid/lib/index.js:40:9)
(node:66147) UnhandledPromiseRejectionWarning: Error: Cannot read the key, most likely the password is wrong
at Keychain.importKey (/Users/julien/work/did-blockcerts-poc/node_modules/libp2p/src/keychain/index.js:426:35)
at Ipid.value (/Users/julien/work/js-did-ipid/lib/index.js:78:9)
at Ipid.value (/Users/julien/work/js-did-ipid/lib/index.js:40:9)
And my pem key (which is actually a EC PRIVATE KEY - but I am replacing EC to nothing to avoid an early failure):
I understand that I am trying to open a square with a circle and that's why it does not work. I believe I would also need to modify the #importKey method to work with secp256k1 natively (maybe just unmarshal my key from there)?
IPFS to allows existing keys to be passed: https://docs.ipfs.io/how-to/use-existing-private-key/#javascript, and in the options when creating one can also set the algorithm to be secp256k1. That does not help when importing the key.
Any guidance is welcome,
thanks a lot
The text was updated successfully, but these errors were encountered:
Hi,
so I've been exploring using a secp256k1 private for architectural reasons.
I managed to get as far as generating the DID with a couple of tweaks in the code.
However I am struggling with the publishing. I am curious what is the purpose of this method: https://github.com/ipfs-shipyard/js-did-ipid/blob/master/src/index.js#L96, and how I can adapt things to work with secp256k1 as it expects RSA only (from libp2p-crypto).
I did go to the extent of converting the private key to pem with key-encoder-js, but that still fails since it's not RSA, but EC.
Here is the stacktrace, more for reference than anything:
And my pem key (which is actually a EC PRIVATE KEY - but I am replacing EC to nothing to avoid an early failure):
I understand that I am trying to open a square with a circle and that's why it does not work. I believe I would also need to modify the
#importKey
method to work with secp256k1 natively (maybe just unmarshal my key from there)?IPFS to allows existing keys to be passed: https://docs.ipfs.io/how-to/use-existing-private-key/#javascript, and in the options when creating one can also set the
algorithm
to besecp256k1
. That does not help when importing the key.Any guidance is welcome,
thanks a lot
The text was updated successfully, but these errors were encountered: