openwallet-foundation / credo-ts

Typescript framework for building decentralized identity and verifiable credential solutions
https://credo.js.org
Apache License 2.0
247 stars 186 forks source link

AriesFrameworkError: Missing required dependency: 'Wallet' #1476

Closed realabbas closed 1 year ago

realabbas commented 1 year ago

Hey, I am trying to use @hyperledger/aries-askar-react-native with the following configuration, please have a look

Versions

  "@aries-framework/anoncreds": "^0.4.0-alpha.127",
    "@aries-framework/anoncreds-rs": "^0.4.0-alpha.127",
    "@aries-framework/askar": "^0.4.0-alpha.127",
    "@aries-framework/indy-vdr": "^0.4.0-alpha.127",
    "@aries-framework/react-native": "^0.4.0-alpha.127",
    "@hyperledger/anoncreds-react-native": "^0.1.0-dev.18",
    "@hyperledger/aries-askar-react-native": "^0.1.0-dev.11",
    "@hyperledger/indy-vdr-react-native": "^0.1.0-dev.15",
    "@aries-framework/core": "0.4.0-alpha.127",
    "react": "17.0.2",
    "react-native": "0.66.1",
    "react-native-fs": "^2.16.6",
    "react-native-get-random-values": "^1.8.0"

I am getting the following error while initialising the agent

[AriesFrameworkError: Missing required dependency: 'Wallet'. You can register it using one of the provided modules such as the AskarModule or the IndySdkModule, or implement your own.]

Code

const init = async () => {
    console.log("INIT CALLED")
    const agent = new Agent({
      config: {
        label: 'testing-askar',
        walletConfig: {
          id: 'alice',
          key: 'pw',
        },
        // logger: new ConsoleLogger(LogLevel.debug),
      },
      dependencies: agentDependencies,
      modules: {
        askar: new AskarModule({
          ariesAskar,
        }),
        mediationRecipient: new MediationRecipientModule({
          mediatorPickupStrategy: MediatorPickupStrategy.PickUpV2,
          mediatorInvitationUrl:c 
        }),
        credentials: new CredentialsModule({
          autoAcceptCredentials: AutoAcceptCredential.ContentApproved,
          credentialProtocols: [
            new V2CredentialProtocol({
              credentialFormats: [new LegacyIndyCredentialFormatService()],
            }),
          ],
        }),
        proofs: new ProofsModule({
          autoAcceptProofs: AutoAcceptProof.ContentApproved,
          proofProtocols: [
            new V1ProofProtocol({
              indyProofFormat: new LegacyIndyProofFormatService(),
            }),
            new V2ProofProtocol({
              proofFormats: [new LegacyIndyProofFormatService()],
            }),
          ],
        }),
        anoncreds: new AnonCredsModule({
          registries: [new IndyVdrAnonCredsRegistry()],
        }),
        anoncredsRs: new AnonCredsRsModule({
          anoncreds: anoncreds,
        }),
        indyVdr: new IndyVdrModule({
          indyVdr: indyVdr,
          networks: [
            {
              genesisTransactions: trential,
              indyNamespace: 'trential-dev',
              isProduction: false,
            },
          ],
        }),
      },
    });
    const httpOutboundTransport = new HttpOutboundTransport();
    const wsOutboundTransport = new WsOutboundTransport();
    agent.registerOutboundTransport(wsOutboundTransport);
    agent.registerOutboundTransport(httpOutboundTransport);
    await agent.initialize();
  };
TimoGlastra commented 1 year ago

Do you import ariesAskar from @hyperledger/aries-askar-react-native? Can you share your yarn.lock file?

realabbas commented 1 year ago

Do you import ariesAskar from @hyperledger/aries-askar-react-native? Can you share your yarn.lock file?

Yes, imported it from @hyperledger/aries-askar-react-native

import {ariesAskar} from '@hyperledger/aries-askar-react-native';

Package-lock.json file link https://www.transfernow.net/dl/20230530XvjDCu79/tNPX3mzR

TimoGlastra commented 1 year ago

It seems you have @aries-framework/indy-sdk installed, which is on alpha 129, while the other packages are on 127, which causes the core package to be installed twice. Can you try removing indy sdk (As you're using askar/anoncreds/indy-vdr), and lock the versions to a specific alpha?

    "node_modules/@aries-framework/indy-sdk": {
      "version": "0.4.0-alpha.129",
      "resolved": "https://registry.npmjs.org/@aries-framework/indy-sdk/-/indy-sdk-0.4.0-alpha.129.tgz",
      "integrity": "sha512-sr8rt+nDelUAFJICJbQ2ZsaWvFKAHsOIW4wbkx4r7iHf1Oefhi5eR5HN1g3fsePCplixOQYSw91DHUxa43XqKA==",
      "dependencies": {
        "@aries-framework/anoncreds": "0.4.0-alpha.129+25c76ae6",
        "@aries-framework/core": "0.4.0-alpha.129+25c76ae6",
        "@stablelib/ed25519": "^1.0.3",
        "@types/indy-sdk": "1.16.26",
        "class-transformer": "0.5.1",
        "class-validator": "0.14.0",
        "rxjs": "^7.2.0",
        "tsyringe": "^4.7.0"
      }
    },
    "node_modules/@aries-framework/indy-sdk/node_modules/@aries-framework/anoncreds": {
      "version": "0.4.0-alpha.129",
      "resolved": "https://registry.npmjs.org/@aries-framework/anoncreds/-/anoncreds-0.4.0-alpha.129.tgz",
      "integrity": "sha512-9OUsC5ZmqSD8GAFVzLBZ9qE+uPgdkolGWyGPX5n1bsh5y1eMw4PtO9BFuXxWvzeXlRsGLVe9BZiC9hPPJR/rEQ==",
      "dependencies": {
        "@aries-framework/core": "0.4.0-alpha.129+25c76ae6",
        "bn.js": "^5.2.1",
        "class-transformer": "0.5.1",
        "class-validator": "0.14.0",
        "reflect-metadata": "^0.1.13"
      }
    },
    "node_modules/@aries-framework/indy-sdk/node_modules/@aries-framework/core": {
      "version": "0.4.0-alpha.129",
      "resolved": "https://registry.npmjs.org/@aries-framework/core/-/core-0.4.0-alpha.129.tgz",
      "integrity": "sha512-Y6tI9RpMGlAZofk5DyRrDTLBFy/4xRvSTb19ucFlp3LKidsHtJXn9Te4VJe0pBj4BOjP8I0T5bNmVLmz5sR8Ig==",
      "dependencies": {
        "@digitalcredentials/jsonld": "^5.2.1",
        "@digitalcredentials/jsonld-signatures": "^9.3.1",
        "@digitalcredentials/vc": "^1.1.2",
        "@multiformats/base-x": "^4.0.1",
        "@stablelib/ed25519": "^1.0.2",
        "@stablelib/random": "^1.0.1",
        "@stablelib/sha256": "^1.0.1",
        "@types/ws": "^8.5.4",
        "abort-controller": "^3.0.0",
        "big-integer": "^1.6.51",
        "borc": "^3.0.0",
        "buffer": "^6.0.3",
        "class-transformer": "0.5.1",
        "class-validator": "0.14.0",
        "did-resolver": "^4.1.0",
        "lru_map": "^0.4.1",
        "luxon": "^3.3.0",
        "make-error": "^1.3.6",
        "node-fetch": "^2.6.1",
        "object-inspect": "^1.10.3",
        "query-string": "^7.0.1",
        "reflect-metadata": "^0.1.13",
        "rxjs": "^7.2.0",
        "tsyringe": "^4.7.0",
        "uuid": "^9.0.0",
        "varint": "^6.0.0",
        "web-did-resolver": "^2.0.21"
      }
    },
realabbas commented 1 year ago

Oh Okay, removed @aries-framework/indy-sdk

Please check out the following package-lock.json file

https://www.transfernow.net/dl/20230530qZO8XRAe/JTXl0DOg

TimoGlastra commented 1 year ago

@realabbas we just released AFJ 0.4.0 (stable release). Could you try updating all @aries-framework versions to ^0.4.0, and all @hyperledger versions to ^0.1.0

berendsliedrecht commented 1 year ago

Closing due to presumed fix by v0.4.0 release.