def read_store(self):
"""
Get the store from file.
"""
with open(self._path,'r',encoding='ascii') as fr:
outer_data = json.load(fr)
try:
validate(outer_data,OUTER_SCHEMA)
except ValidationError:
raise SSError("Invalid outer schema")
enc_bytes = hex_str_to_bytes(outer_data["enc_blob"])
try:
inner_data = self._box.decrypt(enc_bytes)
except nacl.exceptions.CryptoError:
raise SSCryptoError("Wrong password")
return json.loads(inner_data.decode('utf-8'))
评论列表
文章目录