Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove the possibility of revocation registry issuance on demand: by … #605

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions aries_cloudagent/issuer/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


DEFAULT_CRED_DEF_TAG = "default"
DEFAULT_ISSUANCE_TYPE = "ISSUANCE_BY_DEFAULT"
DEFAULT_SIGNATURE_TYPE = "CL"


Expand Down Expand Up @@ -166,7 +165,6 @@ async def create_and_store_revocation_registry(
tag: str,
max_cred_num: int,
tails_base_path: str,
issuance_type: str = None,
) -> Tuple[str, str, str]:
"""
Create a new revocation registry and store it in the wallet.
Expand All @@ -178,7 +176,6 @@ async def create_and_store_revocation_registry(
tag: the unique revocation registry tag
max_cred_num: the number of credentials supported in the registry
tails_base_path: where to store the tails file
issuance_type: optionally override the issuance type

Returns:
A tuple of the revocation registry ID, JSON, and entry JSON
Expand Down
7 changes: 2 additions & 5 deletions aries_cloudagent/issuer/indy.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
IssuerError,
IssuerRevocationRegistryFullError,
DEFAULT_CRED_DEF_TAG,
DEFAULT_ISSUANCE_TYPE,
DEFAULT_SIGNATURE_TYPE,
)
from ..indy import create_tails_reader, create_tails_writer
Expand Down Expand Up @@ -211,7 +210,7 @@ async def create_credential(
(
credential_json,
credential_revocation_id,
_, # rev_reg_delta_json only figures if rev reg is ISSUANCE_ON_DEMAND
_, # rev_reg_delta_json only for ISSUANCE_ON_DEMAND, excluded by design
) = await indy.anoncreds.issuer_create_credential(
self.wallet.handle,
json.dumps(credential_offer),
Expand Down Expand Up @@ -314,7 +313,6 @@ async def create_and_store_revocation_registry(
tag: str,
max_cred_num: int,
tails_base_path: str,
issuance_type: str = None,
) -> Tuple[str, str, str]:
"""
Create a new revocation registry and store it in the wallet.
Expand All @@ -326,7 +324,6 @@ async def create_and_store_revocation_registry(
tag: the unique revocation registry tag
max_cred_num: the number of credentials supported in the registry
tails_base_path: where to store the tails file
issuance_type: optionally override the issuance type

Returns:
A tuple of the revocation registry ID, JSON, and entry JSON
Expand All @@ -350,8 +347,8 @@ async def create_and_store_revocation_registry(
cred_def_id,
json.dumps(
{
"issuance_type": "ISSUANCE_BY_DEFAULT",
"max_cred_num": max_cred_num,
"issuance_type": issuance_type or DEFAULT_ISSUANCE_TYPE,
}
),
tails_writer,
Expand Down
6 changes: 0 additions & 6 deletions aries_cloudagent/revocation/indy.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ async def init_issuer_registry(
self,
cred_def_id: str,
issuer_did: str,
issuance_by_default: bool = True,
max_cred_num: int = None,
revoc_def_type: str = None,
tag: str = None,
Expand All @@ -42,11 +41,6 @@ async def init_issuer_registry(
record = IssuerRevRegRecord(
cred_def_id=cred_def_id,
issuer_did=issuer_did,
issuance_type=(
IssuerRevRegRecord.ISSUANCE_BY_DEFAULT
if issuance_by_default
else IssuerRevRegRecord.ISSUANCE_ON_DEMAND
),
max_cred_num=max_cred_num,
revoc_def_type=revoc_def_type,
tag=tag,
Expand Down
18 changes: 0 additions & 18 deletions aries_cloudagent/revocation/models/issuer_rev_reg_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,12 @@ class Meta:
CACHE_ENABLED = False
TAG_NAMES = {
"cred_def_id",
"issuance_type",
"issuer_did",
"revoc_def_type",
"revoc_reg_id",
"state",
}

ISSUANCE_BY_DEFAULT = "ISSUANCE_BY_DEFAULT"
ISSUANCE_ON_DEMAND = "ISSUANCE_ON_DEMAND"

REVOC_DEF_TYPE_CL = "CL_ACCUM"

STATE_INIT = "init"
Expand All @@ -72,7 +68,6 @@ def __init__(
state: str = None,
cred_def_id: str = None,
error_msg: str = None,
issuance_type: str = None,
issuer_did: str = None,
max_cred_num: int = None,
revoc_def_type: str = None,
Expand All @@ -92,7 +87,6 @@ def __init__(
)
self.cred_def_id = cred_def_id
self.error_msg = error_msg
self.issuance_type = issuance_type or self.ISSUANCE_BY_DEFAULT
self.issuer_did = issuer_did
self.max_cred_num = max_cred_num or DEFAULT_REGISTRY_SIZE
self.revoc_def_type = revoc_def_type or self.REVOC_DEF_TYPE_CL
Expand Down Expand Up @@ -164,7 +158,6 @@ async def generate_registry(self, context: InjectionContext):
self.tag,
self.max_cred_num,
tails_hopper_dir,
self.issuance_type,
)
except IssuerError as err:
raise RevocationError() from err
Expand Down Expand Up @@ -383,17 +376,6 @@ class Meta:
description="Error message",
example="Revocation registry undefined",
)
issuance_type = fields.Str(
required=False,
description="Issuance type (ISSUANCE_BY_DEFAULT or ISSUANCE_ON_DEMAND)",
example=IssuerRevRegRecord.ISSUANCE_BY_DEFAULT,
validate=validate.OneOf(
[
IssuerRevRegRecord.ISSUANCE_BY_DEFAULT,
IssuerRevRegRecord.ISSUANCE_ON_DEMAND,
]
),
)
issuer_did = fields.Str(required=False, description="Issuer DID", **INDY_DID)
max_cred_num = fields.Int(
required=False,
Expand Down
4 changes: 2 additions & 2 deletions aries_cloudagent/revocation/models/revocation_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ def from_definition(
}
if public_def:
init["tails_public_uri"] = tails_location
rev_reg = cls(reg_id, **init) # currently ignored: def version, public keys
rev_reg = cls(reg_id, **init) # ignores def ver, issuance type, public keys
rev_reg.tails_local_path = rev_reg.get_receiving_tails_local_path()
else:
init["tails_local_path"] = tails_location
rev_reg = cls(reg_id, **init) # currently ignored: def version, public keys
rev_reg = cls(reg_id, **init) # ignores def ver, issuance type, public keys

return rev_reg

Expand Down
11 changes: 1 addition & 10 deletions aries_cloudagent/revocation/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ class RevRegCreateRequestSchema(Schema):
credential_definition_id = fields.Str(
description="Credential definition identifier", **INDY_CRED_DEF_ID
)
issuance_by_default = fields.Boolean(
description="Create registry with all indexes issued",
required=False,
default=True,
)
max_cred_num = fields.Int(
description="Maximum credential numbers", example=100, required=False
)
Expand Down Expand Up @@ -129,7 +124,6 @@ async def revocation_create_registry(request: web.BaseRequest):

credential_definition_id = body.get("credential_definition_id")
max_cred_num = body.get("max_cred_num")
issuance_by_default = body.get("issuance_by_default", True)

# check we published this cred def
storage = await context.inject(BaseStorage)
Expand All @@ -147,10 +141,7 @@ async def revocation_create_registry(request: web.BaseRequest):
issuer_did = credential_definition_id.split(":")[0]
revoc = IndyRevocation(context)
registry_record = await revoc.init_issuer_registry(
credential_definition_id,
issuer_did,
issuance_by_default=issuance_by_default,
max_cred_num=max_cred_num,
credential_definition_id, issuer_did, max_cred_num=max_cred_num,
)
except RevocationNotSupportedError as e:
raise web.HTTPBadRequest(reason=e.message) from e
Expand Down
1 change: 0 additions & 1 deletion aries_cloudagent/revocation/tests/test_indy.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ async def test_init_issuer_registry(self):

assert result.cred_def_id == CRED_DEF_ID
assert result.issuer_did == self.test_did
assert result.issuance_type == IssuerRevRegRecord.ISSUANCE_BY_DEFAULT
assert result.max_cred_num == DEFAULT_REGISTRY_SIZE
assert result.revoc_def_type == IssuerRevRegRecord.REVOC_DEF_TYPE_CL
assert result.tag is None
Expand Down
6 changes: 4 additions & 2 deletions demo/runners/support/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,10 @@ async def create_and_publish_revocation_registry(
log_msg(f"Revocation Registry ID: {revocation_registry_id}")
assert tails_hash == my_tails_hash

tails_file_url = f"{self.public_tails_url}/revocation/registry/{revocation_registry_id}/tails-file"

tails_file_url = (
f"{self.public_tails_url}/revocation/registry/"
f"{revocation_registry_id}/tails-file"
)
if os.getenv("PUBLIC_TAILS_URL"):
tails_file_url = f"{self.public_tails_url}/{revocation_registry_id}"
tails_file_external_url = (
Expand Down