Using the Bonfida APIs, you can do a reverse lookup as follows:
import { performReverseLookup } from "@bonfida/spl-name-service";
// Public key of bonfida.sol
const domainKey = new PublicKey("Crf8hzfthWGbGbLTVCiqRqV5MVnbpHB1L9KQMd6gsinb");
const domainName = await performReverseLookup(connection, domainKey); // bonfida
In practice, this is returning an "invalid account name" error for user public keys. Is there an intermediary step to convert from a user's public key to their naming account public key first?