Skip to content

Commit

Permalink
#1 don't validate 3rd byte. ANSI or AAMVA.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenquan authored Sep 5, 2018
1 parent 8c342c0 commit 937342a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion AAMVAtoJSON.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
function AAMVAtoJSON(data) {
var m = data.match(/^@\n\u001e\r(ANSI )(\d{6})(\d{2})(\d{2})(\d{2})/);
// Detect AAMVA header:
// 1. First two characters: "@\n"
// 2. Third character should be 0x1e but we ignore because of South Carolina 0x1c edge condition
// 3. Next 5 characters either "ANSI " or "AAMVA"
// 4. Next 12 characters: IIN, AAMVAVersion, JurisdictionVersion, numberOfEntries
var m = data.match(/^@\n.\r(ANSI |AAMVA)(\d{6})(\d{2})(\d{2})(\d{2})/);
if (!m) {
return null;
}
Expand Down

0 comments on commit 937342a

Please sign in to comment.