我正在尝试执行createPairwise功能的indy包.
它抛出一个独立错误WalletItemNotFound. 212 => =>(我还执行了createAndStoreMyDid函数)
这是我的密码
let [myDid, myVerkey] = await sdk.createAndStoreMyDid(await indy.wallet.get(), {});
let theirVerkey = await sdk.keyForDid(await indy.pool.get(), await indy.wallet.get(), theirDid);
let meta = JSON.stringify({
theirEndpointDid: theirEndpointDid,
verified: false // Indicates that the owner of the agent has confirmed they want to stay connected with this person.
});
//FIXME: Check to see if pairwise exists
await sdk.createPairwise(await indy.wallet.get(), theirDid, myDid, meta);有人能帮我吗?
发布于 2019-09-29 10:57:11
在您的代码中,实际上有两个地方IndySDK 1.11.1可以抛出212 WalletItemNotFound。
1.第一条是这条线:
let theirVerkey = await sdk.keyForDid(await indy.pool.get(), await indy.wallet.get(), theirDid);IndySDK将首先尝试查看变量theirDid下的DID是否是存储在钱包中的DID之一。如果没有,它会试图在账簿上找到这件事。如果仍然找不到,就会抛出WalletItemNotFound。您可以在这里查看IndySDK锈蚀代码中的这种行为:
https://github.com/hyperledger/indy-sdk/blob/v1.11.1/libindy/src/commands/did.rs#L331
2.然而,我认为这并不是您的实际情况,您的错误来自
wait sdk.createPairwise(await indy.wallet.get(), theirDid, myDid, meta);如果您查看此方法是如何在Rust中实现的
https://github.com/hyperledger/indy-sdk/blob/v1.11.1/libindy/src/commands/pairwise.rs#L84
您将看到它正在为您提供的get_indy_record和theirDid调用myDid。因此,如果不首先将两个DID存储在钱包中,就不能创建成对的记录。您可以通过调用theirDid方法来确保钱包中包含storeTheirDid。在……里面
sdk.storeTheirDid(wh, {did:'V4SGRU86Z58d6TV7PBUe6f', verkey: 'GJ1SzoWzavQYfNL9XkaJdrQejfztN4XqdsiV4ct3LXKL'} )调用它之后,您将能够在您和他们之间调用createPairwise,而不会出现任何问题。
IndySDK版本/缓存说明
我认为您可能正在使用一些旧版本的IndySDK。在IndySDK 1.11.1中,当keyForDid从分类帐中解析某些内容时,它实际上缓存了这些数据,所以您发布的代码实际上是从盒子里为我编写的,没有错误。
https://stackoverflow.com/questions/58095680
复制相似问题