-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore!(sdk): Remove html wrapper creation (#406)
- still allow reading html wrapped files, for transitional support
- Loading branch information
1 parent
a5c1167
commit 1beb02c
Showing
14 changed files
with
67 additions
and
354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { decodeArrayBuffer } from '../../../src/encodings/base64.js'; | ||
import { InvalidFileError } from '../../../src/errors.js'; | ||
|
||
export function unwrapHtml(htmlPayload: Uint8Array): Uint8Array { | ||
const html = new TextDecoder().decode(htmlPayload); | ||
const payloadRe = /<input id=['"]?data-input['"]?[^>]*?value=['"]?([a-zA-Z0-9+/=]+)['"]?/; | ||
const reResult = payloadRe.exec(html); | ||
if (!reResult) { | ||
throw new InvalidFileError('Payload is missing'); | ||
} | ||
const base64Payload = reResult[1]; | ||
try { | ||
return new Uint8Array(decodeArrayBuffer(base64Payload)); | ||
} catch (e) { | ||
throw new InvalidFileError('There was a problem extracting the TDF3 payload', e); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.