1 # Copyright (C) 2006, Thomas Leonard
2 # See the README file for details, or visit http://0install.net.
7 from namespaces
import config_site
, config_prog
15 def is_trusted(self
, key
):
16 self
.ensure_uptodate()
17 return key
in self
.keys
19 def trust_key(self
, key
):
20 self
.ensure_uptodate()
21 if key
in self
.keys
: return
22 int(key
, 16) # Ensure fingerprint is valid
26 def untrust_key(self
, key
):
27 self
.ensure_uptodate()
32 d
= basedir
.save_config_path(config_site
, config_prog
)
34 f
= file(os
.path
.join(d
, 'trust'), 'w')
39 def ensure_uptodate(self
):
40 # This is a bit inefficient...
41 trust
= basedir
.load_first_config(config_site
, config_prog
,
43 # By default, trust our own key
44 self
.keys
= {"92429807C9853C0744A68B9AAE07828059A53CC1": True}
46 #print "Loading trust from", trust_db
47 for key
in file(trust
).read().split('\n'):