Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Whisper js #6161

Merged
merged 10 commits into from
Jul 31, 2017
62 changes: 41 additions & 21 deletions js/src/api/rpc/shh/shh.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,58 +14,78 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

export default class Personal {
export default class Shh {
constructor (transport) {
this._transport = transport;
}

addToGroup (identity) {
info () {
return this._transport
.execute('shh_addToGroup', identity);
.execute('shh_info');
}

getFilterChanges (filterId) {
newKeyPair () {
return this._transport
.execute('shh_getFilterChanges', filterId);
.execute('shh_newKeyPair');
}

getMessages (filterId) {
addPrivateKey (privKey) {
return this._transport
.execute('shh_getMessages', filterId);
.execute('shh_addPrivateKey', privKey);
}

hasIdentity (identity) {
newSymKey () {
return this._transport
.execute('shh_hasIdentity', identity);
.execute('shh_newSymKey');
}

newFilter (options) {
getPublicKey (identity) {
return this._transport
.execute('shh_newFilter', options);
.execute('shh_getPublicKey', identity);
}

newGroup () {
getPrivateKey (identity) {
return this._transport
.execute('shh_newGroup');
.execute('shh_getPrivateKey', identity);
}

newIdentity () {
getSymKey (identity) {
return this._transport
.execute('shh_newIdentity');
.execute('shh_getSymKey', identity);
}

post (options) {
deleteKey (identity) {
return this._transport
.execute('shh_post', options);
.execute('shh_deleteKey', identity);
}

uninstallFilter (filterId) {
post (messageObj) {
return this._transport
.execute('shh_uninstallFilter', filterId);
.execute('shh_post', messageObj);
}

version () {
newMessageFilter (filterObj) {
return this._transport
.execute('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);
}
}
2 changes: 1 addition & 1 deletion js/src/api/transport/ws/ws.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default class Ws extends JsonRpcBase {
this._url = url;
this._token = token;
this._messages = {};
this._subscriptions = { 'eth_subscription': [], 'parity_subscription': [] };
this._subscriptions = { 'eth_subscription': [], 'parity_subscription': [], 'shh_subscription': [] };
this._sessionHash = null;

this._connecting = false;
Expand Down