-
Notifications
You must be signed in to change notification settings - Fork 515
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #669 from sklump/provision-profile-linked-domain-e…
…ndpoints provisioning for profile endpoints, accommodate w3c (to API) and indy…
- Loading branch information
Showing
17 changed files
with
153 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""Ledger utilities.""" | ||
|
||
from collections import namedtuple | ||
from enum import Enum | ||
|
||
EndpointTypeName = namedtuple("EndpointTypeName", "w3c indy") | ||
|
||
|
||
class EndpointType(Enum): | ||
"""Enum for endpoint/service types.""" | ||
|
||
ENDPOINT = EndpointTypeName("Endpoint", "endpoint") | ||
PROFILE = EndpointTypeName("Profile", "profile") | ||
LINKED_DOMAINS = EndpointTypeName("LinkedDomains", "linked_domains") | ||
|
||
@staticmethod | ||
def get(name: str) -> "EndpointType": | ||
"""Return enum instance corresponding to input string.""" | ||
if name is None: | ||
return None | ||
|
||
for endpoint_type in EndpointType: | ||
if name.replace("_", "").lower() == endpoint_type.w3c.lower(): | ||
return endpoint_type | ||
|
||
return None | ||
|
||
@property | ||
def w3c(self): | ||
"""W3C name of endpoint type: externally-facing.""" | ||
return self.value.w3c | ||
|
||
@property | ||
def indy(self): | ||
"""Indy name of endpoint type: internally-facing, on ledger and in wallet.""" | ||
return self.value.indy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from asynctest import TestCase as AsyncTestCase | ||
|
||
from ..endpoint_type import EndpointType | ||
|
||
|
||
class TestEndpointType(AsyncTestCase): | ||
async def test_endpoint_type(self): | ||
assert EndpointType.ENDPOINT == EndpointType.get("endpoint") | ||
assert EndpointType.PROFILE == EndpointType.get("PROFILE") | ||
assert EndpointType.LINKED_DOMAINS == EndpointType.get("linked_domains") | ||
assert EndpointType.get("no-such-type") is None | ||
assert EndpointType.get(None) is None | ||
|
||
assert EndpointType.PROFILE.w3c == "Profile" | ||
assert EndpointType.PROFILE.indy == "profile" | ||
assert EndpointType.ENDPOINT.w3c == "Endpoint" | ||
assert EndpointType.ENDPOINT.indy == "endpoint" | ||
assert EndpointType.LINKED_DOMAINS.w3c == "LinkedDomains" | ||
assert EndpointType.LINKED_DOMAINS.indy == "linked_domains" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,3 @@ | ||
"""Ledger utilities.""" | ||
|
||
from enum import Enum | ||
|
||
TAA_ACCEPTED_RECORD_TYPE = "taa_accepted" | ||
|
||
|
||
class EndpointType(Enum): | ||
"""Enum for endpoint/service types.""" | ||
|
||
ENDPOINT = "endpoint" | ||
PROFILE = "Profile" | ||
LINKED_DOMAINS = "LinkedDomains" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.