首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >执行createPairwise时的INDY 212

执行createPairwise时的INDY 212
EN

Stack Overflow用户
提问于 2019-09-25 09:50:30
回答 1查看 577关注 0票数 0

我正在尝试执行createPairwise功能的indy包.

它抛出一个独立错误WalletItemNotFound. 212 => =>(我还执行了createAndStoreMyDid函数)

这是我的密码

代码语言:javascript
复制
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);

有人能帮我吗?

EN

回答 1

Stack Overflow用户

发布于 2019-09-29 10:57:11

在您的代码中,实际上有两个地方IndySDK 1.11.1可以抛出212 WalletItemNotFound

1.第一条是这条线:

代码语言:javascript
复制
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.然而,我认为这并不是您的实际情况,您的错误来自

代码语言:javascript
复制
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_recordtheirDid调用myDid。因此,如果不首先将两个DID存储在钱包中,就不能创建成对的记录。您可以通过调用theirDid方法来确保钱包中包含storeTheirDid。在……里面

代码语言:javascript
复制
sdk.storeTheirDid(wh, {did:'V4SGRU86Z58d6TV7PBUe6f', verkey: 'GJ1SzoWzavQYfNL9XkaJdrQejfztN4XqdsiV4ct3LXKL'} )

调用它之后,您将能够在您和他们之间调用createPairwise,而不会出现任何问题。

IndySDK版本/缓存说明

我认为您可能正在使用一些旧版本的IndySDK。在IndySDK 1.11.1中,当keyForDid从分类帐中解析某些内容时,它实际上缓存了这些数据,所以您发布的代码实际上是从盒子里为我编写的,没有错误。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58095680

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档