Any string which was sign by secret key can be verify with public key. Some examples below
For sign a payload (nacl used from ton-crypto)
const signatureData = beginCell()
.storeUint(123, 32)
.storeCoins(toNano(123))
.endCell()
nacl.sign(signatureData.hash(), YOUR_SECRET_KEY)
For check signature on another side (js) it can be like this:
return nacl.sign.detached.verify(message, signature, pubkey)
OR if you want to check it in contract
(int public_key) = load_data()
slice ref = in_msg~load_ref().begin_parse();
var signature = ref~load_bits(512);
int is_valid = check_signature(slice_hash(in_msg), signature, public_key)
Some references