Skip to content

Commit

Permalink
Use secrets in CI pipelines + update type aliases
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Shenshin <[email protected]>
  • Loading branch information
AlexanderShenshin committed Jan 27, 2025
1 parent d075928 commit 7dd5cd9
Show file tree
Hide file tree
Showing 9 changed files with 2,158 additions and 2,248 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
python-version: ["3.12", "3.13"]
fail-fast: false
defaults:
run:
Expand All @@ -45,6 +45,9 @@ jobs:

- name: Run tests
run: poetry run pytest tests --cov --cov-config=pyproject.toml --cov-report=xml
env:
OPERATOR_ID: 0.0.5065521
OPERATOR_KEY: 302a300506032b6570032100f32f7379f50d72ca6d501da611e2723b24528802983d16b5990255419e2eb2db

- name: Check typing
run: poetry run pyright
Expand Down
4 changes: 2 additions & 2 deletions did_sdk_py/anoncreds/types.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from dataclasses import dataclass
from typing import Literal, TypeAlias
from typing import Literal

from .models import AnonCredsCredDef, AnonCredsRevList, AnonCredsRevRegDef, AnonCredsSchema

ObjectState: TypeAlias = Literal["finished", "failed", "action", "wait"]
ObjectState = Literal["finished", "failed", "action", "wait"]


@dataclass(frozen=True)
Expand Down
8 changes: 4 additions & 4 deletions did_sdk_py/did/types.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from typing import Literal, TypeAlias
from typing import Literal

from did_resolver import DIDDocument, DIDResolutionResult
from did_resolver.resolver import DIDDocumentMetadata

DidServiceType: TypeAlias = Literal["LinkedDomains", "DIDCommMessaging"]
DidServiceType = Literal["LinkedDomains", "DIDCommMessaging"]

SupportedKeyType: TypeAlias = Literal["Ed25519VerificationKey2018", "EcdsaSecp256k1VerificationKey2019"]
SupportedKeyType = Literal["Ed25519VerificationKey2018", "EcdsaSecp256k1VerificationKey2019"]

VerificationRelationshipType: TypeAlias = Literal[
VerificationRelationshipType = Literal[
"authentication", "assertionMethod", "keyAgreement", "capabilityInvocation", "capabilityDelegation"
]

Expand Down
3 changes: 1 addition & 2 deletions did_sdk_py/hcs/hcs_topic_service.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from dataclasses import dataclass
from typing import TypeAlias

from hedera import (
Hbar,
Expand All @@ -16,7 +15,7 @@
from .constants import MAX_TRANSACTION_FEE
from .utils import execute_hcs_query_async, execute_hcs_transaction_async, sign_hcs_transaction_async

TopicTransaction: TypeAlias = TopicCreateTransaction | TopicUpdateTransaction
TopicTransaction: type = TopicCreateTransaction | TopicUpdateTransaction


@dataclass(frozen=True)
Expand Down
4 changes: 2 additions & 2 deletions did_sdk_py/hedera_client_provider.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from dataclasses import dataclass
from typing import Literal, TypeAlias
from typing import Literal

from hedera import AccountId, Client, PrivateKey

from .utils.serializable import Serializable

NetworkName: TypeAlias = Literal["mainnet", "testnet", "previewnet"]
NetworkName = Literal["mainnet", "testnet", "previewnet"]


@dataclass(frozen=True)
Expand Down
4 changes: 2 additions & 2 deletions did_sdk_py/utils/logger.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import logging
import re
from typing import Literal, TypeAlias
from typing import Literal

LogLevel: TypeAlias = Literal["DEBUG", "INFO", "WARN", "ERROR"]
LogLevel = Literal["DEBUG", "INFO", "WARN", "ERROR"]


def configure_logger(logger, log_level: LogLevel | None, log_format: str | None):
Expand Down
4,374 changes: 2,141 additions & 2,233 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/integration/test_hedera_did.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async def test_creates_new_did(self, client_provider: HederaClientProvider):
did = await create_and_register_new_did(client_provider)
assert did.topic_id

expected_identifier = f"did:hedera:testnet:{multibase_encode(bytes(OPERATOR_KEY.getPublicKey().toBytesRaw()), 'base58btc')}_{did.topic_id}"
expected_identifier = f"did:hedera:testnet:{multibase_encode(bytes(OPERATOR_KEY.getPublicKey().toBytesRaw()), "base58btc")}_{did.topic_id}"

assert bool(TOPIC_REGEX.match(did.topic_id))
assert did.identifier == expected_identifier
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/did/test_did_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ async def test_handle_did_delete_event(self, test_key):
async def test_handle_change_did_owner_event(self, test_key):
"""handles change DID owner event"""
other_owner_key = PrivateKey.generate()
other_owner_identifier = f"did:hedera:testnet:{multibase_encode(bytes(other_owner_key.getPublicKey().toBytes()), 'base58btc')}_0.0.29999999"
other_owner_identifier = f"did:hedera:testnet:{multibase_encode(bytes(other_owner_key.getPublicKey().toBytes()), "base58btc")}_0.0.29999999"

key2 = PrivateKey.generate()
key2_type = get_key_type(key2)
Expand Down

0 comments on commit 7dd5cd9

Please sign in to comment.