Skip to content

pwa_validate

(Added by the PWALoader amendment.)

The pwa_validate method checks whether a document a client was served is the account’s current AppLoader document, as of the validated ledger. It is intended for clients such as browser extensions that want to vet a document served by one node against a second node.

{
"command": "pwa_validate",
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"hash": "<hex SHA-512Half of the document bytes served>",
"domain": "app.example.org"
}

Command line:

xahaud pwa_validate <account> <hash> [<domain>]
FieldJSON TypeRequired?Description
accountStringYesThe address of the account that published the document.
hashStringYesThe SHA-512Half of the document bytes that were served, as hex.
domainStringNoThe host the document was served from. If given, the account’s Domain must equal it or be a parent of it (case-insensitive). For example, an account with Domain example.org endorses example.org and app.example.org.
{
"result": {
"ledger_index": 12345678,
"app_loader_sequence": 4,
"valid": true,
"status": "success"
}
}
FieldJSON TypeDescription
ledger_indexNumberThe validated ledger the check was made against.
app_loader_sequenceNumberThe AppLoaderSequence of the account’s current document.
validBooleantrue if the hash matches the current document (and the domain, if given, is endorsed by the account).
reasonString(Only when valid is false) One of "no loader", "hash mismatch" or "domain not endorsed by account".

If the client was served from an older ledger (the X-LedgerSeq response header) than the returned ledger_index and gets "hash mismatch", it should simply reload the document.

  • Any of the universal error types.
  • actMalformed: the account is not a valid address.
  • invalidParams: the hash is not a valid 32-byte hex value.
  • notSynced: the server is not synced to the network.