Skip to content

Commit

Permalink
refactor: rearrange packages
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Bluhm <[email protected]>
  • Loading branch information
dbluhm committed Jun 6, 2024
1 parent 0ed568d commit b56127a
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""V1 DIDComm v1 Interfaces.
"""DIDComm v1 Interfaces.
These components are intended to provide a similar structure to the DIDComm v2
interfaces provided by this library. While the community is transitioning from
Expand Down
10 changes: 10 additions & 0 deletions didcomm_messaging/v1/crypto/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""V1 DIDComm Crypto interfaces.
These components are intended to provide a similar structure to the DIDComm v2
interfaces provided by this library. While the community is transitioning from
DIDComm v1 to v2, having a consistent interface to interact with will help
implementers to support both versions until the transition is complete.
It is expected that a future version of this library will eventually remove
these interfaces.
"""
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from pydid import VerificationMethod

from didcomm_messaging.crypto.jwe import JweBuilder, JweEnvelope, JweRecipient
from didcomm_messaging.legacy.base import (
from .base import (
V1CryptoService,
V1UnpackResult,
RecipData,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import nacl.utils
except ImportError as err:
raise ImportError(
"V1 implementation requires 'legacy' extra to be installed"
"V1 nacl implementation requires 'nacl' extra to be installed"
) from err


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
from pydid.service import DIDCommV1Service

from didcomm_messaging.crypto import P, S, SecretsManager
from didcomm_messaging.legacy.base import V1CryptoService
from didcomm_messaging.legacy.packaging import V1PackagingService
from didcomm_messaging.v1.crypto.base import V1CryptoService
from didcomm_messaging.v1.packaging import V1PackagingService
from didcomm_messaging.resolver import DIDResolver


class V1DIDCommMessagingError(Exception):
"""Raised on error in legacy didcomm messaging."""
"""Raised on error in v1 didcomm messaging."""


@dataclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from didcomm_messaging.crypto.base import P, S, SecretsManager
from didcomm_messaging.crypto.jwe import JweEnvelope, JweRecipient
from didcomm_messaging.legacy.base import (
from didcomm_messaging.v1.crypto.base import (
V1CryptoService,
V1UnpackResult,
RecipData,
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ legacy = [
"msgpack>=1.0.8",
"PyNaCl>=1.5.0",
]
nacl = [
"msgpack>=1.0.8",
"PyNaCl>=1.5.0",
]

[build-system]
requires = ["pdm-backend"]
Expand Down
2 changes: 1 addition & 1 deletion tests/legacy/test_crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest
from didcomm_messaging.legacy import crypto
from didcomm_messaging.legacy.nacl import KeyPair
from didcomm_messaging.v1.crypto.nacl import KeyPair


@pytest.fixture
Expand Down
Empty file added tests/v1/__init__.py
Empty file.
14 changes: 7 additions & 7 deletions tests/legacy/conftest.py → tests/v1/conftest.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
from aries_askar import Key, KeyAlg, Store
import base58
from did_peer_4.input_doc import KeySpec, input_doc_from_keys_and_services
import did_peer_4
from did_peer_4.input_doc import KeySpec, input_doc_from_keys_and_services
import pytest
import pytest_asyncio

from didcomm_messaging.crypto.backend.askar import AskarKey, AskarSecretsManager
from didcomm_messaging.legacy.askar import AskarV1CryptoService, AskarSecretKey
from didcomm_messaging.legacy.messaging import V1DIDCommMessaging
from didcomm_messaging.legacy.nacl import (
from didcomm_messaging.resolver import DIDResolver
from didcomm_messaging.resolver.peer import Peer4
from didcomm_messaging.v1.crypto.askar import AskarSecretKey, AskarV1CryptoService
from didcomm_messaging.v1.crypto.nacl import (
EdPublicKey,
InMemSecretsManager,
KeyPair,
NaclV1CryptoService,
)
from didcomm_messaging.legacy.packaging import V1PackagingService
from didcomm_messaging.resolver import DIDResolver
from didcomm_messaging.resolver.peer import Peer4
from didcomm_messaging.v1.messaging import V1DIDCommMessaging
from didcomm_messaging.v1.packaging import V1PackagingService


@pytest.fixture
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from didcomm_messaging.crypto.base import SecretKey
from didcomm_messaging.legacy.messaging import V1DIDCommMessaging
from didcomm_messaging.v1.messaging import V1DIDCommMessaging


@pytest.mark.asyncio
Expand Down

0 comments on commit b56127a

Please sign in to comment.