Skip to content

Commit

Permalink
Bump to production docker images
Browse files Browse the repository at this point in the history
Signed-off-by: DaevMithran <[email protected]>
  • Loading branch information
DaevMithran committed Mar 6, 2025
1 parent 53aab3d commit 0caa16b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 24 deletions.
16 changes: 6 additions & 10 deletions cheqd/cheqd/anoncreds/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ async def get_schema_info_by_schema_id(
async def get_schema(self, _profile: Profile, schema_id: str) -> GetSchemaResult:
"""Get a schema from the registry."""
resource_with_metadata = await self.resolver.dereference_with_metadata(
_profile,
schema_id
_profile, schema_id
)
schema = resource_with_metadata.resource
metadata = resource_with_metadata.metadata
Expand Down Expand Up @@ -172,7 +171,7 @@ async def register_schema(
try:
existing_schema = await self.resolver.dereference_with_metadata(
profile,
f"{schema.issuer_id}?resourceName={resource_name}&resourceType={resource_type}"
f"{schema.issuer_id}?resourceName={resource_name}&resourceType={resource_type}",
)
except DIDNotFound:
existing_schema = None
Expand Down Expand Up @@ -257,8 +256,7 @@ async def get_credential_definition(
) -> GetCredDefResult:
"""Get a credential definition from the registry."""
resource_with_metadata = await self.resolver.dereference_with_metadata(
_profile,
credential_definition_id
_profile, credential_definition_id
)
credential_definition = resource_with_metadata.resource
metadata = resource_with_metadata.metadata
Expand Down Expand Up @@ -337,8 +335,7 @@ async def get_revocation_registry_definition(
) -> GetRevRegDefResult:
"""Get a revocation registry definition from the registry."""
resource_with_metadata = await self.resolver.dereference_with_metadata(
_profile,
revocation_registry_id
_profile, revocation_registry_id
)
revocation_registry_definition = resource_with_metadata.resource
metadata = resource_with_metadata.metadata
Expand Down Expand Up @@ -441,7 +438,7 @@ async def get_revocation_list(
resource_time = dt_object.strftime("%Y-%m-%dT%H:%M:%SZ")
resource_with_metadata = await self.resolver.dereference_with_metadata(
profile,
f"{did}?resourceType={resource_type}&resourceName={resource_name}&resourceVersionTime={resource_time}"
f"{did}?resourceType={resource_type}&resourceName={resource_name}&resourceVersionTime={resource_time}",
)
status_list = resource_with_metadata.resource
metadata = resource_with_metadata.metadata
Expand All @@ -465,8 +462,7 @@ async def get_schema_info_by_id(
) -> AnoncredsSchemaInfo:
"""Get a schema info from the registry."""
resource_with_metadata = await self.resolver.dereference_with_metadata(
profile,
schema_id
profile, schema_id
)
schema = resource_with_metadata.resource
(did, resource_id) = self.split_did_url(schema_id)
Expand Down
22 changes: 10 additions & 12 deletions cheqd/cheqd/resolver/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@

from ..validation import CheqdDID


@dataclass
class DIDLinkedResourceWithMetadata:
"""Schema for DID Linked Resource with metadata."""

resource: dict
metadata: dict


class DIDUrlDereferencingResult(BaseModel):
"""DID Url Dereferencing Result with Metadata."""

Expand All @@ -36,8 +38,11 @@ class Config:

extra = "allow"


DID_RESOLUTION_HEADER = "application/ld+json;profile=https://w3id.org/did-resolution"
DID_URL_DEREFERENCING_HEADER = "application/ld+json;profile=https://w3id.org/did-url-dereferencing"
DID_URL_DEREFERENCING_HEADER = (
"application/ld+json;profile=https://w3id.org/did-url-dereferencing"
)


class CheqdDIDResolver(BaseDIDResolver):
Expand Down Expand Up @@ -107,32 +112,25 @@ async def resolve(
did_doc = DIDDocument.from_json(json.dumps(did_doc_resp))
result = did_doc.serialize()
# Check if 'deactivated' field is present in didDocumentMetadata
if (
did_doc_metadata
and did_doc_metadata.get("deactivated") is True
):
if did_doc_metadata and did_doc_metadata.get("deactivated") is True:
result["deactivated"] = True
return result
except Exception as err:
raise ResolverError("Response was incorrectly formatted") from err

async def dereference_with_metadata(
self,
profile: Profile,
did_url: str
self, profile: Profile, did_url: str
) -> DIDLinkedResourceWithMetadata:
"""Resolve a Cheqd DID Linked Resource and its Metadata."""
# Fetch the main resource
result = await self._resolve(
profile,
did_url,
[f"Accept: {DID_URL_DEREFERENCING_HEADER}"]
profile, did_url, [f"Accept: {DID_URL_DEREFERENCING_HEADER}"]
)
try:
validated_resp = DIDUrlDereferencingResult(**result)
return DIDLinkedResourceWithMetadata(
resource=validated_resp.contentStream,
metadata=validated_resp.contentMetadata
metadata=validated_resp.contentMetadata,
)
except ValidationError:
raise ResolverError("DidUrlDereferencing result was incorrectly formatted")
2 changes: 1 addition & 1 deletion cheqd/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ services:
- driver-did-cheqd

driver-did-cheqd:
image: ghcr.io/cheqd/did-registrar:staging-latest
image: ghcr.io/cheqd/did-registrar:production-latest
ports:
- "9089:3000"
restart: on-failure
Expand Down
2 changes: 1 addition & 1 deletion cheqd/integration/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ services:
- driver-did-cheqd

driver-did-cheqd:
image: ghcr.io/cheqd/did-registrar:staging-latest
image: ghcr.io/cheqd/did-registrar:production-latest
ports:
- "9089:3000"
restart: on-failure
Expand Down

0 comments on commit 0caa16b

Please sign in to comment.