added sneakernet auto importing

exportblocks now takes argument
This commit is contained in:
Kevin Froman 2020-03-30 03:23:59 -05:00
parent 160469f50f
commit 1bd0aa9419
17 changed files with 131 additions and 91 deletions

View file

@ -1,5 +0,0 @@
{
"name" : "metadataprocessor",
"version" : "1.0",
"author" : "onionr"
}

View file

@ -1,59 +0,0 @@
'''
Onionr - Private P2P Communication
This processes metadata for Onionr blocks
'''
'''
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
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
# useful libraries
import logger, config
import os, sys, json, time, random, shutil, base64, getpass, datetime, re
import onionrusers, onionrexceptions
from onionrutils import stringvalidators
plugin_name = 'metadataprocessor'
# event listeners
def _processForwardKey(api, myBlock):
'''
Get the forward secrecy key specified by the user for us to use
'''
peer = onionrusers.OnionrUser(myBlock.signer)
key = myBlock.getMetadata('newFSKey')
# We don't need to validate here probably, but it helps
if stringvalidators.validate_pub_key(key):
peer.addForwardKey(key)
else:
raise onionrexceptions.InvalidPubkey("%s is not a valid pubkey key" % (key,))
def on_processblocks(api, data=None):
# Generally fired by utils.
myBlock = api.data['block']
blockType = api.data['type']
# Process specific block types
# forwardKey blocks, add a new forward secrecy key for a peer
if blockType == 'forwardKey':
if api.data['validSig'] == True:
_processForwardKey(api, myBlock)
def on_init(api, data = None):
pluginapi = api
return

View file

@ -63,7 +63,7 @@
},
"transports": {
"lan": true,
"manual_disk": true,
"sneakernet": true,
"tor": true
},
"ui": {