Skip to content

Commit

Permalink
plugin:adding did plugin support in indy-plenum
Browse files Browse the repository at this point in the history
Signed-off-by: Atharva Amritkar <atharvaamritkar0@gmail.com>
  • Loading branch information
wiredhikari committed Feb 27, 2024
1 parent 67c6c58 commit c4cab05
Showing 1 changed file with 0 additions and 136 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,106 +20,6 @@
import libnacl
import libnacl.encode

"""
{
"SecurityDomainDIDDocument": {
"id": "did:<iin_name>:<network_name>",
"networkMembers": [
"did:<iin_name>:<network_member_1>",
"did:<iin_name>:<network_member_2>",
"did:<iin_name>:<network_member_3>"
],
"verificationMethod": [{
"id": "did:<iin_name>:<network_name>#multisig",
"type": "BlockchainNetworkMultiSig",
"controller": "did:<iin_name>:<network_name>",
"multisigKeys": [
"did:<iin_name>:<network_member_1>#key1",
"did:<iin_name>:<network_member_2>#key3",
"did:<iin_name>:<network_member_3>#key1"
],
"updatePolicy": {
"id": "did:<iin_name>:<network_name>#updatepolicy",
"controller": "did:<iin_name>:<network_name>",
"type": "VerifiableCondition2021",
"conditionAnd": [{
"id": "did:<iin_name>:<network_name>#updatepolicy-1",
"controller": "did:<iin_name>:<network_name>",
"type": "VerifiableCondition2021",
"conditionOr": ["did:<iin_name>:<network_member_3>#key1",
"did:<iin_name>:<network_member_2>#key3"
]
},
"did:<iin_name>:<network_member_1>#key1"
]
}
},
{
"id": "did:<iin_name>:<network_name>#fabriccerts",
"type": "DataplaneCredentials",
"controller": "did:<iin_name>:<network_name>",
"FabricCredentials": {
"did:<iin_name>:<network_member_1>": "Certificate3_Hash",
"did:<iin_name>:<network_member_2>": "Certificate2_Hash",
"did:<iin_name>:<network_member_3>": "Certificate3_Hash"
}
}
],
"authentication": [
"did:<iin_name>:<network_name>#multisig"
],
"relayEndpoints": [{
"hostname": "10.0.0.8",
"port": "8888"
},
{
"hostname": "10.0.0.9",
"port": "8888"
}
]
},
"signatures": {
"did:<iin_name>:<network_member_1>": "...",
"did:<iin_name>:<network_member_2>": "...",
"did:<iin_name>:<network_member_3>": "..."
}
}
"""



"""
<<<<NORMAL DID>>>>
"DIDDocument": {
"@context": [
"https://www.w3.org/ns/did/v1",
"https://w3id.org/security/suites/ed25519-2020/v1"
],
"id": "did:iin:iin123:shippingcompany",
"verificationMethod": [
{
"id": "did:iin:iin123:shippingcompany#key-1",
"type": "Ed25519VerificationKey2020",
"controller": "did:example:123456789abcdefghi",
"publicKeyBase64": "zH3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV"
}
],
"authentication": [
"did:iin:iin123:shippingcompany#keys-1",
{
"id": "did:iin:iin123:shippingcompany#keys-2",
"type": "Ed25519VerificationKey2020",
"controller": "did:shippingcompany",
"publicKeyBase64": "zH3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV"
}
]
},
"""



class CreateSDDIDRequest:
did: NetworkDID = None
did_str = None
Expand All @@ -138,56 +38,20 @@ def fetch_party_key_from_auth_method(self, party_did_id, auth_method):
return candidate_key_url

def fetch_party_verification_method(self, party_key_url):
<<<<<<< HEAD
=======
print("hello3")
>>>>>>> parent of 71dff0f7 (need to fix verification method)
party_did_id = did_id_from_url(party_key_url)
# Fetch party did
# TODO: if did is in some other iin network
# Will handle later...

# If did is in the same indy iin network
<<<<<<< HEAD

### TODO: did:iin:iin123:shippingcompany -----> DIDDocument: {....}

json_data = {
"@context": [
"https://www.w3.org/ns/did/v1",
"https://w3id.org/security/suites/ed25519-2020/v1"
],
"id": party_did_id,
"verificationMethod": [
{
"id": f"{party_did_id}#key1",
"type": "libnacl",
"controller": "did:example:123456789abcdefghi",
"publicKeyBase64": "zH3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z"
}
],
"authentication": [
f"{party_did_id}#key1",
{
"id": f"{party_did_id}#key1",
"type": "libnacl",
"controller": "did:shippingcompany",
"publicKeyBase64": "zH3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z"
}
]
}
json_string = json.dumps(json_data, indent=4)
party_did = DID(json_string)
party_authentication_method = party_did.fetch_authentication(party_key_url)
=======
serialized_party_did = self.this_indy_state.get(party_did_id)
# if not serialized_party_did:
# raise "Could not resolve did " + party_did_id
print(serialized_party_did)
party_did = domain_state_serializer.deserialize(serialized_party_did)
party_did = DID(party_did)
party_authentication_method = party_did.fetch_authentication_method(party_key_url)
>>>>>>> parent of 71dff0f7 (need to fix verification method)
return party_authentication_method


Expand Down

0 comments on commit c4cab05

Please sign in to comment.