Beispiel #1
0
    def __init__(self,
                 name: str,
                 protocol: Protocol = None,
                 config: dict = None) -> None:
        """
        Initializer for node pool. Does not open the pool, only retains input parameters.

        :param name: name of the pool
        :param protocol: indy-node protocol
        :param config: configuration, None for default
        """

        LOGGER.debug(
            'NodePool.__init__ >>> name: %s, protocol: %s, config: %s', name,
            protocol, config)

        self._protocol = protocol or Protocol.DEFAULT
        self._name = name
        self._handle = None
        self._config = config or {}
        validate_config('pool', self._config)

        self._cache_id = None

        LOGGER.debug('NodePool.__init__ <<<')
Beispiel #2
0
    def config(self, value: dict) -> None:
        """
        Set configuration dict

        :param value: configuration dict
        """

        validate_config('verifier', value or {})
        self._config = value or {}
Beispiel #3
0
    def __init__(self,
                 wallet: Wallet,
                 pool: NodePool = None,
                 **kwargs) -> 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 config: 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, kwargs: %s',
                     wallet, pool, kwargs)

        super().__init__(wallet, pool, **kwargs)

        self._config = kwargs.get('config', {})
        validate_config('verifier', self._config)

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

        LOGGER.debug('Verifier.__init__ <<<')
Beispiel #4
0
    def __init__(self,
                 wallet: Wallet,
                 pool: NodePool = None,
                 **kwargs) -> None:
        """
        Initializer for org hub anchor. Retain input parameters; do not open wallet.

        :param wallet: wallet for anchor use
        :param pool: pool for anchor use
        :param config: configuration dict for cache archive behaviour qua Issuer and Verifier roles; e.g.,

        ::

            {
                'parse-caches-on-open': True,
                'archive-holder-prover-caches-on-close': 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',
                        ...
                    ]
                }
            }

        :param rrbx: whether revocation registry builder is an external process
        """

        LOGGER.debug(
            'OrgHubAnchor.__init__ >>> wallet: %s, pool: %s, kwargs: %s',
            wallet, pool, kwargs)

        super().__init__(wallet, pool, **kwargs)

        self._config = kwargs.get('config', {})
        validate_config('org-hub', self._config)

        LOGGER.debug('OrgHubAnchor.__init__ <<<')
Beispiel #5
0
    def __init__(self,
                 name: str,
                 storage_type: str = None,
                 config: dict = None,
                 access_creds: dict = None) -> None:
        """
        Initializer for wallet. Store input parameters, packing name and storage_type into config.
        Do not create wallet until call to create(). Do not open until call to open() or __aenter__().

        :param name: name of the wallet
        :param storage_type: storage type (default None)
        :param config: configuration dict (default None); 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__ >>> name %s, storage_type %s, config %s, access_creds %s',
            name, storage_type, config, access_creds)

        self._next_seed = None
        self._handle = None

        self._config = {**config} if config else {}
        self._config['id'] = name
        self._config['storage_type'] = storage_type
        if 'freshness_time' not in self._config:
            self._config['freshness_time'] = 0

        validate_config('wallet', self._config)

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

        self._access_creds = access_creds
        self._did = None
        self._verkey = None

        LOGGER.debug('Wallet.__init__ <<<')