powVerify
Verifies a nonce generated with the powSolve
function.
info
This function can be used to prevent form spamming.
Signature
powVerify(
nonce: string,
difficulty: number,
validity: number,
data: Instance | Context | {
exportables: Export.IExportables;
actionables: Export.IActionables | undefined;
},
id?: string
): boolean
Parameters
Name | Type | Optional | Description |
---|---|---|---|
nonce | string | No | Specifies the nonce to verify. This nonce is generated with the powSolve function. |
difficulty | number | No | Specifies the required difficulty (this should match the given difficulty to the powSolve function). |
validity | number | No | Specifies the maximum validity period for the nonce in milliseconds (or 0 to disable). This indicates how old the nonce may be. |
data | Instance | Context | object | No | Specifies the data used in the powSolve function. If an Instance or Context is supplied, the data is automatically retrieved. It is also possible to supply the data directly using the exportables and actionables functions from the export module. |
id | string | Yes | Optional identifier for the data used in the powSolve function. |
Return value
Returns true
when the nonce is valid.