diff --git a/handshake-api/index.js b/handshake-api/index.js index 896514fb..63cd75d7 100644 --- a/handshake-api/index.js +++ b/handshake-api/index.js @@ -32,7 +32,13 @@ const getDomainRecords = async (name) => { }; const findSkylinkRecord = (records) => { - return records?.find(({ txt }) => txt?.some((entry) => isValidSkylink(entry))); + // Find the last one, so people can update their domains in a non-destructive + // way by simply adding a new link. This will also allow keeping links to + // older versions for backwards compatibility. + return records + ?.slice() + .reverse() + .find(({ txt }) => txt?.some((entry) => isValidSkylink(entry))); }; const getSkylinkFromRecord = (record) => {