openwallet-foundation / credo-ts

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

React native register schema crash #1626

Closed valavanisleonidas closed 9 months ago

valavanisleonidas commented 1 year ago

Hello,

I am running a mobile agent in React native with all the latest release versions except from aries-askar because it fails to build and when I try to create to register the schema definition I get this error . Can anyone help me with this error or at least share a working version with the packages that should be working ? I also have a discord thread for that issue if thats easier :) Thanks a lot !!!

The error is

ERROR: Error registering schema for did 'did:indy:bcovrin:test:TGScrcgjEykofSnVdJqPWp' {
  "error": {
    "name": "Error",
    "stack": "Error: Validation error: Trying to use DID with unexpected length: 0. The 16- or 32-byte number upon which a DID is based should be 22/23 or 44/45 bytes when encoded as base58.\n    at construct (native)\n    at Wrapper (http://10.0.2.2:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.mobileapptrevo&modulesOnly=false&runModule=true:27107:64)\n    at construct (native)\n    at _createSuperInternal (http://10.0.2.2:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.mobileapptrevo&modulesOnly=false&runModule=true:273445:406)\n    at call (native)\n    at IndyVdrError (http://10.0.2.2:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.mobileapptrevo&modulesOnly=false&runModule=true:273460:26)\n    at handleError (http://10.0.2.2:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.mobileapptrevo&modulesOnly=false&runModule=true:275471:98)\n    at buildGetAcceptanceMechanismsRequest (http://10.0.2.2:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.mobileapptrevo&modulesOnly=false&runModule=true:275518:126)\n    at GetAcceptanceMechanismsRequest (http://10.0.2.2:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.mobileapptrevo&modulesOnly=false&runModule=true:273006:108)\n    at ?anon_0_ (http://10.0.2.2:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.mobileapptrevo&modulesOnly=false&runModule=true:274159:143)\n    at next (native)\n    at asyncGeneratorStep (http://10.0.2.2:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.mobileapptrevo&modulesOnly=false&runModule=true:28354:26)\n    at _next (http://10.0.2.2:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.mobileapptrevo&modulesOnly=false&runModule=true:28373:29)\n    at tryCallOne (/root/react-native/packages/react-native/ReactAndroid/hermes-engine/.cxx/Release/2sw813f4/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:53:16)\n    at anonymous (/root/react-native/packages/react-native/ReactAndroid/hermes-engine/.cxx/Release/2sw813f4/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:139:27)\n    at apply (native)\n    at anonymous (http://10.0.2.2:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.mobileapptrevo&modulesOnly=false&runModule=true:34985:26)\n    at _callTimer (http://10.0.2.2:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.mobileapptrevo&modulesOnly=false&runModule=true:34864:17)\n    at _callReactNativeMicrotasksPass (http://10.0.2.2:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.mobileapptrevo&modulesOnly=false&runModule=true:34909:17)\n    at callReactNativeMicrotasks (http://10.0.2.2:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.mobileapptrevo&modulesOnly=false&runModule=true:35115:44)\n    at __callReactNativeMicrotasks (http://10.0.2.2:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.mobileapptrevo&modulesOnly=false&runModule=true:3282:46)\n    at anonymous (http://10.0.2.2:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.mobileapptrevo&modulesOnly=false&runModule=true:3056:45)\n    at __guard (http://10.0.2.2:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.mobileapptrevo&modulesOnly=false&runModule=true:3255:15)\n    at flushedQueue (http://10.0.2.2:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.mobileapptrevo&modulesOnly=false&runModule=true:3055:21)",
    "message": "Validation error: Trying to use DID with unexpected length: 0. The 16- or 32-byte number upon which a DID is based should be 22/23 or 44/45 bytes when encoded as base58.",
    "code": 4,
    "extra": null
  },
  "did": "did:indy:bcovrin:test:TGScrcgjEykofSnVdJqPWp",
  "schema": {
    "attrNames": [
      "name",
      "age"
    ],
    "issuerId": "did:indy:bcovrin:test:TGScrcgjEykofSnVdJqPWp",
    "name": "Example Schema to register",
    "version": "2.0.6"
  }
}

My package.json looks like this

{
  "name": "mobileApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest"
  },
  "dependencies": {
    "@aries-framework/anoncreds-rs": "0.5.0-alpha.60",
    "@aries-framework/askar": "0.5.0-alpha.60",
    "@aries-framework/core": "0.5.0-alpha.60",
    "@aries-framework/indy-vdr": "0.5.0-alpha.60",
    "@aries-framework/react-native": "0.5.0-alpha.60",
    "@hyperledger/anoncreds-react-native": "0.2.0-dev.4",
    "@hyperledger/anoncreds-shared": "0.2.0-dev.4",
    "@hyperledger/aries-askar-react-native": "0.1.1",
    "@hyperledger/aries-askar-shared": "0.1.1",
    "@hyperledger/indy-vdr-react-native": "0.2.0-dev.5",
    "@hyperledger/indy-vdr-shared": "0.2.0-dev.5",
    "@aries-framework/push-notifications": "0.6.0",
    "@aries-framework/react-hooks": "0.5.0",
    "@react-native-async-storage/async-storage": "^1.12.1",
    "assert": "^1.5.1",
    "events": "^1.1.1",
    "expo-modules-core": "^1.5.11",
    "react": "18.2.0",
    "react-native": "0.72.4",
    "react-native-fs": "^2.16.6",
    "react-native-get-random-values": "^1.9.0",
    "react-native-randombytes": "^3.6.1"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@react-native/eslint-config": "^0.72.2",
    "@react-native/metro-config": "^0.72.11",
    "@tsconfig/react-native": "^3.0.0",
    "@types/react": "^18.0.24",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.2.1",
    "eslint": "^8.19.0",
    "jest": "^29.2.1",
    "jetifier": "^2.0.0",
    "metro-react-native-babel-preset": "0.76.8",
    "prettier": "^2.4.1",
    "react-test-renderer": "18.2.0",
    "typescript": "4.8.4"
  },
  "engines": {
    "node": ">=16"
  }
}

and my code like this

import { AskarModule } from '@aries-framework/askar';
import {
    Agent,InitConfig,    ConnectionEventTypes,    ConnectionStateChangedEvent,    WsOutboundTransport,  HttpOutboundTransport,    DidExchangeState,    OutOfBandRecord,    ConnectionsModule,    ConsoleLogger,    LogLevel,   AutoAcceptCredential,    CredentialsModule,    MediatorPickupStrategy,    ProofsModule,    MediationRecipientModule,    V2CredentialProtocol,    V2ProofProtocol,    AutoAcceptProof,    ProofEventTypes,    ProofState,    ProofStateChangedEvent,
    CredentialEventTypes,    CredentialState,    CredentialStateChangedEvent,    KeyType,    TypedArrayEncoder,    DidsModule,
} from '@aries-framework/core';
import { agentDependencies } from '@aries-framework/react-native';
import {
    PushNotificationsFcmModule,
    PushNotificationsApnsModule,
} from '@aries-framework/push-notifications';

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

import { anoncreds } from '@hyperledger/anoncreds-react-native';
import { AnonCredsRsModule } from '@aries-framework/anoncreds-rs';

import {
    AnonCredsModule,    LegacyIndyCredentialFormatService, LegacyIndyProofFormatService,    V1CredentialProtocol,    V1ProofProtocol,    AnonCredsCredentialFormatService,    AnonCredsProofFormatService,
} from '@aries-framework/anoncreds';
import { } from '@aries-framework/core';
import {
    IndyVdrAnonCredsRegistry,    IndyVdrIndyDidRegistrar,    IndyVdrIndyDidResolver,    IndyVdrModule,    IndyVdrPoolConfig,
} from '@aries-framework/indy-vdr';

import { indyVdr } from '@hyperledger/indy-vdr-react-native';

const BCOVRIN_TEST_GENESIS = `{"reqSignature":{},"txn":{"data":{"data":{"alias":"Node1","blskey":"4N8aUNHSgjQVgkpm8nhNEfDf6txHznoYREg9kirmJrkivgL4oSEimFF6nsQ6M41QvhM2Z33nves5vfSn9n1UwNFJBYtWVnHYMATn76vLuL3zU88KyeAYcHfsih3He6UHcXDxcaecHVz6jhCYz1P2UZn2bDVruL5wXpehgBfBaLKm3Ba","blskey_pop":"RahHYiCvoNCtPTrVtP7nMC5eTYrsUA8WjXbdhNc8debh1agE9bGiJxWBXYNFbnJXoXhWFMvyqhqhRoq737YQemH5ik9oL7R4NTTCz2LEZhkgLJzB3QRQqJyBNyv7acbdHrAT8nQ9UkLbaVL9NBpnWXBTw4LEMePaSHEw66RzPNdAX1","client_ip":"138.197.138.255","client_port":9702,"node_ip":"138.197.138.255","node_port":9701,"services":["VALIDATOR"]},"dest":"Gw6pDLhcBcoQesN72qfotTgFa7cbuqZpkX3Xo6pLhPhv"},"metadata":{"from":"Th7MpTaRZVRYnPiabds81Y"},"type":"0"},"txnMetadata":{"seqNo":1,"txnId":"fea82e10e894419fe2bea7d96296a6d46f50f93f9eeda954ec461b2ed2950b62"},"ver":"1"}
{"reqSignature":{},"txn":{"data":{"data":{"alias":"Node2","blskey":"37rAPpXVoxzKhz7d9gkUe52XuXryuLXoM6P6LbWDB7LSbG62Lsb33sfG7zqS8TK1MXwuCHj1FKNzVpsnafmqLG1vXN88rt38mNFs9TENzm4QHdBzsvCuoBnPH7rpYYDo9DZNJePaDvRvqJKByCabubJz3XXKbEeshzpz4Ma5QYpJqjk","blskey_pop":"Qr658mWZ2YC8JXGXwMDQTzuZCWF7NK9EwxphGmcBvCh6ybUuLxbG65nsX4JvD4SPNtkJ2w9ug1yLTj6fgmuDg41TgECXjLCij3RMsV8CwewBVgVN67wsA45DFWvqvLtu4rjNnE9JbdFTc1Z4WCPA3Xan44K1HoHAq9EVeaRYs8zoF5","client_ip":"138.197.138.255","client_port":9704,"node_ip":"138.197.138.255","node_port":9703,"services":["VALIDATOR"]},"dest":"8ECVSk179mjsjKRLWiQtssMLgp6EPhWXtaYyStWPSGAb"},"metadata":{"from":"EbP4aYNeTHL6q385GuVpRV"},"type":"0"},"txnMetadata":{"seqNo":2,"txnId":"1ac8aece2a18ced660fef8694b61aac3af08ba875ce3026a160acbc3a3af35fc"},"ver":"1"}
{"reqSignature":{},"txn":{"data":{"data":{"alias":"Node3","blskey":"3WFpdbg7C5cnLYZwFZevJqhubkFALBfCBBok15GdrKMUhUjGsk3jV6QKj6MZgEubF7oqCafxNdkm7eswgA4sdKTRc82tLGzZBd6vNqU8dupzup6uYUf32KTHTPQbuUM8Yk4QFXjEf2Usu2TJcNkdgpyeUSX42u5LqdDDpNSWUK5deC5","blskey_pop":"QwDeb2CkNSx6r8QC8vGQK3GRv7Yndn84TGNijX8YXHPiagXajyfTjoR87rXUu4G4QLk2cF8NNyqWiYMus1623dELWwx57rLCFqGh7N4ZRbGDRP4fnVcaKg1BcUxQ866Ven4gw8y4N56S5HzxXNBZtLYmhGHvDtk6PFkFwCvxYrNYjh","client_ip":"138.197.138.255","client_port":9706,"node_ip":"138.197.138.255","node_port":9705,"services":["VALIDATOR"]},"dest":"DKVxG2fXXTU8yT5N7hGEbXB3dfdAnYv1JczDUHpmDxya"},"metadata":{"from":"4cU41vWW82ArfxJxHkzXPG"},"type":"0"},"txnMetadata":{"seqNo":3,"txnId":"7e9f355dffa78ed24668f0e0e369fd8c224076571c51e2ea8be5f26479edebe4"},"ver":"1"}
{"reqSignature":{},"txn":{"data":{"data":{"alias":"Node4","blskey":"2zN3bHM1m4rLz54MJHYSwvqzPchYp8jkHswveCLAEJVcX6Mm1wHQD1SkPYMzUDTZvWvhuE6VNAkK3KxVeEmsanSmvjVkReDeBEMxeDaayjcZjFGPydyey1qxBHmTvAnBKoPydvuTAqx5f7YNNRAdeLmUi99gERUU7TD8KfAa6MpQ9bw","blskey_pop":"RPLagxaR5xdimFzwmzYnz4ZhWtYQEj8iR5ZU53T2gitPCyCHQneUn2Huc4oeLd2B2HzkGnjAff4hWTJT6C7qHYB1Mv2wU5iHHGFWkhnTX9WsEAbunJCV2qcaXScKj4tTfvdDKfLiVuU2av6hbsMztirRze7LvYBkRHV3tGwyCptsrP","client_ip":"138.197.138.255","client_port":9708,"node_ip":"138.197.138.255","node_port":9707,"services":["VALIDATOR"]},"dest":"4PS3EDQ3dW1tci1Bp6543CfuuebjFrg36kLAUcskGfaA"},"metadata":{"from":"TWwCRQRZ2ZHMJFn9TzLp7W"},"type":"0"},"txnMetadata":{"seqNo":4,"txnId":"aa5e817d7cc626170eca175822029339a444eb0ee8f0bd20d3b0b76e566fb008"},"ver":"1"}`;

export const initializeBobAgent = async () => {
    // Simple agent configuration. This sets some basic fields like the wallet
    // configuration and the label. It also sets the mediator invitation url,
    // because this is most likely required in a mobile environment.
    const config: InitConfig = {
        label: 'demo-agent-bob',
        logger: new ConsoleLogger(LogLevel.debug),
        walletConfig: {
            id: 'mainBob',
            key: 'demoagentbob00000000000000000000',
        },
    };

    const agent = new Agent({
        config,
        modules: getAgentModules({}),
        dependencies: agentDependencies,
    });

    // Register a simple `WebSocket` outbound transport
    agent.registerOutboundTransport(new WsOutboundTransport());

    // Register a simple `Http` outbound transport
    agent.registerOutboundTransport(new HttpOutboundTransport());

    // Initialize the agent
    await agent.initialize();

    const holderIndyDid = {
        seed: '12345678901234567890123456789111',
        did: 'TGScrcgjEykofSnVdJqPWp',
    };
    //  did:indy:bcovrin:test:TGScrcgjEykofSnVdJqPWp/anoncreds/v0/CLAIM_DEF/91322/v3
    const did = await createIndyDid(agent, holderIndyDid.seed, holderIndyDid.did);

    await createIndyCredDefinition(agent, did);

    return agent;
};

function getAgentModules({ }) {
    const indyCredentialFormat = new LegacyIndyCredentialFormatService();
    const indyProofFormat = new LegacyIndyProofFormatService();
    return {
        askar: new AskarModule({ ariesAskar }),
        anoncredsRs: new AnonCredsRsModule({
            anoncreds,
        }),
        anoncreds: new AnonCredsModule({
            registries: [new IndyVdrAnonCredsRegistry()],
        }),
        indyVdr: new IndyVdrModule({
            indyVdr,
            networks: [
                {
                    isProduction: false,
                    indyNamespace: 'bcovrin:test',
                    genesisTransactions: BCOVRIN_TEST_GENESIS,
                    connectOnStartup: true,
                },
            ],
        }),
        connections: new ConnectionsModule({
            autoAcceptConnections: true,
        }),
        credentials: new CredentialsModule({
            autoAcceptCredentials: AutoAcceptCredential.ContentApproved,
            credentialProtocols: [
                new V1CredentialProtocol({ indyCredentialFormat }),
                new V2CredentialProtocol({
                    credentialFormats: [
                        indyCredentialFormat,
                        new AnonCredsCredentialFormatService(),
                    ],
                }),
            ],
        }),
        proofs: new ProofsModule({
            autoAcceptProofs: AutoAcceptProof.ContentApproved,
            proofProtocols: [
                new V1ProofProtocol({ indyProofFormat }),
                new V2ProofProtocol({
                    proofFormats: [indyProofFormat, new AnonCredsProofFormatService()],
                }),
            ],
        }),
        dids: new DidsModule({
            registrars: [new IndyVdrIndyDidRegistrar()],
            resolvers: [new IndyVdrIndyDidResolver()],
        }),
        pushNotificationsFcm: new PushNotificationsFcmModule(),
        pushNotificationsApns: new PushNotificationsApnsModule(),
        mediationRecipient: new MediationRecipientModule({
            mediatorInvitationUrl:
                'https://public.mediator.indiciotech.io?c_i=eyJAdHlwZSI6ICJkaWQ6c292OkJ6Q2JzTlloTXJqSGlxWkRUVUFTSGc7c3BlYy9jb25uZWN0aW9ucy8xLjAvaW52aXRhdGlvbiIsICJAaWQiOiAiMDVlYzM5NDItYTEyOS00YWE3LWEzZDQtYTJmNDgwYzNjZThhIiwgInNlcnZpY2VFbmRwb2ludCI6ICJodHRwczovL3B1YmxpYy5tZWRpYXRvci5pbmRpY2lvdGVjaC5pbyIsICJyZWNpcGllbnRLZXlzIjogWyJDc2dIQVpxSktuWlRmc3h0MmRIR3JjN3U2M3ljeFlEZ25RdEZMeFhpeDIzYiJdLCAibGFiZWwiOiAiSW5kaWNpbyBQdWJsaWMgTWVkaWF0b3IifQ==',
            mediatorPickupStrategy: MediatorPickupStrategy.Implicit,
        }),
    };
}

export const receiveInvitation = async (
    agent: Agent,
    invitationUrl: string,
) => {
    const { outOfBandRecord } = await agent.oob.receiveInvitationFromUrl(
        invitationUrl,
        { autoAcceptInvitation: true, autoAcceptConnection: true },
    );

    return outOfBandRecord;
};

export const createIndyDid = async (
    agent: Agent,
    seedPhrase: string,
    unqualifiedIndyDid: string,
) => {
    // this is created by registering a 32 characters seed in http://test.bcovrin.vonx.io/
    const seed = TypedArrayEncoder.fromString(seedPhrase);
    const indyDid = `did:indy:bcovrin:test:${unqualifiedIndyDid}`;

    console.log('seed:', seed);
    await agent.dids.import({
        did: indyDid,
        overwrite: true,
        privateKeys: [
            {
                privateKey: seed,
                keyType: KeyType.Ed25519,
            },
        ],
    });

    const dids = await agent.dids.getCreatedDids({});
    console.log('dids length ', dids.length);
    return indyDid;
};

export const createIndyCredDefinition = async (
    agent: Agent,
    issuerDid: string,
) => {
    // register schema
    const schemaResult = await agent.modules.anoncreds.registerSchema({
        schema: {
            attrNames: ['name', 'age'],
            issuerId: issuerDid,
            name: 'Example Schema to register',
            version: '2.0.6',
        },
        options: {},
    });

    if (schemaResult.schemaState.state === 'failed') {
        throw new Error(
            `Error creating schema: ${schemaResult.schemaState.reason}`,
        );
    }

    // create credential definition
    const credentialDefinitionResult =
        await agent.modules.anoncreds.registerCredentialDefinition({
            credentialDefinition: {
                tag: 'v2',
                issuerId: issuerDid,
                schemaId: schemaResult.schemaState.schemaId,
            },
            options: {},
        });

    console.log(
        'credentialDefinitionResult.credentialDefinitionState.credentialDefinitionId, ',
        credentialDefinitionResult.credentialDefinitionState.credentialDefinitionId,
    );
    if (credentialDefinitionResult.credentialDefinitionState.state === 'failed') {
        throw new Error(
            `Error creating credential definition: ${credentialDefinitionResult.credentialDefinitionState.reason}`,
        );
    }
};
valavanisleonidas commented 1 year ago

btw if I use "@hyperledger/aries-askar-react-native": "0.2.0-dev.1", instead of 0.1.1 I get this error during build

I run using Mac M2 node v16.16 and tried v18.0 as well


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':hyperledger_aries-askar-react-native:buildCMakeDebug[arm64-v8a]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `/Users/testApp/mobileAppTest/node_modules/@hyperledger/aries-askar-react-native/android/.cxx/Debug/5d4t2544/arm64-v8a'
  [1/5] Building CXX object 'CMakeFiles/ariesaskarreactnative.dir/Users/testApp/mobileAppTest/node_modules/@hyperledger/aries-askar-react-native/cpp/ariesAskar.cpp.o'
  FAILED: CMakeFiles/ariesaskarreactnative.dir/Users/testApp/mobileAppTest/node_modules/@hyperledger/aries-askar-react-native/cpp/ariesAskar.cpp.o 
  /Users/user/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --sysroot=/Users/user/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -Dariesaskarreactnative_EXPORTS -I/Users/testApp/mobileAppTest/node_modules/@hyperledger/aries-askar-react-native/android/../cpp -I/Users/testApp/mobileAppTest/node_modules/@hyperledger/aries-askar-react-native/android/../cpp/include -I/Users/testApp/mobileAppTest/node_modules/@hyperledger/aries-askar-react-native/android/../native/mobile/android/arm64-v8a -I/Users/testApp/mobileAppTest/node_modules/react-native/ReactAndroid/src/main/jni/react/turbomodule -I/Users/testApp/mobileAppTest/node_modules/react-native/ReactCommon -I/Users/testApp/mobileAppTest/node_modules/react-native/ReactCommon/callinvoker -I/Users/testApp/mobileAppTest/node_modules/react-native/ReactCommon/jsi -I/Users/testApp/mobileAppTest/node_modules/react-native/ReactCommon/react/renderer/graphics/platform/cxx -I/Users/testApp/mobileAppTest/node_modules/react-native/ReactCommon/runtimeexecutor -I/Users/testApp/mobileAppTest/node_modules/react-native/ReactCommon/yoga -isystem /Users/user/.gradle/caches/transforms-3/8fe27c04def1192978b13f3646b3fab6/transformed/jetified-react-android-0.72.4-debug/prefab/modules/jsi/include -isystem /Users/user/.gradle/caches/transforms-3/8fe27c04def1192978b13f3646b3fab6/transformed/jetified-react-android-0.72.4-debug/prefab/modules/reactnativejni/include -isystem /Users/user/.gradle/caches/transforms-3/521cd468cbebe6dc0785507890aaf83f/transformed/jetified-fbjni-0.3.0/prefab/modules/fbjni/include -fexceptions -frtti -std=c++1y -DONANDROID -g  -fno-limit-debug-info -fPIC -MD -MT 'CMakeFiles/ariesaskarreactnative.dir/Users/testApp/mobileAppTest/node_modules/@hyperledger/aries-askar-react-native/cpp/ariesAskar.cpp.o' -MF CMakeFiles/ariesaskarreactnative.dir/Users/testApp/mobileAppTest/node_modules/@hyperledger/aries-askar-react-native/cpp/ariesAskar.cpp.o.d -o 'CMakeFiles/ariesaskarreactnative.dir/Users/testApp/mobileAppTest/node_modules/@hyperledger/aries-askar-react-native/cpp/ariesAskar.cpp.o' -c '/Users/testApp/mobileAppTest/node_modules/@hyperledger/aries-askar-react-native/cpp/ariesAskar.cpp'
  /Users/testApp/mobileAppTest/node_modules/@hyperledger/aries-askar-react-native/cpp/ariesAskar.cpp:278:20: error: no matching function for call to 'askar_store_set_default_profile'
    ErrorCode code = askar_store_set_default_profile(
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Users/testApp/mobileAppTest/node_modules/@hyperledger/aries-askar-react-native/android/../cpp/include/libaries_askar.h:594:11: note: candidate function not viable: no overload of 'callbackWithResponse' matching 'void (*)(CallbackId, ErrorCode)' (aka 'void (*)(long, ErrorCode)') for 3rd argument
  ErrorCode askar_store_set_default_profile(StoreHandle handle,
            ^
  /Users/testApp/mobileAppTest/node_modules/@hyperledger/aries-askar-react-native/cpp/ariesAskar.cpp:1048:20: error: no matching function for call to 'askar_string_list_count'
    ErrorCode code = askar_string_list_count(stringListHandle, &out);
                     ^~~~~~~~~~~~~~~~~~~~~~~
  /Users/testApp/mobileAppTest/node_modules/@hyperledger/aries-askar-react-native/android/../cpp/include/libaries_askar.h:599:11: note: candidate function not viable: no known conversion from 'ArcHandle_FfiEntryList' to 'StringListHandle' (aka 'ArcHandle_FfiStringList') for 1st argument
  ErrorCode askar_string_list_count(StringListHandle handle, int32_t *count);
            ^
  /Users/testApp/mobileAppTest/node_modules/@hyperledger/aries-askar-react-native/cpp/ariesAskar.cpp:1057:3: error: no matching function for call to 'askar_string_list_free'
    askar_string_list_free(stringListHandle);
    ^~~~~~~~~~~~~~~~~~~~~~
  /Users/testApp/mobileAppTest/node_modules/@hyperledger/aries-askar-react-native/android/../cpp/include/libaries_askar.h:601:6: note: candidate function not viable: no known conversion from 'ArcHandle_FfiEntryList' to 'StringListHandle' (aka 'ArcHandle_FfiStringList') for 1st argument
  void askar_string_list_free(StringListHandle handle);
       ^
  3 errors generated.
  [2/5] Building CXX object 'CMakeFiles/ariesaskarreactnative.dir/Users/testApp/mobileAppTest/node_modules/@hyperledger/aries-askar-react-native/cpp/HostObject.cpp.o'
  [3/5] Building CXX object CMakeFiles/ariesaskarreactnative.dir/cpp-adapter.cpp.o
  [4/5] Building CXX object 'CMakeFiles/ariesaskarreactnative.dir/Users/testApp/mobileAppTest/node_modules/@hyperledger/aries-askar-react-native/cpp/turboModuleUtility.cpp.o'
  ninja: build stopped: subcommand failed.

  C++ build system [build] failed while executing:
      /Users/user/Library/Android/sdk/cmake/3.22.1/bin/ninja \
        -C \
        /Users/testApp/mobileAppTest/node_modules/@hyperledger/aries-askar-react-native/android/.cxx/Debug/5d4t2544/arm64-v8a \
        ariesaskarreactnative
    from /Users/testApp/mobileAppTest/node_modules/@hyperledger/aries-askar-react-native/android
djleonskennedy commented 1 year ago

Using 0.1.0 in RN environment M1, app is building fine, credential definition created successfully from node app, we have node agent as issuer

valavanisleonidas commented 1 year ago

@djleonskennedy thanks for your answer. I think we have a different use case though.

First of all, you use 0.1.0 for askar ? Also, I want to offer credentials from the mobile so i want to import the did and create a schema and definition in the mobile.

I can create a definition in the node app as well but the same code doesn't work in the mobile

TimoGlastra commented 1 year ago

Hmm this seems like an indy-vdr error, where it is expecting an unqualified did, but a qualified did (with did:indy:bcovrin:test) is passed.

@valavanisleonidas did you try to run the same code in Node.JS to see if it succeeds?

valavanisleonidas commented 1 year ago

Hey @TimoGlastra thanks for your answer. Yes I have tried the same code in nodeJs and it works

In my code I pass a qualifiedDid but even if I pass only TGScrcgjEykofSnVdJqPWp it crashes

 const schemaResult = await agent.modules.anoncreds.registerSchema({
        schema: {
            attrNames: ['name', 'age'],
            issuerId: 'did:indy:bcovrin:test:TGScrcgjEykofSnVdJqPWp',
            name: 'Example Schema to register',
            version: '2.0.6',
        },
        options: {},
    });
TimoGlastra commented 9 months ago

@valavanisleonidas can you try to reproduce the issue with the latest 0.5.0 alpha release and 0.2.0 for all the shared components? If the issue still persists happy to take a look at it further

Closing for now, but please re-open if it persists