Minor fix

This commit is contained in:
Maria Shodunke
2025-04-23 10:18:39 +01:00
parent 2296a6c34b
commit 3e5c391994
2 changed files with 18 additions and 17 deletions

View File

@@ -5,26 +5,28 @@ Verifies that a specific credential exists on the XRPL and is valid.
Quick install & usage: Quick install & usage:
```sh ```sh
blob npm install
``` ```
`verify_credential.js` can also be used as a commandline utility. Full usage statement: `verify_credential.js` can also be used as a commandline utility. Full usage statement:
```sh ```sh
$ ./verify_credential.js -h $ ./verify_credential.js -h
usage: verify_credential.js [-h] [-b] [-n {devnet,testnet,mainnet}]
[issuer] [subject] [credential_type] Usage: verify-credential [options] [issuer] [subject] [credential_type]
Verify an XRPL credential Verify an XRPL credential
positional arguments: Arguments:
issuer Credential issuer address as base58. issuer Credential issuer address as base58 (default:
subject Credential subject (holder) address as base58. "rEzikzbnH6FQJ2cCr4Bqmf6c3jyWLzkonS")
credential_type Credential type as string subject Credential subject (holder) address as base58 (default:
"rsYhHbanGpnYe3M6bsaMeJT5jnLTfDEzoA")
credential_type Credential type as string. (default: "my_credential")
options: Options:
-h, --help show this help message and exit
-b, --binary Use binary (hexadecimal) for credential_type -b, --binary Use binary (hexadecimal) for credential_type
-n, --network {devnet,testnet,mainnet} -n, --network <network> {devnet,testnet,mainnet} Use the specified network for lookup (default: "devnet")
Use the specified network for lookup -q, --quiet Don't print log messages
-h, --help display help for command
``` ```

View File

@@ -30,12 +30,11 @@ async function verifyCredential(client, issuer, subject, credentialType, binary=
* as of the most recently validated ledger. * as of the most recently validated ledger.
* Parameters: * Parameters:
* client - Client for interacting with rippled servers. * client - Client for interacting with rippled servers.
* issuer - Address of the credential issuer, in base58 * issuer - Address of the credential issuer, in base58.
* subject - Address of the credential holder/subject, in base58 * subject - Address of the credential holder/subject, in base58.
* credentialType - Credential type to check for as a string, * credentialType - Credential type to check for as a string,
* which will be encoded as UTF-8 (1-128 bytes long). * which will be encoded as UTF-8 (1-128 bytes long).
* binary - Specifies that the credential type is provided in hexadecimal format. * binary - Specifies that the credential type is provided in hexadecimal format.
* verbose - If true, print details to stdout during lookup.
* You must provide the credential_type as input. * You must provide the credential_type as input.
* Returns True if the account holds the specified, valid credential. * Returns True if the account holds the specified, valid credential.
* Returns False if the credential is missing, expired, or not accepted. * Returns False if the credential is missing, expired, or not accepted.
@@ -81,7 +80,7 @@ async function verifyCredential(client, issuer, subject, credentialType, binary=
logger.info("Credential was not found"); logger.info("Credential was not found");
return false; return false;
} else { } else {
//Other errors, for example invalidly-specified addresses. // Other errors, for example invalidly pecified addresses.
throw new XRPLLookupError(xrplResponse); throw new XRPLLookupError(xrplResponse);
} }
} }
@@ -129,7 +128,7 @@ async function verifyCredential(client, issuer, subject, credentialType, binary=
// Commandline usage ----------------------------------------------------------- // Commandline usage -----------------------------------------------------------
async function main() { async function main() {
// JSON-RPC URLs of public servers // Websocket URLs of public servers
const NETWORKS = { const NETWORKS = {
devnet: "wss://s.devnet.rippletest.net:51233", devnet: "wss://s.devnet.rippletest.net:51233",
testnet: "wss://s.altnet.rippletest.net:51233", testnet: "wss://s.altnet.rippletest.net:51233",