Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,7 @@ Install the plugin:
asdf plugin-add nodejs https://github.com/asdf-vm/asdf-nodejs.git
```

Import the Node.js release team's OpenPGP keys to main keyring:

```bash
bash -c '${ASDF_DATA_DIR:=$HOME/.asdf}/plugins/nodejs/bin/import-release-team-keyring'
```

If you are trying to install a previous release and facing any issue about verification, import the Node.js previous release team's OpenPGP keys to main keyring:
The plugin now automatically imports the NodeJS release team's OpenPGP keys. If you are trying to install a previous release and facing any issue about verification, import the Node.js previous release team's OpenPGP keys to main keyring:

```bash
bash -c '${ASDF_DATA_DIR:=$HOME/.asdf}/plugins/nodejs/bin/import-previous-release-team-keyring'
Expand Down
7 changes: 4 additions & 3 deletions bin/import-release-team-keyring
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ if [ -z "${gnugp_verify_command_name}" ]; then
fi

for key in $KEYS; do
for server in $SERVERS; do
$gnugp_verify_command_name --no-default-keyring --keyring ${ASDF_NODEJS_KEYRING} --no-tty --keyserver "hkp://$server" $OPTIONS --display-charset utf-8 --recv-keys "$key" && break
done
for server in $SERVERS; do
$gnugp_verify_command_name --with-colons --no-default-keyring --keyring ${ASDF_NODEJS_KEYRING} -k $key > /dev/null 2>&1 || \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't this line be moved above line 42?

Something like this:

for key in $KEYS; do
  # Halt fetching this key if we already have it
  $gnugp_verify_command_name --with-colons --no-default-keyring --keyring ${ASDF_NODEJS_KEYRING} -k $key > /dev/null 2>&1 && break

  # Otherwise loop through servers until we find it
  for server in $SERVERS; do
    $gnugp_verify_command_name --no-default-keyring --keyring ${ASDF_NODEJS_KEYRING} --no-tty --keyserver "hkp://$server" $OPTIONS --display-charset utf-8 --recv-keys "$key" && break
  done
done

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd originally tried that but got a weird gnupg_verify_command_name: unbound variable error that I didn't get when I had it in the inner loop. I futzed with it a bit but ultimately opted to go with working code vice spending more time down the rathole troubleshooting further.

$gnugp_verify_command_name --no-default-keyring --keyring ${ASDF_NODEJS_KEYRING} --no-tty --keyserver "hkp://$server" $OPTIONS --display-charset utf-8 --recv-keys "$key" && break
done
done
3 changes: 3 additions & 0 deletions bin/install
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ download_and_verify_checksums() {
export GNUPGHOME="${ASDF_DIR:-$HOME/.asdf}/keyrings/nodejs"
fi

# Automatically add needed PGP keys
"$(dirname "$0")/import-release-team-keyring"

if ! $gnugp_verify_command_name --no-default-keyring --keyring "${ASDF_NODEJS_KEYRING}" --display-charset utf-8 --verify "$signed_checksum_file" 2>/dev/null; then
# Try default keyring
if ! $gnugp_verify_command_name --display-charset utf-8 --verify "$signed_checksum_file" 2>/dev/null; then
Expand Down