Skip to content

Commit

Permalink
Fix: Split by camel case and concatenate by space for credential type…
Browse files Browse the repository at this point in the history
… in display for discovery

Signed-off-by: George Padayatti <[email protected]>
  • Loading branch information
georgepadayatti committed May 14, 2024
1 parent 1c48f91 commit 57ccc3c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions eudi_wallet/ebsi/entry_points/server/v2_well_known.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from eudi_wallet.ebsi.repositories.organisation import SqlAlchemyOrganisationRepository
from logging import Logger

import re
from sqlalchemy.orm import Session
from eudi_wallet.ebsi.exceptions.application.organisation import (
LegalEntityNotFoundError,
Expand Down Expand Up @@ -139,6 +139,14 @@ def validate_credential_type_based_on_disclosure_mapping(
return credential


def split_camel_case_and_concatenate_by_space(s):
words = s.split()
if len(words) > 0:
return " ".join(re.findall(r"[A-Za-z][a-z]*|[A-Z]+(?=[A-Z]|$)", s))
else:
return s


def create_credential_supported_from_credential_offers(credential_offers: list) -> dict:
credentials_supported = {}
for credential_offer in credential_offers:
Expand All @@ -161,7 +169,7 @@ def create_credential_supported_from_credential_offers(credential_offers: list)
"cryptographic_suites_supported": ["ES256"],
"display": [
{
"name": credential_types[-1],
"name": split_camel_case_and_concatenate_by_space(credential_types[-1]),
"locale": "en-GB",
"background_color": "#12107c",
"text_color": "#FFFFFF",
Expand Down

0 comments on commit 57ccc3c

Please sign in to comment.