Skip to content

Commit

Permalink
Remove Whisper API (ethereum#1791)
Browse files Browse the repository at this point in the history
* remove whisper API

* add newsfragment
  • Loading branch information
wolovim authored Nov 12, 2020
1 parent 7947544 commit d28f89a
Show file tree
Hide file tree
Showing 30 changed files with 3 additions and 2,182 deletions.
1 change: 0 additions & 1 deletion ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ methods/*
web3.eth.*
web3.net.*
web3.personal.*
web3.shh.*

Methods and properties are first defined as a dictionary
and then are converted to real functions and attached to the
Expand Down
361 changes: 0 additions & 361 deletions docs/web3.geth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -529,364 +529,3 @@ The following methods are available on the ``web3.geth.txpool`` namespace.
}
}
}
GethShh
~~~~~~~

The ``web3.geth.shh`` object exposes methods to interact with the RPC APIs under the
``shh_`` namespace.

Full documentation for Geth-supported endpoints can be found `here <https://github.com/ethereum/go-ethereum/wiki/Whisper-v6-RPC-API>`_.

.. warning:: The Whisper protocol is in flux, with incompatible versions supported
by different major clients.

.. py:method:: Shh.version()
Returns the Whisper version this node offers.

.. code-block:: python
>>> web3.geth.shh.version()
6.0
.. py:method:: Shh.info()
Returns the Whisper statistics for diagnostics.

.. code-block:: python
>>> web3.geth.shh.info()
{'maxMessageSize': 1024, 'memory': 240, 'messages': 0, 'minPow': 0.2}
.. py:method:: Shh.post(self, message)
* Creates a whisper message and injects it into the network for distribution.

* Parameters:
* ``symKeyID``: When using symmetric key encryption, holds the symmetric key ID.
* ``pubKey``: When using asymmetric key encryption, holds the public key.
* ``ttl``: Time-to-live in seconds.
* ``sig (optional)``: ID of the signing key.
* ``topic``: Message topic (four bytes of arbitrary data).
* ``payload``: Payload to be encrypted.
* ``padding (optional)``: Padding (byte array of arbitrary length).
* ``powTime``: Maximal time in seconds to be spent on prrof of work.
* ``powTarget``: Minimal PoW target required for this message.
* ``targetPeer (optional)``: Peer ID (for peer-to-peer message only).

* Returns ``True`` if the message was succesfully sent, otherwise ``False``

.. code-block:: python
>>> web3.geth.shh.post({'payload': web3.toHex(text="test_payload"), 'pubKey': recipient_public, 'topic': '0x12340000', 'powTarget': 2.5, 'powTime': 2})
True
.. py:method:: Shh.newMessageFilter()
.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.shh.new_message_filter()`

.. py:method:: Shh.new_message_filter(self, criteria)
* Create a new filter id. This filter id can be used with ``ShhFilter`` to poll for new messages that match the set of criteria.

* Parameters:
* ``symKeyID``: When using symmetric key encryption, holds the symmetric key ID.
* ``privateKeyID``: When using asymmetric key encryption, holds the private key ID.
* ``sig``: Public key of the signature.
* ``minPoW``: Minimal PoW requirement for incoming messages.
* ``topic``: Array of possible topics (or partial topics).
* ``allowP2P``: Indicates if this filter allows processing of direct peer-to-peer messages.


.. code-block:: python
>>> web3.geth.shh.new_message_filter({'topic': '0x12340000', 'privateKeyID': recipient_private})
'b37c3106cfb683e8f01b5019342399e0d1d74e9160f69b27625faba7a6738554'
.. py:method:: Shh.deleteMessageFilter()
.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.shh.delete_message_filter()`


.. py:method:: Shh.delete_message_filter(self, filter_id)
* Deletes a message filter in the node.

* Returns ``True`` if the filter was sucesfully uninstalled, otherwise ``False``

.. code-block:: python
>>> web3.geth.shh.delete_message_filter('b37c3106cfb683e8f01b5019342399e0d1d74e9160f69b27625faba7a6738554')
True
.. py:method:: Shh.getMessages()
.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.shh.get_filter_messages()`

.. py:method:: Shh.get_filter_messages(self, filter_id)
* Retrieve messages that match the filter criteria and are received between the last time this function was called and now.

* Returns all new messages since the last invocation

.. code-block:: python
>>> web3.geth.shh.get_filter_messages('b37c3106cfb683e8f01b5019342399e0d1d74e9160f69b27625faba7a6738554')
[{
'ttl': 50,
'timestamp': 1524497850,
'topic': HexBytes('0x13370000'),
'payload': HexBytes('0x74657374206d657373616765203a29'),
'padding': HexBytes('0x50ab643f1b23bc6df1b1532bb6704ad947c2453366754aade3e3597553eeb96119f4f4299834d9989dc4ecc67e6b6470317bb3f7396ace0417fc0d6d2023900d3'),
'pow': 6.73892030848329,
'hash': HexBytes('0x7418f8f0989655ed2f4f9b496e6b1d9be51ef9f0f5ad89f6f750b0eee268b02f'),
'recipientPublicKey': HexBytes('0x047d36c9e45fa82fcd27d35bc7d2fd41a2e41e512feec9e4b90ee4293ab12dc2cfc98250a6f5689b07650f8a5ca3a6e0fa8808cd0ce1a1962f2551354487a8fc79')
}]
.. py:method:: Shh.setMaxMessageSize()
.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.shh.set_max_message_size()`

.. py:method:: Shh.set_max_message_size(self, size)
* Sets the maximal message size allowed by this node. Incoming and outgoing messages with a larger size will be rejected. Whisper message size can never exceed the limit imposed by the underlying P2P protocol (10 Mb).

* Returns ``True`` if the filter was sucesfully uninstalled, otherwise ``False``

.. code-block:: python
>>> web3.geth.shh.set_max_message_size(1024)
True
.. py:method:: Shh.setMinPoW()
.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.shh.set_min_pow()`

.. py:method:: Shh.set_min_pow(self, min_pow)
* Sets the minimal PoW required by this node.

* Returns ``True`` if the filter was sucesfully uninstalled, otherwise ``False``

.. code-block:: python
>>> web3.geth.shh.set_min_pow(0.4)
True
.. py:method:: Shh.markTrustedPeer()
.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.shh.mark_trusted_peer()`

.. py:method:: Shh.mark_trusted_peer(self, enode)
* Marks specific peer trusted, which will allow it to send historic (expired) messages.

* Returns ``True`` if the filter was sucesfully uninstalled, otherwise ``False``

.. code-block:: python
>>> web3.geth.shh.mark_trusted_peer('enode://d25474361659861e9e651bc728a17e807a3359ca0d344afd544ed0f11a31faecaf4d74b55db53c6670fd624f08d5c79adfc8da5dd4a11b9213db49a3b750845e@52.178.209.125:30379')
True
---------------
Asymmetric Keys
---------------

.. py:method:: Shh.newKeyPair()
.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.shh.new_key_pair()`

.. py:method:: Shh.new_key_pair(self)
* Generates a new cryptographic identity for the client, and injects it into the known identities for message decryption

* Returns the new key pair's identity

.. code-block:: python
>>> web3.geth.shh.new_key_pair()
'86e658cbc6da63120b79b5eec0c67d5dcfb6865a8f983eff08932477282b77bb'
.. py:method:: Shh.addPrivateKey()
.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.shh.add_private_key()`

.. py:method:: Shh.add_private_key(self, key)
* Stores a key pair derived from a private key, and returns its ID.

* Returns the added key pair's ID

.. code-block:: python
>>> web3.geth.shh.add_private_key('0x7b8190d96cd061a102e551ee36d08d4f3ca1f56fb0008ef5d70c56271d8c46d0')
'86e658cbc6da63120b79b5eec0c67d5dcfb6865a8f983eff08932477282b77bb'
.. py:method:: Shh.deleteKeyPair()
.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.shh.delete_key_pair()`

.. py:method:: Shh.delete_key_pair(self, id)
* Deletes the specified key if it exists.

* Returns ``True`` if the key pair was deleted, otherwise ``False``

.. code-block:: python
>>> web3.geth.shh.delete_key_pair('86e658cbc6da63120b79b5eec0c67d5dcfb6865a8f983eff08932477282b77bb')
True
.. py:method:: Shh.hasKeyPair()
.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.shh.has_key_pair()`

.. py:method:: Shh.has_key_pair(self, id)
* Checks if the whisper node has a private key of a key pair matching the given ID.

* Returns ``True`` if the key pair exists, otherwise ``False``

.. code-block:: python
>>> web3.geth.shh.has_key_pair('86e658cbc6da63120b79b5eec0c67d5dcfb6865a8f983eff08932477282b77bb')
False
.. py:method:: Shh.getPublicKey()
.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.shh.get_public_key()`

.. py:method:: Shh.get_public_key(self, id)
* Returns the public key associated with the key pair.

.. code-block:: python
>>> web3.geth.shh.get_public_key('86e658cbc6da63120b79b5eec0c67d5dcfb6865a8f983eff08932477282b77bb')
'0x041b0777ceb8cf8748fe0bba5e55039d650a03eb0239a909f9ee345bbbad249f2aa236a4b8f41f51bd0a97d87c08e69e67c51f154d634ba51a224195212fc31e4e'
.. py:method:: Shh.getPrivateKey()
.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.shh.get_private_key()`

.. py:method:: Shh.get_private_key(self, id)
* Returns the private key associated with the key pair.

.. code-block:: python
>>> web3.geth.shh.get_private_key('86e658cbc6da63120b79b5eec0c67d5dcfb6865a8f983eff08932477282b77bb')
'0x7b8190d96cd061a102e551ee36d08d4f3ca1f56fb0008ef5d70c56271d8c46d0'
---------------
Symmetric Keys
---------------

.. py:method:: Shh.newSymKey()
.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.shh.new_sym_key()`

.. py:method:: Shh.new_sym_key(self)
* Generates a random symmetric key and stores it under id, which is then returned. Will be used in the future for session key exchange

* Returns the new key pair's identity

.. code-block:: python
>>> web3.geth.shh.new_sym_key()
'6c388d63003deb378700c9dad87f67df0247e660647d6ba1d04321bbc2f6ce0c'
.. py:method:: Shh.addSymKey()
.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.shh.add_sym_key()`

.. py:method:: Shh.add_sym_key(self, key)
* Stores the key, and returns its ID.

* Returns the new key pair's identity

.. code-block:: python
>>> web3.geth.shh.add_sym_key('0x58f6556e56a0d41b464a083161377c8a9c2e95156921f954f99ef97d41cebaa2')
'6c388d63003deb378700c9dad87f67df0247e660647d6ba1d04321bbc2f6ce0c'
.. py:method:: Shh.generateSymKeyFromPassword()
.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.shh.generate_sym_key_from_password()`

.. py:method:: Shh.generate_sym_key_from_password(self)
* Generates the key from password, stores it, and returns its ID.

* Returns the new key pair's identity

.. code-block:: python
>>> web3.geth.shh.generate_sym_key_from_password('shh secret pwd')
'6c388d63003deb378700c9dad87f67df0247e660647d6ba1d04321bbc2f6ce0c'
.. py:method:: Shh.hasSymKey()
.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.shh.has_sym_key()`

.. py:method:: Shh.has_sym_key(self, id)
* Checks if there is a symmetric key stored with the given ID.

* Returns ``True`` if the key exists, otherwise ``False``

.. code-block:: python
>>> web3.geth.shh.has_sym_key('6c388d63003deb378700c9dad87f67df0247e660647d6ba1d04321bbc2f6ce0c')
False
.. py:method:: Shh.getSymKey()
.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.shh.get_sym_key()`

.. py:method:: Shh.get_sym_key(self, id)
* Returns the symmetric key associated with the given ID.

* Returns the public key associated with the key pair

.. code-block:: python
>>> web3.geth.shh.get_sym_key('6c388d63003deb378700c9dad87f67df0247e660647d6ba1d04321bbc2f6ce0c')
'0x58f6556e56a0d41b464a083161377c8a9c2e95156921f954f99ef97d41cebaa2'
.. py:method:: Shh.deleteSymKey()
.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.shh.delete_sym_key()`

.. py:method:: Shh.delete_sym_key(self, id)
* Deletes the symmetric key associated with the given ID.

* Returns ``True`` if the key pair was deleted, otherwise ``False``

.. code-block:: python
>>> web3.geth.shh.delete_sym_key('6c388d63003deb378700c9dad87f67df0247e660647d6ba1d04321bbc2f6ce0c')
True
Loading

0 comments on commit d28f89a

Please sign in to comment.