ripple / explorer

Open Source XRP Ledger Explorer
https://livenet.xrpl.org/
MIT License
121 stars 68 forks source link

Credentials: decode simple CredentialType values #1080

Open mDuo13 opened 1 week ago

mDuo13 commented 1 week ago

This applies to CredentialCreate, CredentialAccept, and CredentialDelete transaction views, as well as anywhere else Credential details are displayed (currently I think that's all).

Similar to how the explorer decodes other hex values like accounts' Domain value or extended currency codes, I expect the CredentialType field to be decoded into human-readable text, at least if it decodes into reasonable plain text using ASCII. (Or UTF-8, although that has a lot more edge cases to account for.) Obviously you would want to exclude or escape special characters so that you don't end up with cross-site scripting, or right-to-left text, or other glitchiness, similar to how you do with Domains, Memos, and other examples.

I would expect this to display the CredentialType as test_cred1 for example. (Test transaction on Devnet): Screenshot of the "Simple" view of a sample transaction. The CredentialType is displayed as the hex "746573745F6372656431"

mvadari commented 1 week ago

Credential support hasn't actually been added yet, this is just the default processing.

ckeshava commented 1 week ago

Hello, DepositPreauth transaction also deals with arrays of credentials. It is helpful to decode those hex-strings as well. Here's an exanple: https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0070d-credentials#124-depositpreauth