Я пытаюсь запустить следующий код для инициализации Javascript-агента Credo/Aries Framework в среде React Native в версии Expo ^50:
import {
Agent,
ConnectionEventTypes,
ConnectionsModule,
ConsoleLogger,
DidExchangeState,
LogLevel,
MediationRecipientModule,
MediatorPickupStrategy,
KeyDerivationMethod,
HttpOutboundTransport,
WsOutboundTransport,
InitConfig,
} from "@credo-ts/core"
import { agentDependencies } from "@credo-ts/react-native"
import { AskarModule } from "@credo-ts/askar"
import { ariesAskar } from "@hyperledger/aries-askar-react-native"
// and other irrelevant dependencies as well
const config: InitConfig = {
label: "standalone-agent-10",
walletConfig: {
id: "standalone-agent-10",
key: "00000000001000000000000000000010",
keyDerivationMethod: KeyDerivationMethod.Argon2IMod,
},
logger: new ConsoleLogger(LogLevel.trace),
// autoUpdateStorageOnStartup: true,
}
const mediatorInvitationUrl = "https://url...."
const agent = new Agent({
config,
modules: {
askar: new AskarModule({ ariesAskar }),
connections: new ConnectionsModule({ autoAcceptConnections: true }),
mediationRecipient: new MediationRecipientModule({
mediatorInvitationUrl,
mediatorPickupStrategy: MediatorPickupStrategy.Implicit,
}),
},
dependencies: agentDependencies,
})
agent.registerOutboundTransport(new WsOutboundTransport())
agent.registerOutboundTransport(new HttpOutboundTransport())
export const WelcomeScreenCredo = () => {
useEffect(() => {
agent
.initialize()
.then((_) => console.log("Agent initialized!"))
.catch((err) => console.log("Agent not initialized:", err))
}, [])
return
Hi
}
Если я удалю этот фрагмент ниже, код будет работать отлично и выйдет из системы. Агент инициализирован! как и ожидалось:
mediationRecipient: new MediationRecipientModule({
mediatorInvitationUrl,
mediatorPickupStrategy: MediatorPickupStrategy.Implicit,
}),
Но когда я сохраняю этот фрагмент, я получаю следующую ошибку при запуске пряжи Android:
INFO INFO: Creating agent with config {
"agentConfig": {
"label": "standalone-agent-10",
"walletConfig": {
"id": "standalone-agent-10",
"key": "[*****]",
"keyDerivationMethod": "ARGON2I_MOD",
"storage": {}
},
"logger": 1,
"agentDependencies": true
}
}
INFO INFO: Initializing wallet 'standalone-agent-10' {
"id": "standalone-agent-10",
"key": "[*****]",
"keyDerivationMethod": "ARGON2I_MOD",
"storage": {}
}
DEBUG DEBUG: Wallet 'standalone-agent-10' opened with handle '1'
INFO INFO: Agent storage is up to date.
DEBUG DEBUG: Starting HTTP outbound transport
DEBUG DEBUG: Starting WS outbound transport
DEBUG DEBUG: Provision mediation with invitation {
"mediatorInvitationUrl": "https://url...."
}
DEBUG DEBUG: Mediation connection does not exist, creating connection
DEBUG DEBUG: Routing created {
"endpoints": [
"didcomm:transport/queue"
],
"routingKeys": [],
"recipientKey": {
"keyType": "ed25519",
"publicKeyBase58": "----xyz----"
}
}
ERROR Something went wrong while setting up the agent! Message: TypeError: 0, _$$_REQUIRE(_dependencyMap[1], "did-resolver").parse is not a function (it is undefined)
Подробнее здесь: https://stackoverflow.com/questions/785 ... d-resolver