// InitializeKeyspace sets the ipns record for the given key to // point to an empty directory. // TODO: this doesnt feel like it belongs here func InitializeKeyspace(ctx context.Context, ds dag.DAGService, pub Publisher, pins pin.Pinner, key ci.PrivKey) error { emptyDir := &dag.Node{Data: ft.FolderPBData()} nodek, err := ds.Add(emptyDir) if err != nil { return err } // pin recursively because this might already be pinned // and doing a direct pin would throw an error in that case err = pins.Pin(ctx, emptyDir, true) if err != nil { return err } err = pins.Flush() if err != nil { return err } err = pub.Publish(ctx, key, path.FromKey(nodek)) if err != nil { return err } return nil }