Ton Proof Go
Ton proof library for go
go get github.com/domikedos/ton-proof-go
Ton proof library for check proof.
This library can generate payload for proof and also check that proof is valid
How to use
Payload
To generate payload use proof.GeneratePayload(config *model.PayloadConfig) method.
Example of model.PayloadConfig:
&model.PayloadConfig{
Secret: "your secret",
PayloadTTL: "time to live for payload",
}
As response, you'll get the following object model.Payload:
Payload{
Payload: "payload"
}
Proof
Firstly, you need to get request body as model.TonProofRequest:
{
"address": "wallet_address",
"network": "-239",
"publicKey": "public_key",
"proof": {
"timestamp": 1733300545,
"domain": {
"lengthBytes": 20,
"value": "your-domain.com"
},
"signature": "signature",
"payload": "payload",
"stateInit": "state_init"
}
}
To check proof use proof.Proof(config *model.ProofConfig) method.
Example of ProofConfig:
&model.ProofConfig{
Secret: "your secret",
Domain: "your-domain.com",
ProofTTL: "time to live for proof",
TonProof: "your body",
}
As response, you'll get nil if proof checked successfully and error otherwise