Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
`check_signature` & `check_data_signature` usage for Signing?

Hi guys, how can I sign a Cell with ton-crypto, or ton-core or in someway, that later can be correctly verified by check_signature or check_data_signature from stdlib.fc in FunC?

This question was imported from Telegram Chat: https://t.me/tondev_eng/31621

Posted 11 months ago
Votes Newest


You can sign a Cell with ton-crypto or ton-core, and later verify it using check_signature or check_data_signature from stdlib.fc in FunC.

Here's an approximate code snippet that you should review:

sign(yourCell.hash(), keypair.secretKey);

## And in the FunC contract, check like this:
check_signature(cell_hash(your_cell), signature, public_key)

For more details, you can refer to the TON documentation on signature checks.

On the other hand, in Tact language, we also has the same feature in the Smart Contract side like this:

    external(msg: ExtMessage) {
        let hash: Int = beginCell().storeUint(msg.seqno, 32).storeUint(msg.valid_until, 32).storeRef(msg.message_parameters.toCell()).endCell().hash();
        require(checkSignature(hash, msg.signature, self.publicKey), "Invalid Signature"); // 😃😃😃 We checek the hash here
        require(msg.seqno == self.seqno, "Invalid Seqno");
        require(now() <= msg.valid_until, "Invalid Time");
        self.seqno = self.seqno + 1;
Posted 11 months ago
Edited 11 months ago
1 Answer
11 months ago
11 months ago