Skip to content

Commit

Permalink
chore: add indy deprecation warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Bluhm <[email protected]>
  • Loading branch information
dbluhm committed Jul 20, 2023
1 parent 5cf9fdc commit cae6d7a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 14 deletions.
30 changes: 21 additions & 9 deletions aries_cloudagent/config/logging.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
"""Utilities related to logging."""
import asyncio
from datetime import datetime, timedelta
from io import TextIOWrapper
import logging
from logging.config import fileConfig
from logging.handlers import BaseRotatingHandler
import os
import pkg_resources
import sys
from random import randint
import re
import sys
import time as mod_time
from typing import Optional, TextIO

from datetime import datetime, timedelta
from io import TextIOWrapper
from logging.handlers import BaseRotatingHandler
from logging.config import fileConfig
from portalocker import lock, unlock, LOCK_EX
import pkg_resources
from portalocker import LOCK_EX, lock, unlock
from pythonjsonlogger import jsonlogger
from typing import Optional, TextIO

from ..config.settings import Settings
from ..core.profile import Profile
from ..version import __version__
from ..wallet.base import BaseWallet, DIDInfo

from .banner import Banner
from .base import BaseSettings

Expand Down Expand Up @@ -199,6 +199,18 @@ def print_banner(
print("Listening...")
print()

@classmethod
def print_notices(cls, settings: Settings):
"""Print notices and warnings."""
if settings.get("wallet.type", "in_memory").lower() == "indy":
print("DEPRECATTION NOTICE:", file=sys.stderr)
print(
"\tThe Indy wallet type is deprecated, use Askar instead; see: "
"https://github.com/hyperledger/aries-cloudagent-python/issues/2330",
file=sys.stderr,
)
print()


######################################################################
# Derived from
Expand Down
1 change: 1 addition & 0 deletions aries_cloudagent/core/conductor.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ async def start(self) -> None:
self.setup_public_did and self.setup_public_did.did,
self.admin_server,
)
LoggingConfigurator.print_notices(context.settings)

# record ACA-Py version in Wallet, if needed
from_version_storage = None
Expand Down
18 changes: 13 additions & 5 deletions aries_cloudagent/indy/sdk/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,24 @@

import asyncio
import logging

from typing import Any, Mapping
import warnings
from weakref import finalize, ref

from ...config.injection_context import InjectionContext
from ...config.provider import ClassProvider
from ...core.profile import Profile, ProfileManager, ProfileSession
from ...core.error import ProfileError
from ...core.profile import Profile, ProfileManager, ProfileSession
from ...ledger.base import BaseLedger
from ...ledger.indy import IndySdkLedger, IndySdkLedgerPool
from ...storage.base import BaseStorage, BaseStorageSearch
from ...storage.vc_holder.base import VCHolder
from ...wallet.base import BaseWallet
from ...wallet.indy import IndySdkWallet

from ..holder import IndyHolder
from ..issuer import IndyIssuer
from ..verifier import IndyVerifier

from .wallet_setup import IndyWalletConfig, IndyOpenWallet
from .wallet_setup import IndyOpenWallet, IndyWalletConfig

LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -191,6 +189,16 @@ async def open(
self, context: InjectionContext, config: Mapping[str, Any] = None
) -> Profile:
"""Open an instance of an existing profile."""
warnings.warn(
"Indy wallet type is deprecated, use Askar instead; see: "
"https://github.com/hyperledger/aries-cloudagent-python/issues/2330",
DeprecationWarning,
)
LOGGER.warning(
"Indy wallet type is deprecated, use Askar instead; see: "
"https://github.com/hyperledger/aries-cloudagent-python/issues/2330",
)

indy_config = IndyWalletConfig(config)
opened = await indy_config.open_wallet()
return IndySdkProfile(opened, context)

0 comments on commit cae6d7a

Please sign in to comment.