TransWikia.com

I can't work out how to get TangleID to work

Iota Asked by icehazard on August 21, 2021

So im trying to get tangleID to work to use it on a project. I am using this project.

https://github.com/TangleID/TangleID

But everytime I try and run the code i get an error message of “Mam.init is not a function”.

I’ve tried to include the mam library as well inside then then it stops throwing an error but breaks completely by not printing out the console.log on the next line.

I found this code as well

https://gist.github.com/ender503/ecd884b07190adb79f01b0d515c3b5a3

and I’m still getting the same problem!

(node:19332) UnhandledPromiseRejectionWarning: TypeError: Mam.init is not a function
    at Object.mam.createMam (C:UsersUserDesktopCodeProjectsTangleIDnode_modulestic.api.jsnode_modulesmam.tools.jslibmamClient.js:79:25)
    at Object.fromMasterSeed (C:UsersUserDesktopCodeProjectsTangleIDnode_modulestic.api.jslibticApi.js:166:40)
    at IdenityRegistry.<anonymous> (C:UsersUserDesktopCodeProjectsTangleIDnode_modules@tangleiddidlibdidsrcIdenityRegistry.js:75:55)
    at step (C:UsersUserDesktopCodeProjectsTangleIDnode_modules@tangleiddidlibdidsrcIdenityRegistry.js:32:23)
    at Object.next (C:UsersUserDesktopCodeProjectsTangleIDnode_modules@tangleiddidlibdidsrcIdenityRegistry.js:13:53)
    at C:UsersUserDesktopCodeProjectsTangleIDnode_modules@tangleiddidlibdidsrcIdenityRegistry.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (C:UsersUserDesktopCodeProjectsTangleIDnode_modules@tangleiddidlibdidsrcIdenityRegistry.js:3:12)
    at IdenityRegistry.getTicClient (C:UsersUserDesktopCodeProjectsTangleIDnode_modules@tangleiddidlibdidsrcIdenityRegistry.js:69:63)
    at IdenityRegistry.<anonymous> (C:UsersUserDesktopCodeProjectsTangleIDnode_modules@tangleiddidlibdidsrcIdenityRegistry.js:101:59)
(node:19332) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which 
was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:19332) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Node version v13.13.0

One Answer

I'm running the sample code with following step:

  1. Create the project directory
$ mkdir tangleid-test
$ cd tangleid-test
  1. Paste the sample code to main.js.

  2. Add the @tangleid/core package.

$ yarn add @tangleid/core
  1. Run the code,
$ node main.js
seed BAWWOZIAYXUPHNFBZABIVKSF9LYFVFWRNCEYNSCNMVK9AJOHXZYUMPGJZPVDVDZQSYOACJRWEIIEIXHCQ
2020-04-05T02:58:27.331Z warn: The seeds of profile and contacts channel are not save on the tangle. Channel clients can't be initialized.
2020-04-05T02:58:31.529Z info: Saving channel seeds in restricted channel
2020-04-05T02:58:52.887Z info: Attached message
2020-04-05T02:59:03.121Z info: Attached message
2020-04-05T02:59:03.121Z info: Publishing channel roots in public stream
2020-04-05T02:59:18.012Z info: Attached message
2020-04-05T02:59:30.181Z info: Attached message
2020-04-05T02:59:30.181Z info: Creating TIC completed
2020-04-05T02:59:30.188Z info: Publishing json: {"put":{"@context":["https://w3id.org/did/v1","https://w3id.org/security/v2"],"id":"did:tangle:MiqQTdR653Xdi9YLqYvqVG7jyQtj5xT4rozBryfeVtyDR2S5aWcwm9db91xWVtRA9nSik3ZSuh","publicKey":[{"id":"did:tangle:MiqQTdR653Xdi9YLqYvqVG7jyQtj5xT4rozBryfeVtyDR2S5aWcwm9db91xWVtRA9nSik3ZSuh#keys-1","type":"RsaVerificationKey2018","controller":"did:tangle:MiqQTdR653Xdi9YLqYvqVG7jyQtj5xT4rozBryfeVtyDR2S5aWcwm9db91xWVtRA9nSik3ZSuh","publicKeyPem":"-----BEGIN PUBLIC KEY-----nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAol+0LrzQ4+Z128AsTIsEnk+7+NRttp97tYP5jF1oqMShYfuqmYkde2p2V99Wp4c1/m0SX31t6/XkokXAClC/Fn3LDQj4cYkR16wW/ff5hi4J19KxQN35ANeRMcNLphCjZqTm6YmCOVfptjIIM3a7fxnY+cVacnjNMf9KKmQYaq6dUNv4aOM6m+7kyVZlCf+ZoQWQ3290vXi70Mq9RHQeoKLn2lW1acAKfhGkolvyAJmPbgWIy/IJBfQJ0inaJV+fbzqujsGY41s8RaZ9clkRQcJmnp5Boc+etklaFEd4wdB5PPUyW5EQw1lq2dUIyDi4ZmgfBdGuzMT5mfq1v+nGU930QnOwIDAQABn-----END PUBLIC KEY-----n"}],"assertionMethod":["did:tangle:MiqQTdR653Xdi9YLqYvqVG7jyQtj5xT4rozBryfeVtyDR2S5aWcwm9db91xWVtRA9nSik3ZSuh#keys-1"]}}
2020-04-05T02:59:46.256Z info: Attached message
{
  '@context': [ 'https://w3id.org/did/v1', 'https://w3id.org/security/v2' ],
  id: 'did:tangle:MiqQTdR653Xdi9YLqYvqVG7jyQtj5xT4rozBryfeVtyDR2S5aWcwm9db91xWVtRA9nSik3ZSuh',
  publicKey: [
    {
      id: 'did:tangle:MiqQTdR653Xdi9YLqYvqVG7jyQtj5xT4rozBryfeVtyDR2S5aWcwm9db91xWVtRA9nSik3ZSuh#keys-1',
      type: 'RsaVerificationKey2018',
      controller: 'did:tangle:MiqQTdR653Xdi9YLqYvqVG7jyQtj5xT4rozBryfeVtyDR2S5aWcwm9db91xWVtRA9nSik3ZSuh',
      publicKeyPem: '-----BEGIN PUBLIC KEY-----n' +
        'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAol+0LrzQ4+Z128AsTIsEn' +
        'k+7+NRttp97tYP5jF1oqMShYfuqmYkde2p2V99Wp4c1/m0SX31t6/XkokXAClC/Fn' +
        '3LDQj4cYkR16wW/ff5hi4J19KxQN35ANeRMcNLphCjZqTm6YmCOVfptjIIM3a7fxn' +
        'Y+cVacnjNMf9KKmQYaq6dUNv4aOM6m+7kyVZlCf+ZoQWQ3290vXi70Mq9RHQeoKLn' +
        '2lW1acAKfhGkolvyAJmPbgWIy/IJBfQJ0inaJV+fbzqujsGY41s8RaZ9clkRQcJmn' +
        'p5Boc+etklaFEd4wdB5PPUyW5EQw1lq2dUIyDi4ZmgfBdGuzMT5mfq1v+nGU930Qn' +
        'OwIDAQABn' +
        '-----END PUBLIC KEY-----n'
    }
  ],
  assertionMethod: [
    'did:tangle:MiqQTdR653Xdi9YLqYvqVG7jyQtj5xT4rozBryfeVtyDR2S5aWcwm9db91xWVtRA9nSik3ZSuh#keys-1'
  ]
}
{
  '@context': [ 'https://www.w3.org/2018/credentials/v1', 'http://schema.org' ],
  id: 'http://example.edu/credentials/58473',
  type: [ 'VerifiableCredential', 'AlumniCredential' ],
  credentialSubject: {
    id: 'did:tangle:5i1WeTSiRnsUBwj3DGLxHzENfryPxKUzkMES98S57LLAauY2NF5dx17yPke9PaoVYY9Qhh47J',
    alumniOf: 'Example University'
  },
  proof: {
    type: 'RsaSignature2018',
    created: '2020-04-05T02:59:50Z',
    'https://w3id.org/security#jws': 'eyJhbGciOiJQUzI1NiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..M45rqTlR9MBx33jVDOlV8a65BTvylmylHXNtPfT3bmDv7RR5Do_54qt8B9VHpZpa31SUArOZigc0t8UT1BgkCIxjYJt0DB0FmPRydMxdbNfrxtsxSggL9512mUu9Rp2-3ZpT3IueQqML9Xb9FvHY-Oi7rQdoyh6-eoF_A0jlGyzvygYtDy_PZ4cS1vLnFVedGsWax1BiFvI2lVatmaOnPA1FPlUDvTaRy0SpfJy7NEnZ52jqgEIbqvl4vJM7no7Bg3s0-r3XC6GuQhonQmNOYQ_yR0D2ix61WlOjkgLrFL3M7Iq0-Vx2CMmBdoKpNHSUk1273yFmG3IToT_-Woe7dw',
    'https://w3id.org/security#proofPurpose': { id: 'https://w3id.org/security#assertionMethod' },
    'https://w3id.org/security#verificationMethod': {
      id: 'did:tangle:MiqQTdR653Xdi9YLqYvqVG7jyQtj5xT4rozBryfeVtyDR2S5aWcwm9db91xWVtRA9nSik3ZSuh#keys-1'
    }
  }
}
verified true

If you are still getting the same problem, could you provide your Node.js version?

Answered by ender503 on August 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP