Closed jbenet closed 9 years ago
Wont a DHT Get and a DAG Get return the same data?
Addendum to above
NameSystem
thing above can just be one NSResolver
: IpfsResolver
or something.
// rename NSResolver -> Resolver
// previously RoutingName
type SignedLink {
Hash u.Key
Signature []byte
}
type Publisher interface {
Publish(*PubKey, *SignedLink) error
}
// this could be the same object as IpfsResolver actually...
type IpfsPublisher struct { ... }
func (p *IpfsPublisher) Publish(p *PubKey, l *SignedLink) error {
// verify l.Hash exists and is reachable via IPFS
... p.dag.Get(l.Hash)
// key is the ipns hash of PubKey (e.g. /ipns/<hash of pubkey>)
key := NameKey(p.Hash())
p.routing.PutValue(key, serialized(l))
}
func NameKey(hash u.Key) u.Key {
// return hash of /ipns/<hash> (or whatever we go with)
}
type NameSystem interface {
Resolver
Publisher
}
type IPNS struct {
*IpfsResolver
*IpfsPublisher
}
@whyrusleeping here's a rough spec of ipns / the namespace:
NSResolver
interface.NSResolvers
(which @Bren2010 started).RoutingResolver
(the meat of IPNS) which does:NameService
orNameSystem
object:/ipns
toipfs mount
cmd (maybe have options for each i.e.-n, --ipns
and-f, --ipfs
to toggle each on/off)