mirror of https://github.com/nucypher/nucypher.git
Relocate keypairs.py from datastore to crypto
parent
064972e800
commit
0fb2cad64a
|
@ -28,9 +28,9 @@ from umbral.keys import UmbralPublicKey
|
|||
|
||||
from nucypher.characters.lawful import Bob, Enrico, Ursula
|
||||
from nucypher.config.constants import TEMPORARY_DOMAIN
|
||||
from nucypher.crypto.keypairs import DecryptingKeypair, SigningKeypair
|
||||
from nucypher.crypto.kits import UmbralMessageKit
|
||||
from nucypher.crypto.powers import DecryptingPower, SigningPower
|
||||
from nucypher.datastore.keypairs import DecryptingKeypair, SigningKeypair
|
||||
from nucypher.network.middleware import RestMiddleware
|
||||
from nucypher.utilities.logging import GlobalLoggerSettings
|
||||
|
||||
|
|
|
@ -67,11 +67,11 @@ from nucypher.cli.processes import UrsulaCommandProtocol
|
|||
from nucypher.config.storages import ForgetfulNodeStorage, NodeStorage
|
||||
from nucypher.crypto.api import encrypt_and_sign, keccak_digest
|
||||
from nucypher.crypto.constants import PUBLIC_KEY_LENGTH
|
||||
from nucypher.crypto.keypairs import HostingKeypair
|
||||
from nucypher.crypto.kits import UmbralMessageKit
|
||||
from nucypher.crypto.powers import DecryptingPower, DelegatingPower, PowerUpError, SigningPower, TransactingPower
|
||||
from nucypher.crypto.signing import InvalidSignature
|
||||
from nucypher.datastore.datastore import DatastoreTransactionError, RecordNotFound
|
||||
from nucypher.datastore.keypairs import HostingKeypair
|
||||
from nucypher.datastore.models import PolicyArrangement
|
||||
from nucypher.network.exceptions import NodeSeemsToBeDown
|
||||
from nucypher.network.middleware import RestMiddleware
|
||||
|
|
|
@ -26,8 +26,8 @@ from nucypher.blockchain.eth.decorators import validate_checksum_address
|
|||
from nucypher.blockchain.eth.interfaces import BlockchainInterface, BlockchainInterfaceFactory
|
||||
from nucypher.blockchain.eth.signers.software import Web3Signer
|
||||
from nucypher.blockchain.eth.signers.base import Signer
|
||||
from nucypher.datastore import keypairs
|
||||
from nucypher.datastore.keypairs import DecryptingKeypair, SigningKeypair
|
||||
from nucypher.crypto import keypairs
|
||||
from nucypher.crypto.keypairs import DecryptingKeypair, SigningKeypair
|
||||
|
||||
|
||||
class PowerUpError(TypeError):
|
||||
|
|
|
@ -23,7 +23,6 @@ from bytestring_splitter import BytestringSplitter
|
|||
from constant_sorrow import constants
|
||||
from constant_sorrow.constants import FLEET_STATES_MATCH, NO_BLOCKCHAIN_CONNECTION, NO_KNOWN_NODES
|
||||
from flask import Flask, Response, jsonify, request
|
||||
from hendrix.experience import crosstown_traffic
|
||||
from jinja2 import Template, TemplateError
|
||||
from typing import Tuple, Set
|
||||
from umbral.keys import UmbralPublicKey
|
||||
|
@ -33,12 +32,12 @@ from web3.exceptions import TimeExhausted
|
|||
import nucypher
|
||||
from nucypher.config.constants import MAX_UPLOAD_CONTENT_LENGTH
|
||||
from nucypher.config.storages import ForgetfulNodeStorage
|
||||
from nucypher.crypto.keypairs import HostingKeypair
|
||||
from nucypher.crypto.kits import UmbralMessageKit
|
||||
from nucypher.crypto.powers import KeyPairBasedPower, PowerUpError
|
||||
from nucypher.crypto.signing import InvalidSignature
|
||||
from nucypher.crypto.utils import canonical_address_from_umbral_key
|
||||
from nucypher.datastore.datastore import Datastore, RecordNotFound, DatastoreTransactionError
|
||||
from nucypher.datastore.keypairs import HostingKeypair
|
||||
from nucypher.datastore.models import PolicyArrangement, Workorder
|
||||
from nucypher.network import LEARNING_LOOP_VERSION
|
||||
from nucypher.network.exceptions import NodeSeemsToBeDown
|
||||
|
|
|
@ -235,7 +235,7 @@ mock_metadata_validation = patch("nucypher.network.nodes.Teacher.validate_metada
|
|||
|
||||
@contextmanager
|
||||
def mock_secret_source(*args, **kwargs):
|
||||
with patch("nucypher.datastore.keypairs.Keypair._private_key_source", new=lambda *args, **kwargs: NotAPrivateKey()):
|
||||
with patch("nucypher.crypto.keypairs.Keypair._private_key_source", new=lambda *args, **kwargs: NotAPrivateKey()):
|
||||
yield
|
||||
NotAPublicKey.reset()
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import sha3
|
|||
from constant_sorrow.constants import PUBLIC_ONLY
|
||||
from umbral.keys import UmbralPrivateKey
|
||||
|
||||
from nucypher.datastore import keypairs
|
||||
from nucypher.crypto import keypairs
|
||||
|
||||
|
||||
def test_gen_keypair_if_needed():
|
||||
|
|
|
@ -21,10 +21,12 @@ import pytest
|
|||
import tempfile
|
||||
from datetime import datetime
|
||||
|
||||
from nucypher.datastore import datastore, keypairs
|
||||
from nucypher.crypto import keypairs
|
||||
from nucypher.datastore import datastore
|
||||
from nucypher.datastore.base import DatastoreRecord, RecordField
|
||||
from nucypher.datastore.models import PolicyArrangement, Workorder
|
||||
|
||||
|
||||
class TestRecord(DatastoreRecord):
|
||||
_test = RecordField(bytes)
|
||||
_test_date = RecordField(datetime,
|
||||
|
@ -152,6 +154,7 @@ def test_datastore_describe():
|
|||
with storage.describe(TestRecord, 'new_id') as new_test_record:
|
||||
assert new_test_record.test == b'now it exists :)'
|
||||
|
||||
|
||||
def test_datastore_query_by():
|
||||
temp_path = tempfile.mkdtemp()
|
||||
storage = datastore.Datastore(temp_path)
|
||||
|
@ -250,6 +253,7 @@ def test_datastore_query_by():
|
|||
with pytest.raises(datastore.RecordNotFound):
|
||||
with storage.query_by(NoRecord, writeable=True) as records:
|
||||
assert len(records) == 'this never gets executed'
|
||||
|
||||
|
||||
def test_datastore_record_read():
|
||||
db_env = lmdb.open(tempfile.mkdtemp())
|
||||
|
|
Loading…
Reference in New Issue