blob: 99e01ca700cda5b08de658968496d082469896bf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/* SPDX-License-Identifier: AGPL-3.0-or-later */
import AppID from "./AppID.js";
import typescriptNever from "./typescriptNever.js";
/**
* To generate a new AppID, please follow these steps:
*
* 1. Open Tor Browser and go to:
* https://products.wolframalpha.com/api/
* 2. Click the orange "Get API Access" button.
* Tor Browser will redirect you to:
* https://account.wolfram.com/login/oauth2/sign-in
* 3. Click the red "Create one" hyperlink to create a new Wolfram ID.
* Tor Browser will redirect you to:
* https://account.wolfram.com/login/create
* 4. Fill out the form with random alphanumeric characters.
* 5. Click the red "Create Wolfram ID" button.
* Tor Browser will redirect you to:
* https://developer.wolframalpha.com/portal/myapps/index.html
* 6. Click the orange "Sign up to get your first AppID" button.
* 7. Fill out the form with random alphanumeric characters.
* 8. Click the orange "Sign up" button.
* 9. Click the orange "Get an AppID" button.
* 10. Fill out the form with random alphanumeric characters.
* 11. Click the orange "Get AppID" button.
*/
const appIDArray: Readonly<AppID[]> = Object.freeze([
"G5VJT6-29G98TJJAG",
]);
console.assert(appIDArray.length > 0);
appIDArray.forEach((appID) => {
console.assert(appID.length === 17);
console.assert(/[0-9A-Z]{6}-[0-9A-Z]{10}/.test(appID));
});
export default (): AppID => {
const random = appIDArray[getRandomInt() % appIDArray.length];
if (typeof random === "string") {
return random;
} else if (random === undefined) {
console.warn({ random });
} else {
typescriptNever(random);
}
return "H9V325-HTALUWHKGK";
};
const getRandomInt = (): number => {
const random = crypto.getRandomValues(new Uint32Array(1))[0];
if (typeof random === "number") {
return random;
} else if (random === undefined) {
console.warn({ random });
} else {
typescriptNever(random);
}
return 0;
};
|