Beispiel #1
0
    def setCredential(self,
                      node_name="root",
                      key=None,
                      credentialHash=None,
                      participants=[],
                      caller_key=None):

        if node_name == "root":
            node_hash = b.to_32byte_hex(0)
        else:
            node_hash = raw_name_to_hash(node_name)

        participantsHash = []
        for i in range(5):
            if i < len(participants):
                participantsHash.append(self.hash(participants[i]))
            else:
                participantsHash.append(bytes(32))

        success, tx_receipt, tx_hash = b.send_signed_tx(
            PublicResolver.functions.setCredential(
                node_hash,
                key,
                credentialHash,
                participantsHash[0],
                participantsHash[1],
                participantsHash[2],
                participantsHash[3],
                participantsHash[4],
            ), caller_key)

        return success, tx_receipt, tx_hash
Beispiel #2
0
    def setAlaDIDPublicEntity(self, node_name, label, DID, name, DIDDocument,
                              active, new_owner_address, caller_key):

        if node_name == "root":
            node_hash = b.to_32byte_hex(0)
        else:
            node_hash = raw_name_to_hash(node_name)

        label_hash = label_to_hash(label)

        # Calculate the hash of the DID
        DIDHash = b.Web3.keccak(text=DID)

        success, tx_receipt, tx_hash = b.send_signed_tx(
            PublicResolver.functions.setAlaDIDPublicEntity(
                node_hash,
                label_hash,
                DIDHash,
                name,
                DIDDocument,
                active,
                new_owner_address,
            ), caller_key)

        return success, tx_receipt, tx_hash
Beispiel #3
0
    def setApprovalForAll(self, operator_address, approved, current_owner_key):

        contract_fun = ENS.functions.setApprovalForAll(operator_address,
                                                       approved)
        success, tx_receipt, tx_hash = b.send_signed_tx(
            contract_fun, current_owner_key)
        return success, tx_receipt, tx_hash
Beispiel #4
0
    def setAlaDIDDocument(self, _DID, DIDDocument, caller_key):

        # Check that the DID is a string starting with "did:" and that it has some more characters (we accept ANY DID)
        if (not _DID.startswith("did:")) or (len(_DID) <= 4):
            return None, None, None, False

        # Calculate the hash of the DID
        _DIDHash = b.Web3.keccak(text=_DID)

        success, tx_receipt, tx_hash = b.send_signed_tx(
            PublicResolver.functions.setAlaDIDDocument(_DIDHash, DIDDocument),
            caller_key)

        return success, tx_receipt, tx_hash
Beispiel #5
0
    def setResolver(self,
                    node_name="root",
                    resolver_address=None,
                    current_owner_key=None):

        if node_name == "root":
            node_hash = b.to_32byte_hex(0)
        else:
            node_hash = raw_name_to_hash(node_name)

        contract_fun = ENS.functions.setResolver(node_hash, resolver_address)
        success, tx_receipt, tx_hash = b.send_signed_tx(
            contract_fun, current_owner_key)
        return success, tx_receipt, tx_hash
Beispiel #6
0
    def setName(self,
                node_name="root",
                name_to_resolve="root",
                current_owner_key=None):

        if node_name == "root":
            node_hash = b.to_32byte_hex(0)
        else:
            node_hash = raw_name_to_hash(node_name)

        contract_fun = PublicResolver.functions.setName(
            node_hash, name_to_resolve)
        success, tx_receipt, tx_hash = b.send_signed_tx(
            contract_fun, current_owner_key)
        return success, tx_receipt, tx_hash
Beispiel #7
0
    def confirmCredential(self,
                          node_name=None,
                          key=None,
                          participantDID=None,
                          caller_key=None):

        if node_name == "root":
            node_hash = b.to_32byte_hex(0)
        else:
            node_hash = raw_name_to_hash(node_name)

        participantHash = self.hash(participantDID)

        success, tx_receipt, tx_hash = b.send_signed_tx(
            PublicResolver.functions.confirmCredential(node_hash, key,
                                                       participantHash),
            caller_key)

        return success, tx_receipt, tx_hash
Beispiel #8
0
    def setAlaTSP(self,
                  node_name,
                  label,
                  URI,
                  org,
                  active,
                  current_owner_key=None):

        if node_name == "root":
            node_hash = b.to_32byte_hex(0)
        else:
            node_hash = raw_name_to_hash(node_name)

        label_hash = label_to_hash(label)

        contract_fun = PublicResolver.functions.setAlaTSP(
            node_hash, label_hash, URI, org, active)
        success, tx_receipt, tx_hash = b.send_signed_tx(
            contract_fun, current_owner_key)
        return success, tx_receipt, tx_hash
Beispiel #9
0
    def addAlaTSPService(self,
                         node_name,
                         label,
                         X509SKI,
                         serviceName,
                         X509Certificate,
                         active,
                         current_owner_key=None):

        if node_name == "root":
            node_hash = b.to_32byte_hex(0)
        else:
            node_hash = raw_name_to_hash(node_name)

        label_hash = label_to_hash(label)

        contract_fun = PublicResolver.functions.addAlaTSPService(
            node_hash, label_hash, X509SKI, serviceName, X509Certificate,
            active)
        success, tx_receipt, tx_hash = b.send_signed_tx(
            contract_fun, current_owner_key)
        return success, tx_receipt, tx_hash