/** * @license * SPDX-License-Identifier: AGPL-3.0-or-later * This file is part of Wolfree. * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. */ // @ts-check // To generate a new AppID: // 1. Open Tor Browser and go to: https://products.wolframalpha.com/api/ // 2. Click the orangish "Get API Access" button. You will go to: https://account.wolfram.com/login/oauth2/sign-in // 3. Click the reddish "Create one" hyperlink to create a new Wolfram ID. You will go to: https://account.wolfram.com/login/create // 4. Fill out the form using random alphanumeric characters. // 5. Click the reddish "Create Wolfram ID" button. You will go to: https://developer.wolframalpha.com/portal/myapps/index.html // 6. Click the orangish "Sign up to get your first AppID" button. // 7. Fill out the form using random alphanumeric characters. // 8. Click the orangish "Sign up" button. // 9. Click the orangish "Get an AppID" button. // 10. Fill out the form using random alphanumeric characters. // 11. Click the orangish "Get AppID" button. export default class AppID { appIDArray = Array(); constructor( appIDArray = ["H9V325-HTALUWHKGK", "AKJTJT-LR5LL8WTG6", "LKY83U-XW6ATU9URU"] ) { (this.appIDArray = appIDArray), Array.from(this.appIDArray).forEach( (appID) => ( console.assert(17 === appID.length), console.assert(/[0-9A-Z]{6}-[0-9A-Z]{10}/.test(appID)) ) ); } getAppID = ({ appID = this.appIDArray[this.getRandomInt() % this.appIDArray.length], } = {}) => { try { return appID; } catch (error) { return console.error({ error }), String(); } }; getRandomInt = ({ randomInt = crypto.getRandomValues(new Uint32Array(1))[0], } = {}) => { try { return randomInt; } catch (error) { return console.error({ error }), Number(); } }; }