whisper-js

This commit is contained in:
kaikun213 2017-07-27 13:16:56 +02:00
parent a068f72f08
commit cd0fbbe948

View File

@ -14,58 +14,78 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
export default class Personal { export default class Shh {
constructor (provider) { constructor (transport) {
this._provider = provider; this._transport = transport;
} }
addToGroup (identity) { info () {
return this._provider return this._transport
.send('shh_addToGroup', identity); .execute('shh_info');
} }
getFilterChanges (filterId) { newKeyPair () {
return this._provider return this._transport
.send('shh_getFilterChanges', filterId); .execute('shh_newKeyPair');
} }
getMessages (filterId) { addPrivateKey (privKey) {
return this._provider return this._transport
.send('shh_getMessages', filterId); .execute('shh_addPrivateKey', privKey);
} }
hasIdentity (identity) { newSymKey () {
return this._provider return this._transport
.send('shh_hasIdentity', identity); .execute('shh_newSymKey');
} }
newFilter (options) { getPublicKey (identity) {
return this._provider return this._transport
.send('shh_newFilter', options); .execute('shh_getPublicKey', identity);
} }
newGroup () { getPrivateKey (identity) {
return this._provider return this._transport
.send('shh_newGroup'); .execute('shh_getPrivateKey', identity);
} }
newIdentity () { getSymKey (identity) {
return this._provider return this._transport
.send('shh_newIdentity'); .execute('shh_getSymKey', identity);
} }
post (options) { deleteKey (identity) {
return this._provider return this._transport
.send('shh_post', options); .execute('shh_deleteKey', identity);
} }
uninstallFilter (filterId) { post (messageObj) {
return this._provider return this._transport
.send('shh_uninstallFilter', filterId); .execute('shh_post', messageObj);
} }
version () { newMessageFilter (filterObj) {
return this._provider return this._transport
.send('shh_version'); .execute('shh_newMessageFilter', filterObj);
}
getFilterMessages (filterId) {
return this._transport
.execute('shh_getFilterMessages', filterId);
}
deleteMessageFilter (filterId) {
return this._transport
.execute('shh_deleteMessageFilter', filterId);
}
subscribe (filterObj, callback) {
return this._transport
.subscribe('shh', callback, filterObj);
}
unsubscribe (subscriptionId) {
return this._transport
.unsubscribe(subscriptionId);
} }
} }