Exemplo n.º 1
0
    def cfg(self, value: dict) -> None:
        """
        Set configuration dict

        :param value: configuration dict
        """

        self._cfg = value or {}
        validate_config('verifier', self._cfg)
Exemplo n.º 2
0
    def __init__(self,
                 wallet: Wallet,
                 pool: NodePool,
                 cfg: dict = None) -> None:
        """
        Initializer for Verifier anchor. Retain input parameters; do not open wallet.

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

        ::

            {
                'parse-caches-on-open': True,
                'archive-verifier-caches-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:tag',
                        '9cHbp54C8n...:3:CL:37:tag',
                        'Pcq76cx6jE...:3:CL:51:tag',
                        ...
                    ]
                    'rev_reg_id': [
                        'R17v42T4pk...:4:R17v42T4pk...:3:CL:19:tag:CL_ACCUM:0',
                        'R17v42T4pk...:4:R17v42T4pk...:3:CL:19:tag:CL_ACCUM:1',
                        '9cHbp54C8n...:4:9cHbp54C8n...:3:CL:37:tag:CL_ACCUM:0',
                        '9cHbp54C8n...:4:9cHbp54C8n...:3:CL:37:tag:CL_ACCUM:1',
                        '9cHbp54C8n...:4:9cHbp54C8n...:3:CL:37:tag: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', 'cache',
                               self.wallet.name)
        makedirs(self._dir_cache, exist_ok=True)

        LOGGER.debug('Verifier.__init__ <<<')
Exemplo n.º 3
0
    def __init__(
            self,
            seed: str,
            name: str,
            wallet_type: str = None,
            cfg: dict = None,
            access_creds: dict = None) -> None:
        """
        Initializer for wallet. Store input parameters, packing name and wallet_type into cfg (the
        signature retains them independently as a convenience and to retain compatibility with prior releases).
        Do not create wallet until call to create(). Do not open until call to open() or __aenter__().

        :param seed: seed for wallet user
        :param name: name of the wallet
        :param wallet_type: wallet type str, None for default
        :param cfg: configuration dict, None for default; i.e.,
            ::
            {
                'auto-remove': bool (default False) - whether to remove serialized indy configuration data on close,
                ... (more keys) : ... (more types) - any other configuration data to pass through to indy-sdk
            }
        :param access_creds: wallet access credentials dict, None for default
        """

        LOGGER.debug(
            'Wallet.__init__ >>> seed [SEED], name %s, wallet_type %s, cfg %s, access_creds %s',
            name,
            wallet_type,
            cfg,
            access_creds)

        self._seed = seed
        self._next_seed = None
        self._handle = None

        self._cfg = cfg or {}
        self._cfg['id'] = name
        self._cfg['storage_type'] = wallet_type or 'default'
        if 'freshness_time' not in self._cfg:
            self._cfg['freshness_time'] = 0

        validate_config('wallet', self._cfg)

        # pop and retain configuration specific to von_anchor.Wallet, extrinsic to indy-sdk
        self._auto_remove = self._cfg.pop('auto-remove') if self._cfg and 'auto-remove' in self._cfg else False

        self._access_creds = access_creds or Wallet.DEFAULT_ACCESS_CREDS
        self._did = None
        self._verkey = None
        self._created = False

        LOGGER.debug('Wallet.__init__ <<<')
Exemplo n.º 4
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
                'protocol': str ('1.3' or '1.4', default '1.4), indy protocol version
            }
        """

        LOGGER.debug(
            'NodePool.__init__ >>> name: %s, genesis_txn_path: %s, cfg: %s',
            name, genesis_txn_path, cfg)

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

        # pop and retain configuration specific to von_anchor.NodePool, extrinsic to indy-sdk
        self._auto_remove = self._cfg.pop(
            'auto-remove'
        ) if self._cfg and 'auto-remove' in self._cfg else False
        self._protocol = Protocol.value_of(self._cfg.pop('protocol', None))
        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__ <<<')