web3.shh.hasIdentity
调用hasIdentity()
方法检查用户是否有指定的id。
调用方法:
web3.shh.hasIdentity(identity, [callback])
参数:
identity
:String ,要检查的idcallback
:Function ,可选的回调函数,设置此参数后函数将采用异步http来请求节点API。
返回值:
Boolean
- 如果指定的id存在则返回true,否则返回false
示例代码:
var identity = web3.shh.newIdentity();
var result = web3.shh.hasIdentity(identity);
console.log(result); // true
var result2 = web3.shh.hasIdentity(identity + "0");
console.log(result2); // false