library(sodium)
# Generate keypair, share pub with LORIS
key <- keygen()
pub <- pubkey(key)
# Encrypt id with pubkey in LORIS
id <- "17"
id_encrypted <- serialize(id, NULL) |>
simple_encrypt(pub) |>
bin2hex()
nchar(id_encrypted) # this is a bit long but should be okay for an URL
# Generate URL in LORIS
(url <- paste0("https://ucsd-cmig.shinyapps.io/hbcdtlfb-dev/?encryptedid=", id_encrypted))
# Decrypt id with private key in the app
id_decrypted <- id_encrypted |>
hex2bin() |>
simple_decrypt(key) |>
unserialize()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.