MCPcopy
hub / github.com/HelloZeroNet/ZeroNet / testPublickey

Method testPublickey

plugins/CryptMessage/Test/TestCrypt.py:29–47  ·  view source on GitHub ↗
(self, ui_websocket)

Source from the content-addressed store, hash-verified

27 assert ecc.decrypt(encrypted) == b"hello"
28
29 def testPublickey(self, ui_websocket):
30 pub = ui_websocket.testAction("UserPublickey", 0)
31 assert len(pub) == 44 # Compressed, b64 encoded publickey
32
33 # Different pubkey for specificed index
34 assert ui_websocket.testAction("UserPublickey", 1) != ui_websocket.testAction("UserPublickey", 0)
35
36 # Same publickey for same index
37 assert ui_websocket.testAction("UserPublickey", 2) == ui_websocket.testAction("UserPublickey", 2)
38
39 # Different publickey for different cert
40 site_data = ui_websocket.user.getSiteData(ui_websocket.site.address)
41 site_data["cert"] = None
42 pub1 = ui_websocket.testAction("UserPublickey", 0)
43
44 site_data = ui_websocket.user.getSiteData(ui_websocket.site.address)
45 site_data["cert"] = "zeroid.bit"
46 pub2 = ui_websocket.testAction("UserPublickey", 0)
47 assert pub1 != pub2
48
49 def testEcies(self, ui_websocket):
50 pub = ui_websocket.testAction("UserPublickey")

Callers

nothing calls this directly

Calls 1

getSiteDataMethod · 0.80

Tested by

no test coverage detected