I kind of wanted my first blog post to be something thoughtful or insightful but instead I'll post something boring but also something that took me a while to figure out: How to implement Nostr NIP-05 verification with your Wix-hosted website.
If you're unfamiliar with Nostr, go here: What is Nostr?
If you're unfamiliar with NIP-05 verification, go here: Get NIP-05 Verified
Problem:
In order to do NIP-05 verification that many Nostr clients will use to show a "verification" logo on your profile, you need to host a json file in a special directory on your website. Wix hosting doesn't allow you to manage files in this special directory yourself because of the 'security' implications.
Solution:
1) Go to your homepage and edit in Dev Mode. Go to the Public & Backend section and add a new file called "http-functions.js" in the Backend.
2) Edit the file and drop in the following code, replacing these 2 values:
Example:
nip-05 address = trey@cafesatoshi.org
nostrName = trey
npubHex = dd9939f135fa9848dcc64dd79337741be78b342b8a655acbe0e676d292955b8c
import { ok, notFound, serverError } from 'wix-http-functions';
let nostr = {
"names": {
"nostrName": "npubHex"
}
}
const nostrJSON = JSON.stringify(nostr);
export function get_nostr(request) {
let options = {
"headers": {
"Content-Type": "application/json"
},
"body": nostrJSON
};
return ok(options);
}
3) Publish the changes and head over to your Marketing & SEO tools from your Dashboard.
Dashboard > Marketing & SEO > SEO > URL Redirect Manager
4) Add a New Redirect that will redirect the nostr.json file path to the new function you just published. It should look like this:
Special thanks to this post for pointing me in the right direction!
Comments