dimp 2.3.3__tar.gz → 2.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dimp-2.3.3 → dimp-2.4.0}/PKG-INFO +47 -29
- {dimp-2.3.3 → dimp-2.4.0}/README.md +46 -28
- {dimp-2.3.3 → dimp-2.4.0}/dimp/__init__.py +146 -68
- {dimp-2.3.3 → dimp-2.4.0}/dimp/crypto/__init__.py +13 -25
- {dimp-2.3.3 → dimp-2.4.0}/dimp/crypto/algorithms.py +0 -15
- {dimp-2.3.3 → dimp-2.4.0}/dimp/dkd/__init__.py +51 -46
- {dimp-2.3.3/dimp/msg → dimp-2.4.0/dimp/dkd}/base.py +8 -7
- {dimp-2.3.3/dimp/msg → dimp-2.4.0/dimp/dkd}/envelope.py +10 -11
- {dimp-2.3.3/dimp/msg → dimp-2.4.0/dimp/dkd}/instant.py +35 -25
- {dimp-2.3.3/dimp/msg → dimp-2.4.0/dimp/dkd}/reliable.py +15 -14
- {dimp-2.3.3/dimp/msg → dimp-2.4.0/dimp/dkd}/secure.py +24 -37
- {dimp-2.3.3/dimp/plugins → dimp-2.4.0/dimp/ext}/__init__.py +42 -27
- dimp-2.4.0/dimp/format/__init__.py +110 -0
- dimp-2.4.0/dimp/format/base.py +208 -0
- dimp-2.4.0/dimp/format/data.py +113 -0
- dimp-2.4.0/dimp/format/duri.py +284 -0
- dimp-2.4.0/dimp/format/embed.py +224 -0
- dimp-2.4.0/dimp/format/file.py +245 -0
- dimp-2.4.0/dimp/format/file_wrapper.py +158 -0
- dimp-2.4.0/dimp/format/pnf.py +182 -0
- dimp-2.4.0/dimp/format/pnf_wrapper.py +222 -0
- {dimp-2.3.3 → dimp-2.4.0}/dimp/mkm/__init__.py +24 -22
- {dimp-2.3.3 → dimp-2.4.0}/dimp/mkm/docs.py +47 -55
- {dimp-2.3.3 → dimp-2.4.0}/dimp/mkm/document.py +43 -52
- {dimp-2.3.3 → dimp-2.4.0}/dimp/mkm/meta.py +35 -21
- dimp-2.4.0/dimp/protocol/__init__.py +187 -0
- dimp-2.3.3/dimp/protocol/money.py → dimp-2.4.0/dimp/protocol/assets.py +12 -12
- {dimp-2.3.3 → dimp-2.4.0}/dimp/protocol/base.py +96 -89
- {dimp-2.3.3 → dimp-2.4.0}/dimp/protocol/commands.py +15 -18
- {dimp-2.3.3 → dimp-2.4.0}/dimp/protocol/contents.py +71 -49
- {dimp-2.3.3 → dimp-2.4.0}/dimp/protocol/docs.py +39 -17
- {dimp-2.3.3 → dimp-2.4.0}/dimp/protocol/files.py +141 -86
- {dimp-2.3.3 → dimp-2.4.0}/dimp/protocol/forward.py +33 -43
- dimp-2.4.0/dimp/protocol/groups.py +257 -0
- {dimp-2.3.3 → dimp-2.4.0}/dimp/protocol/quote.py +90 -34
- {dimp-2.3.3 → dimp-2.4.0}/dimp/protocol/receipt.py +17 -33
- {dimp-2.3.3 → dimp-2.4.0}/dimp/protocol/types.py +12 -61
- dimp-2.4.0/dimp/protocol/version.py +78 -0
- {dimp-2.3.3 → dimp-2.4.0}/dimp.egg-info/PKG-INFO +47 -29
- {dimp-2.3.3 → dimp-2.4.0}/dimp.egg-info/SOURCES.txt +18 -14
- dimp-2.4.0/dimp.egg-info/requires.txt +2 -0
- {dimp-2.3.3 → dimp-2.4.0}/setup.py +3 -3
- dimp-2.3.3/dimp/crypto/keys.py +0 -194
- dimp-2.3.3/dimp/crypto/pnf.py +0 -150
- dimp-2.3.3/dimp/crypto/ted.py +0 -154
- dimp-2.3.3/dimp/msg/__init__.py +0 -68
- dimp-2.3.3/dimp/protocol/__init__.py +0 -130
- dimp-2.3.3/dimp/protocol/customized.py +0 -113
- dimp-2.3.3/dimp/protocol/groups.py +0 -498
- dimp-2.3.3/dimp/protocol/helpers.py +0 -41
- dimp-2.3.3/dimp.egg-info/requires.txt +0 -2
- {dimp-2.3.3 → dimp-2.4.0}/LICENSE +0 -0
- {dimp-2.3.3 → dimp-2.4.0}/dimp.egg-info/dependency_links.txt +0 -0
- {dimp-2.3.3 → dimp-2.4.0}/dimp.egg-info/top_level.txt +0 -0
- {dimp-2.3.3 → dimp-2.4.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dimp
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: Decentralized Instant Messaging Protocol
|
|
5
5
|
Home-page: https://github.com/dimchat/core-py
|
|
6
6
|
Author: Albert Moky
|
|
@@ -18,7 +18,7 @@ License-File: LICENSE
|
|
|
18
18
|
[](https://github.com/dimchat/core-py/pulls)
|
|
19
19
|
[](https://github.com/dimchat/core-py/wiki)
|
|
20
20
|
[](https://github.com/dimchat/core-py/issues)
|
|
21
|
-
[](https://github.com/dimchat/core-py/archive/refs/heads/
|
|
21
|
+
[](https://github.com/dimchat/core-py/archive/refs/heads/master.zip)
|
|
22
22
|
[](https://github.com/dimchat/core-py/tags)
|
|
23
23
|
[](https://pypi.org/project/dimp)
|
|
24
24
|
|
|
@@ -36,7 +36,7 @@ License-File: LICENSE
|
|
|
36
36
|
|
|
37
37
|
## Examples
|
|
38
38
|
|
|
39
|
-
###
|
|
39
|
+
### Extends Command
|
|
40
40
|
|
|
41
41
|
* _Handshake Command Protocol_
|
|
42
42
|
0. (C-S) handshake start
|
|
@@ -49,7 +49,7 @@ from abc import ABC, abstractmethod
|
|
|
49
49
|
from enum import IntEnum
|
|
50
50
|
from typing import Optional, Dict
|
|
51
51
|
|
|
52
|
-
from dimp import
|
|
52
|
+
from dimp import *
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
class HandshakeState(IntEnum):
|
|
@@ -78,12 +78,12 @@ class HandshakeCommand(Command, ABC):
|
|
|
78
78
|
~~~~~~~~~~~~~~~~~
|
|
79
79
|
|
|
80
80
|
data format: {
|
|
81
|
-
type : 0x88,
|
|
82
|
-
sn :
|
|
81
|
+
"type" : i2s(0x88),
|
|
82
|
+
"sn" : 12345,
|
|
83
83
|
|
|
84
|
-
command : "handshake", // command name
|
|
85
|
-
title : "Hello world!", // "DIM?", "DIM!"
|
|
86
|
-
session : "{SESSION_ID}", // session key
|
|
84
|
+
"command" : "handshake", // command name
|
|
85
|
+
"title" : "Hello world!", // "DIM?", "DIM!"
|
|
86
|
+
"session" : "{SESSION_ID}", // session key
|
|
87
87
|
}
|
|
88
88
|
"""
|
|
89
89
|
HANDSHAKE = 'handshake'
|
|
@@ -172,30 +172,25 @@ class BaseHandshakeCommand(BaseCommand, HandshakeCommand):
|
|
|
172
172
|
return handshake_state(title=self.title, session=self.session)
|
|
173
173
|
```
|
|
174
174
|
|
|
175
|
-
###
|
|
175
|
+
### Extends Content
|
|
176
176
|
|
|
177
177
|
```python
|
|
178
178
|
from abc import ABC, abstractmethod
|
|
179
|
-
from typing import Any, Dict
|
|
180
179
|
|
|
181
|
-
from dimp import
|
|
182
|
-
from dimp import Content
|
|
183
|
-
from dimp import BaseContent
|
|
180
|
+
from dimp import *
|
|
184
181
|
|
|
185
182
|
|
|
186
183
|
class AppContent(Content, ABC):
|
|
187
184
|
"""
|
|
188
|
-
Application
|
|
189
|
-
|
|
185
|
+
Content for Application 0nly
|
|
186
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
190
187
|
|
|
191
188
|
data format: {
|
|
192
|
-
type : 0xA0,
|
|
193
|
-
sn :
|
|
189
|
+
"type" : i2s(0xA0),
|
|
190
|
+
"sn" : 12345,
|
|
194
191
|
|
|
195
|
-
app : "{APP_ID}", // application (e.g.: "chat.dim.sechat")
|
|
196
|
-
|
|
197
|
-
act : "{ACTION}", // action name (e.g.: "throw")
|
|
198
|
-
extra : info // action parameters
|
|
192
|
+
"app" : "{APP_ID}", // application (e.g.: "chat.dim.sechat")
|
|
193
|
+
"extra" : info // action parameters
|
|
199
194
|
}
|
|
200
195
|
"""
|
|
201
196
|
|
|
@@ -205,6 +200,23 @@ class AppContent(Content, ABC):
|
|
|
205
200
|
""" App ID """
|
|
206
201
|
raise NotImplemented
|
|
207
202
|
|
|
203
|
+
|
|
204
|
+
class CustomizedContent(Content, ABC):
|
|
205
|
+
"""
|
|
206
|
+
Application Customized message
|
|
207
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
208
|
+
|
|
209
|
+
data format: {
|
|
210
|
+
"type" : i2s(0xCC),
|
|
211
|
+
"sn" : 12345,
|
|
212
|
+
|
|
213
|
+
"app" : "{APP_ID}", // application (e.g.: "chat.dim.sechat")
|
|
214
|
+
"mod" : "{MODULE}", // module name (e.g.: "drift_bottle")
|
|
215
|
+
"act" : "{ACTION}", // action name (e.g.: "throw")
|
|
216
|
+
"extra" : info // action parameters
|
|
217
|
+
}
|
|
218
|
+
"""
|
|
219
|
+
|
|
208
220
|
@property
|
|
209
221
|
@abstractmethod
|
|
210
222
|
def module(self) -> str:
|
|
@@ -218,16 +230,22 @@ class AppContent(Content, ABC):
|
|
|
218
230
|
raise NotImplemented
|
|
219
231
|
|
|
220
232
|
#
|
|
221
|
-
# Factory
|
|
233
|
+
# Factory method
|
|
222
234
|
#
|
|
223
235
|
@classmethod
|
|
224
236
|
def create(cls, app: str, mod: str, act: str):
|
|
225
|
-
return
|
|
237
|
+
return AppCustomizedContent(app=app, mod=mod, act=act)
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
```python
|
|
241
|
+
from typing import Dict
|
|
242
|
+
|
|
243
|
+
from dimp import *
|
|
226
244
|
|
|
227
245
|
|
|
228
|
-
class
|
|
246
|
+
class AppCustomizedContent(BaseContent, AppContent, CustomizedContent):
|
|
229
247
|
|
|
230
|
-
def __init__(self, content: Dict
|
|
248
|
+
def __init__(self, content: Dict = None,
|
|
231
249
|
msg_type: str = None,
|
|
232
250
|
app: str = None, mod: str = None, act: str = None):
|
|
233
251
|
if content is None:
|
|
@@ -235,7 +253,7 @@ class ApplicationContent(BaseContent, AppContent):
|
|
|
235
253
|
assert app is not None and mod is not None and act is not None, \
|
|
236
254
|
'customized content error: %s, %s, %s, %s' % (msg_type, app, mod, act)
|
|
237
255
|
if msg_type is None:
|
|
238
|
-
msg_type = ContentType.
|
|
256
|
+
msg_type = ContentType.CUSTOMIZED
|
|
239
257
|
super().__init__(None, msg_type)
|
|
240
258
|
self['app'] = app
|
|
241
259
|
self['mod'] = mod
|
|
@@ -259,11 +277,11 @@ class ApplicationContent(BaseContent, AppContent):
|
|
|
259
277
|
return self.get_str(key='act', default='')
|
|
260
278
|
```
|
|
261
279
|
|
|
262
|
-
###
|
|
280
|
+
### Extends ID Address
|
|
263
281
|
|
|
264
282
|
* Examples in [dim plugins](https://pypi.org/project/dimplugins)
|
|
265
283
|
|
|
266
284
|
----
|
|
267
285
|
|
|
268
|
-
Copyright © 2018-
|
|
286
|
+
Copyright © 2018-2026 Albert Moky
|
|
269
287
|
[](https://github.com/moky?tab=followers)
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://github.com/dimchat/core-py/pulls)
|
|
5
5
|
[](https://github.com/dimchat/core-py/wiki)
|
|
6
6
|
[](https://github.com/dimchat/core-py/issues)
|
|
7
|
-
[](https://github.com/dimchat/core-py/archive/refs/heads/
|
|
7
|
+
[](https://github.com/dimchat/core-py/archive/refs/heads/master.zip)
|
|
8
8
|
[](https://github.com/dimchat/core-py/tags)
|
|
9
9
|
[](https://pypi.org/project/dimp)
|
|
10
10
|
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
## Examples
|
|
24
24
|
|
|
25
|
-
###
|
|
25
|
+
### Extends Command
|
|
26
26
|
|
|
27
27
|
* _Handshake Command Protocol_
|
|
28
28
|
0. (C-S) handshake start
|
|
@@ -35,7 +35,7 @@ from abc import ABC, abstractmethod
|
|
|
35
35
|
from enum import IntEnum
|
|
36
36
|
from typing import Optional, Dict
|
|
37
37
|
|
|
38
|
-
from dimp import
|
|
38
|
+
from dimp import *
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
class HandshakeState(IntEnum):
|
|
@@ -64,12 +64,12 @@ class HandshakeCommand(Command, ABC):
|
|
|
64
64
|
~~~~~~~~~~~~~~~~~
|
|
65
65
|
|
|
66
66
|
data format: {
|
|
67
|
-
type : 0x88,
|
|
68
|
-
sn :
|
|
67
|
+
"type" : i2s(0x88),
|
|
68
|
+
"sn" : 12345,
|
|
69
69
|
|
|
70
|
-
command : "handshake", // command name
|
|
71
|
-
title : "Hello world!", // "DIM?", "DIM!"
|
|
72
|
-
session : "{SESSION_ID}", // session key
|
|
70
|
+
"command" : "handshake", // command name
|
|
71
|
+
"title" : "Hello world!", // "DIM?", "DIM!"
|
|
72
|
+
"session" : "{SESSION_ID}", // session key
|
|
73
73
|
}
|
|
74
74
|
"""
|
|
75
75
|
HANDSHAKE = 'handshake'
|
|
@@ -158,30 +158,25 @@ class BaseHandshakeCommand(BaseCommand, HandshakeCommand):
|
|
|
158
158
|
return handshake_state(title=self.title, session=self.session)
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
-
###
|
|
161
|
+
### Extends Content
|
|
162
162
|
|
|
163
163
|
```python
|
|
164
164
|
from abc import ABC, abstractmethod
|
|
165
|
-
from typing import Any, Dict
|
|
166
165
|
|
|
167
|
-
from dimp import
|
|
168
|
-
from dimp import Content
|
|
169
|
-
from dimp import BaseContent
|
|
166
|
+
from dimp import *
|
|
170
167
|
|
|
171
168
|
|
|
172
169
|
class AppContent(Content, ABC):
|
|
173
170
|
"""
|
|
174
|
-
Application
|
|
175
|
-
|
|
171
|
+
Content for Application 0nly
|
|
172
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
176
173
|
|
|
177
174
|
data format: {
|
|
178
|
-
type : 0xA0,
|
|
179
|
-
sn :
|
|
175
|
+
"type" : i2s(0xA0),
|
|
176
|
+
"sn" : 12345,
|
|
180
177
|
|
|
181
|
-
app : "{APP_ID}", // application (e.g.: "chat.dim.sechat")
|
|
182
|
-
|
|
183
|
-
act : "{ACTION}", // action name (e.g.: "throw")
|
|
184
|
-
extra : info // action parameters
|
|
178
|
+
"app" : "{APP_ID}", // application (e.g.: "chat.dim.sechat")
|
|
179
|
+
"extra" : info // action parameters
|
|
185
180
|
}
|
|
186
181
|
"""
|
|
187
182
|
|
|
@@ -191,6 +186,23 @@ class AppContent(Content, ABC):
|
|
|
191
186
|
""" App ID """
|
|
192
187
|
raise NotImplemented
|
|
193
188
|
|
|
189
|
+
|
|
190
|
+
class CustomizedContent(Content, ABC):
|
|
191
|
+
"""
|
|
192
|
+
Application Customized message
|
|
193
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
194
|
+
|
|
195
|
+
data format: {
|
|
196
|
+
"type" : i2s(0xCC),
|
|
197
|
+
"sn" : 12345,
|
|
198
|
+
|
|
199
|
+
"app" : "{APP_ID}", // application (e.g.: "chat.dim.sechat")
|
|
200
|
+
"mod" : "{MODULE}", // module name (e.g.: "drift_bottle")
|
|
201
|
+
"act" : "{ACTION}", // action name (e.g.: "throw")
|
|
202
|
+
"extra" : info // action parameters
|
|
203
|
+
}
|
|
204
|
+
"""
|
|
205
|
+
|
|
194
206
|
@property
|
|
195
207
|
@abstractmethod
|
|
196
208
|
def module(self) -> str:
|
|
@@ -204,16 +216,22 @@ class AppContent(Content, ABC):
|
|
|
204
216
|
raise NotImplemented
|
|
205
217
|
|
|
206
218
|
#
|
|
207
|
-
# Factory
|
|
219
|
+
# Factory method
|
|
208
220
|
#
|
|
209
221
|
@classmethod
|
|
210
222
|
def create(cls, app: str, mod: str, act: str):
|
|
211
|
-
return
|
|
223
|
+
return AppCustomizedContent(app=app, mod=mod, act=act)
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
```python
|
|
227
|
+
from typing import Dict
|
|
228
|
+
|
|
229
|
+
from dimp import *
|
|
212
230
|
|
|
213
231
|
|
|
214
|
-
class
|
|
232
|
+
class AppCustomizedContent(BaseContent, AppContent, CustomizedContent):
|
|
215
233
|
|
|
216
|
-
def __init__(self, content: Dict
|
|
234
|
+
def __init__(self, content: Dict = None,
|
|
217
235
|
msg_type: str = None,
|
|
218
236
|
app: str = None, mod: str = None, act: str = None):
|
|
219
237
|
if content is None:
|
|
@@ -221,7 +239,7 @@ class ApplicationContent(BaseContent, AppContent):
|
|
|
221
239
|
assert app is not None and mod is not None and act is not None, \
|
|
222
240
|
'customized content error: %s, %s, %s, %s' % (msg_type, app, mod, act)
|
|
223
241
|
if msg_type is None:
|
|
224
|
-
msg_type = ContentType.
|
|
242
|
+
msg_type = ContentType.CUSTOMIZED
|
|
225
243
|
super().__init__(None, msg_type)
|
|
226
244
|
self['app'] = app
|
|
227
245
|
self['mod'] = mod
|
|
@@ -245,11 +263,11 @@ class ApplicationContent(BaseContent, AppContent):
|
|
|
245
263
|
return self.get_str(key='act', default='')
|
|
246
264
|
```
|
|
247
265
|
|
|
248
|
-
###
|
|
266
|
+
### Extends ID Address
|
|
249
267
|
|
|
250
268
|
* Examples in [dim plugins](https://pypi.org/project/dimplugins)
|
|
251
269
|
|
|
252
270
|
----
|
|
253
271
|
|
|
254
|
-
Copyright © 2018-
|
|
272
|
+
Copyright © 2018-2026 Albert Moky
|
|
255
273
|
[](https://github.com/moky?tab=followers)
|
|
@@ -28,18 +28,12 @@
|
|
|
28
28
|
# SOFTWARE.
|
|
29
29
|
# ==============================================================================
|
|
30
30
|
|
|
31
|
-
from
|
|
32
|
-
from mkm.format import *
|
|
33
|
-
from mkm.crypto import *
|
|
34
|
-
from mkm import *
|
|
35
|
-
from dkd import *
|
|
36
|
-
|
|
37
|
-
from .protocol.base import CommandFactory
|
|
38
|
-
from .protocol import *
|
|
31
|
+
from .format import *
|
|
39
32
|
from .crypto import *
|
|
33
|
+
from .protocol import *
|
|
40
34
|
from .mkm import *
|
|
41
35
|
from .dkd import *
|
|
42
|
-
from .
|
|
36
|
+
from .ext import *
|
|
43
37
|
|
|
44
38
|
|
|
45
39
|
name = "DIMP"
|
|
@@ -53,6 +47,7 @@ __all__ = [
|
|
|
53
47
|
'URI', 'DateTime',
|
|
54
48
|
|
|
55
49
|
'Converter', 'DataConverter', 'BaseConverter',
|
|
50
|
+
|
|
56
51
|
'Copier',
|
|
57
52
|
'Wrapper', 'Stringer', 'Mapper',
|
|
58
53
|
'ConstantString', # 'String',
|
|
@@ -65,7 +60,6 @@ __all__ = [
|
|
|
65
60
|
'DataCoder', 'Hex', 'Base58', 'Base64',
|
|
66
61
|
'ObjectCoder', 'JSON',
|
|
67
62
|
'MapCoder', 'JSONMap',
|
|
68
|
-
'ListCoder', 'JSONList',
|
|
69
63
|
'StringCoder', 'UTF8',
|
|
70
64
|
|
|
71
65
|
'hex_encode', 'hex_decode',
|
|
@@ -74,17 +68,50 @@ __all__ = [
|
|
|
74
68
|
'json_encode', 'json_decode',
|
|
75
69
|
'utf8_encode', 'utf8_decode',
|
|
76
70
|
|
|
77
|
-
'
|
|
78
|
-
'
|
|
71
|
+
'TransportableResource',
|
|
72
|
+
'TransportableData',
|
|
73
|
+
|
|
74
|
+
'TransportableDataFactory',
|
|
75
|
+
|
|
76
|
+
'TransportableDataHelper',
|
|
77
|
+
'FormatExtensions', 'shared_format_extensions',
|
|
78
|
+
|
|
79
|
+
'Header', 'DataURI',
|
|
79
80
|
|
|
80
81
|
#
|
|
81
|
-
#
|
|
82
|
+
# TED
|
|
82
83
|
#
|
|
83
84
|
|
|
84
|
-
'
|
|
85
|
-
|
|
85
|
+
'EncodeAlgorithms',
|
|
86
|
+
|
|
87
|
+
'BaseString', 'BaseData',
|
|
88
|
+
|
|
89
|
+
'Base64Data', 'PlainData',
|
|
90
|
+
'EmbedData',
|
|
91
|
+
|
|
92
|
+
#
|
|
93
|
+
# PNF
|
|
94
|
+
#
|
|
95
|
+
|
|
96
|
+
'TransportableFile', 'TransportableFileFactory',
|
|
97
|
+
# 'TransportableFileHelper', 'TransportableFileExtension',
|
|
98
|
+
'TransportableFileWrapper', 'TransportableFileWrapperFactory',
|
|
99
|
+
# 'TransportableFileWrapperExtension',
|
|
100
|
+
|
|
101
|
+
'PortableNetworkFile',
|
|
102
|
+
'PortableNetworkFileWrapper',
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
# ================================================================
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
#
|
|
109
|
+
# Digest
|
|
110
|
+
#
|
|
86
111
|
|
|
87
|
-
'
|
|
112
|
+
'MessageDigester',
|
|
113
|
+
'SHA256', 'KECCAK256', 'RIPEMD160',
|
|
114
|
+
'sha256', 'keccak256', 'ripemd160',
|
|
88
115
|
|
|
89
116
|
#
|
|
90
117
|
# Crypto
|
|
@@ -97,102 +124,153 @@ __all__ = [
|
|
|
97
124
|
|
|
98
125
|
'SymmetricKeyFactory', 'PrivateKeyFactory', 'PublicKeyFactory',
|
|
99
126
|
|
|
100
|
-
'
|
|
101
|
-
'BaseAsymmetricKey', 'BasePublicKey', 'BasePrivateKey',
|
|
127
|
+
'SymmetricKeyHelper', 'PublicKeyHelper', 'PrivateKeyHelper',
|
|
102
128
|
|
|
103
|
-
'
|
|
104
|
-
'
|
|
129
|
+
'SymmetricKeyExtension', 'PublicKeyExtension', 'PrivateKeyExtension',
|
|
130
|
+
'CryptoExtensions', 'shared_crypto_extensions',
|
|
105
131
|
|
|
106
132
|
#
|
|
107
|
-
#
|
|
133
|
+
# Algorithms
|
|
108
134
|
#
|
|
135
|
+
|
|
109
136
|
'AsymmetricAlgorithms', 'SymmetricAlgorithms',
|
|
110
|
-
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
# ================================================================
|
|
140
|
+
|
|
111
141
|
|
|
112
142
|
#
|
|
113
|
-
#
|
|
143
|
+
# Ming-Ke-Ming
|
|
114
144
|
#
|
|
115
145
|
|
|
116
146
|
'EntityType',
|
|
117
|
-
'Address',
|
|
118
|
-
'
|
|
119
|
-
'Meta',
|
|
120
|
-
'Document', 'Visa', 'Bulletin',
|
|
121
|
-
|
|
122
|
-
'MetaType', 'DocumentType',
|
|
147
|
+
'Address', 'ID',
|
|
148
|
+
'Meta', 'TAI', 'Document',
|
|
123
149
|
|
|
124
|
-
'AddressFactory',
|
|
125
|
-
'
|
|
126
|
-
'MetaFactory',
|
|
127
|
-
'DocumentFactory',
|
|
150
|
+
'AddressFactory', 'IDFactory',
|
|
151
|
+
'MetaFactory', 'DocumentFactory',
|
|
128
152
|
|
|
129
|
-
'Identifier',
|
|
130
|
-
'ANYONE', 'EVERYONE', 'FOUNDER',
|
|
131
153
|
'ANYWHERE', 'EVERYWHERE',
|
|
132
|
-
|
|
154
|
+
'ANYONE', 'EVERYONE', 'FOUNDER',
|
|
155
|
+
'BroadcastAddress', 'Identifier',
|
|
133
156
|
|
|
134
|
-
'
|
|
135
|
-
'
|
|
157
|
+
'AddressHelper', 'IDHelper',
|
|
158
|
+
'MetaHelper', 'DocumentHelper',
|
|
159
|
+
|
|
160
|
+
'AddressExtension', 'IDExtension',
|
|
161
|
+
'MetaExtension', 'DocumentExtension',
|
|
162
|
+
'AccountExtensions', 'shared_account_extensions',
|
|
136
163
|
|
|
137
164
|
#
|
|
138
|
-
#
|
|
165
|
+
# Dao-Ke-Dao
|
|
139
166
|
#
|
|
140
167
|
|
|
141
|
-
'
|
|
142
|
-
'Content',
|
|
143
|
-
'Envelope',
|
|
168
|
+
'Content', 'Envelope',
|
|
144
169
|
'Message',
|
|
145
170
|
'InstantMessage', 'SecureMessage', 'ReliableMessage',
|
|
146
171
|
|
|
147
|
-
|
|
172
|
+
'ContentFactory', 'EnvelopeFactory',
|
|
173
|
+
'InstantMessageFactory', 'SecureMessageFactory', 'ReliableMessageFactory',
|
|
174
|
+
|
|
175
|
+
'ContentHelper', 'EnvelopeHelper',
|
|
176
|
+
'InstantMessageHelper', 'SecureMessageHelper', 'ReliableMessageHelper',
|
|
177
|
+
|
|
178
|
+
'ContentExtension',
|
|
179
|
+
'InstantMessageExtension', 'SecureMessageExtension', 'ReliableMessageExtension',
|
|
180
|
+
'MessageExtensions', 'shared_message_extensions',
|
|
181
|
+
|
|
182
|
+
#
|
|
183
|
+
# Core Protocols
|
|
184
|
+
#
|
|
185
|
+
|
|
186
|
+
'MetaType',
|
|
187
|
+
'DocumentType',
|
|
188
|
+
'Visa', 'Bulletin',
|
|
189
|
+
|
|
190
|
+
'ContentType',
|
|
191
|
+
|
|
192
|
+
'Command', 'CommandFactory',
|
|
193
|
+
|
|
194
|
+
# 'CommandHelper', 'GeneralCommandHelper',
|
|
195
|
+
# 'CommandExtension', 'CmdExtension',
|
|
196
|
+
|
|
197
|
+
#
|
|
198
|
+
# Contents
|
|
199
|
+
#
|
|
200
|
+
|
|
148
201
|
'TextContent', 'PageContent', 'NameCard',
|
|
149
|
-
'ForwardContent', 'CombineContent', 'ArrayContent',
|
|
150
|
-
'FileContent', 'ImageContent', 'AudioContent', 'VideoContent',
|
|
151
202
|
'MoneyContent', 'TransferContent',
|
|
203
|
+
'FileContent', 'ImageContent', 'AudioContent', 'VideoContent',
|
|
204
|
+
'ForwardContent', 'CombineContent', 'ArrayContent',
|
|
152
205
|
'QuoteContent',
|
|
153
|
-
'
|
|
206
|
+
# 'QuoteHelper', 'QuotePurifier', 'QuoteExtension',
|
|
207
|
+
|
|
208
|
+
#
|
|
209
|
+
# Commands
|
|
210
|
+
#
|
|
154
211
|
|
|
155
|
-
# commands
|
|
156
|
-
'Command',
|
|
157
212
|
'MetaCommand', 'DocumentCommand',
|
|
158
213
|
'ReceiptCommand',
|
|
159
214
|
|
|
160
|
-
# group history
|
|
161
215
|
'HistoryCommand', 'GroupCommand',
|
|
162
|
-
'InviteCommand', 'ExpelCommand', 'JoinCommand', 'QuitCommand', '
|
|
163
|
-
|
|
216
|
+
'InviteCommand', 'ExpelCommand', 'JoinCommand', 'QuitCommand', 'ResetCommand',
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
# ================================================================
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
#
|
|
223
|
+
# Account Implementations
|
|
224
|
+
#
|
|
225
|
+
|
|
226
|
+
'BaseMeta',
|
|
227
|
+
'BaseDocument', 'BaseVisa', 'BaseBulletin',
|
|
228
|
+
|
|
229
|
+
#
|
|
230
|
+
# Content Implementations
|
|
231
|
+
#
|
|
232
|
+
|
|
233
|
+
'BaseContent', 'BaseCommand',
|
|
234
|
+
# 'CommandHelper', 'GeneralCommandHelper',
|
|
235
|
+
# 'CommandExtension', 'CmdExtension',
|
|
164
236
|
|
|
165
|
-
# extend contents
|
|
166
|
-
'BaseContent',
|
|
167
237
|
'BaseTextContent', 'WebPageContent', 'NameCardContent',
|
|
168
|
-
'SecretContent', 'CombineForwardContent', 'ListContent',
|
|
169
|
-
'BaseFileContent', 'ImageFileContent', 'AudioFileContent', 'VideoFileContent',
|
|
170
238
|
'BaseMoneyContent', 'TransferMoneyContent',
|
|
239
|
+
'BaseFileContent', 'ImageFileContent', 'AudioFileContent', 'VideoFileContent',
|
|
240
|
+
'SecretContent', 'CombineForwardContent', 'ListContent',
|
|
171
241
|
'BaseQuoteContent',
|
|
172
|
-
'
|
|
242
|
+
# 'QuoteHelper', 'QuotePurifier', 'QuoteExtension',
|
|
173
243
|
|
|
174
|
-
# extend commands
|
|
175
|
-
'BaseCommand',
|
|
176
244
|
'BaseMetaCommand', 'BaseDocumentCommand',
|
|
177
245
|
'BaseReceiptCommand',
|
|
178
|
-
|
|
179
|
-
# extend group history
|
|
180
246
|
'BaseHistoryCommand', 'BaseGroupCommand',
|
|
181
|
-
'InviteGroupCommand', 'ExpelGroupCommand', 'JoinGroupCommand',
|
|
182
|
-
'QuitGroupCommand', 'QueryGroupCommand', 'ResetGroupCommand',
|
|
183
|
-
'HireGroupCommand', 'FireGroupCommand', 'ResignGroupCommand',
|
|
247
|
+
'InviteGroupCommand', 'ExpelGroupCommand', 'JoinGroupCommand', 'QuitGroupCommand', 'ResetGroupCommand',
|
|
184
248
|
|
|
185
249
|
#
|
|
186
|
-
# Message
|
|
250
|
+
# Message Implementations
|
|
187
251
|
#
|
|
188
252
|
|
|
189
253
|
'MessageEnvelope',
|
|
190
254
|
'BaseMessage',
|
|
191
255
|
'PlainMessage', 'EncryptedMessage', 'NetworkMessage',
|
|
192
256
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
257
|
+
|
|
258
|
+
# ================================================================
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
'GeneralCryptoHelper', 'GeneralCryptoExtension',
|
|
262
|
+
'GeneralAccountHelper', 'GeneralAccountExtension',
|
|
263
|
+
|
|
264
|
+
'GeneralMessageHelper', 'GeneralMessageExtension',
|
|
265
|
+
|
|
266
|
+
'TransportableFileHelper',
|
|
267
|
+
'TransportableFileExtension',
|
|
268
|
+
'TransportableFileWrapperExtension',
|
|
269
|
+
|
|
270
|
+
'CommandHelper', 'GeneralCommandHelper',
|
|
271
|
+
'CommandExtension', 'CmdExtension',
|
|
272
|
+
|
|
273
|
+
'QuoteHelper', 'QuotePurifier',
|
|
274
|
+
'QuoteExtension',
|
|
197
275
|
|
|
198
276
|
]
|
|
@@ -28,26 +28,21 @@
|
|
|
28
28
|
# SOFTWARE.
|
|
29
29
|
# ==============================================================================
|
|
30
30
|
|
|
31
|
+
from mkm.digest import *
|
|
31
32
|
from mkm.crypto import *
|
|
32
33
|
|
|
33
34
|
from .algorithms import AsymmetricAlgorithms, SymmetricAlgorithms
|
|
34
|
-
from .algorithms import EncodeAlgorithms
|
|
35
35
|
|
|
36
|
-
from .keys import BaseKey, BaseSymmetricKey
|
|
37
|
-
from .keys import BaseAsymmetricKey, BasePublicKey, BasePrivateKey
|
|
38
|
-
|
|
39
|
-
from .ted import BaseDataWrapper
|
|
40
|
-
from .pnf import BaseFileWrapper
|
|
41
36
|
|
|
42
37
|
__all__ = [
|
|
43
38
|
|
|
44
39
|
#
|
|
45
|
-
#
|
|
40
|
+
# Digest
|
|
46
41
|
#
|
|
47
42
|
|
|
48
|
-
'
|
|
49
|
-
'
|
|
50
|
-
'
|
|
43
|
+
'MessageDigester',
|
|
44
|
+
'SHA256', 'KECCAK256', 'RIPEMD160',
|
|
45
|
+
'sha256', 'keccak256', 'ripemd160',
|
|
51
46
|
|
|
52
47
|
#
|
|
53
48
|
# Crypto
|
|
@@ -60,22 +55,15 @@ __all__ = [
|
|
|
60
55
|
|
|
61
56
|
'SymmetricKeyFactory', 'PrivateKeyFactory', 'PublicKeyFactory',
|
|
62
57
|
|
|
63
|
-
#
|
|
64
|
-
# Algorithm
|
|
65
|
-
#
|
|
66
|
-
'AsymmetricAlgorithms', 'SymmetricAlgorithms',
|
|
67
|
-
'EncodeAlgorithms',
|
|
58
|
+
# 'SymmetricKeyHelper', 'PublicKeyHelper', 'PrivateKeyHelper',
|
|
68
59
|
|
|
69
|
-
#
|
|
70
|
-
#
|
|
71
|
-
#
|
|
72
|
-
'BaseKey', 'BaseSymmetricKey',
|
|
73
|
-
'BaseAsymmetricKey', 'BasePublicKey', 'BasePrivateKey',
|
|
60
|
+
# 'SymmetricKeyExtension', 'PublicKeyExtension', 'PrivateKeyExtension',
|
|
61
|
+
# 'CryptoExtensions', 'shared_crypto_extensions',
|
|
74
62
|
|
|
75
|
-
|
|
76
|
-
#
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
'
|
|
63
|
+
|
|
64
|
+
# ----------------------------------------------------------------
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
'AsymmetricAlgorithms', 'SymmetricAlgorithms',
|
|
80
68
|
|
|
81
69
|
]
|