Files
mDuo13 359e598a8b Add Credential Issuer tutorial
Adds a code sample and a code walkthrough explaining how to build a
service that issues Credentials (XLS-70) on the XRP Ledger.

Credential issuer: Clarify/revise documents field

Issue credentials code sample: fix bugs

Apply suggestions from @oeggert review

Co-authored-by: oeggert <117319296+oeggert@users.noreply.github.com>

Credential Issuer: more edits for clarity
2025-03-19 16:15:06 -07:00

15 lines
451 B
Python

from binascii import unhexlify
def decode_hex(s_hex):
"""
Try decoding a hex string as ASCII; return the decoded string on success,
or the un-decoded string prefixed by '(BIN) ' on failure.
"""
try:
s = unhexlify(s_hex).decode("ascii")
# Could use utf-8 instead, but it has more edge cases.
# Optionally, sanitize the string for display before returning
except:
s = "(BIN) "+s_hex
return s