code string | signature string | docstring string | loss_without_docstring float64 | loss_with_docstring float64 | factor float64 |
|---|---|---|---|---|---|
LOGGER.debug('SchemaCache.index >>>')
rv = self._seq_no2schema_key
LOGGER.debug('SchemaCache.index <<< %s', rv)
return rv | def index(self) -> dict | Return dict mapping content sequence numbers to schema keys.
:return: dict mapping sequence numbers to schema keys | 12.300857 | 6.868917 | 1.7908 |
LOGGER.debug('SchemaCache.schema_key_for >>> seq_no: %s', seq_no)
rv = self._seq_no2schema_key.get(seq_no, None)
LOGGER.debug('SchemaCache.schema_key_for <<< %s', rv)
return rv | def schema_key_for(self, seq_no: int) -> SchemaKey | Get schema key for schema by sequence number if known, None for no such schema in cache.
:param seq_no: sequence number
:return: corresponding schema key or None | 3.067198 | 2.6512 | 1.156909 |
LOGGER.debug('SchemaCache.schemata >>>')
LOGGER.debug('SchemaCache.schemata <<<')
return [self._schema_key2schema[seq_no] for seq_no in self._schema_key2schema] | def schemata(self) -> list | Return list with schemata in cache.
:return: list of schemata | 6.600978 | 5.560213 | 1.187181 |
LOGGER.debug('SchemaCache.clear >>>')
self._schema_key2schema = {}
self._seq_no2schema_key = {}
LOGGER.debug('SchemaCache.clear <<<') | def clear(self) -> None | Clear the cache. | 8.446942 | 7.111752 | 1.187744 |
LOGGER.debug(
'RevoCacheEntry.get_delta_json >>> rr_delta_builder: %s, fro: %s, to: %s',
rr_delta_builder.__name__,
fro,
to)
rv = await self._get_update(rr_delta_builder, fro, to, True)
LOGGER.debug('RevoCacheEntry.get_delta_json <<< %s'... | async def get_delta_json(
self,
rr_delta_builder: Callable[['HolderProver', str, int, int, dict], Awaitable[Tuple[str, int]]],
fro: int,
to: int) -> (str, int) | Get rev reg delta json, and its timestamp on the distributed ledger,
from cached rev reg delta frames list or distributed ledger,
updating cache as necessary.
Raise BadRevStateTime if caller asks for a delta to the future.
On return of any previously existing rev reg delta frame, alway... | 2.808626 | 2.8879 | 0.972549 |
LOGGER.debug(
'RevoCacheEntry.get_state_json >>> rr_state_builder: %s, fro: %s, to: %s',
rr_state_builder.__name__,
fro,
to)
rv = await self._get_update(rr_state_builder, fro, to, False)
LOGGER.debug('RevoCacheEntry.get_state_json <<< %s... | async def get_state_json(
self,
rr_state_builder: Callable[['Verifier', str, int], Awaitable[Tuple[str, int]]],
fro: int,
to: int) -> (str, int) | Get rev reg state json, and its timestamp on the distributed ledger,
from cached rev reg state frames list or distributed ledger,
updating cache as necessary.
Raise BadRevStateTime if caller asks for a state in the future.
On return of any previously existing rev reg state frame, alway... | 2.913775 | 2.878708 | 1.012182 |
LOGGER.debug('clear >>>')
with SCHEMA_CACHE.lock:
SCHEMA_CACHE.clear()
with CRED_DEF_CACHE.lock:
CRED_DEF_CACHE.clear()
with REVO_CACHE.lock:
REVO_CACHE.clear()
LOGGER.debug('clear <<<') | def clear() -> None | Clear all archivable caches in memory. | 4.377911 | 3.712078 | 1.179369 |
LOGGER.debug('archive >>> base_dir: %s', base_dir)
rv = int(time())
timestamp_dir = join(base_dir, str(rv))
makedirs(timestamp_dir, exist_ok=True)
with SCHEMA_CACHE.lock:
with open(join(timestamp_dir, 'schema'), 'w') as archive:
print(json.... | def archive(base_dir: str) -> int | Archive schema, cred def, revocation caches to disk as json.
:param base_dir: archive base directory
:return: timestamp (epoch seconds) used as subdirectory | 2.436935 | 2.107322 | 1.156414 |
LOGGER.debug('purge_archives >>> base_dir: %s, retain_latest: %s', base_dir, retain_latest)
if isdir(base_dir):
timestamps = sorted([int(t) for t in listdir(base_dir) if t.isdigit()])
if retain_latest and timestamps:
timestamps.pop()
for tim... | def purge_archives(base_dir: str, retain_latest: bool = False) -> None | Erase all (or nearly all) cache archives.
:param base_dir: archive base directory
:param retain_latest: retain latest archive if present, purge all others | 2.6843 | 2.413689 | 1.112115 |
rv = {
canon_pairwise_tag(tag): raw(pairwise.metadata[tag]) for tag in pairwise.metadata or {}
}
rv['~their_did'] = pairwise.their_did
rv['~their_verkey'] = pairwise.their_verkey
rv['~my_did'] = pairwise.my_did
rv['~my_verkey'] = pairwise.my_verkey
if not StorageRecord.ok_tags... | def pairwise_info2tags(pairwise: PairwiseInfo) -> dict | Given pairwise info with metadata mapping tags to values, return corresponding
indy-sdk non_secrets record tags dict to store same in wallet (via non_secrets)
unencrypted (for WQL search options). Canonicalize metadata values to strings via
raw() for WQL fitness.
Raise BadRecord if metadata does not c... | 4.945764 | 3.418523 | 1.446754 |
return PairwiseInfo(
storec.id, # = their did
storec.value, # = their verkey
storec.tags['~my_did'],
storec.tags['~my_verkey'],
{
tag[tag.startswith('~'):]: storec.tags[tag] for tag in (storec.tags or {}) # strip any leading '~'
}) | def storage_record2pairwise_info(storec: StorageRecord) -> PairwiseInfo | Given indy-sdk non_secrets implementation of pairwise storage record dict, return corresponding PairwiseInfo.
:param storec: (non-secret) storage record to convert to PairwiseInfo
:return: PairwiseInfo on record DIDs, verkeys, metadata | 6.51721 | 5.904422 | 1.103784 |
assert {'name', 'id'} & {k for k in config}
return {
'id': config.get('name', config.get('id')),
'storage_type': config.get('storage_type', self.default_storage_type),
'freshness_time': config.get('freshness_time', self.default_freshness_time)
} | def _config2indy(self, config: dict) -> dict | Given a configuration dict with indy and possibly more configuration values, return the
corresponding indy wallet configuration dict from current default and input values.
:param config: input configuration
:return: configuration dict for indy wallet | 3.882448 | 3.491819 | 1.11187 |
rv = {k: config.get(k, self._defaults[k]) for k in ('auto_create', 'auto_remove')}
rv['access'] = access or self.default_access
for key in ('seed', 'did', 'link_secret_label'):
if key in config:
rv[key] = config[key]
return rv | def _config2von(self, config: dict, access: str = None) -> dict | Given a configuration dict with indy and possibly more configuration values, return the
corresponding VON wallet configuration dict from current default and input values.
:param config: input configuration
:param access: access credentials value
:return: configuration dict for VON walle... | 5.411078 | 4.074049 | 1.328182 |
LOGGER.debug('WalletManager.create >>> config %s, access %s, replace %s', config, access, replace)
assert {'name', 'id'} & {k for k in config}
wallet_name = config.get('name', config.get('id'))
if replace:
von_wallet = self.get(config, access)
if not aw... | async def create(self, config: dict = None, access: str = None, replace: bool = False) -> Wallet | Create wallet on input name with given configuration and access credential value.
Raise ExtantWallet if wallet on input name exists already and replace parameter is False.
Raise BadAccess on replacement for bad access credentials value.
FAIR WARNING: specifying replace=True attempts to remove ... | 3.963847 | 3.198076 | 1.239448 |
LOGGER.debug('WalletManager.get >>> config %s, access %s', config, access)
rv = Wallet(
self._config2indy(config),
self._config2von(config, access))
LOGGER.debug('WalletManager.get <<< %s', rv)
return rv | def get(self, config: dict, access: str = None) -> Wallet | Instantiate and return VON anchor wallet object on given configuration, respecting wallet manager
default configuration values.
:param config: configuration data for both indy-sdk and VON anchor wallet:
- 'name' or 'id': wallet name
- 'storage_type': storage type
- ... | 5.824901 | 4.672369 | 1.24667 |
LOGGER.debug('WalletManager.reseed_local >>> local_wallet %s', local_wallet)
await local_wallet.reseed_init(next_seed)
rv = await local_wallet.reseed_apply()
LOGGER.debug('WalletManager.reseed_local <<< %s', rv)
return rv | async def reseed_local(self, local_wallet: Wallet, next_seed: str = None) -> DIDInfo | Generate and apply new key, in wallet only, for local DID based on input seed (default random).
Raise WalletState if wallet is closed.
Note that this operation does not update the corresponding NYM on the ledger: for VON anchors
anchored to the ledger, use von_anchor.BaseAnchor.reseed().
... | 4.27451 | 3.873799 | 1.103441 |
LOGGER.debug('WalletManager.export_wallet >>> von_wallet %s, path %s', von_wallet, path)
if not von_wallet.handle:
LOGGER.debug('WalletManager.export_wallet <!< Wallet %s is closed', von_wallet.name)
raise WalletState('Wallet {} is closed'.format(von_wallet.name))
... | async def export_wallet(self, von_wallet: Wallet, path: str) -> None | Export an existing VON anchor wallet. Raise WalletState if wallet is closed.
:param von_wallet: open wallet
:param path: path to which to export wallet | 3.730546 | 3.011771 | 1.238655 |
LOGGER.debug('WalletManager.import_wallet >>> indy_config %s, path: %s', indy_config, path)
try:
await wallet.import_wallet(
json.dumps(indy_config),
json.dumps({'key': access or self.default_access}),
json.dumps({'path': path, 'key'... | async def import_wallet(self, indy_config: dict, path: str, access: str = None) -> None | Import a VON anchor wallet. Raise BadAccess on bad access credential value.
:param indy_config: indy wallet configuration to use, with:
- 'id'
- 'storage_type' (optional)
- 'storage_config' (optional)
:param path: path from which to import wallet file
:para... | 2.613663 | 2.29867 | 1.137033 |
LOGGER.debug('WalletManager.reset >>> von_wallet %s', von_wallet)
if not von_wallet.handle:
LOGGER.debug('WalletManager.reset <!< Wallet %s is closed', von_wallet.name)
raise WalletState('Wallet {} is closed'.format(von_wallet.name))
w_config = von_wallet.conf... | async def reset(self, von_wallet: Wallet, seed: str = None) -> Wallet | Close and delete (open) VON anchor wallet and then create, open, and return
replacement on current link secret.
Note that this operation effectively destroys private keys for keyed data
structures such as credential offers or credential definitions.
Raise WalletState if the wallet is c... | 4.137765 | 3.544917 | 1.167239 |
LOGGER.debug('WalletManager.remove >>> wallet %s', von_wallet)
await von_wallet.remove()
LOGGER.debug('WalletManager.remove <<<') | async def remove(self, von_wallet: Wallet) -> None | Remove serialized wallet if it exists. Raise WalletState if wallet is open.
:param von_wallet: (closed) wallet to remove | 6.199957 | 5.512574 | 1.124694 |
LOGGER.debug(
'WalletManager.register_storage_library >>> storage_type %s, c_library %s, entry_point %s',
storage_type,
c_library,
entry_point)
try:
stg_lib = CDLL(c_library)
result = stg_lib[entry_point]()
if... | async def register_storage_library(storage_type: str, c_library: str, entry_point: str) -> None | Load a wallet storage plug-in.
An indy-sdk wallet storage plug-in is a shared library; relying parties must explicitly
load it before creating or opening a wallet with the plug-in.
The implementation loads a dynamic library and calls an entry point; internally,
the plug-in calls the in... | 2.766637 | 2.586195 | 1.069771 |
if not invalidate:
return
if kwargs.get("raw", False):
return
if sender is MigrationRecorder.Migration:
return
if issubclass(sender, Model):
obj = kwargs["instance"]
if isinstance(obj, Model):
# get_for_model itself is cached
try:
... | def on_post_save(sender, **kwargs) | Expire ultracache cache keys affected by this object | 2.890828 | 2.750111 | 1.051168 |
if not invalidate:
return
if kwargs.get("raw", False):
return
if sender is MigrationRecorder.Migration:
return
if issubclass(sender, Model):
obj = kwargs["instance"]
if isinstance(obj, Model):
# get_for_model itself is cached
try:
... | def on_post_delete(sender, **kwargs) | Expire ultracache cache keys affected by this object | 4.648169 | 4.298223 | 1.081416 |
LOGGER.debug('Wallet.create_signing_key >>> seed: [SEED], metadata: %s', metadata)
if not self.handle:
LOGGER.debug('Wallet.create_signing_key <!< Wallet %s is closed', self.name)
raise WalletState('Wallet {} is closed'.format(self.name))
try:
verk... | async def create_signing_key(self, seed: str = None, metadata: dict = None) -> KeyInfo | Create a new signing key pair.
Raise WalletState if wallet is closed, ExtantRecord if verification key already exists.
:param seed: optional seed allowing deterministic key creation
:param metadata: optional metadata to store with key pair
:return: KeyInfo for new key pair | 2.879786 | 2.306201 | 1.248714 |
LOGGER.debug('Wallet.get_signing_key >>> seed: [SEED], verkey: %s', verkey)
if not self.handle:
LOGGER.debug('Wallet.get_signing_key <!< Wallet %s is closed', self.name)
raise WalletState('Wallet {} is closed'.format(self.name))
try:
metadata = awa... | async def get_signing_key(self, verkey: str) -> KeyInfo | Get signing key pair for input verification key.
Raise WalletState if wallet is closed, AbsentRecord for no such key pair.
:param verkey: verification key of key pair
:return: KeyInfo for key pair | 2.646971 | 2.27963 | 1.161141 |
LOGGER.debug('Wallet.create_local_did >>> seed: [SEED] loc_did: %s metadata: %s', loc_did, metadata)
cfg = {}
if seed:
cfg['seed'] = seed
if loc_did:
cfg['did'] = loc_did
if not self.handle:
LOGGER.debug('Wallet.create_local_did <!<... | async def create_local_did(self, seed: str = None, loc_did: str = None, metadata: dict = None) -> DIDInfo | Create and store a new local DID for use in pairwise DID relations.
:param seed: seed from which to create (default random)
:param loc_did: local DID value (default None to let indy-sdk generate)
:param metadata: metadata to associate with the local DID
(operation always sets 'since... | 2.46734 | 2.261248 | 1.091141 |
LOGGER.debug('Wallet.replace_local_did_metadata >>> loc_did: %s, metadata: %s', loc_did, metadata)
old = await self.get_local_did(loc_did) # raises exceptions if applicable
now = int(time())
loc_did_metadata = {**(metadata or {}), 'since': (old.metadata or {}).get('since', no... | async def replace_local_did_metadata(self, loc_did: str, metadata: dict) -> DIDInfo | Replace the metadata associated with a local DID.
Raise WalletState if wallet is closed, AbsentRecord for no such local DID.
:param loc_did: local DID of interest
:param metadata: new metadata to store
:return: DIDInfo for local DID after write | 3.377781 | 3.244906 | 1.040949 |
LOGGER.debug('Wallet.get_local_dids >>>')
dids_with_meta = json.loads(did.list_my_dids_with_meta(self.handle)) # list
rv = []
for did_with_meta in dids_with_meta:
meta = json.loads(did_with_meta['metadata']) if did_with_meta['metadata'] else {}
if met... | async def get_local_dids(self) -> Sequence[DIDInfo] | Get list of DIDInfos for local DIDs.
:return: list of local DIDInfos | 3.373125 | 3.348016 | 1.0075 |
LOGGER.debug('Wallet.get_local_did >>> loc: %s', loc)
if not self.handle:
LOGGER.debug('Wallet.get_local_did <!< Wallet %s is closed', self.name)
raise WalletState('Wallet {} is closed'.format(self.name))
if ok_did(loc): # it's a DID
try:
... | async def get_local_did(self, loc: str) -> DIDInfo | Get local DID info by local DID or verification key.
Raise AbsentRecord for no such local DID.
:param loc: DID or verification key of interest
:return: DIDInfo for local DID | 2.060932 | 1.95645 | 1.053404 |
LOGGER.debug('Wallet.get_anchor_did >>>')
if not self.handle:
LOGGER.debug('Wallet.get_anchor_did <!< Wallet %s is closed', self.name)
raise WalletState('Wallet {} is closed'.format(self.name))
rv = None
dids_with_meta = json.loads(await did.list_my_di... | async def get_anchor_did(self) -> str | Get current anchor DID by metadata, None for not yet set.
:return: DID | 3.295964 | 3.15876 | 1.043436 |
LOGGER.debug('Wallet.create_link_secret >>> label: %s', label)
if not self.handle:
LOGGER.debug('Wallet.create_link_secret <!< Wallet %s is closed', self.name)
raise WalletState('Wallet {} is closed'.format(self.name))
try:
await anoncreds.prover_c... | async def create_link_secret(self, label: str) -> None | Create link secret (a.k.a. master secret) used in proofs by HolderProver, if the
current link secret does not already correspond to the input link secret label.
Raise WalletState if wallet is closed, or any other IndyError causing failure
to set link secret in wallet.
:param label: lab... | 3.14712 | 2.633736 | 1.194926 |
LOGGER.debug('Wallet._write_link_secret_label <<< %s', label)
if await self.get_link_secret_label() == label:
LOGGER.info('Wallet._write_link_secret_label abstaining - already current')
else:
await self.write_non_secret(StorageRecord(
TYPE_LINK_... | async def _write_link_secret_label(self, label) -> None | Update non-secret storage record with link secret label.
:param label: link secret label | 6.193484 | 5.314698 | 1.16535 |
LOGGER.debug('Wallet.get_link_secret_label >>>')
if not self.handle:
LOGGER.debug('Wallet.get_link_secret <!< Wallet %s is closed', self.name)
raise WalletState('Wallet {} is closed'.format(self.name))
rv = None
records = await self.get_non_secret(TYPE... | async def get_link_secret_label(self) -> str | Get current link secret label from non-secret storage records; return None for no match.
:return: latest non-secret storage record for link secret label | 5.569408 | 4.517105 | 1.23296 |
LOGGER.debug('Wallet.open >>>')
created = False
while True:
try:
self._handle = await wallet.open_wallet(
json.dumps(self.config),
json.dumps(self.access_creds))
LOGGER.info('Opened wallet %s on handle... | async def open(self) -> 'Wallet' | Explicit entry. Open wallet as configured, for later closure via close().
For use when keeping wallet open across multiple calls.
Raise any IndyError causing failure to open wallet, WalletState if wallet already open,
or AbsentWallet on attempt to enter wallet not yet created.
:return:... | 2.348415 | 2.220572 | 1.057573 |
LOGGER.debug('Wallet.create >>>')
try:
await wallet.create_wallet(
config=json.dumps(self.config),
credentials=json.dumps(self.access_creds))
LOGGER.info('Created wallet %s', self.name)
except IndyError as x_indy:
if ... | async def create(self) -> None | Persist the wallet. Raise ExtantWallet if it already exists.
Actuators should prefer WalletManager.create() to calling this method directly - the wallet manager
filters wallet configuration through preset defaults. | 3.281208 | 3.006346 | 1.091427 |
LOGGER.debug('Wallet.close >>>')
if not self.handle:
LOGGER.warning('Abstaining from closing wallet %s: already closed', self.name)
else:
LOGGER.debug('Closing wallet %s', self.name)
await wallet.close_wallet(self.handle)
self._handle = ... | async def close(self) -> None | Explicit exit. Close wallet (and delete if so configured). | 3.755757 | 3.203277 | 1.172473 |
LOGGER.debug('Wallet.remove >>>')
if self.handle:
LOGGER.debug('Wallet.remove <!< Wallet %s is open', self.name)
raise WalletState('Wallet {} is open'.format(self.name))
rv = True
try:
LOGGER.info('Attempting to remove wallet: %s', self.nam... | async def remove(self) -> bool | Remove serialized wallet, best effort, if it exists. Return whether wallet absent after operation
(removal successful or else not present a priori).
Raise WalletState if wallet is open.
:return: whether wallet gone from persistent storage | 3.582574 | 3.045738 | 1.176258 |
LOGGER.debug(
'Wallet.write_pairwise >>> their_did: %s, their_verkey: %s, my_did: %s, metadata: %s, replace_meta: %s',
their_did,
their_verkey,
my_did,
metadata,
replace_meta)
if their_verkey is None:
match = ... | async def write_pairwise(
self,
their_did: str,
their_verkey: str = None,
my_did: str = None,
metadata: dict = None,
replace_meta: bool = False) -> PairwiseInfo | Store a pairwise DID for a secure connection. Use verification key for local DID in wallet if
supplied; otherwise, create one first. If local DID specified but not present, raise AbsentRecord.
With supplied metadata, replace or augment and overwrite any existing metadata for the pairwise
relati... | 2.828482 | 2.583862 | 1.094672 |
LOGGER.debug('Wallet.delete_pairwise >>> their_did: %s', their_did)
if not ok_did(their_did):
LOGGER.debug('Wallet.delete_pairwise <!< Bad DID %s', their_did)
raise BadIdentifier('Bad DID {}'.format(their_did))
await self.delete_non_secret(TYPE_PAIRWISE, their... | async def delete_pairwise(self, their_did: str) -> None | Remove a pairwise DID record by its remote DID. Silently return if no such record is present.
Raise WalletState for closed wallet, or BadIdentifier for invalid pairwise DID.
:param their_did: remote DID marking pairwise DID to remove | 3.357203 | 2.97092 | 1.130021 |
LOGGER.debug('Wallet.get_pairwise >>> pairwise_filt: %s', pairwise_filt)
if not self.handle:
LOGGER.debug('Wallet.get_pairwise <!< Wallet %s is closed', self.name)
raise WalletState('Wallet {} is closed'.format(self.name))
storecs = await self.get_non_secret(
... | async def get_pairwise(self, pairwise_filt: str = None) -> dict | Return dict mapping each pairwise DID of interest in wallet to its pairwise info, or,
for no filter specified, mapping them all. If wallet has no such item, return empty dict.
:param pairwise_filt: remote DID of interest, or WQL json (default all)
:return: dict mapping remote DIDs to PairwiseIn... | 6.418128 | 5.397105 | 1.18918 |
LOGGER.debug('Wallet.write_non_secret >>> storec: %s, replace_meta: %s', storec, replace_meta)
if not self.handle:
LOGGER.debug('Wallet.write_non_secret <!< Wallet %s is closed', self.name)
raise WalletState('Wallet {} is closed'.format(self.name))
if not Stor... | async def write_non_secret(self, storec: StorageRecord, replace_meta: bool = False) -> StorageRecord | Add or update non-secret storage record to the wallet; return resulting wallet non-secret record.
:param storec: non-secret storage record
:param replace_meta: whether to replace any existing metadata on matching record or to augment it
:return: non-secret storage record as it appears in the wa... | 2.595328 | 2.494882 | 1.040261 |
LOGGER.debug('Wallet.delete_non_secret >>> typ: %s, ident: %s', typ, ident)
if not self.handle:
LOGGER.debug('Wallet.delete_non_secret <!< Wallet %s is closed', self.name)
raise WalletState('Wallet {} is closed'.format(self.name))
try:
await non_se... | async def delete_non_secret(self, typ: str, ident: str) -> None | Remove a non-secret record by its type and identifier. Silently return if no such record is present.
Raise WalletState for closed wallet.
:param typ: non-secret storage record type
:param ident: non-secret storage record identifier | 2.668588 | 2.30108 | 1.159711 |
LOGGER.debug('Wallet.get_non_secret >>> typ: %s, filt: %s, canon_wql: %s', typ, filt, canon_wql)
if not self.handle:
LOGGER.debug('Wallet.get_non_secret <!< Wallet %s is closed', self.name)
raise WalletState('Wallet {} is closed'.format(self.name))
records = [... | async def get_non_secret(
self,
typ: str,
filt: Union[dict, str] = None,
canon_wql: Callable[[dict], dict] = None,
limit: int = None) -> dict | Return dict mapping each non-secret storage record of interest by identifier or,
for no filter specified, mapping them all. If wallet has no such item, return empty dict.
:param typ: non-secret storage record type
:param filt: non-secret storage record identifier or WQL json (default all)
... | 2.868724 | 2.676671 | 1.071751 |
LOGGER.debug(
'Wallet.encrypt >>> message: %s, authn: %s, to_verkey: %s, from_verkey: %s',
message,
authn,
to_verkey,
from_verkey)
if not message:
LOGGER.debug('Wallet.encrypt <!< No message to encrypt')
raise... | async def encrypt(
self,
message: bytes,
authn: bool = False,
to_verkey: str = None,
from_verkey: str = None) -> bytes | Encrypt plaintext for owner of DID, anonymously or via authenticated encryption scheme.
Raise AbsentMessage for missing message, or WalletState if wallet is closed.
:param message: plaintext, as bytes
:param authn: whether to use authenticated encryption scheme
:param to_verkey: verific... | 2.314026 | 1.979817 | 1.168808 |
LOGGER.debug(
'Wallet.decrypt >>> ciphertext: %s, authn_check: %s, to_verkey: %s, from_verkey: %s',
ciphertext,
authn_check,
to_verkey,
from_verkey)
if not ciphertext:
LOGGER.debug('Wallet.decrypt <!< No ciphertext to dec... | async def decrypt(
self,
ciphertext: bytes,
authn_check: bool = None,
to_verkey: str = None,
from_verkey: str = None) -> (bytes, str) | Decrypt ciphertext and optionally authenticate sender.
Raise BadKey if authentication operation checks and reveals sender key distinct from input
sender verification key. Raise AbsentMessage for missing ciphertext, or WalletState if
wallet is closed.
:param ciphertext: ciphertext, as ... | 2.315295 | 1.970538 | 1.174955 |
LOGGER.debug('Wallet.sign >>> message: %s, verkey: %s', message, verkey)
if not message:
LOGGER.debug('Wallet.sign <!< No message to sign')
raise AbsentMessage('No message to sign')
if not self.handle:
LOGGER.debug('Wallet.sign <!< Wallet %s is clo... | async def sign(self, message: bytes, verkey: str = None) -> bytes | Derive signing key and Sign message; return signature. Raise WalletState if wallet is closed.
Raise AbsentMessage for missing message, or WalletState if wallet is closed.
:param message: Content to sign, as bytes
:param verkey: verification key corresponding to private signing key (default anch... | 3.016111 | 2.332914 | 1.292851 |
LOGGER.debug('Wallet.verify >>> message: %s, signature: %s, verkey: %s', message, signature, verkey)
if not message:
LOGGER.debug('Wallet.verify <!< No message to verify')
raise AbsentMessage('No message to verify')
if not signature:
LOGGER.debug('... | async def verify(self, message: bytes, signature: bytes, verkey: str = None) -> bool | Verify signature against input signer verification key (default anchor's own).
Raise AbsentMessage for missing message or signature, or WalletState if wallet is closed.
:param message: Content to sign, as bytes
:param signature: signature, as bytes
:param verkey: signer verification key... | 2.459748 | 2.050442 | 1.199618 |
LOGGER.debug(
'Wallet.pack >>> message: %s, recip_verkeys: %s, sender_verkey: %s',
message,
recip_verkeys,
sender_verkey)
if message is None:
LOGGER.debug('Wallet.pack <!< No message to pack')
raise AbsentMessage('No mess... | async def pack(
self,
message: str,
recip_verkeys: Union[str, Sequence[str]] = None,
sender_verkey: str = None) -> bytes | Pack a message for one or more recipients (default anchor only).
Raise AbsentMessage for missing message, or WalletState if wallet is closed.
:param message: message to pack
:param recip_verkeys: verification keys of recipients (default anchor's own, only)
:param sender_verkey: sender v... | 2.669831 | 2.234544 | 1.194799 |
LOGGER.debug('Wallet.unpack >>> ciphertext: %s', ciphertext)
if not ciphertext:
LOGGER.debug('Wallet.pack <!< No ciphertext to unpack')
raise AbsentMessage('No ciphertext to unpack')
try:
unpacked = json.loads(await crypto.unpack_message(self.handl... | async def unpack(self, ciphertext: bytes) -> (str, str, str) | Unpack a message. Return triple with cleartext, sender verification key, and recipient verification key.
Raise AbsentMessage for missing ciphertext, or WalletState if wallet is closed. Raise AbsentRecord
if wallet has no key to unpack ciphertext.
:param ciphertext: JWE-like formatted message as... | 3.338061 | 2.609951 | 1.278974 |
LOGGER.debug('Wallet.reseed_init >>> next_seed: [SEED]')
if not self.handle:
LOGGER.debug('Wallet.reseed_init <!< Wallet %s is closed', self.name)
raise WalletState('Wallet {} is closed'.format(self.name))
rv = await did.replace_keys_start(self.handle, self.di... | async def reseed_init(self, next_seed: str = None) -> str | Begin reseed operation: generate new key. Raise WalletState if wallet is closed.
:param next_seed: incoming replacement seed (default random)
:return: new verification key | 5.006967 | 3.63145 | 1.378779 |
LOGGER.debug('Wallet.reseed_apply >>>')
if not self.handle:
LOGGER.debug('Wallet.reseed_init <!< Wallet %s is closed', self.name)
raise WalletState('Wallet {} is closed'.format(self.name))
await did.replace_keys_apply(self.handle, self.did)
self.verkey... | async def reseed_apply(self) -> DIDInfo | Replace verification key with new verification key from reseed operation.
Raise WalletState if wallet is closed.
:return: DIDInfo with new verification key and metadata for DID | 3.725185 | 3.313556 | 1.124226 |
LOGGER.debug('Origin.send_schema >>> schema_data_json: %s', schema_data_json)
schema_data = json.loads(schema_data_json)
for attr in schema_data['attr_names']:
if not (re.match(r'(?=[^- ])[-_a-zA-Z0-9 ]+(?<=[^- ])$', attr)) or attr.strip().lower() == 'hash':
... | async def send_schema(self, schema_data_json: str) -> str | Send schema to ledger, then retrieve it as written to the ledger and return it.
Raise BadLedgerTxn on failure. Raise BadAttribute for attribute name with spaces or
reserved for indy-sdk.
If schema already exists on ledger, log error and return schema.
:param schema_data_json: schema da... | 3.34237 | 2.795847 | 1.195477 |
LOGGER.debug('NominalAnchor.least_role >>>')
rv = Role.USER
LOGGER.debug('NominalAnchor.least_role <<< %s', rv)
return rv | def least_role() -> Role | Return the indy-sdk null role for a tails sync anchor, which does not need write access.
:return: USER role | 10.815067 | 6.618578 | 1.634047 |
LOGGER.debug('OrgHubAnchor.close >>>')
archive_caches = False
if self.config.get('archive-holder-prover-caches-on-close', False):
archive_caches = True
await self.load_cache_for_proof(False)
if self.config.get('archive-verifier-caches-on-close', {}):
... | async def close(self) -> None | Explicit exit. If so configured, populate cache to prove for any creds on schemata,
cred defs, and rev regs marked of interest in configuration at initialization,
archive cache, and purge prior cache archives.
:return: current object | 8.071318 | 7.23921 | 1.114945 |
for k in [qk for qk in query]: # copy: iteration alters query keys
attr_match = re.match('attr::([^:]+)::(marker|value)$', k)
if isinstance(query[k], dict): # only subqueries are dicts: recurse
query[k] = canon_cred_wql(query[k])
if k == '$or':
if not isinstan... | def canon_cred_wql(query: dict) -> dict | Canonicalize WQL attribute marker and value keys for input to indy-sdk wallet credential filtration.
Canonicalize comparison values to proper indy-sdk raw values as per raw().
Raise BadWalletQuery for WQL mapping '$or' to non-list.
:param query: WQL query
:return: canonicalized WQL query dict | 3.602821 | 3.18666 | 1.130595 |
if not query:
return {
'~their_did': {
'$neq': ''
}
}
for k in [qk for qk in query]: # copy: iteration alters query keys
if isinstance(query[k], dict): # only subqueries are dicts: recurse
query[k] = canon_pairwise_wql(query[k]... | def canon_pairwise_wql(query: dict = None) -> dict | Canonicalize WQL tags to unencrypted storage specification.
Canonicalize comparison values to strings via raw().
Raise BadWalletQuery for WQL mapping '$or' to non-list.
:param query: WQL query
:return: canonicalized WQL query dict | 3.405453 | 2.935706 | 1.160012 |
try:
with open(filename) as fh_req:
return [line.strip() for line in fh_req if line.strip() and not line.startswith('#')]
except FileNotFoundError:
print('File not found: {}'.format(realpath(filename)), file=stderr)
raise | def parse_requirements(filename) | Load requirements from a pip requirements file.
:param filename: file name with requirements to parse | 3.504601 | 3.612953 | 0.97001 |
LOGGER.debug('NodePoolManager.__init__ >>> name: %s, genesis: %s', name, genesis)
if name in await self.list():
LOGGER.debug('NodePoolManager.add_config: <!< Node pool %s configuration already present', name)
raise ExtantPool('Node pool {} configuration already present... | async def add_config(self, name: str, genesis: str = None) -> None | Given pool name and genesis transaction path or data, add node pool configuration to indy home directory.
Raise ExtantPool if node pool configuration on input name already exists.
:param name: pool name
:param genesis: genesis transaction path or raw data | 3.459804 | 2.842484 | 1.217176 |
LOGGER.debug('NodePoolManager.list >>>')
rv = [p['pool'] for p in await pool.list_pools()]
LOGGER.debug('NodePoolManager.list <<< %s', rv)
return rv | async def list(self) -> List[str] | Return list of pool names configured, empty list for none.
:return: list of pool names. | 7.092717 | 5.873394 | 1.207601 |
LOGGER.debug('NodePoolManager.node_pool >>>')
rv = NodePool(name, self.protocol, config)
LOGGER.debug('NodePoolManager.node_pool <<< %s', rv)
return rv | def get(self, name: str, config: dict = None) -> NodePool | Return node pool in input name and optional configuration.
:param name: name of configured pool
:param config: pool configuration with optional 'timeout' int, 'extended_timeout' int,
'preordered_nodes' array of strings
:return: node pool | 6.15786 | 6.619282 | 0.930291 |
LOGGER.debug('NodePoolManager.remove >>> name: %s', name)
try:
await pool.delete_pool_ledger_config(name)
except IndyError as x_indy:
LOGGER.info('Abstaining from node pool removal; indy-sdk error code %s', x_indy.error_code)
LOGGER.debug('NodePool.rem... | async def remove(self, name: str) -> None | Remove serialized pool info if it exists. Abstain from removing open node pool. | 7.022555 | 4.92781 | 1.425086 |
return {k: self._pubkey[k] for k in self._pubkey if self._pubkey[k].authn} | def authnkey(self) -> dict | Accessor for public keys marked as authentication keys, by identifier. | 7.909725 | 4.324795 | 1.828925 |
if isinstance(item, Service):
self.service[item.id] = item
elif isinstance(item, PublicKey):
self.pubkey[item.id] = item
else:
raise BadDIDDocItem('Cannot add item {} to DIDDoc on DID {}'.format(item, self.did)) | def set(self, item: Union[Service, PublicKey]) -> 'DIDDoc' | Add or replace service or public key; return current DIDDoc.
Raise BadDIDDocItem if input item is neither service nor public key.
:param item: service or public key to set
:return: current DIDDoc | 3.024364 | 2.685719 | 1.126091 |
return {
'@context': DIDDoc.CONTEXT,
'id': canon_ref(self.did, self.did),
'publicKey': [pubkey.to_dict() for pubkey in self.pubkey.values()],
'authentication': [{
'type': pubkey.type.authn_type,
'publicKey': canon_ref(self... | def serialize(self) -> str | Dump current object to a JSON-compatible dictionary.
:return: dict representation of current DIDDoc | 3.357543 | 3.025607 | 1.109709 |
rv = []
for tag in [tags] if isinstance(tags, str) else list(tags):
for svc_key in service.get(tag, {}):
canon_key = canon_ref(self.did, svc_key)
pubkey = None
if '#' in svc_key:
if canon_key in self.pubkey:
... | def add_service_pubkeys(self, service: dict, tags: Union[Sequence[str], str]) -> List[PublicKey] | Add public keys specified in service. Return public keys so discovered.
Raise AbsentDIDDocItem for public key reference not present in DID document.
:param service: service from DID document
:param tags: potential tags marking public keys of type of interest - the standard is still coalescing
... | 4.433198 | 3.907525 | 1.134528 |
rv = None
if 'id' in did_doc:
rv = DIDDoc(did_doc['id'])
else: # get DID to serve as DID document identifier from first public key
if 'publicKey' not in did_doc:
LOGGER.debug('DIDDoc.deserialize <!< no identifier in DID document')
... | def deserialize(cls, did_doc: dict) -> 'DIDDoc' | Construct DIDDoc object from dict representation.
Raise BadIdentifier for bad DID.
:param did_doc: DIDDoc dict reprentation.
:return: DIDDoc from input json. | 3.409677 | 3.433169 | 0.993157 |
return Protocol.V_13 if version == Protocol.V_13.value.name else Protocol.DEFAULT | def get(version: str) -> 'Protocol' | Return enum instance corresponding to input version value ('1.6' etc.) | 11.233223 | 9.489699 | 1.183728 |
if for_box_id:
return '' if self == Protocol.V_13 else ':tag'
return 'tag' | def cd_id_tag(self, for_box_id: bool = False) -> str | Return (place-holder) credential definition identifier tag for current version of node protocol.
At present, von_anchor always uses the tag of 'tag' if the protocol calls for one.
:param for_box_id: whether to prefix a colon, if current protocol uses one, in constructing
a cred def id or re... | 20.305996 | 12.035062 | 1.687237 |
return '{}:3:CL:{}{}'.format( # 3 marks indy cred def id, CL is sig type
issuer_did,
schema_seq_no,
self.cd_id_tag(True)) | def cred_def_id(self, issuer_did: str, schema_seq_no: int) -> str | Return credential definition identifier for input issuer DID and schema sequence number.
:param issuer_did: DID of credential definition issuer
:param schema_seq_no: schema sequence number
:return: credential definition identifier | 14.277624 | 14.242385 | 1.002474 |
rv = None
if self == Protocol.V_13:
rv = SchemaKey(txn['identifier'], txn['data']['name'], txn['data']['version'])
else:
txn_txn = txn.get('txn', None) or txn # may have already run this txn through txn2data() below
rv = SchemaKey(
t... | def txn_data2schema_key(self, txn: dict) -> SchemaKey | Return schema key from ledger transaction data.
:param txn: get-schema transaction (by sequence number)
:return: schema key identified | 5.604516 | 5.412226 | 1.035529 |
rv_json = json.dumps({})
if self == Protocol.V_13:
rv_json = json.dumps(txn['result'].get('data', {}))
else:
rv_json = json.dumps((txn['result'].get('data', {}) or {}).get('txn', {})) # "data": null for no such txn
return rv_json | def txn2data(self, txn: dict) -> str | Given ledger transaction, return its data json.
:param txn: transaction as dict
:return: transaction data json | 6.761711 | 6.129995 | 1.103053 |
rv = None
if self == Protocol.V_13:
rv = txn['result']['txnTime']
else:
rv = txn['result']['txnMetadata']['txnTime']
return rv | def txn2epoch(self, txn: dict) -> int | Given ledger transaction, return its epoch time.
:param txn: transaction as dict
:return: transaction time | 8.283708 | 6.870111 | 1.20576 |
txn_data = genesis_txn['data'] if self == Protocol.V_13 else genesis_txn['txn']['data']['data']
return (txn_data['node_ip'], txn_data['node_port']) | def genesis_host_port(self, genesis_txn: dict) -> tuple | Given a genesis transaction, return its node host and port.
:param genesis_txn: genesis transaction as dict
:return: node host and port | 6.460598 | 6.045745 | 1.068619 |
LOGGER.debug('Tails.open >>>')
self._reader_handle = await blob_storage.open_reader('default', self._tails_config_json)
LOGGER.debug('Tails.open <<<')
return self | async def open(self) -> 'Tails' | Open reader handle and return current object.
:return: current object | 7.546237 | 6.538414 | 1.154139 |
LOGGER.debug('Tails.ok_hash >>> token: %s', token)
rv = re.match('[{}]{{42,44}}$'.format(B58), token) is not None
LOGGER.debug('Tails.ok_hash <<< %s', rv)
return rv | def ok_hash(token: str) -> bool | Whether input token looks like a valid tails hash.
:param token: candidate string
:return: whether input token looks like a valid tails hash | 7.329083 | 5.064758 | 1.447075 |
LOGGER.debug('Tails.associate >>> base_dir: %s, rr_id: %s, tails_hash: %s', base_dir, rr_id, tails_hash)
if not ok_rev_reg_id(rr_id):
LOGGER.debug('Tails.associate <!< Bad rev reg id %s', rr_id)
raise BadIdentifier('Bad rev reg id {}'.format(rr_id))
if not Tai... | def associate(base_dir: str, rr_id: str, tails_hash: str) -> None | Create symbolic link to tails file named tails_hash for rev reg id rr_id.
:param rr_id: rev reg id
:param tails_hash: hash of tails file, serving as file name | 2.435398 | 2.187264 | 1.113445 |
LOGGER.debug('Tails.dir >>> base_dir: %s, rr_id: %s', base_dir, rr_id)
if not ok_rev_reg_id(rr_id):
LOGGER.debug('Tails.dir <!< Bad rev reg id %s', rr_id)
raise BadIdentifier('Bad rev reg id {}'.format(rr_id))
rv = join(base_dir, rev_reg_id2cred_def_id(rr_id))... | def dir(base_dir: str, rr_id: str) -> str | Return correct subdirectory of input base dir for artifacts corresponding to input rev reg id.
:param base_dir: base directory for tails files, thereafter split by cred def id
:param rr_id: rev reg id | 3.327741 | 2.526316 | 1.317231 |
LOGGER.debug('Tails.linked >>> base_dir: %s, rr_id: %s', base_dir, rr_id)
if not ok_rev_reg_id(rr_id):
LOGGER.debug('Tails.linked <!< Bad rev reg id %s', rr_id)
raise BadIdentifier('Bad rev reg id {}'.format(rr_id))
cd_id = rev_reg_id2cred_def_id(rr_id)
... | def linked(base_dir: str, rr_id: str) -> str | Get, from the specified directory, the path to the tails file associated with
the input revocation registry identifier, or None for no such file.
:param base_dir: base directory for tails files, thereafter split by cred def id
:param rr_id: rev reg id
:return: (stringified) path to tail... | 3.48223 | 2.639282 | 1.319385 |
LOGGER.debug('Tails.links >>> base_dir: %s, issuer_did: %s', base_dir, issuer_did)
if issuer_did and not ok_did(issuer_did):
LOGGER.debug('Tails.links <!< Bad DID %s', issuer_did)
raise BadIdentifier('Bad DID {}'.format(issuer_did))
rv = set()
for dir_... | def links(base_dir: str, issuer_did: str = None) -> set | Return set of all paths to symbolic links (rev reg ids) associating their
respective tails files, in specified base tails directory recursively
(omitting the .hopper subdirectory), on input issuer DID if specified.
:param base_dir: base directory for tails files, thereafter split by cred def id... | 2.259552 | 2.082491 | 1.085024 |
LOGGER.debug('Tails.unlinked >>> base_dir: %s', base_dir)
rv = set()
for dir_path, dir_names, file_names in walk(base_dir, topdown=True):
dir_names[:] = [d for d in dir_names if not d.startswith('.')]
for file_name in file_names:
if isfile(join(... | def unlinked(base_dir: str) -> set | Return all paths to tails files, in specified tails base directory recursively
(omitting the .hopper subdirectory), without symbolic links associating
revocation registry identifiers.
At an Issuer, tails files should not persist long without revocation registry identifier
association vi... | 2.878534 | 2.495269 | 1.153596 |
LOGGER.debug('Tails.next_tag >>> base_dir: %s, cd_id: %s', base_dir, cd_id)
if not ok_cred_def_id(cd_id):
LOGGER.debug('Tails.next_tag <!< Bad cred def id %s', cd_id)
raise BadIdentifier('Bad cred def id {}'.format(cd_id))
tag = 1 + max([int(rev_reg_id2tag(bas... | def next_tag(base_dir: str, cd_id: str) -> (str, int) | Return the next tag name available for a new rev reg id on input cred def id in base directory,
and suggested size of associated rev reg.
:param base_dir: base directory for tails files, thereafter split by cred def id
:param cd_id: credential definition identifier of interest
:return: ... | 4.818086 | 3.827523 | 1.2588 |
LOGGER.debug('Tails.current_rev_reg_id >>> base_dir: %s, cd_id: %s', base_dir, cd_id)
if not ok_cred_def_id(cd_id):
LOGGER.debug('Tails.current_rev_reg_id <!< Bad cred def id %s', cd_id)
raise BadIdentifier('Bad cred def id {}'.format(cd_id))
tags = [int(rev_r... | def current_rev_reg_id(base_dir: str, cd_id: str) -> str | Return the current revocation registry identifier for
input credential definition identifier, in input directory.
Raise AbsentTails if no corresponding tails file, signifying no such revocation registry defined.
:param base_dir: base directory for tails files, thereafter split by cred def id
... | 3.781987 | 3.258533 | 1.160641 |
config = json.loads(self._tails_config_json)
return join(config['base_dir'], config['file']) | def path(self) -> str | Accessor for (stringified) path to current tails file.
:return: (stringified) path to current tails file. | 15.17517 | 9.357669 | 1.621683 |
if isinstance(orig, int) and -I32_BOUND <= orig < I32_BOUND:
return str(int(orig)) # python bools are ints
try:
i32orig = int(str(orig)) # don't encode floats as ints
if -I32_BOUND <= i32orig < I32_BOUND:
return str(i32orig)
except (ValueError, TypeError):
... | def encode(orig: Any) -> str | Encode credential attribute value, purely stringifying any int32 and leaving numeric int32 strings alone,
but mapping any other input to a stringified 256-bit (but not 32-bit) integer. Predicates in indy-sdk operate
on int32 values properly only when their encoded values match their raw values.
:param orig... | 3.975882 | 3.692807 | 1.076656 |
for pred in Predicate:
if relation.upper() in (pred.value.fortran, pred.value.wql.upper(), pred.value.math):
return pred
return None | def get(relation: str) -> 'Predicate' | Return enum instance corresponding to input relation string | 12.532135 | 9.936096 | 1.261274 |
if isinstance(value, (bool, int)):
return int(value)
return int(str(value)) | def to_int(value: Any) -> int | Cast a value as its equivalent int for indy predicate argument. Raise ValueError for any input but
int, stringified int, or boolean.
:param value: value to coerce. | 6.372038 | 4.661023 | 1.36709 |
if token is None:
return Role.USER
for role in Role:
if role == Role.ROLE_REMOVE:
continue # ROLE_REMOVE is not a sensible role to parse from any configuration
if isinstance(token, int) and token in role.value:
return role
... | def get(token: Union[str, int] = None) -> 'Role' | Return enum instance corresponding to input token.
:param token: token identifying role to indy-sdk: 'STEWARD', 'TRUSTEE', 'TRUST_ANCHOR', '' or None
:return: enum instance corresponding to input token | 6.426092 | 6.31336 | 1.017856 |
return self.value[0] if self in (Role.USER, Role.ROLE_REMOVE) else self.name | def token(self) -> str | Return token identifying role to indy-sdk.
:return: token: 'STEWARD', 'TRUSTEE', 'TRUST_ANCHOR', or None (for USER) | 24.797869 | 18.307585 | 1.354513 |
def decorator(view_func):
@wraps(view_func, assigned=available_attrs(view_func))
def _wrapped_view(view_or_request, *args, **kwargs):
# The type of the request gets muddled when using a function based
# decorator. We must use a function based decorator so it can be
... | def cached_get(timeout, *params) | Decorator applied specifically to a view's get method | 3.737104 | 3.662661 | 1.020325 |
def decorator(cls):
class WrappedClass(cls):
def __init__(self, *args, **kwargs):
super(WrappedClass, self).__init__(*args, **kwargs)
@cached_get(timeout, *params)
def get(self, *args, **kwargs):
return super(WrappedClass, self).get(... | def ultracache(timeout, *params) | Decorator applied to a view class. The get method is decorated
implicitly. | 2.282994 | 2.022013 | 1.12907 |
LOGGER.debug('Issuer.open >>>')
await super().open()
for path_rr_id in Tails.links(self.dir_tails, self.did):
await self._sync_revoc_for_issue(basename(path_rr_id))
LOGGER.debug('Issuer.open <<<')
return self | async def open(self) -> 'Issuer' | Explicit entry. Perform ancestor opening operations,
then synchronize revocation registry to tails tree content.
:return: current object | 10.75239 | 9.172164 | 1.172285 |
LOGGER.debug('Issuer._send_rev_reg_def >>> rr_id: %s', rr_id)
dir_tails_rr_id = self.rrb.dir_tails_top(rr_id)
dir_target = self.rrb.dir_tails_target(rr_id)
if not Tails.linked(dir_tails_rr_id, rr_id):
LOGGER.debug(
'Issuer._send_rev_reg_def <!< Tai... | async def _send_rev_reg_def(self, rr_id: str) -> None | Move tails file from hopper; deserialize revocation registry definition and initial entry;
send to ledger and cache revocation registry definition.
Operation serializes to subdirectory within tails hopper directory; symbolic
link presence signals completion.
Raise AbsentRevReg if revoc... | 2.228908 | 2.10067 | 1.061046 |
LOGGER.debug('Issuer._set_rev_reg >>> rr_id: %s, rr_size: %s', rr_id, rr_size)
assert self.rrbx
dir_hopper_rr_id = join(self.rrb.dir_tails_hopper, rr_id)
while Tails.linked(dir_hopper_rr_id, rr_id) is None:
await asyncio.sleep(1)
await self._send_rev_reg_d... | async def _set_rev_reg(self, rr_id: str, rr_size: int) -> None | Move precomputed revocation registry data from hopper into place within tails directory.
:param rr_id: revocation registry identifier
:param rr_size: revocation registry size, in case creation required | 4.779446 | 4.28128 | 1.116359 |
LOGGER.debug('Issuer._sync_revoc_for_issue >>> rr_id: %s, rr_size: %s', rr_id, rr_size)
if not ok_rev_reg_id(rr_id):
LOGGER.debug('Issuer._sync_revoc_for_issue <!< Bad rev reg id %s', rr_id)
raise BadIdentifier('Bad rev reg id {}'.format(rr_id))
(cd_id, tag) =... | async def _sync_revoc_for_issue(self, rr_id: str, rr_size: int = None) -> None | Create revocation registry if need be for input revocation registry identifier;
open and cache tails file reader.
:param rr_id: revocation registry identifier
:param rr_size: if new revocation registry necessary, its size (default as per RevRegBuilder.create_rev_reg()) | 2.684647 | 2.630571 | 1.020557 |
LOGGER.debug('Issuer.path_tails >>>')
if not ok_rev_reg_id(rr_id):
LOGGER.debug('Issuer.path_tails <!< Bad rev reg id %s', rr_id)
raise BadIdentifier('Bad rev reg id {}'.format(rr_id))
rv = Tails.linked(self.dir_tails, rr_id)
LOGGER.debug('Issuer.path_... | def path_tails(self, rr_id: str) -> str | Return path to tails file for input revocation registry identifier.
:param rr_id: revocation registry identifier of interest
:return: path to tails file for input revocation registry identifier | 3.887284 | 3.445838 | 1.12811 |
LOGGER.debug(
'Issuer._create_cred_def >>> schema: %s, ledger_cred_def: %s, revo: %s',
schema,
ledger_cred_def,
revo)
cred_def_json = '{}'
private_key_ok = True
try:
(_, cred_def_json) = await anoncreds.issuer_create_... | async def _create_cred_def(self, schema: dict, ledger_cred_def: dict, revo: bool) -> (str, bool) | Create credential definition in wallet as part of the send_cred_def() sequence.
Return whether the private key for the cred def is OK to continue with the sequence,
propagating the cred def and revocation registry info to the ledger.
:param schema: schema on which to create cred def
:pa... | 3.598093 | 3.447338 | 1.043731 |
LOGGER.debug('Issuer.create_cred_offer >>> schema_seq_no: %s', schema_seq_no)
if not self.wallet.handle:
LOGGER.debug('Issuer.create_cred_offer <!< Wallet %s is closed', self.name)
raise WalletState('Wallet {} is closed'.format(self.name))
if not self.pool:
... | async def create_cred_offer(self, schema_seq_no: int) -> str | Create credential offer as Issuer for given schema.
Raise CorruptWallet if the wallet has no private key for the corresponding credential definition.
Raise WalletState for closed wallet.
:param schema_seq_no: schema sequence number
:return: credential offer json for use in storing cred... | 2.427794 | 2.217435 | 1.094866 |
LOGGER.debug('Issuer.revoke_cred >>> rr_id: %s, cr_id: %s', rr_id, cr_id)
if not self.wallet.handle:
LOGGER.debug('Issuer.revoke_cred <!< Wallet %s is closed', self.name)
raise WalletState('Wallet {} is closed'.format(self.name))
if not ok_rev_reg_id(rr_id):
... | async def revoke_cred(self, rr_id: str, cr_id) -> int | Revoke credential that input revocation registry identifier and
credential revocation identifier specify.
Return (epoch seconds) time of revocation.
Raise AbsentTails if no tails file is available for input revocation registry identifier.
Raise WalletState for closed wallet.
Ra... | 3.187411 | 2.817575 | 1.13126 |
LOGGER.debug('Issuer.get_box_ids_issued >>>')
cd_ids = [
d for d in listdir(self.dir_tails) if isdir(join(self.dir_tails, d)) and ok_cred_def_id(d, self.did)]
s_ids = []
for cd_id in cd_ids:
try:
s_ids.append(json.loads(await self.get_sc... | async def get_box_ids_issued(self) -> str | Return json object on lists of all unique box identifiers (schema identifiers,
credential definition identifiers, and revocation registry identifiers) for
all credential definitions and credentials issued; e.g.,
::
{
"schema_id": [
"R17v42T4pk...... | 3.837304 | 3.27231 | 1.172659 |
return ref.split(delimiter if delimiter else '#')[0] | def resource(ref: str, delimiter: str = None) -> str | Given a (URI) reference, return up to its delimiter (exclusively), or all of it if there is none.
:param ref: reference
:param delimiter: delimiter character (default None maps to '#', or ';' introduces identifiers) | 16.105051 | 9.111184 | 1.767613 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.