dimp 2.4.2__tar.gz → 2.5.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.
Files changed (53) hide show
  1. {dimp-2.4.2 → dimp-2.5.0}/PKG-INFO +17 -8
  2. {dimp-2.4.2 → dimp-2.5.0}/README.md +16 -7
  3. dimp-2.5.0/dimp/__init__.py +384 -0
  4. {dimp-2.4.2 → dimp-2.5.0}/dimp/crypto/__init__.py +37 -13
  5. {dimp-2.4.2/dimp/mkm → dimp-2.5.0/dimp/dkd}/__init__.py +18 -41
  6. {dimp-2.4.2 → dimp-2.5.0}/dimp/dkd/base.py +33 -19
  7. {dimp-2.4.2 → dimp-2.5.0}/dimp/dkd/envelope.py +32 -10
  8. {dimp-2.4.2 → dimp-2.5.0}/dimp/dkd/instant.py +20 -14
  9. {dimp-2.4.2 → dimp-2.5.0}/dimp/dkd/reliable.py +14 -12
  10. {dimp-2.4.2 → dimp-2.5.0}/dimp/dkd/secure.py +25 -16
  11. dimp-2.5.0/dimp/ext/__init__.py +187 -0
  12. dimp-2.5.0/dimp/ext/cmd_ext.py +135 -0
  13. {dimp-2.4.2 → dimp-2.5.0}/dimp/format/__init__.py +26 -55
  14. {dimp-2.4.2 → dimp-2.5.0}/dimp/format/base.py +145 -45
  15. {dimp-2.4.2 → dimp-2.5.0}/dimp/format/data.py +23 -49
  16. dimp-2.4.2/dimp/format/file.py → dimp-2.5.0/dimp/format/pnf.py +125 -48
  17. dimp-2.4.2/dimp/format/file_wrapper.py → dimp-2.5.0/dimp/format/pnf_wrapper.py +94 -28
  18. dimp-2.5.0/dimp/protocol/__init__.py +126 -0
  19. dimp-2.5.0/dimp/protocol/command.py +206 -0
  20. {dimp-2.4.2 → dimp-2.5.0}/dimp/protocol/types.py +27 -25
  21. dimp-2.4.2/dimp/crypto/algorithms.py → dimp-2.5.0/dimp/types/__init__.py +26 -12
  22. dimp-2.5.0/dimp/types/dictionary.py +276 -0
  23. {dimp-2.4.2 → dimp-2.5.0}/dimp.egg-info/PKG-INFO +17 -8
  24. {dimp-2.4.2 → dimp-2.5.0}/dimp.egg-info/SOURCES.txt +4 -20
  25. dimp-2.5.0/dimp.egg-info/requires.txt +2 -0
  26. {dimp-2.4.2 → dimp-2.5.0}/setup.py +3 -3
  27. dimp-2.4.2/dimp/__init__.py +0 -276
  28. dimp-2.4.2/dimp/dkd/__init__.py +0 -127
  29. dimp-2.4.2/dimp/ext/__init__.py +0 -103
  30. dimp-2.4.2/dimp/format/duri.py +0 -284
  31. dimp-2.4.2/dimp/format/embed.py +0 -223
  32. dimp-2.4.2/dimp/format/pnf.py +0 -182
  33. dimp-2.4.2/dimp/format/pnf_wrapper.py +0 -222
  34. dimp-2.4.2/dimp/mkm/docs.py +0 -147
  35. dimp-2.4.2/dimp/mkm/document.py +0 -262
  36. dimp-2.4.2/dimp/mkm/meta.py +0 -210
  37. dimp-2.4.2/dimp/protocol/__init__.py +0 -187
  38. dimp-2.4.2/dimp/protocol/assets.py +0 -219
  39. dimp-2.4.2/dimp/protocol/base.py +0 -296
  40. dimp-2.4.2/dimp/protocol/commands.py +0 -264
  41. dimp-2.4.2/dimp/protocol/contents.py +0 -455
  42. dimp-2.4.2/dimp/protocol/docs.py +0 -164
  43. dimp-2.4.2/dimp/protocol/files.py +0 -495
  44. dimp-2.4.2/dimp/protocol/forward.py +0 -255
  45. dimp-2.4.2/dimp/protocol/groups.py +0 -263
  46. dimp-2.4.2/dimp/protocol/quote.py +0 -234
  47. dimp-2.4.2/dimp/protocol/receipt.py +0 -194
  48. dimp-2.4.2/dimp/protocol/version.py +0 -78
  49. dimp-2.4.2/dimp.egg-info/requires.txt +0 -2
  50. {dimp-2.4.2 → dimp-2.5.0}/LICENSE +0 -0
  51. {dimp-2.4.2 → dimp-2.5.0}/dimp.egg-info/dependency_links.txt +0 -0
  52. {dimp-2.4.2 → dimp-2.5.0}/dimp.egg-info/top_level.txt +0 -0
  53. {dimp-2.4.2 → dimp-2.5.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dimp
3
- Version: 2.4.2
3
+ Version: 2.5.0
4
4
  Summary: Decentralized Instant Messaging Protocol
5
5
  Home-page: https://github.com/dimchat/core-py
6
6
  Author: Albert Moky
@@ -29,6 +29,8 @@ License-File: LICENSE
29
29
 
30
30
  ## Dependencies
31
31
 
32
+ * Latest Versions
33
+
32
34
  | Name | Version | Description |
33
35
  |------|---------|-------------|
34
36
  | [Ming Ke Ming (名可名)](https://github.com/dimchat/mkm-py) | [![Version](https://img.shields.io/pypi/v/mkm)](https://pypi.org/project/mkm) | Decentralized User Identity Authentication |
@@ -47,7 +49,7 @@ License-File: LICENSE
47
49
  ```python
48
50
  from abc import ABC, abstractmethod
49
51
  from enum import IntEnum
50
- from typing import Optional, Dict
52
+ from typing import Optional
51
53
 
52
54
  from dimp import *
53
55
 
@@ -81,9 +83,9 @@ class HandshakeCommand(Command, ABC):
81
83
  "type" : i2s(0x88),
82
84
  "sn" : 12345,
83
85
 
84
- "command" : "handshake", // command name
85
- "title" : "Hello world!", // "DIM?", "DIM!"
86
- "session" : "{SESSION_ID}", // session key
86
+ "command" : "handshake", // command name
87
+ "title" : "Hello world!", // "DIM?", "DIM!"
88
+ "session" : "{SESSION_KEY}", // session key
87
89
  }
88
90
  """
89
91
  HANDSHAKE = 'handshake'
@@ -146,11 +148,18 @@ class HandshakeCommand(Command, ABC):
146
148
  again = ask # (2. S->C) ask client to handshake with new session key
147
149
  restart = offer # (3. C->S) handshake with new session key
148
150
  success = accepted # (4. S->C) notice the client that handshake accepted
151
+ ```
152
+
153
+ ```python
154
+ from collections.abc import Mapping
155
+ from typing import Optional
156
+
157
+ from dimp import *
149
158
 
150
159
 
151
160
  class BaseHandshakeCommand(BaseCommand, HandshakeCommand):
152
161
 
153
- def __init__(self, content: Dict = None, title: str = None, session: str = None):
162
+ def __init__(self, content: Mapping = None, title: str = None, session: str = None):
154
163
  if content is None:
155
164
  # 1. new command with title & session key
156
165
  assert title is not None, 'handshake command error: %s' % session
@@ -250,14 +259,14 @@ class CustomizedContent(Content, ABC):
250
259
  ```
251
260
 
252
261
  ```python
253
- from typing import Dict
262
+ from collections.abc import Mapping
254
263
 
255
264
  from dimp import *
256
265
 
257
266
 
258
267
  class AppCustomizedContent(BaseContent, AppContent, CustomizedContent):
259
268
 
260
- def __init__(self, content: Dict = None,
269
+ def __init__(self, content: Mapping = None,
261
270
  msg_type: str = None,
262
271
  app: str = None, mod: str = None, act: str = None):
263
272
  if content is None:
@@ -15,6 +15,8 @@
15
15
 
16
16
  ## Dependencies
17
17
 
18
+ * Latest Versions
19
+
18
20
  | Name | Version | Description |
19
21
  |------|---------|-------------|
20
22
  | [Ming Ke Ming (名可名)](https://github.com/dimchat/mkm-py) | [![Version](https://img.shields.io/pypi/v/mkm)](https://pypi.org/project/mkm) | Decentralized User Identity Authentication |
@@ -33,7 +35,7 @@
33
35
  ```python
34
36
  from abc import ABC, abstractmethod
35
37
  from enum import IntEnum
36
- from typing import Optional, Dict
38
+ from typing import Optional
37
39
 
38
40
  from dimp import *
39
41
 
@@ -67,9 +69,9 @@ class HandshakeCommand(Command, ABC):
67
69
  "type" : i2s(0x88),
68
70
  "sn" : 12345,
69
71
 
70
- "command" : "handshake", // command name
71
- "title" : "Hello world!", // "DIM?", "DIM!"
72
- "session" : "{SESSION_ID}", // session key
72
+ "command" : "handshake", // command name
73
+ "title" : "Hello world!", // "DIM?", "DIM!"
74
+ "session" : "{SESSION_KEY}", // session key
73
75
  }
74
76
  """
75
77
  HANDSHAKE = 'handshake'
@@ -132,11 +134,18 @@ class HandshakeCommand(Command, ABC):
132
134
  again = ask # (2. S->C) ask client to handshake with new session key
133
135
  restart = offer # (3. C->S) handshake with new session key
134
136
  success = accepted # (4. S->C) notice the client that handshake accepted
137
+ ```
138
+
139
+ ```python
140
+ from collections.abc import Mapping
141
+ from typing import Optional
142
+
143
+ from dimp import *
135
144
 
136
145
 
137
146
  class BaseHandshakeCommand(BaseCommand, HandshakeCommand):
138
147
 
139
- def __init__(self, content: Dict = None, title: str = None, session: str = None):
148
+ def __init__(self, content: Mapping = None, title: str = None, session: str = None):
140
149
  if content is None:
141
150
  # 1. new command with title & session key
142
151
  assert title is not None, 'handshake command error: %s' % session
@@ -236,14 +245,14 @@ class CustomizedContent(Content, ABC):
236
245
  ```
237
246
 
238
247
  ```python
239
- from typing import Dict
248
+ from collections.abc import Mapping
240
249
 
241
250
  from dimp import *
242
251
 
243
252
 
244
253
  class AppCustomizedContent(BaseContent, AppContent, CustomizedContent):
245
254
 
246
- def __init__(self, content: Dict = None,
255
+ def __init__(self, content: Mapping = None,
247
256
  msg_type: str = None,
248
257
  app: str = None, mod: str = None, act: str = None):
249
258
  if content is None:
@@ -0,0 +1,384 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # DIMP : Decentralized Instant Messaging Protocol
4
+ #
5
+ # Written in 2019 by Moky <albert.moky@gmail.com>
6
+ # ==============================================================================
7
+ # MIT License
8
+ #
9
+ # Copyright (c) 2019 Albert Moky
10
+ #
11
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ # of this software and associated documentation files (the "Software"), to deal
13
+ # in the Software without restriction, including without limitation the rights
14
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ # copies of the Software, and to permit persons to whom the Software is
16
+ # furnished to do so, subject to the following conditions:
17
+ #
18
+ # The above copyright notice and this permission notice shall be included in all
19
+ # copies or substantial portions of the Software.
20
+ #
21
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ # SOFTWARE.
28
+ # ==============================================================================
29
+
30
+ """
31
+ DIMP
32
+ ~~~~
33
+
34
+ Decentralized Instant Messaging Protocol
35
+ """
36
+
37
+ from .types import *
38
+ from .format import *
39
+ from .crypto import *
40
+ from .protocol import *
41
+ from .dkd import *
42
+ from .ext import *
43
+
44
+
45
+ name = "DIMP"
46
+
47
+ __author__ = 'Albert Moky'
48
+
49
+ __all__ = [
50
+
51
+ 'Singleton',
52
+
53
+ 'final',
54
+
55
+ 'StrMap', 'MutableStrMap',
56
+ 'AnyList', 'StrList',
57
+
58
+ 'URI', 'DateTime',
59
+
60
+ 'Stringer',
61
+ 'ConstantString', # 'String',
62
+ 'Mapper',
63
+
64
+ 'Converter', 'DataConverter', 'BaseConverter',
65
+ 'Copier', 'DataCopier', 'BaseCopier',
66
+ 'Wrapper', 'DataWrapper', 'BaseWrapper',
67
+
68
+ 'Dictionary',
69
+
70
+ ################################################################
71
+ #
72
+ # Format
73
+ #
74
+ ################################################################
75
+
76
+ 'DataCoder', 'Hex', 'Base58', 'Base64',
77
+
78
+ 'ObjectCoder', 'JSON',
79
+ 'MapCoder', 'JSONMap',
80
+ 'StringCoder', 'UTF8',
81
+
82
+ 'TransportableResource',
83
+ 'TransportableData', 'TransportableDataFactory',
84
+ # 'FormatExtensions',
85
+ # 'TransportableDataHelper',
86
+ # 'shared_format_extensions', 'ted_helper',
87
+
88
+ #
89
+ # TED
90
+ #
91
+
92
+ 'BaseString', 'BaseData',
93
+
94
+ 'PlainData',
95
+
96
+ #
97
+ # PNF
98
+ #
99
+
100
+ 'TransportableFile', 'TransportableFileFactory',
101
+ # 'TransportableFileExtension',
102
+ # 'TransportableFileHelper',
103
+ # 'pnf_helper',
104
+ 'TransportableFileWrapper', 'TransportableFileWrapperFactory',
105
+ # 'TransportableFileWrapperExtension',
106
+ # 'pnf_wrapper_factory',
107
+
108
+ ################################################################
109
+ #
110
+ # Crypto
111
+ #
112
+ ################################################################
113
+
114
+ 'MessageDigester',
115
+ 'SHA256', 'KECCAK256', 'RIPEMD160',
116
+
117
+ #
118
+ # Crypto
119
+ #
120
+
121
+ 'CryptographyKey', 'EncryptKey', 'DecryptKey',
122
+ 'AsymmetricKey', 'SignKey', 'VerifyKey',
123
+ # 'CryptoExtensions',
124
+ # 'shared_crypto_extensions',
125
+
126
+ 'SymmetricKey', 'SymmetricKeyFactory',
127
+ # 'SymmetricKeyExtension',
128
+ # 'SymmetricKeyHelper',
129
+ # 'symmetric_helper',
130
+
131
+ 'PublicKey', 'PublicKeyFactory',
132
+ # 'PublicKeyExtension',
133
+ # 'PublicKeyHelper',
134
+ # 'public_helper',
135
+
136
+ 'PrivateKey', 'PrivateKeyFactory',
137
+ # 'PrivateKeyExtension',
138
+ # 'PrivateKeyHelper',
139
+ # 'private_helper',
140
+
141
+ #
142
+ # Encrypted Key Bundle
143
+ #
144
+
145
+ 'BytesMap',
146
+
147
+ 'EncryptedBundle',
148
+ # 'EncryptedBundleExtension',
149
+ # 'EncryptedBundleHandler',
150
+ # 'bundle_handler',
151
+
152
+ 'UserEncryptedBundle',
153
+
154
+ # 'DefaultBundleHandler',
155
+
156
+ ################################################################
157
+ #
158
+ # Protocol
159
+ #
160
+ ################################################################
161
+
162
+ #
163
+ # Ming-Ke-Ming
164
+ #
165
+
166
+ 'EntityType',
167
+ # 'AccountExtensions',
168
+ # 'shared_account_extensions',
169
+
170
+ 'Address', 'AddressFactory',
171
+ # 'AddressExtension',
172
+ # 'AddressHelper',
173
+ # 'address_helper',
174
+
175
+ 'ID', 'IDFactory',
176
+ # 'IDExtension',
177
+ # 'IDHelper',
178
+ # 'id_helper',
179
+
180
+ 'Meta', 'MetaFactory',
181
+ # 'MetaExtension',
182
+ # 'MetaHelper',
183
+ # 'meta_helper',
184
+
185
+ 'TAI',
186
+ 'Document', 'DocumentFactory',
187
+ # 'DocumentExtension',
188
+ # 'DocumentHelper',
189
+ # 'doc_helper',
190
+
191
+ 'ANYWHERE', 'EVERYWHERE',
192
+ 'ANYONE', 'EVERYONE', 'FOUNDER',
193
+ 'Identifier', # 'BroadcastAddress',
194
+
195
+ #
196
+ # Dao-Ke-Dao
197
+ #
198
+
199
+ 'Message',
200
+ # 'MessageExtensions',
201
+ # 'shared_message_extensions',
202
+
203
+ 'Envelope', 'EnvelopeFactory',
204
+ # 'EnvelopeHelper',
205
+ # 'envelope_helper',
206
+
207
+ 'InstantMessage', 'InstantMessageFactory',
208
+ # 'InstantMessageExtension',
209
+ # 'InstantMessageHelper',
210
+ # 'instant_helper',
211
+
212
+ 'SecureMessage', 'SecureMessageFactory',
213
+ # 'SecureMessageExtension',
214
+ # 'SecureMessageHelper',
215
+ # 'secure_helper',
216
+
217
+ 'ReliableMessage', 'ReliableMessageFactory',
218
+ # 'ReliableMessageExtension',
219
+ # 'ReliableMessageHelper',
220
+ # 'reliable_helper',
221
+
222
+ 'Content', 'ContentFactory',
223
+ # 'ContentExtension',
224
+ # 'ContentHelper',
225
+ # 'content_helper',
226
+
227
+ #
228
+ # Core Protocols
229
+ #
230
+
231
+ 'ContentType',
232
+
233
+ 'Command', 'CommandFactory',
234
+ # 'CommandExtension',
235
+ # 'CommandHelper',
236
+ # 'command_helper',
237
+
238
+ #
239
+ # Message Implementations
240
+ #
241
+
242
+ 'MessageEnvelope',
243
+
244
+ 'BaseMessage',
245
+ 'PlainMessage',
246
+ 'EncryptedMessage',
247
+ 'NetworkMessage',
248
+
249
+ ################################################################
250
+ #
251
+ # Extensions
252
+ #
253
+ ################################################################
254
+
255
+ #
256
+ # Format
257
+ #
258
+
259
+ 'FormatExtensions',
260
+ 'TransportableDataHelper',
261
+ 'shared_format_extensions', 'ted_helper',
262
+
263
+ #
264
+ # Crypto
265
+ #
266
+
267
+ 'CryptoExtensions',
268
+ 'shared_crypto_extensions',
269
+
270
+ 'SymmetricKeyExtension',
271
+ 'SymmetricKeyHelper',
272
+ 'symmetric_helper',
273
+
274
+ 'PublicKeyExtension',
275
+ 'PublicKeyHelper',
276
+ 'public_helper',
277
+
278
+ 'PrivateKeyExtension',
279
+ 'PrivateKeyHelper',
280
+ 'private_helper',
281
+
282
+ #
283
+ # Account
284
+ #
285
+
286
+ 'AccountExtensions',
287
+ 'shared_account_extensions',
288
+
289
+ 'AddressExtension',
290
+ 'AddressHelper',
291
+ 'address_helper',
292
+
293
+ 'IDExtension',
294
+ 'IDHelper',
295
+ 'id_helper',
296
+
297
+ 'MetaExtension',
298
+ 'MetaHelper',
299
+ 'meta_helper',
300
+
301
+ 'DocumentExtension',
302
+ 'DocumentHelper',
303
+ 'doc_helper',
304
+
305
+ #
306
+ # General Extensions
307
+ #
308
+
309
+ 'GeneralCryptoExtension',
310
+ 'CryptoKeyHandler',
311
+ 'crypto_handler',
312
+
313
+ 'GeneralAccountExtension',
314
+ 'AccountHandler',
315
+ 'account_handler',
316
+
317
+ #
318
+ # Bundle
319
+ #
320
+
321
+ 'EncryptedBundleExtension',
322
+ 'EncryptedBundleHandler',
323
+ 'bundle_handler',
324
+
325
+ 'DefaultBundleHandler',
326
+
327
+ #
328
+ # Message
329
+ #
330
+
331
+ 'MessageExtensions',
332
+ 'shared_message_extensions',
333
+
334
+ 'EnvelopeHelper',
335
+ 'envelope_helper',
336
+
337
+ 'InstantMessageExtension',
338
+ 'InstantMessageHelper',
339
+ 'instant_helper',
340
+
341
+ 'SecureMessageExtension',
342
+ 'SecureMessageHelper',
343
+ 'secure_helper',
344
+
345
+ 'ReliableMessageExtension',
346
+ 'ReliableMessageHelper',
347
+ 'reliable_helper',
348
+
349
+ 'ContentExtension',
350
+ 'ContentHelper',
351
+ 'content_helper',
352
+
353
+ #
354
+ # General Extensions
355
+ #
356
+
357
+ 'MessageHandlerExtension',
358
+ 'MessageHandler',
359
+ 'message_handler',
360
+
361
+ #
362
+ # Transportable File
363
+ #
364
+
365
+ 'TransportableFileExtension',
366
+ 'TransportableFileHelper',
367
+ 'pnf_helper',
368
+
369
+ 'TransportableFileWrapperExtension',
370
+ 'pnf_wrapper_factory',
371
+
372
+ #
373
+ # Command
374
+ #
375
+
376
+ 'CommandExtension',
377
+ 'CommandHelper',
378
+ 'command_helper',
379
+
380
+ 'GeneralCommandExtension',
381
+ 'CommandHandler',
382
+ 'command_handler',
383
+
384
+ ]
@@ -28,10 +28,18 @@
28
28
  # SOFTWARE.
29
29
  # ==============================================================================
30
30
 
31
+ """
32
+ Cryptography
33
+ ~~~~~~~~~~~~
34
+
35
+ 1. Crypto Keys
36
+ 2. Data Digest
37
+ 3. Data Format
38
+ """
39
+
31
40
  from mkm.digest import *
32
41
  from mkm.crypto import *
33
-
34
- from .algorithms import AsymmetricAlgorithms, SymmetricAlgorithms
42
+ from dkd.crypto import *
35
43
 
36
44
 
37
45
  __all__ = [
@@ -42,28 +50,44 @@ __all__ = [
42
50
 
43
51
  'MessageDigester',
44
52
  'SHA256', 'KECCAK256', 'RIPEMD160',
45
- 'sha256', 'keccak256', 'ripemd160',
46
53
 
47
54
  #
48
55
  # Crypto
49
56
  #
50
57
 
51
- 'CryptographyKey',
52
- 'EncryptKey', 'DecryptKey', 'SignKey', 'VerifyKey',
53
- 'SymmetricKey', 'AsymmetricKey',
54
- 'PrivateKey', 'PublicKey',
58
+ 'CryptographyKey', 'EncryptKey', 'DecryptKey',
59
+ 'AsymmetricKey', 'SignKey', 'VerifyKey',
60
+ # 'CryptoExtensions',
61
+ # 'shared_crypto_extensions',
55
62
 
56
- 'SymmetricKeyFactory', 'PrivateKeyFactory', 'PublicKeyFactory',
63
+ 'SymmetricKey', 'SymmetricKeyFactory',
64
+ # 'SymmetricKeyExtension',
65
+ # 'SymmetricKeyHelper',
66
+ # 'symmetric_helper',
57
67
 
58
- # 'SymmetricKeyHelper', 'PublicKeyHelper', 'PrivateKeyHelper',
68
+ 'PublicKey', 'PublicKeyFactory',
69
+ # 'PublicKeyExtension',
70
+ # 'PublicKeyHelper',
71
+ # 'public_helper',
59
72
 
60
- # 'SymmetricKeyExtension', 'PublicKeyExtension', 'PrivateKeyExtension',
61
- # 'CryptoExtensions', 'shared_crypto_extensions',
73
+ 'PrivateKey', 'PrivateKeyFactory',
74
+ # 'PrivateKeyExtension',
75
+ # 'PrivateKeyHelper',
76
+ # 'private_helper',
77
+
78
+ #
79
+ # Encrypted Key Bundle
80
+ #
62
81
 
82
+ 'BytesMap',
63
83
 
64
- # ----------------------------------------------------------------
84
+ 'EncryptedBundle',
85
+ # 'EncryptedBundleExtension',
86
+ # 'EncryptedBundleHandler',
87
+ # 'bundle_handler',
65
88
 
89
+ 'UserEncryptedBundle',
66
90
 
67
- 'AsymmetricAlgorithms', 'SymmetricAlgorithms',
91
+ # 'DefaultBundleHandler',
68
92
 
69
93
  ]
@@ -3,7 +3,6 @@
3
3
  # DIMP : Decentralized Instant Messaging Protocol
4
4
  #
5
5
  # Written in 2019 by Moky <albert.moky@gmail.com>
6
- #
7
6
  # ==============================================================================
8
7
  # MIT License
9
8
  #
@@ -28,55 +27,33 @@
28
27
  # SOFTWARE.
29
28
  # ==============================================================================
30
29
 
31
- from mkm.protocol import *
32
- from mkm.protocol.broadcast import BroadcastAddress, Identifier
33
-
34
- from ..protocol import MetaType
35
- from ..protocol import DocumentType
36
- from ..protocol import Visa, Bulletin
37
-
38
- from .meta import BaseMeta
39
- from .document import BaseDocument
40
- from .docs import BaseVisa, BaseBulletin
41
-
42
-
43
- __all__ = [
44
-
45
- #
46
- # Protocol
47
- #
48
-
49
- 'EntityType',
50
- 'Address', 'ID',
51
- 'Meta', 'TAI', 'Document',
52
-
53
- 'AddressFactory', 'IDFactory',
54
- 'MetaFactory', 'DocumentFactory',
55
30
 
56
- 'ANYWHERE', 'EVERYWHERE',
57
- 'ANYONE', 'EVERYONE', 'FOUNDER',
58
- 'BroadcastAddress', 'Identifier',
31
+ """
32
+ Dao-Ke-Dao
33
+ ~~~~~~~~~~
59
34
 
60
- # 'AddressHelper', 'IDHelper',
61
- # 'MetaHelper', 'DocumentHelper',
35
+ Universal Message Module
36
+ """
62
37
 
63
- # 'AddressExtension', 'IDExtension',
64
- # 'MetaExtension', 'DocumentExtension',
65
- # 'AccountExtensions', 'shared_account_extensions',
38
+ from .envelope import MessageEnvelope
66
39
 
40
+ from .base import BaseMessage
41
+ from .instant import PlainMessage
42
+ from .secure import EncryptedMessage
43
+ from .reliable import NetworkMessage
67
44
 
68
- # ----------------------------------------------------------------
69
45
 
70
-
71
- 'MetaType',
72
- 'DocumentType',
73
- 'Visa', 'Bulletin',
46
+ __all__ = [
74
47
 
75
48
  #
76
- # Implementations
49
+ # Message Implementations
77
50
  #
78
51
 
79
- 'BaseMeta',
80
- 'BaseDocument', 'BaseVisa', 'BaseBulletin',
52
+ 'MessageEnvelope',
53
+
54
+ 'BaseMessage',
55
+ 'PlainMessage',
56
+ 'EncryptedMessage',
57
+ 'NetworkMessage',
81
58
 
82
59
  ]