remove unnecesary const from parse and added comment to binarytoarray
This commit is contained in:
parent
848e0c0e03
commit
03969051a4
12
src/parse.ts
12
src/parse.ts
|
@ -1,10 +1,3 @@
|
||||||
const baseUrl: string = "https://envs.sh"
|
|
||||||
const id: string = "QnK" // < unicode >
|
|
||||||
const key: string = "LhBRttf+oI/PNHyTBrPa7HGDK/uC9fcMkGGgz63zT4Y=" // 32 bytes b64
|
|
||||||
const completeUrl: string = baseUrl + "/" + id + ".bin#" + key
|
|
||||||
console.log(completeUrl);
|
|
||||||
const urlObj:URL = new URL(completeUrl);
|
|
||||||
|
|
||||||
/** will return a tuple of the key and id if valid
|
/** will return a tuple of the key and id if valid
|
||||||
* 1 if no id ( creator )
|
* 1 if no id ( creator )
|
||||||
* 2 if encryption key is missing / wrong length
|
* 2 if encryption key is missing / wrong length
|
||||||
|
@ -30,6 +23,9 @@ function validUrl(url: URL): [string,Uint8Array] | number {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* will convert a binary string to a Uint8Array
|
||||||
|
*/
|
||||||
function binaryToArray(raw: string): Uint8Array {
|
function binaryToArray(raw: string): Uint8Array {
|
||||||
var rawLength = raw.length;
|
var rawLength = raw.length;
|
||||||
var array = new Uint8Array(new ArrayBuffer(rawLength));
|
var array = new Uint8Array(new ArrayBuffer(rawLength));
|
||||||
|
@ -39,5 +35,3 @@ function binaryToArray(raw: string): Uint8Array {
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(validUrl(urlObj));
|
|
||||||
|
|
Loading…
Reference in a new issue