Migrate library publish function to PeerDB