Closed GuilhermeMenezes closed 4 years ago
Hey @GuilhermeMenezes, sorry for the late answer!! The Jolocom Lib v4.4.1 and its documentation is still valid and in good shape. Let us know how your project goes :)
Hi @Joachim16, no worries.
I think I know what the problem was, I was saving the code snippets you guys have as "js" files instead of "ts" files... So now I'm trying to figure out why is the code not recognizing the libraries when I'm trying to import the jolocom-lib nor the crypto lib that I installed when I was following the instructions in https://jolocom-lib.readthedocs.io/en/latest/gettingStarted.html. Even though I have both modules in the node_modules folder...
Thanks for the help :)
@GuilhermeMenezes when using npm to install the Jolocom Lib please make sure you use Jolocom Lib v4.4.1 and not v5.0
ok, thank you @Joachim16. Will do.
Hi, sorry to bother you guys again. I'm trying to use this code snippet in order to create a DID.
import { JolocomLib } from 'jolocom-lib'
import { data } from './data'
const registry = JolocomLib.registries.jolocom.create()
const vaultedProvider = new JolocomLib.KeyProvider(data.seed, data.secret)
const publicEthereumKey = vaultedProvider.getPublicKey({
derivationPath: JolocomLib.KeyTypes.ethereumKey,
encryptionPass: data.secret
})
JolocomLib.util.fuelKeyWithEther(publicEthereumKey).then(() => {
registry.create(vaultedProvider, data.secret).then(identityWallet => {
console.log(
did - ${identityWallet.did})
})
})
First I got a bug in the line:
const vaultedProvider = new JolocomLib.KeyProvider(data.seed, data.secret)
it says expected 1 argument but it got 2. I went to the documentation and there you have a fromSeed that is missing in the above code. So I changed it to:
const vaultedProvider = new JolocomLib.KeyProvider.fromSeed(data.seed, data.secret)
But then, I got an error saying: "only a void function can be called with the 'new' keyword."
so I changed it to:
const vaultedProvider = JolocomLib.KeyProvider.fromSeed(data.seed, data.secret)
like it is in the documentation website. And apparently, I got past that.
But then I got an error in the "data.ts" file that I'm not finding a solution:
export const data = { seed: Buffer.from('e'.repeat(64), 'hex'), secret: 'secret', }
and the error is: Property 'repeat' does not exist on type '"e"'.
I haven't worked with typescript before, and I'm not experienced in javascript. So I'm sorry if these are easy bugs to solve without help... I'm I doing something wrong? Should I not have made the changes described above? Am I missing something?
Thanks for all your time. Cheers.
@GuilhermeMenezes how are you running this file? are you using ts-node
or are you compiling the typescript then running the javascript files?
Hi @mnzaki,
I'm using ts-node to run the file, yes.
I have managed to solve the problem, I needed to run using "tsc script.ts" command and then "node script.js" command. I got a valid DID. Thanks for trying to help. Cheers.
Hello everyone, I hope I find you all safe and well.
I'm working on a thesis project for college where I want to use DIDs and the Universal Resolver. In order to do that I need to be able to create a DID. I was advised to try and use the Jolocom Library, but I'm having trouble using your code. I was told your Documentation seems not to be up-to-date.
Is there any way where I can be provided with the up-to-date documentation in order to use this library properly? If not, can you guys point me towards some other way to create DIDs?
Thanks in advance for all the attention, Best regards, Guilherme Menezes.