mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-09 22:35:49 +00:00
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
15 lines
451 B
Python
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
|