Compare commits
3 Commits
a4e058fe53
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
11792cba26
|
|||
|
901ea165e5
|
|||
|
1621d82c56
|
78
dnsconfig.js
78
dnsconfig.js
@@ -51,10 +51,15 @@ D("arirex.me", REG_101DOMAIN,
|
||||
protonmail("6fd60590dc31588ca5a85c7e311649ff5f93cab2", "dodai2qaszneyk5jeyfloq24ttjcqfer2gdopw3nfmxn3bugtw2hq"),
|
||||
|
||||
// Verifications
|
||||
TXT("@", "oa1:xmr recipient_address=89dQNyY3E9gJGYrEeRw4EFAdezWQg7BBbHJdBpLRwrjH52ngNfAYRcEhAHQotCswGxTeSoFi5nQ7Gf86kySmXzuQE9CXjUH; recipient_name=AriRexouium;", CF_COMMENT("OpenAlias > XMR > Kraken")),
|
||||
TXT("_discord", "dh=1c93b7effbe0bf428cb55d33175c2721ef715bb6", CF_COMMENT("Discord Verify")),
|
||||
TXT("_atproto", "did=did:plc:53kf45pcsqgayjmoau42lhsk", CF_COMMENT("BlueSky Verify")),
|
||||
TXT("_github-pages-challenge-arirexouium", "0b62c2fb7a8422145d5b5e6637257d", CF_COMMENT("GitHub Pages Verify")),
|
||||
|
||||
// OpenAlias
|
||||
openalias("xmr", "89dQNyY3E9gJGYrEeRw4EFAdezWQg7BBbHJdBpLRwrjH52ngNfAYRcEhAHQotCswGxTeSoFi5nQ7Gf86kySmXzuQE9CXjUH", {
|
||||
name: "AriRexouium",
|
||||
checksum: true,
|
||||
}),
|
||||
);
|
||||
|
||||
D("achl.fr", REG_101DOMAIN,
|
||||
@@ -141,6 +146,9 @@ cnames("arirex.me", rexcloud, [
|
||||
Helper Functions
|
||||
\* ****************************************************************************************************************** */
|
||||
|
||||
/* -------------------------------------------------------------------------- *\
|
||||
Basic Builders
|
||||
\* -------------------------------------------------------------------------- */
|
||||
/**
|
||||
* Create CNAME records from "comment@subdomain" strings
|
||||
* @param {string} domain - Domain to extend
|
||||
@@ -169,6 +177,9 @@ function minecraft(comment, subdomain, domain, port) {
|
||||
);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- *\
|
||||
Email Builders
|
||||
\* -------------------------------------------------------------------------- */
|
||||
/**
|
||||
* Generate ProtonMail DNS records (MX, SPF, DMARC, verification, DKIM)
|
||||
* @param {string} verification - ProtonMail verification token
|
||||
@@ -215,3 +226,68 @@ function simplelogin(verification) {
|
||||
dmarcRecord,
|
||||
];
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- *\
|
||||
Open Alias Builder
|
||||
\* -------------------------------------------------------------------------- */
|
||||
/**
|
||||
* Generate OpenAlias TXT record
|
||||
* @param {string} prefix - Application prefix (e.g., "xmr", "btc")
|
||||
* @param {string} address - Recipient address
|
||||
* @param {object} [opts] - Optional key-value pairs
|
||||
* @param {string} [opts.name] - Recipient name
|
||||
* @param {string} [opts.description] - Transaction description
|
||||
* @param {string} [opts.amount] - Transaction amount
|
||||
* @param {string} [opts.paymentId] - Payment ID (e.g., for Monero)
|
||||
* @param {string} [opts.signature] - Address signature
|
||||
* @param {boolean} [opts.checksum] - Optional CRC-32 checksum
|
||||
* @returns {DomainModifier} TXT record
|
||||
*/
|
||||
function openalias(prefix, address, opts) {
|
||||
// Prefix and address are minimum requirement.
|
||||
// Everything else is optional.
|
||||
|
||||
opts = opts || {};
|
||||
var record = "oa1:" + prefix + " recipient_address=" + address + ";";
|
||||
|
||||
if (opts.name) { record += " recipient_name=" + opts.name + ";"; }
|
||||
if (opts.description) { record += " tx_description=" + opts.description + ";"; }
|
||||
if (opts.amount) { record += " tx_amount=" + opts.amount + ";"; }
|
||||
if (opts.paymentId) { record += " tx_payment_id=" + opts.paymentId + ";"; }
|
||||
if (opts.signature) { record += " address_signature=" + opts.signature + ";"; }
|
||||
if (opts.checksum) { record += " checksum=" + crc32(record.trim()).toString(16).toUpperCase() + ";"; }
|
||||
// Checksum must be last: CRC-32 of the record trimmed of surrounding spaces.
|
||||
|
||||
return TXT("@", record, CF_COMMENT("OpenAlias > " + prefix.toUpperCase() + (opts.name ? " > " + opts.name : "")));
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate CRC-32 checksum of a string
|
||||
* Handles UTF-8 strings correctly for use with DNSControl.
|
||||
* @param {string} str - Input string
|
||||
* @returns {number} CRC-32 value
|
||||
* @see https://github.com/nabijaczleweli/openalias.rs/blob/master/src/crypto_addr.rs
|
||||
*/
|
||||
function crc32(str) {
|
||||
// 1. Generate the CRC Table
|
||||
var table = [];
|
||||
for (var i = 0; i < 256; i++) {
|
||||
var c = i;
|
||||
for (var j = 0; j < 8; j++) {
|
||||
c = (c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1);
|
||||
}
|
||||
table[i] = c;
|
||||
}
|
||||
|
||||
// 2. Convert string to UTF-8 "binary" string
|
||||
// This ensures characters like '€' are treated as 3 bytes, not 1.
|
||||
var utf8Str = unescape(encodeURIComponent(str));
|
||||
|
||||
// 3. Calculate CRC
|
||||
var crc = 0xFFFFFFFF;
|
||||
for (var k = 0; k < utf8Str.length; k++) {
|
||||
crc = table[(crc ^ utf8Str.charCodeAt(k)) & 0xFF] ^ (crc >>> 8);
|
||||
}
|
||||
|
||||
return (crc ^ 0xFFFFFFFF) >>> 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user