moving onionrutils over to ujson
This commit is contained in:
parent
37913d544b
commit
a8ab5d20f1
@ -1,9 +1,11 @@
|
||||
'''
|
||||
Onionr - Private P2P Communication
|
||||
"""Onionr - Private P2P Communication.
|
||||
|
||||
Return a useful tuple of (metadata (header), meta, and data) by accepting raw block data
|
||||
'''
|
||||
'''
|
||||
"""
|
||||
import ujson as json
|
||||
|
||||
from onionrutils import bytesconverter
|
||||
"""
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
@ -16,17 +18,15 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
'''
|
||||
"""
|
||||
|
||||
import json
|
||||
|
||||
from onionrutils import bytesconverter
|
||||
def get_block_metadata_from_data(block_data):
|
||||
'''
|
||||
accepts block contents as string, returns a tuple of
|
||||
metadata, meta (meta being internal metadata, which will be
|
||||
"""
|
||||
accepts block contents as string, returns a tuple of
|
||||
metadata, meta (meta being internal metadata, which will be
|
||||
returned as an encrypted base64 string if it is encrypted, dict if not).
|
||||
'''
|
||||
"""
|
||||
meta = {}
|
||||
metadata = {}
|
||||
data = block_data
|
||||
|
@ -1,8 +1,13 @@
|
||||
"""
|
||||
Onionr - Private P2P Communication
|
||||
"""Onionr - Private P2P Communication.
|
||||
|
||||
validate new block's metadata
|
||||
validate new block's metadata
|
||||
"""
|
||||
import ujson as json
|
||||
|
||||
import logger, onionrexceptions
|
||||
from etc import onionrvalues
|
||||
from . import stringvalidators, epoch, bytesconverter
|
||||
import config, filepaths, onionrcrypto
|
||||
"""
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -17,11 +22,7 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
import json
|
||||
import logger, onionrexceptions
|
||||
from etc import onionrvalues
|
||||
from . import stringvalidators, epoch, bytesconverter
|
||||
import config, filepaths, onionrcrypto
|
||||
|
||||
|
||||
def validate_metadata(metadata, block_data) -> bool:
|
||||
"""Validate metadata meets onionr spec (does not validate proof value computation), take in either dictionary or json string"""
|
||||
|
Loading…
Reference in New Issue
Block a user