RNS Logo

rns.recipes

Community Forum

Forum / Showcase / rnns: friendly name to rnid tool

rnns: friendly name to rnid tool

Started by qbit b253938bf730967b... ·

qbit b253938bf730967b...

rnns is an extremely simple script that helps one locally resolve names to RNIDs.

#!/bin/sh

RN_NAME_FILE=${RN_NAME_FILE:-~/.rnns}

function usage() {
    echo "rnns [-h] friendly_identifier"
}

while getopts h name; do
    case $name in
h)
    usage
    exit 0
    ;;
*)
    usage
    exit 1
    esac
done

if [ -z "$1" ]; then
    usage
    exit 1
fi

awk -v entry="$1" '{ for (i=NF; i>1; i--) { if ($i == entry) { print $1} } }' $RN_NAME_FILE

For example usage, one can add an entry for the official Reticulum signing key:

bc7291552be7a58f361522990465165crns-sig

Now you can use it by calling rnns with the string rns-sig:

% rnid -i $(rnns rns-sig) -V nomadnet-1.0.4.tar.gz
Recalled Identity <bc7291552be7a58f361522990465165c>
Signature is valid, the file nomadnet-1.0.4.tar.gz was signed by <bc7291552be7a58f361522990465165c>
%

You can even add multiple aliases for a single entry:

0cc65124b72a5fdec6dcc14241bb8108openbsd.app openbsd app

All three of the above "resolve" to 0cc6...!

Hope someone finds it useful!

qbit b253938bf730967b...

alternative link to the script: 3b5bc6888356193f1ac1bfb716c1beef:/file/rnns

sprell 39ca0e9212495cfe...

3b5bc6888356193f1ac1bfb716c1beef... beef...

Mark bc7291552be7a58f...

That's nice! Thanks qbit!

joakim b918e659eeedac9a...
edited

Nice one!

Follow-up idea: Have all CLI tools of RNS support a .reticulum/aliases file, similar to SSH aliases.

Or maybe an rnalias tool for managing .reticulum/storage/aliases, if not a part of rnid itself?

Post a Reply

Markdown

Supports Markdown: **bold**, *italic*, `code`, ```code blocks```, [links](url)

Log in to upload images

Proof of work verification for anonymous posting

Copied to clipboard