MCPcopy Index your code
hub / github.com/HelloZeroNet/ZeroNet / addCert

Method addCert

src/User/User.py:125–143  ·  view source on GitHub ↗
(self, auth_address, domain, auth_type, auth_user_name, cert_sign)

Source from the content-addressed store, hash-verified

123
124 # Add cert for the user
125 def addCert(self, auth_address, domain, auth_type, auth_user_name, cert_sign):
126 # Find privatekey by auth address
127 auth_privatekey = [site["auth_privatekey"] for site in list(self.sites.values()) if site["auth_address"] == auth_address][0]
128 cert_node = {
129 "auth_address": auth_address,
130 "auth_privatekey": auth_privatekey,
131 "auth_type": auth_type,
132 "auth_user_name": auth_user_name,
133 "cert_sign": cert_sign
134 }
135 # Check if we have already cert for that domain and its not the same
136 if self.certs.get(domain) and self.certs[domain] != cert_node:
137 return False
138 elif self.certs.get(domain) == cert_node: # Same, not updated
139 return None
140 else: # Not exist yet, add
141 self.certs[domain] = cert_node
142 self.save()
143 return True
144
145 # Remove cert from user
146 def deleteCert(self, domain):

Callers 3

actionCertAddMethod · 0.80
cbCertAddConfirmMethod · 0.80
testCertMethod · 0.80

Calls 3

saveMethod · 0.95
valuesMethod · 0.80
getMethod · 0.45

Tested by 1

testCertMethod · 0.64