如何解决在 hyperledger Fabric 2.2 中不存在 CA 'undefined' 时出现错误
我正在尝试使用以下代码让所有用户进入fabric-ca,但是收到错误为CA 'undefined' does not exist
/p>
ca-dfarmadmin
连接配置文件 CA 部分
async GetAllUser(callback) {
try {
const caURL = connection.certificateAuthorities[caName].url;
var ca = new FabricCAServices(caURL);
const walletPath = path.join(process.cwd(),'wallet');
const wallet = await Wallets.newFileSystemWallet(walletPath);
const adminIdentity = await wallet.get(appAdmin);
if (!adminIdentity) {
console.log('check Admin Exists')
response.data = null;
response.httpstatus = 400;
response.message = "Am admin identity is not registered . please register admin first";
return callback(response);
}
const provider = wallet.getProviderRegistry().getProvider(adminIdentity.type);
const adminUser = await provider.getUserContext(adminIdentity,'admin');
const identityService = ca.newIdentityService();
console.log('identityService',identityService)
let res1 = await identityService.getAll(adminUser);
console.log('userIdendetu',res1);
response.data = res1
response.httpstatus = 200;
return callback(response);
} catch (error) {
response.error = error;
response.httpstatus = 500;
response.message = "Failed to enroll admin due to above error";
return callback(response);
}
};
CA 名称定义的 CA-docker 容器日志
"certificateAuthorities": {
"ca-dfarmadmin": {
"url": "https://localhost:7054","caName": "ca-dfarmadmin","tlsCACerts": {
"pem": ["-----BEGIN CERTIFICATE-----xxxxxxxx=\n-----END CERTIFICATE-----\n"]
},"httpOptions": {
"verify": false
}
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。