예제 #1
0
    def __init__(self,
                 name: str,
                 genesis_txn_path: str,
                 cfg: dict = None) -> None:
        """
        Initializer for node pool. Does not open the pool, only retains input parameters.

        :param name: name of the pool
        :param genesis_txn_path: path to genesis transaction file
        :param cfg: configuration, None for default;
            i.e., {
                'auto-remove': bool (default False), whether to remove serialized indy configuration data on close
            }
        """

        logger = logging.getLogger(__name__)
        logger.debug(
            'NodePool.__init__: >>> name: {}, genesis_txn_path: {}, cfg: {}'.
            format(name, genesis_txn_path, cfg))

        self._cfg = cfg or {}
        validate_config('pool', self._cfg)

        self._name = name
        self._genesis_txn_path = genesis_txn_path
        self._handle = None

        logger.debug('NodePool.__init__: <<<')
예제 #2
0
    def __init__(self, wallet: Wallet, cfg: dict = None) -> None:
        """
        Initializer for HolderProver agent. Retain input parameters; do not open wallet nor tails writer.

        :param wallet: wallet for agent use
        :param cfg: configuration dict for cache archive behaviour; e.g.,

        ::

            {
                'parse-cache-on-open': True
                'archive-cache-on-close': True,
            }

        """

        LOGGER.debug('HolderProver.__init__ >>> wallet: %s, cfg: %s', wallet,
                     cfg)

        super().__init__(wallet)
        self._link_secret = None

        self._dir_tails = join(expanduser('~'), '.indy_client', 'tails')
        makedirs(self._dir_tails, exist_ok=True)

        self._cfg = cfg or {}
        validate_config('holder-prover', self._cfg)

        self._dir_cache = join(expanduser('~'), '.indy_client', 'wallet',
                               self.wallet.name, 'cache')
        makedirs(self._dir_cache, exist_ok=True)

        LOGGER.debug('HolderProver.__init__ <<<')
예제 #3
0
    def __init__(self, name: str, genesis_txn_path: str, cfg: dict = None) -> None:
        """
        Initializer for node pool. Does not open the pool, only retains input parameters.

        :param name: name of the pool
        :param genesis_txn_path: path to genesis transaction file
        :param cfg: configuration, None for default;
            i.e., {
                'auto-remove': bool (default False), whether to remove serialized indy configuration data on close
            }
        """

        logger = logging.getLogger(__name__)
        logger.debug('NodePool.__init__: >>> name: {}, genesis_txn_path: {}, cfg: {}'.format(
            name,
            genesis_txn_path,
            cfg))

        self._cfg = cfg or {}
        validate_config('pool', self._cfg)

        # pop and retain configuration specific to von_agent.NodePool, extrinsic to indy-sdk
        self._auto_remove = self._cfg.pop('auto-remove') if self._cfg and 'auto-remove' in self._cfg else False
        if 'refresh_on_open' not in self._cfg:
            self._cfg['refresh_on_open'] = True
        if 'auto_refresh_time' not in self._cfg:
            self._cfg['auto_refresh_time'] = 0

        self._name = name
        self._genesis_txn_path = genesis_txn_path
        self._handle = None

        logger.debug('NodePool.__init__: <<<')
예제 #4
0
    def cfg(self, value: dict) -> None:
        """
        Set configuration dict

        :param value: configuration dict
        """

        self._cfg = value or {}
        validate_config('verifier', self._cfg)
예제 #5
0
    def __init__(self,
                 wallet: Wallet,
                 pool: NodePool,
                 cfg: dict = None) -> None:
        """
        Initializer for Verifier agent. Retain input parameters; do not open wallet.

        :param wallet: wallet for agent use
        :param pool: pool for agent use
        :param cfg: configuration dict for cache archive behaviour; e.g.,

        ::

            {
                'parse-cache-on-open': True,
                'archive-on-close': {
                    'schema_id': [
                        'R17v42T4pk...:2:tombstone:1.2',
                        '9cHbp54C8n...:2:business:2.0',
                        'Pcq76cx6jE...:2:birth_cert:1.0',
                        ...
                    ],
                    'cred_def_id': [
                        'R17v42T4pk...:3:CL:19:0',
                        '9cHbp54C8n...:3:CL:37:0',
                        'Pcq76cx6jE...:3:CL:51:0',
                        ...
                    ]
                    'rev_reg_id': [
                        'R17v42T4pk...:4:R17v42T4pk...:3:CL:19:0:CL_ACCUM:0',
                        'R17v42T4pk...:4:R17v42T4pk...:3:CL:19:0:CL_ACCUM:1',
                        '9cHbp54C8n...:4:9cHbp54C8n...:3:CL:37:0:CL_ACCUM:0',
                        '9cHbp54C8n...:4:9cHbp54C8n...:3:CL:37:0:CL_ACCUM:1',
                        '9cHbp54C8n...:4:9cHbp54C8n...:3:CL:37:0:CL_ACCUM:2',
                        ...
                    ]
                }
            }

        """

        LOGGER.debug('Verifier.__init__ >>> wallet: %s, pool: %s, cfg: %s',
                     wallet, pool, cfg)

        super().__init__(wallet, pool)

        self._cfg = cfg or {}
        validate_config('verifier', self._cfg)

        self._dir_cache = join(expanduser('~'), '.indy_client', 'wallet',
                               self.wallet.name, 'cache')
        makedirs(self._dir_cache, exist_ok=True)

        LOGGER.debug('HolderProver.__init__ <<<')
예제 #6
0
    def __init__(self,
                 pool_name: str,
                 seed: str,
                 name: str,
                 cfg: dict = None) -> None:
        """
        Initializer for wallet. Store input parameters and create wallet.
        Does not open until open() or __enter__().

        :param pool_name: name of pool on which wallet operates
        :param seed: seed for wallet user
        :param name: name of the wallet
        :param cfg: configuration, None for default;
            i.e., {
                'auto-remove': bool (default False), whether to remove serialized indy configuration data on close,
                ... (any other indy configuration data)
            }
        """

        logger = logging.getLogger(__name__)
        logger.debug(
            'Wallet.__init__: >>> pool_name {}, seed [SEED], name {}, cfg {}'.
            format(pool_name, name, cfg))

        self._pool_name = pool_name
        self._seed = seed
        self._name = name
        self._handle = None

        self._cfg = cfg or {}
        validate_config('wallet', self._cfg)

        self._did = None
        self._verkey = None

        logger.debug('Wallet.__init__: <<<')