Merge pull request #136 from julien1619/patch-1
Fix decoder for third dose - fixes #124
This commit is contained in:
commit
bc3efc4728
|
@ -20,6 +20,10 @@ export function typedArrayToBuffer(array: Uint8Array): ArrayBuffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function decodeData(data: string): Object {
|
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')) {
|
if (data.startsWith('HC1')) {
|
||||||
data = data.substring(3);
|
data = data.substring(3);
|
||||||
|
@ -45,4 +49,4 @@ export function decodeData(data: string): Object {
|
||||||
var decoded: Object = cbor.decode(typedArrayToBufferSliced(plaintext));
|
var decoded: Object = cbor.decode(typedArrayToBufferSliced(plaintext));
|
||||||
|
|
||||||
return decoded;
|
return decoded;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue