Generating and redeeming binary data codes on websites (Coupons, Product Keys, etc.) is a disaster.
It is inappropriate to expect a user to transcribe a complex coupon code or product key without
error. In fact, it is somewhat insulting. When your user (inevitably) gets a couple of characters
wrong, they are forced to manually find the error, and re-enter the code.
Instead, just enable Reed-Solomon error correction on the code. A few wrong symbols entered? No
problem – they automatically get corrected.
Much happier clients == more revenue for your web store!
Generate a code with built-in Reed-Solomon error correction using the rskey.js APIs. For example,
encrypt 64 bits of your Customer ID and card ID and generate an RSKEY like:
and print or email this for your client.
Later, when the client re-enters the code (with error 'W'->'v'), you might get back something like:
psx1 tpv8 snfp zm7g
No problem. The transcriptions errors are corrected (whitespace and dashes are ignored), and your
encrypted card ID data is recovered. A quick request back to your server decrypts the customer
and card IDs, and you can present the discount!
Since all of the RSKEY decoding occurs in your client's browser, you can easily display that the
coupon code is valid in real-time – even showing the auto-correction, if you wish. All
decryption occurs safely and securely on your server, so no encryption keys are ever transmitted
to the browser.