Fix decoder for third dose

This commit is contained in:
Julien Blatecky 2021-12-10 14:18:10 +01:00 committed by GitHub
parent 48028bb211
commit 674d325502
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -20,6 +20,10 @@ export function typedArrayToBuffer(array: Uint8Array): ArrayBuffer {
}
export function decodeData(data: string): Object {
if (data.startsWith('https://')) {
var url = new URL(data);
data = decodeURIComponent(url.hash.substring(1));
}
if (data.startsWith('HC1')) {
data = data.substring(3);
@ -45,4 +49,4 @@ export function decodeData(data: string): Object {
var decoded: Object = cbor.decode(typedArrayToBufferSliced(plaintext));
return decoded;
}
}