package-installer-cli 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bundle-standalone/cli-with-packages.js +2940 -28
- data/bundle-standalone/features/ui/shadcn/nextjs/package.json +5 -0
- data/bundle-standalone/features/ui/shadcn/reactjs/package.json +5 -0
- data/bundle-standalone/template.json +18 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/README.md +7 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/components.json +21 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/index.html +14 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/jsconfig.json +10 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/package.json +23 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/public/tauri.svg +6 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/public/vite.svg +1 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src/App.css +116 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src/App.jsx +51 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src/assets/react.svg +1 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src/components/ui/button.jsx +55 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src/components/ui/card.jsx +101 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src/components/ui/input.jsx +24 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src/components/ui/textarea.jsx +20 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src/lib/utils.js +6 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src/main.jsx +9 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src-tauri/Cargo.toml +25 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src-tauri/build.rs +3 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src-tauri/capabilities/default.json +10 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src-tauri/icons/128x128.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src-tauri/icons/128x128@2x.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src-tauri/icons/32x32.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src-tauri/icons/Square107x107Logo.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src-tauri/icons/Square142x142Logo.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src-tauri/icons/Square150x150Logo.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src-tauri/icons/Square284x284Logo.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src-tauri/icons/Square30x30Logo.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src-tauri/icons/Square310x310Logo.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src-tauri/icons/Square44x44Logo.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src-tauri/icons/Square71x71Logo.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src-tauri/icons/Square89x89Logo.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src-tauri/icons/StoreLogo.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src-tauri/icons/icon.icns +0 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src-tauri/icons/icon.ico +0 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src-tauri/icons/icon.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src-tauri/src/lib.rs +14 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src-tauri/src/main.rs +6 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/src-tauri/tauri.conf.json +35 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/tailwind.config.js +12 -0
- data/bundle-standalone/templates/tauri/javascript/react-frontend/vite.config.js +31 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/README.md +7 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/angular.json +78 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/package.json +32 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src/app/app.component.css +112 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src/app/app.component.html +21 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src/app/app.component.ts +22 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src/app/app.config.ts +16 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src/app/app.routes.ts +3 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src/assets/angular.svg +16 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src/assets/tauri.svg +6 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src/index.html +12 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src/main.ts +7 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src/styles.css +1 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src-tauri/Cargo.toml +25 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src-tauri/build.rs +3 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src-tauri/capabilities/default.json +10 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src-tauri/icons/128x128.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src-tauri/icons/128x128@2x.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src-tauri/icons/32x32.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src-tauri/icons/Square107x107Logo.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src-tauri/icons/Square142x142Logo.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src-tauri/icons/Square150x150Logo.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src-tauri/icons/Square284x284Logo.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src-tauri/icons/Square30x30Logo.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src-tauri/icons/Square310x310Logo.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src-tauri/icons/Square44x44Logo.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src-tauri/icons/Square71x71Logo.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src-tauri/icons/Square89x89Logo.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src-tauri/icons/StoreLogo.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src-tauri/icons/icon.icns +0 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src-tauri/icons/icon.ico +0 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src-tauri/icons/icon.png +0 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src-tauri/src/lib.rs +14 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src-tauri/src/main.rs +6 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/src-tauri/tauri.conf.json +35 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/tsconfig.app.json +11 -0
- data/bundle-standalone/templates/tauri/javascript/tauri-app/tsconfig.json +26 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/README.md +7 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src/assets/javascript.svg +1 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src/assets/tauri.svg +6 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src/index.html +39 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src/main.js +18 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src/styles.css +112 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src-tauri/Cargo.toml +25 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src-tauri/build.rs +3 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src-tauri/capabilities/default.json +10 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src-tauri/icons/128x128.png +0 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src-tauri/icons/128x128@2x.png +0 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src-tauri/icons/32x32.png +0 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src-tauri/icons/Square107x107Logo.png +0 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src-tauri/icons/Square142x142Logo.png +0 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src-tauri/icons/Square150x150Logo.png +0 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src-tauri/icons/Square284x284Logo.png +0 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src-tauri/icons/Square30x30Logo.png +0 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src-tauri/icons/Square310x310Logo.png +0 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src-tauri/icons/Square44x44Logo.png +0 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src-tauri/icons/Square71x71Logo.png +0 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src-tauri/icons/Square89x89Logo.png +0 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src-tauri/icons/StoreLogo.png +0 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src-tauri/icons/icon.icns +0 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src-tauri/icons/icon.ico +0 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src-tauri/icons/icon.png +0 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src-tauri/src/lib.rs +14 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src-tauri/src/main.rs +6 -0
- data/bundle-standalone/templates/tauri/rust/tauri-rust-template/src-tauri/tauri.conf.json +33 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/README.md +7 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/angular.json +78 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/jsconfig.app.json +11 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/jsconfig.json +26 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/package.json +32 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src/app/app.component.css +112 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src/app/app.component.html +21 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src/app/app.component.ts +22 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src/app/app.config.ts +16 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src/app/app.routes.ts +3 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src/assets/angular.svg +16 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src/assets/tauri.svg +6 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src/index.html +12 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src/main.ts +7 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src/styles.css +1 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src-tauri/Cargo.toml +25 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src-tauri/build.rs +3 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src-tauri/capabilities/default.json +10 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src-tauri/icons/128x128.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src-tauri/icons/128x128@2x.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src-tauri/icons/32x32.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src-tauri/icons/Square107x107Logo.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src-tauri/icons/Square142x142Logo.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src-tauri/icons/Square150x150Logo.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src-tauri/icons/Square284x284Logo.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src-tauri/icons/Square30x30Logo.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src-tauri/icons/Square310x310Logo.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src-tauri/icons/Square44x44Logo.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src-tauri/icons/Square71x71Logo.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src-tauri/icons/Square89x89Logo.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src-tauri/icons/StoreLogo.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src-tauri/icons/icon.icns +0 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src-tauri/icons/icon.ico +0 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src-tauri/icons/icon.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src-tauri/src/lib.rs +14 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src-tauri/src/main.rs +6 -0
- data/bundle-standalone/templates/tauri/typescript/angular-frontend/src-tauri/tauri.conf.json +35 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/README.md +7 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/components.json +21 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/index.html +14 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/package.json +26 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/public/tauri.svg +6 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/public/vite.svg +1 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src/App.css +116 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src/App.tsx +51 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src/assets/react.svg +1 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src/components/ui/button.tsx +59 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src/components/ui/card.tsx +92 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src/components/ui/input.tsx +21 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src/components/ui/textarea.tsx +18 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src/lib/utils.ts +6 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src/main.tsx +9 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src/vite-env.d.ts +1 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src-tauri/Cargo.toml +25 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src-tauri/build.rs +3 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src-tauri/capabilities/default.json +10 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src-tauri/icons/128x128.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src-tauri/icons/128x128@2x.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src-tauri/icons/32x32.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src-tauri/icons/Square107x107Logo.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src-tauri/icons/Square142x142Logo.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src-tauri/icons/Square150x150Logo.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src-tauri/icons/Square284x284Logo.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src-tauri/icons/Square30x30Logo.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src-tauri/icons/Square310x310Logo.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src-tauri/icons/Square44x44Logo.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src-tauri/icons/Square71x71Logo.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src-tauri/icons/Square89x89Logo.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src-tauri/icons/StoreLogo.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src-tauri/icons/icon.icns +0 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src-tauri/icons/icon.ico +0 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src-tauri/icons/icon.png +0 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src-tauri/src/lib.rs +14 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src-tauri/src/main.rs +6 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/src-tauri/tauri.conf.json +35 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/tailwind.config.js +11 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/tsconfig.json +25 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/tsconfig.node.json +10 -0
- data/bundle-standalone/templates/tauri/typescript/react-fronend/vite.config.ts +32 -0
- metadata +195 -8
- /data/bundle-standalone/templates/electron/{template/javascript → javascript/template}/index.html +0 -0
- /data/bundle-standalone/templates/electron/{template/javascript → javascript/template}/main.js +0 -0
- /data/bundle-standalone/templates/electron/{template/javascript → javascript/template}/package.json +0 -0
- /data/bundle-standalone/templates/electron/{template/typescript → typescript/template}/index.html +0 -0
- /data/bundle-standalone/templates/electron/{template/typescript → typescript/template}/main.ts +0 -0
- /data/bundle-standalone/templates/electron/{template/typescript → typescript/template}/package.json +0 -0
|
@@ -1235,6 +1235,39 @@ module.exports.makeDirSync = (dir, options) => {
|
|
|
1235
1235
|
}
|
|
1236
1236
|
|
|
1237
1237
|
|
|
1238
|
+
/***/ }),
|
|
1239
|
+
|
|
1240
|
+
/***/ 279:
|
|
1241
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1242
|
+
|
|
1243
|
+
/**
|
|
1244
|
+
* @otplib/plugin-crypto
|
|
1245
|
+
*
|
|
1246
|
+
* @author Gerald Yeo <contact@fusedthought.com>
|
|
1247
|
+
* @version: 12.0.1
|
|
1248
|
+
* @license: MIT
|
|
1249
|
+
**/
|
|
1250
|
+
|
|
1251
|
+
|
|
1252
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1253
|
+
|
|
1254
|
+
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
1255
|
+
|
|
1256
|
+
var crypto = _interopDefault(__webpack_require__(6982));
|
|
1257
|
+
|
|
1258
|
+
const createDigest = (algorithm, hmacKey, counter) => {
|
|
1259
|
+
const hmac = crypto.createHmac(algorithm, Buffer.from(hmacKey, 'hex'));
|
|
1260
|
+
const digest = hmac.update(Buffer.from(counter, 'hex')).digest();
|
|
1261
|
+
return digest.toString('hex');
|
|
1262
|
+
};
|
|
1263
|
+
const createRandomBytes = (size, encoding) => {
|
|
1264
|
+
return crypto.randomBytes(size).toString(encoding);
|
|
1265
|
+
};
|
|
1266
|
+
|
|
1267
|
+
exports.createDigest = createDigest;
|
|
1268
|
+
exports.createRandomBytes = createRandomBytes;
|
|
1269
|
+
|
|
1270
|
+
|
|
1238
1271
|
/***/ }),
|
|
1239
1272
|
|
|
1240
1273
|
/***/ 287:
|
|
@@ -2232,6 +2265,20 @@ function isSubscriber(value) {
|
|
|
2232
2265
|
}
|
|
2233
2266
|
//# sourceMappingURL=Observable.js.map
|
|
2234
2267
|
|
|
2268
|
+
/***/ }),
|
|
2269
|
+
|
|
2270
|
+
/***/ 543:
|
|
2271
|
+
/***/ ((module) => {
|
|
2272
|
+
|
|
2273
|
+
module.exports = {
|
|
2274
|
+
L : 1,
|
|
2275
|
+
M : 0,
|
|
2276
|
+
Q : 3,
|
|
2277
|
+
H : 2
|
|
2278
|
+
};
|
|
2279
|
+
|
|
2280
|
+
|
|
2281
|
+
|
|
2235
2282
|
/***/ }),
|
|
2236
2283
|
|
|
2237
2284
|
/***/ 553:
|
|
@@ -3643,6 +3690,39 @@ if (!processOk(process)) {
|
|
|
3643
3690
|
}
|
|
3644
3691
|
|
|
3645
3692
|
|
|
3693
|
+
/***/ }),
|
|
3694
|
+
|
|
3695
|
+
/***/ 942:
|
|
3696
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
3697
|
+
|
|
3698
|
+
/*
|
|
3699
|
+
Copyright (c) 2011, Chris Umbel
|
|
3700
|
+
|
|
3701
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
3702
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
3703
|
+
in the Software without restriction, including without limitation the rights
|
|
3704
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
3705
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
3706
|
+
furnished to do so, subject to the following conditions:
|
|
3707
|
+
|
|
3708
|
+
The above copyright notice and this permission notice shall be included in
|
|
3709
|
+
all copies or substantial portions of the Software.
|
|
3710
|
+
|
|
3711
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
3712
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
3713
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
3714
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
3715
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
3716
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
3717
|
+
THE SOFTWARE.
|
|
3718
|
+
*/
|
|
3719
|
+
|
|
3720
|
+
var base32 = __webpack_require__(1103);
|
|
3721
|
+
|
|
3722
|
+
exports.encode = base32.encode;
|
|
3723
|
+
exports.decode = base32.decode;
|
|
3724
|
+
|
|
3725
|
+
|
|
3646
3726
|
/***/ }),
|
|
3647
3727
|
|
|
3648
3728
|
/***/ 963:
|
|
@@ -6696,6 +6776,141 @@ var AsapScheduler = (function (_super) {
|
|
|
6696
6776
|
exports.AsapScheduler = AsapScheduler;
|
|
6697
6777
|
//# sourceMappingURL=AsapScheduler.js.map
|
|
6698
6778
|
|
|
6779
|
+
/***/ }),
|
|
6780
|
+
|
|
6781
|
+
/***/ 1103:
|
|
6782
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
6783
|
+
|
|
6784
|
+
/*
|
|
6785
|
+
Copyright (c) 2011, Chris Umbel
|
|
6786
|
+
|
|
6787
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6788
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6789
|
+
in the Software without restriction, including without limitation the rights
|
|
6790
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
6791
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
6792
|
+
furnished to do so, subject to the following conditions:
|
|
6793
|
+
|
|
6794
|
+
The above copyright notice and this permission notice shall be included in
|
|
6795
|
+
all copies or substantial portions of the Software.
|
|
6796
|
+
|
|
6797
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
6798
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
6799
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
6800
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
6801
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
6802
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
6803
|
+
THE SOFTWARE.
|
|
6804
|
+
*/
|
|
6805
|
+
|
|
6806
|
+
|
|
6807
|
+
var charTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
6808
|
+
var byteTable = [
|
|
6809
|
+
0xff, 0xff, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
|
|
6810
|
+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
|
6811
|
+
0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
|
|
6812
|
+
0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
|
|
6813
|
+
0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
|
|
6814
|
+
0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff,
|
|
6815
|
+
0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
|
|
6816
|
+
0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
|
|
6817
|
+
0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
|
|
6818
|
+
0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff
|
|
6819
|
+
];
|
|
6820
|
+
|
|
6821
|
+
function quintetCount(buff) {
|
|
6822
|
+
var quintets = Math.floor(buff.length / 5);
|
|
6823
|
+
return buff.length % 5 === 0 ? quintets: quintets + 1;
|
|
6824
|
+
}
|
|
6825
|
+
|
|
6826
|
+
exports.encode = function(plain) {
|
|
6827
|
+
if(!Buffer.isBuffer(plain)){
|
|
6828
|
+
plain = new Buffer(plain);
|
|
6829
|
+
}
|
|
6830
|
+
var i = 0;
|
|
6831
|
+
var j = 0;
|
|
6832
|
+
var shiftIndex = 0;
|
|
6833
|
+
var digit = 0;
|
|
6834
|
+
var encoded = new Buffer(quintetCount(plain) * 8);
|
|
6835
|
+
|
|
6836
|
+
/* byte by byte isn't as pretty as quintet by quintet but tests a bit
|
|
6837
|
+
faster. will have to revisit. */
|
|
6838
|
+
while(i < plain.length) {
|
|
6839
|
+
var current = plain[i];
|
|
6840
|
+
|
|
6841
|
+
if(shiftIndex > 3) {
|
|
6842
|
+
digit = current & (0xff >> shiftIndex);
|
|
6843
|
+
shiftIndex = (shiftIndex + 5) % 8;
|
|
6844
|
+
digit = (digit << shiftIndex) | ((i + 1 < plain.length) ?
|
|
6845
|
+
plain[i + 1] : 0) >> (8 - shiftIndex);
|
|
6846
|
+
i++;
|
|
6847
|
+
} else {
|
|
6848
|
+
digit = (current >> (8 - (shiftIndex + 5))) & 0x1f;
|
|
6849
|
+
shiftIndex = (shiftIndex + 5) % 8;
|
|
6850
|
+
if(shiftIndex === 0) i++;
|
|
6851
|
+
}
|
|
6852
|
+
|
|
6853
|
+
encoded[j] = charTable.charCodeAt(digit);
|
|
6854
|
+
j++;
|
|
6855
|
+
}
|
|
6856
|
+
|
|
6857
|
+
for(i = j; i < encoded.length; i++) {
|
|
6858
|
+
encoded[i] = 0x3d; //'='.charCodeAt(0)
|
|
6859
|
+
}
|
|
6860
|
+
|
|
6861
|
+
return encoded;
|
|
6862
|
+
};
|
|
6863
|
+
|
|
6864
|
+
exports.decode = function(encoded) {
|
|
6865
|
+
var shiftIndex = 0;
|
|
6866
|
+
var plainDigit = 0;
|
|
6867
|
+
var plainChar;
|
|
6868
|
+
var plainPos = 0;
|
|
6869
|
+
if(!Buffer.isBuffer(encoded)){
|
|
6870
|
+
encoded = new Buffer(encoded);
|
|
6871
|
+
}
|
|
6872
|
+
var decoded = new Buffer(Math.ceil(encoded.length * 5 / 8));
|
|
6873
|
+
|
|
6874
|
+
/* byte by byte isn't as pretty as octet by octet but tests a bit
|
|
6875
|
+
faster. will have to revisit. */
|
|
6876
|
+
for(var i = 0; i < encoded.length; i++) {
|
|
6877
|
+
if(encoded[i] === 0x3d){ //'='
|
|
6878
|
+
break;
|
|
6879
|
+
}
|
|
6880
|
+
|
|
6881
|
+
var encodedByte = encoded[i] - 0x30;
|
|
6882
|
+
|
|
6883
|
+
if(encodedByte < byteTable.length) {
|
|
6884
|
+
plainDigit = byteTable[encodedByte];
|
|
6885
|
+
|
|
6886
|
+
if(shiftIndex <= 3) {
|
|
6887
|
+
shiftIndex = (shiftIndex + 5) % 8;
|
|
6888
|
+
|
|
6889
|
+
if(shiftIndex === 0) {
|
|
6890
|
+
plainChar |= plainDigit;
|
|
6891
|
+
decoded[plainPos] = plainChar;
|
|
6892
|
+
plainPos++;
|
|
6893
|
+
plainChar = 0;
|
|
6894
|
+
} else {
|
|
6895
|
+
plainChar |= 0xff & (plainDigit << (8 - shiftIndex));
|
|
6896
|
+
}
|
|
6897
|
+
} else {
|
|
6898
|
+
shiftIndex = (shiftIndex + 5) % 8;
|
|
6899
|
+
plainChar |= 0xff & (plainDigit >>> shiftIndex);
|
|
6900
|
+
decoded[plainPos] = plainChar;
|
|
6901
|
+
plainPos++;
|
|
6902
|
+
|
|
6903
|
+
plainChar = 0xff & (plainDigit << (8 - shiftIndex));
|
|
6904
|
+
}
|
|
6905
|
+
} else {
|
|
6906
|
+
throw new Error('Invalid input - it is not base32 encoded string');
|
|
6907
|
+
}
|
|
6908
|
+
}
|
|
6909
|
+
|
|
6910
|
+
return decoded.slice(0, plainPos);
|
|
6911
|
+
};
|
|
6912
|
+
|
|
6913
|
+
|
|
6699
6914
|
/***/ }),
|
|
6700
6915
|
|
|
6701
6916
|
/***/ 1205:
|
|
@@ -9509,6 +9724,285 @@ function windowToggle(openings, closingSelector) {
|
|
|
9509
9724
|
exports.windowToggle = windowToggle;
|
|
9510
9725
|
//# sourceMappingURL=windowToggle.js.map
|
|
9511
9726
|
|
|
9727
|
+
/***/ }),
|
|
9728
|
+
|
|
9729
|
+
/***/ 1678:
|
|
9730
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
9731
|
+
|
|
9732
|
+
var QRMode = __webpack_require__(9802);
|
|
9733
|
+
var QRPolynomial = __webpack_require__(5739);
|
|
9734
|
+
var QRMath = __webpack_require__(6543);
|
|
9735
|
+
var QRMaskPattern = __webpack_require__(9207);
|
|
9736
|
+
|
|
9737
|
+
var QRUtil = {
|
|
9738
|
+
|
|
9739
|
+
PATTERN_POSITION_TABLE : [
|
|
9740
|
+
[],
|
|
9741
|
+
[6, 18],
|
|
9742
|
+
[6, 22],
|
|
9743
|
+
[6, 26],
|
|
9744
|
+
[6, 30],
|
|
9745
|
+
[6, 34],
|
|
9746
|
+
[6, 22, 38],
|
|
9747
|
+
[6, 24, 42],
|
|
9748
|
+
[6, 26, 46],
|
|
9749
|
+
[6, 28, 50],
|
|
9750
|
+
[6, 30, 54],
|
|
9751
|
+
[6, 32, 58],
|
|
9752
|
+
[6, 34, 62],
|
|
9753
|
+
[6, 26, 46, 66],
|
|
9754
|
+
[6, 26, 48, 70],
|
|
9755
|
+
[6, 26, 50, 74],
|
|
9756
|
+
[6, 30, 54, 78],
|
|
9757
|
+
[6, 30, 56, 82],
|
|
9758
|
+
[6, 30, 58, 86],
|
|
9759
|
+
[6, 34, 62, 90],
|
|
9760
|
+
[6, 28, 50, 72, 94],
|
|
9761
|
+
[6, 26, 50, 74, 98],
|
|
9762
|
+
[6, 30, 54, 78, 102],
|
|
9763
|
+
[6, 28, 54, 80, 106],
|
|
9764
|
+
[6, 32, 58, 84, 110],
|
|
9765
|
+
[6, 30, 58, 86, 114],
|
|
9766
|
+
[6, 34, 62, 90, 118],
|
|
9767
|
+
[6, 26, 50, 74, 98, 122],
|
|
9768
|
+
[6, 30, 54, 78, 102, 126],
|
|
9769
|
+
[6, 26, 52, 78, 104, 130],
|
|
9770
|
+
[6, 30, 56, 82, 108, 134],
|
|
9771
|
+
[6, 34, 60, 86, 112, 138],
|
|
9772
|
+
[6, 30, 58, 86, 114, 142],
|
|
9773
|
+
[6, 34, 62, 90, 118, 146],
|
|
9774
|
+
[6, 30, 54, 78, 102, 126, 150],
|
|
9775
|
+
[6, 24, 50, 76, 102, 128, 154],
|
|
9776
|
+
[6, 28, 54, 80, 106, 132, 158],
|
|
9777
|
+
[6, 32, 58, 84, 110, 136, 162],
|
|
9778
|
+
[6, 26, 54, 82, 110, 138, 166],
|
|
9779
|
+
[6, 30, 58, 86, 114, 142, 170]
|
|
9780
|
+
],
|
|
9781
|
+
|
|
9782
|
+
G15 : (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0),
|
|
9783
|
+
G18 : (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0),
|
|
9784
|
+
G15_MASK : (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1),
|
|
9785
|
+
|
|
9786
|
+
getBCHTypeInfo : function(data) {
|
|
9787
|
+
var d = data << 10;
|
|
9788
|
+
while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) {
|
|
9789
|
+
d ^= (QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) ) );
|
|
9790
|
+
}
|
|
9791
|
+
return ( (data << 10) | d) ^ QRUtil.G15_MASK;
|
|
9792
|
+
},
|
|
9793
|
+
|
|
9794
|
+
getBCHTypeNumber : function(data) {
|
|
9795
|
+
var d = data << 12;
|
|
9796
|
+
while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) {
|
|
9797
|
+
d ^= (QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) ) );
|
|
9798
|
+
}
|
|
9799
|
+
return (data << 12) | d;
|
|
9800
|
+
},
|
|
9801
|
+
|
|
9802
|
+
getBCHDigit : function(data) {
|
|
9803
|
+
|
|
9804
|
+
var digit = 0;
|
|
9805
|
+
|
|
9806
|
+
while (data !== 0) {
|
|
9807
|
+
digit++;
|
|
9808
|
+
data >>>= 1;
|
|
9809
|
+
}
|
|
9810
|
+
|
|
9811
|
+
return digit;
|
|
9812
|
+
},
|
|
9813
|
+
|
|
9814
|
+
getPatternPosition : function(typeNumber) {
|
|
9815
|
+
return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1];
|
|
9816
|
+
},
|
|
9817
|
+
|
|
9818
|
+
getMask : function(maskPattern, i, j) {
|
|
9819
|
+
|
|
9820
|
+
switch (maskPattern) {
|
|
9821
|
+
|
|
9822
|
+
case QRMaskPattern.PATTERN000 : return (i + j) % 2 === 0;
|
|
9823
|
+
case QRMaskPattern.PATTERN001 : return i % 2 === 0;
|
|
9824
|
+
case QRMaskPattern.PATTERN010 : return j % 3 === 0;
|
|
9825
|
+
case QRMaskPattern.PATTERN011 : return (i + j) % 3 === 0;
|
|
9826
|
+
case QRMaskPattern.PATTERN100 : return (Math.floor(i / 2) + Math.floor(j / 3) ) % 2 === 0;
|
|
9827
|
+
case QRMaskPattern.PATTERN101 : return (i * j) % 2 + (i * j) % 3 === 0;
|
|
9828
|
+
case QRMaskPattern.PATTERN110 : return ( (i * j) % 2 + (i * j) % 3) % 2 === 0;
|
|
9829
|
+
case QRMaskPattern.PATTERN111 : return ( (i * j) % 3 + (i + j) % 2) % 2 === 0;
|
|
9830
|
+
|
|
9831
|
+
default :
|
|
9832
|
+
throw new Error("bad maskPattern:" + maskPattern);
|
|
9833
|
+
}
|
|
9834
|
+
},
|
|
9835
|
+
|
|
9836
|
+
getErrorCorrectPolynomial : function(errorCorrectLength) {
|
|
9837
|
+
|
|
9838
|
+
var a = new QRPolynomial([1], 0);
|
|
9839
|
+
|
|
9840
|
+
for (var i = 0; i < errorCorrectLength; i++) {
|
|
9841
|
+
a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0) );
|
|
9842
|
+
}
|
|
9843
|
+
|
|
9844
|
+
return a;
|
|
9845
|
+
},
|
|
9846
|
+
|
|
9847
|
+
getLengthInBits : function(mode, type) {
|
|
9848
|
+
|
|
9849
|
+
if (1 <= type && type < 10) {
|
|
9850
|
+
|
|
9851
|
+
// 1 - 9
|
|
9852
|
+
|
|
9853
|
+
switch(mode) {
|
|
9854
|
+
case QRMode.MODE_NUMBER : return 10;
|
|
9855
|
+
case QRMode.MODE_ALPHA_NUM : return 9;
|
|
9856
|
+
case QRMode.MODE_8BIT_BYTE : return 8;
|
|
9857
|
+
case QRMode.MODE_KANJI : return 8;
|
|
9858
|
+
default :
|
|
9859
|
+
throw new Error("mode:" + mode);
|
|
9860
|
+
}
|
|
9861
|
+
|
|
9862
|
+
} else if (type < 27) {
|
|
9863
|
+
|
|
9864
|
+
// 10 - 26
|
|
9865
|
+
|
|
9866
|
+
switch(mode) {
|
|
9867
|
+
case QRMode.MODE_NUMBER : return 12;
|
|
9868
|
+
case QRMode.MODE_ALPHA_NUM : return 11;
|
|
9869
|
+
case QRMode.MODE_8BIT_BYTE : return 16;
|
|
9870
|
+
case QRMode.MODE_KANJI : return 10;
|
|
9871
|
+
default :
|
|
9872
|
+
throw new Error("mode:" + mode);
|
|
9873
|
+
}
|
|
9874
|
+
|
|
9875
|
+
} else if (type < 41) {
|
|
9876
|
+
|
|
9877
|
+
// 27 - 40
|
|
9878
|
+
|
|
9879
|
+
switch(mode) {
|
|
9880
|
+
case QRMode.MODE_NUMBER : return 14;
|
|
9881
|
+
case QRMode.MODE_ALPHA_NUM : return 13;
|
|
9882
|
+
case QRMode.MODE_8BIT_BYTE : return 16;
|
|
9883
|
+
case QRMode.MODE_KANJI : return 12;
|
|
9884
|
+
default :
|
|
9885
|
+
throw new Error("mode:" + mode);
|
|
9886
|
+
}
|
|
9887
|
+
|
|
9888
|
+
} else {
|
|
9889
|
+
throw new Error("type:" + type);
|
|
9890
|
+
}
|
|
9891
|
+
},
|
|
9892
|
+
|
|
9893
|
+
getLostPoint : function(qrCode) {
|
|
9894
|
+
|
|
9895
|
+
var moduleCount = qrCode.getModuleCount();
|
|
9896
|
+
var lostPoint = 0;
|
|
9897
|
+
var row = 0;
|
|
9898
|
+
var col = 0;
|
|
9899
|
+
|
|
9900
|
+
|
|
9901
|
+
// LEVEL1
|
|
9902
|
+
|
|
9903
|
+
for (row = 0; row < moduleCount; row++) {
|
|
9904
|
+
|
|
9905
|
+
for (col = 0; col < moduleCount; col++) {
|
|
9906
|
+
|
|
9907
|
+
var sameCount = 0;
|
|
9908
|
+
var dark = qrCode.isDark(row, col);
|
|
9909
|
+
|
|
9910
|
+
for (var r = -1; r <= 1; r++) {
|
|
9911
|
+
|
|
9912
|
+
if (row + r < 0 || moduleCount <= row + r) {
|
|
9913
|
+
continue;
|
|
9914
|
+
}
|
|
9915
|
+
|
|
9916
|
+
for (var c = -1; c <= 1; c++) {
|
|
9917
|
+
|
|
9918
|
+
if (col + c < 0 || moduleCount <= col + c) {
|
|
9919
|
+
continue;
|
|
9920
|
+
}
|
|
9921
|
+
|
|
9922
|
+
if (r === 0 && c === 0) {
|
|
9923
|
+
continue;
|
|
9924
|
+
}
|
|
9925
|
+
|
|
9926
|
+
if (dark === qrCode.isDark(row + r, col + c) ) {
|
|
9927
|
+
sameCount++;
|
|
9928
|
+
}
|
|
9929
|
+
}
|
|
9930
|
+
}
|
|
9931
|
+
|
|
9932
|
+
if (sameCount > 5) {
|
|
9933
|
+
lostPoint += (3 + sameCount - 5);
|
|
9934
|
+
}
|
|
9935
|
+
}
|
|
9936
|
+
}
|
|
9937
|
+
|
|
9938
|
+
// LEVEL2
|
|
9939
|
+
|
|
9940
|
+
for (row = 0; row < moduleCount - 1; row++) {
|
|
9941
|
+
for (col = 0; col < moduleCount - 1; col++) {
|
|
9942
|
+
var count = 0;
|
|
9943
|
+
if (qrCode.isDark(row, col ) ) count++;
|
|
9944
|
+
if (qrCode.isDark(row + 1, col ) ) count++;
|
|
9945
|
+
if (qrCode.isDark(row, col + 1) ) count++;
|
|
9946
|
+
if (qrCode.isDark(row + 1, col + 1) ) count++;
|
|
9947
|
+
if (count === 0 || count === 4) {
|
|
9948
|
+
lostPoint += 3;
|
|
9949
|
+
}
|
|
9950
|
+
}
|
|
9951
|
+
}
|
|
9952
|
+
|
|
9953
|
+
// LEVEL3
|
|
9954
|
+
|
|
9955
|
+
for (row = 0; row < moduleCount; row++) {
|
|
9956
|
+
for (col = 0; col < moduleCount - 6; col++) {
|
|
9957
|
+
if (qrCode.isDark(row, col) &&
|
|
9958
|
+
!qrCode.isDark(row, col + 1) &&
|
|
9959
|
+
qrCode.isDark(row, col + 2) &&
|
|
9960
|
+
qrCode.isDark(row, col + 3) &&
|
|
9961
|
+
qrCode.isDark(row, col + 4) &&
|
|
9962
|
+
!qrCode.isDark(row, col + 5) &&
|
|
9963
|
+
qrCode.isDark(row, col + 6) ) {
|
|
9964
|
+
lostPoint += 40;
|
|
9965
|
+
}
|
|
9966
|
+
}
|
|
9967
|
+
}
|
|
9968
|
+
|
|
9969
|
+
for (col = 0; col < moduleCount; col++) {
|
|
9970
|
+
for (row = 0; row < moduleCount - 6; row++) {
|
|
9971
|
+
if (qrCode.isDark(row, col) &&
|
|
9972
|
+
!qrCode.isDark(row + 1, col) &&
|
|
9973
|
+
qrCode.isDark(row + 2, col) &&
|
|
9974
|
+
qrCode.isDark(row + 3, col) &&
|
|
9975
|
+
qrCode.isDark(row + 4, col) &&
|
|
9976
|
+
!qrCode.isDark(row + 5, col) &&
|
|
9977
|
+
qrCode.isDark(row + 6, col) ) {
|
|
9978
|
+
lostPoint += 40;
|
|
9979
|
+
}
|
|
9980
|
+
}
|
|
9981
|
+
}
|
|
9982
|
+
|
|
9983
|
+
// LEVEL4
|
|
9984
|
+
|
|
9985
|
+
var darkCount = 0;
|
|
9986
|
+
|
|
9987
|
+
for (col = 0; col < moduleCount; col++) {
|
|
9988
|
+
for (row = 0; row < moduleCount; row++) {
|
|
9989
|
+
if (qrCode.isDark(row, col) ) {
|
|
9990
|
+
darkCount++;
|
|
9991
|
+
}
|
|
9992
|
+
}
|
|
9993
|
+
}
|
|
9994
|
+
|
|
9995
|
+
var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
|
|
9996
|
+
lostPoint += ratio * 10;
|
|
9997
|
+
|
|
9998
|
+
return lostPoint;
|
|
9999
|
+
}
|
|
10000
|
+
|
|
10001
|
+
};
|
|
10002
|
+
|
|
10003
|
+
module.exports = QRUtil;
|
|
10004
|
+
|
|
10005
|
+
|
|
9512
10006
|
/***/ }),
|
|
9513
10007
|
|
|
9514
10008
|
/***/ 1680:
|
|
@@ -14034,6 +14528,475 @@ if (process.platform === 'linux') {
|
|
|
14034
14528
|
}
|
|
14035
14529
|
|
|
14036
14530
|
|
|
14531
|
+
/***/ }),
|
|
14532
|
+
|
|
14533
|
+
/***/ 2304:
|
|
14534
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
14535
|
+
|
|
14536
|
+
//---------------------------------------------------------------------
|
|
14537
|
+
// QRCode for JavaScript
|
|
14538
|
+
//
|
|
14539
|
+
// Copyright (c) 2009 Kazuhiko Arase
|
|
14540
|
+
//
|
|
14541
|
+
// URL: http://www.d-project.com/
|
|
14542
|
+
//
|
|
14543
|
+
// Licensed under the MIT license:
|
|
14544
|
+
// http://www.opensource.org/licenses/mit-license.php
|
|
14545
|
+
//
|
|
14546
|
+
// The word "QR Code" is registered trademark of
|
|
14547
|
+
// DENSO WAVE INCORPORATED
|
|
14548
|
+
// http://www.denso-wave.com/qrcode/faqpatent-e.html
|
|
14549
|
+
//
|
|
14550
|
+
//---------------------------------------------------------------------
|
|
14551
|
+
// Modified to work in node for this project (and some refactoring)
|
|
14552
|
+
//---------------------------------------------------------------------
|
|
14553
|
+
|
|
14554
|
+
var QR8bitByte = __webpack_require__(2696);
|
|
14555
|
+
var QRUtil = __webpack_require__(1678);
|
|
14556
|
+
var QRPolynomial = __webpack_require__(5739);
|
|
14557
|
+
var QRRSBlock = __webpack_require__(7129);
|
|
14558
|
+
var QRBitBuffer = __webpack_require__(4880);
|
|
14559
|
+
|
|
14560
|
+
function QRCode(typeNumber, errorCorrectLevel) {
|
|
14561
|
+
this.typeNumber = typeNumber;
|
|
14562
|
+
this.errorCorrectLevel = errorCorrectLevel;
|
|
14563
|
+
this.modules = null;
|
|
14564
|
+
this.moduleCount = 0;
|
|
14565
|
+
this.dataCache = null;
|
|
14566
|
+
this.dataList = [];
|
|
14567
|
+
}
|
|
14568
|
+
|
|
14569
|
+
QRCode.prototype = {
|
|
14570
|
+
|
|
14571
|
+
addData : function(data) {
|
|
14572
|
+
var newData = new QR8bitByte(data);
|
|
14573
|
+
this.dataList.push(newData);
|
|
14574
|
+
this.dataCache = null;
|
|
14575
|
+
},
|
|
14576
|
+
|
|
14577
|
+
isDark : function(row, col) {
|
|
14578
|
+
if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) {
|
|
14579
|
+
throw new Error(row + "," + col);
|
|
14580
|
+
}
|
|
14581
|
+
return this.modules[row][col];
|
|
14582
|
+
},
|
|
14583
|
+
|
|
14584
|
+
getModuleCount : function() {
|
|
14585
|
+
return this.moduleCount;
|
|
14586
|
+
},
|
|
14587
|
+
|
|
14588
|
+
make : function() {
|
|
14589
|
+
// Calculate automatically typeNumber if provided is < 1
|
|
14590
|
+
if (this.typeNumber < 1 ){
|
|
14591
|
+
var typeNumber = 1;
|
|
14592
|
+
for (typeNumber = 1; typeNumber < 40; typeNumber++) {
|
|
14593
|
+
var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, this.errorCorrectLevel);
|
|
14594
|
+
|
|
14595
|
+
var buffer = new QRBitBuffer();
|
|
14596
|
+
var totalDataCount = 0;
|
|
14597
|
+
for (var i = 0; i < rsBlocks.length; i++) {
|
|
14598
|
+
totalDataCount += rsBlocks[i].dataCount;
|
|
14599
|
+
}
|
|
14600
|
+
|
|
14601
|
+
for (var x = 0; x < this.dataList.length; x++) {
|
|
14602
|
+
var data = this.dataList[x];
|
|
14603
|
+
buffer.put(data.mode, 4);
|
|
14604
|
+
buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber) );
|
|
14605
|
+
data.write(buffer);
|
|
14606
|
+
}
|
|
14607
|
+
if (buffer.getLengthInBits() <= totalDataCount * 8)
|
|
14608
|
+
break;
|
|
14609
|
+
}
|
|
14610
|
+
this.typeNumber = typeNumber;
|
|
14611
|
+
}
|
|
14612
|
+
this.makeImpl(false, this.getBestMaskPattern() );
|
|
14613
|
+
},
|
|
14614
|
+
|
|
14615
|
+
makeImpl : function(test, maskPattern) {
|
|
14616
|
+
|
|
14617
|
+
this.moduleCount = this.typeNumber * 4 + 17;
|
|
14618
|
+
this.modules = new Array(this.moduleCount);
|
|
14619
|
+
|
|
14620
|
+
for (var row = 0; row < this.moduleCount; row++) {
|
|
14621
|
+
|
|
14622
|
+
this.modules[row] = new Array(this.moduleCount);
|
|
14623
|
+
|
|
14624
|
+
for (var col = 0; col < this.moduleCount; col++) {
|
|
14625
|
+
this.modules[row][col] = null;//(col + row) % 3;
|
|
14626
|
+
}
|
|
14627
|
+
}
|
|
14628
|
+
|
|
14629
|
+
this.setupPositionProbePattern(0, 0);
|
|
14630
|
+
this.setupPositionProbePattern(this.moduleCount - 7, 0);
|
|
14631
|
+
this.setupPositionProbePattern(0, this.moduleCount - 7);
|
|
14632
|
+
this.setupPositionAdjustPattern();
|
|
14633
|
+
this.setupTimingPattern();
|
|
14634
|
+
this.setupTypeInfo(test, maskPattern);
|
|
14635
|
+
|
|
14636
|
+
if (this.typeNumber >= 7) {
|
|
14637
|
+
this.setupTypeNumber(test);
|
|
14638
|
+
}
|
|
14639
|
+
|
|
14640
|
+
if (this.dataCache === null) {
|
|
14641
|
+
this.dataCache = QRCode.createData(this.typeNumber, this.errorCorrectLevel, this.dataList);
|
|
14642
|
+
}
|
|
14643
|
+
|
|
14644
|
+
this.mapData(this.dataCache, maskPattern);
|
|
14645
|
+
},
|
|
14646
|
+
|
|
14647
|
+
setupPositionProbePattern : function(row, col) {
|
|
14648
|
+
|
|
14649
|
+
for (var r = -1; r <= 7; r++) {
|
|
14650
|
+
|
|
14651
|
+
if (row + r <= -1 || this.moduleCount <= row + r) continue;
|
|
14652
|
+
|
|
14653
|
+
for (var c = -1; c <= 7; c++) {
|
|
14654
|
+
|
|
14655
|
+
if (col + c <= -1 || this.moduleCount <= col + c) continue;
|
|
14656
|
+
|
|
14657
|
+
if ( (0 <= r && r <= 6 && (c === 0 || c === 6) ) ||
|
|
14658
|
+
(0 <= c && c <= 6 && (r === 0 || r === 6) ) ||
|
|
14659
|
+
(2 <= r && r <= 4 && 2 <= c && c <= 4) ) {
|
|
14660
|
+
this.modules[row + r][col + c] = true;
|
|
14661
|
+
} else {
|
|
14662
|
+
this.modules[row + r][col + c] = false;
|
|
14663
|
+
}
|
|
14664
|
+
}
|
|
14665
|
+
}
|
|
14666
|
+
},
|
|
14667
|
+
|
|
14668
|
+
getBestMaskPattern : function() {
|
|
14669
|
+
|
|
14670
|
+
var minLostPoint = 0;
|
|
14671
|
+
var pattern = 0;
|
|
14672
|
+
|
|
14673
|
+
for (var i = 0; i < 8; i++) {
|
|
14674
|
+
|
|
14675
|
+
this.makeImpl(true, i);
|
|
14676
|
+
|
|
14677
|
+
var lostPoint = QRUtil.getLostPoint(this);
|
|
14678
|
+
|
|
14679
|
+
if (i === 0 || minLostPoint > lostPoint) {
|
|
14680
|
+
minLostPoint = lostPoint;
|
|
14681
|
+
pattern = i;
|
|
14682
|
+
}
|
|
14683
|
+
}
|
|
14684
|
+
|
|
14685
|
+
return pattern;
|
|
14686
|
+
},
|
|
14687
|
+
|
|
14688
|
+
createMovieClip : function(target_mc, instance_name, depth) {
|
|
14689
|
+
|
|
14690
|
+
var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth);
|
|
14691
|
+
var cs = 1;
|
|
14692
|
+
|
|
14693
|
+
this.make();
|
|
14694
|
+
|
|
14695
|
+
for (var row = 0; row < this.modules.length; row++) {
|
|
14696
|
+
|
|
14697
|
+
var y = row * cs;
|
|
14698
|
+
|
|
14699
|
+
for (var col = 0; col < this.modules[row].length; col++) {
|
|
14700
|
+
|
|
14701
|
+
var x = col * cs;
|
|
14702
|
+
var dark = this.modules[row][col];
|
|
14703
|
+
|
|
14704
|
+
if (dark) {
|
|
14705
|
+
qr_mc.beginFill(0, 100);
|
|
14706
|
+
qr_mc.moveTo(x, y);
|
|
14707
|
+
qr_mc.lineTo(x + cs, y);
|
|
14708
|
+
qr_mc.lineTo(x + cs, y + cs);
|
|
14709
|
+
qr_mc.lineTo(x, y + cs);
|
|
14710
|
+
qr_mc.endFill();
|
|
14711
|
+
}
|
|
14712
|
+
}
|
|
14713
|
+
}
|
|
14714
|
+
|
|
14715
|
+
return qr_mc;
|
|
14716
|
+
},
|
|
14717
|
+
|
|
14718
|
+
setupTimingPattern : function() {
|
|
14719
|
+
|
|
14720
|
+
for (var r = 8; r < this.moduleCount - 8; r++) {
|
|
14721
|
+
if (this.modules[r][6] !== null) {
|
|
14722
|
+
continue;
|
|
14723
|
+
}
|
|
14724
|
+
this.modules[r][6] = (r % 2 === 0);
|
|
14725
|
+
}
|
|
14726
|
+
|
|
14727
|
+
for (var c = 8; c < this.moduleCount - 8; c++) {
|
|
14728
|
+
if (this.modules[6][c] !== null) {
|
|
14729
|
+
continue;
|
|
14730
|
+
}
|
|
14731
|
+
this.modules[6][c] = (c % 2 === 0);
|
|
14732
|
+
}
|
|
14733
|
+
},
|
|
14734
|
+
|
|
14735
|
+
setupPositionAdjustPattern : function() {
|
|
14736
|
+
|
|
14737
|
+
var pos = QRUtil.getPatternPosition(this.typeNumber);
|
|
14738
|
+
|
|
14739
|
+
for (var i = 0; i < pos.length; i++) {
|
|
14740
|
+
|
|
14741
|
+
for (var j = 0; j < pos.length; j++) {
|
|
14742
|
+
|
|
14743
|
+
var row = pos[i];
|
|
14744
|
+
var col = pos[j];
|
|
14745
|
+
|
|
14746
|
+
if (this.modules[row][col] !== null) {
|
|
14747
|
+
continue;
|
|
14748
|
+
}
|
|
14749
|
+
|
|
14750
|
+
for (var r = -2; r <= 2; r++) {
|
|
14751
|
+
|
|
14752
|
+
for (var c = -2; c <= 2; c++) {
|
|
14753
|
+
|
|
14754
|
+
if (Math.abs(r) === 2 ||
|
|
14755
|
+
Math.abs(c) === 2 ||
|
|
14756
|
+
(r === 0 && c === 0) ) {
|
|
14757
|
+
this.modules[row + r][col + c] = true;
|
|
14758
|
+
} else {
|
|
14759
|
+
this.modules[row + r][col + c] = false;
|
|
14760
|
+
}
|
|
14761
|
+
}
|
|
14762
|
+
}
|
|
14763
|
+
}
|
|
14764
|
+
}
|
|
14765
|
+
},
|
|
14766
|
+
|
|
14767
|
+
setupTypeNumber : function(test) {
|
|
14768
|
+
|
|
14769
|
+
var bits = QRUtil.getBCHTypeNumber(this.typeNumber);
|
|
14770
|
+
var mod;
|
|
14771
|
+
|
|
14772
|
+
for (var i = 0; i < 18; i++) {
|
|
14773
|
+
mod = (!test && ( (bits >> i) & 1) === 1);
|
|
14774
|
+
this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod;
|
|
14775
|
+
}
|
|
14776
|
+
|
|
14777
|
+
for (var x = 0; x < 18; x++) {
|
|
14778
|
+
mod = (!test && ( (bits >> x) & 1) === 1);
|
|
14779
|
+
this.modules[x % 3 + this.moduleCount - 8 - 3][Math.floor(x / 3)] = mod;
|
|
14780
|
+
}
|
|
14781
|
+
},
|
|
14782
|
+
|
|
14783
|
+
setupTypeInfo : function(test, maskPattern) {
|
|
14784
|
+
|
|
14785
|
+
var data = (this.errorCorrectLevel << 3) | maskPattern;
|
|
14786
|
+
var bits = QRUtil.getBCHTypeInfo(data);
|
|
14787
|
+
var mod;
|
|
14788
|
+
|
|
14789
|
+
// vertical
|
|
14790
|
+
for (var v = 0; v < 15; v++) {
|
|
14791
|
+
|
|
14792
|
+
mod = (!test && ( (bits >> v) & 1) === 1);
|
|
14793
|
+
|
|
14794
|
+
if (v < 6) {
|
|
14795
|
+
this.modules[v][8] = mod;
|
|
14796
|
+
} else if (v < 8) {
|
|
14797
|
+
this.modules[v + 1][8] = mod;
|
|
14798
|
+
} else {
|
|
14799
|
+
this.modules[this.moduleCount - 15 + v][8] = mod;
|
|
14800
|
+
}
|
|
14801
|
+
}
|
|
14802
|
+
|
|
14803
|
+
// horizontal
|
|
14804
|
+
for (var h = 0; h < 15; h++) {
|
|
14805
|
+
|
|
14806
|
+
mod = (!test && ( (bits >> h) & 1) === 1);
|
|
14807
|
+
|
|
14808
|
+
if (h < 8) {
|
|
14809
|
+
this.modules[8][this.moduleCount - h - 1] = mod;
|
|
14810
|
+
} else if (h < 9) {
|
|
14811
|
+
this.modules[8][15 - h - 1 + 1] = mod;
|
|
14812
|
+
} else {
|
|
14813
|
+
this.modules[8][15 - h - 1] = mod;
|
|
14814
|
+
}
|
|
14815
|
+
}
|
|
14816
|
+
|
|
14817
|
+
// fixed module
|
|
14818
|
+
this.modules[this.moduleCount - 8][8] = (!test);
|
|
14819
|
+
|
|
14820
|
+
},
|
|
14821
|
+
|
|
14822
|
+
mapData : function(data, maskPattern) {
|
|
14823
|
+
|
|
14824
|
+
var inc = -1;
|
|
14825
|
+
var row = this.moduleCount - 1;
|
|
14826
|
+
var bitIndex = 7;
|
|
14827
|
+
var byteIndex = 0;
|
|
14828
|
+
|
|
14829
|
+
for (var col = this.moduleCount - 1; col > 0; col -= 2) {
|
|
14830
|
+
|
|
14831
|
+
if (col === 6) col--;
|
|
14832
|
+
|
|
14833
|
+
while (true) {
|
|
14834
|
+
|
|
14835
|
+
for (var c = 0; c < 2; c++) {
|
|
14836
|
+
|
|
14837
|
+
if (this.modules[row][col - c] === null) {
|
|
14838
|
+
|
|
14839
|
+
var dark = false;
|
|
14840
|
+
|
|
14841
|
+
if (byteIndex < data.length) {
|
|
14842
|
+
dark = ( ( (data[byteIndex] >>> bitIndex) & 1) === 1);
|
|
14843
|
+
}
|
|
14844
|
+
|
|
14845
|
+
var mask = QRUtil.getMask(maskPattern, row, col - c);
|
|
14846
|
+
|
|
14847
|
+
if (mask) {
|
|
14848
|
+
dark = !dark;
|
|
14849
|
+
}
|
|
14850
|
+
|
|
14851
|
+
this.modules[row][col - c] = dark;
|
|
14852
|
+
bitIndex--;
|
|
14853
|
+
|
|
14854
|
+
if (bitIndex === -1) {
|
|
14855
|
+
byteIndex++;
|
|
14856
|
+
bitIndex = 7;
|
|
14857
|
+
}
|
|
14858
|
+
}
|
|
14859
|
+
}
|
|
14860
|
+
|
|
14861
|
+
row += inc;
|
|
14862
|
+
|
|
14863
|
+
if (row < 0 || this.moduleCount <= row) {
|
|
14864
|
+
row -= inc;
|
|
14865
|
+
inc = -inc;
|
|
14866
|
+
break;
|
|
14867
|
+
}
|
|
14868
|
+
}
|
|
14869
|
+
}
|
|
14870
|
+
|
|
14871
|
+
}
|
|
14872
|
+
|
|
14873
|
+
};
|
|
14874
|
+
|
|
14875
|
+
QRCode.PAD0 = 0xEC;
|
|
14876
|
+
QRCode.PAD1 = 0x11;
|
|
14877
|
+
|
|
14878
|
+
QRCode.createData = function(typeNumber, errorCorrectLevel, dataList) {
|
|
14879
|
+
|
|
14880
|
+
var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel);
|
|
14881
|
+
|
|
14882
|
+
var buffer = new QRBitBuffer();
|
|
14883
|
+
|
|
14884
|
+
for (var i = 0; i < dataList.length; i++) {
|
|
14885
|
+
var data = dataList[i];
|
|
14886
|
+
buffer.put(data.mode, 4);
|
|
14887
|
+
buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber) );
|
|
14888
|
+
data.write(buffer);
|
|
14889
|
+
}
|
|
14890
|
+
|
|
14891
|
+
// calc num max data.
|
|
14892
|
+
var totalDataCount = 0;
|
|
14893
|
+
for (var x = 0; x < rsBlocks.length; x++) {
|
|
14894
|
+
totalDataCount += rsBlocks[x].dataCount;
|
|
14895
|
+
}
|
|
14896
|
+
|
|
14897
|
+
if (buffer.getLengthInBits() > totalDataCount * 8) {
|
|
14898
|
+
throw new Error("code length overflow. (" +
|
|
14899
|
+
buffer.getLengthInBits() +
|
|
14900
|
+
">" +
|
|
14901
|
+
totalDataCount * 8 +
|
|
14902
|
+
")");
|
|
14903
|
+
}
|
|
14904
|
+
|
|
14905
|
+
// end code
|
|
14906
|
+
if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
|
|
14907
|
+
buffer.put(0, 4);
|
|
14908
|
+
}
|
|
14909
|
+
|
|
14910
|
+
// padding
|
|
14911
|
+
while (buffer.getLengthInBits() % 8 !== 0) {
|
|
14912
|
+
buffer.putBit(false);
|
|
14913
|
+
}
|
|
14914
|
+
|
|
14915
|
+
// padding
|
|
14916
|
+
while (true) {
|
|
14917
|
+
|
|
14918
|
+
if (buffer.getLengthInBits() >= totalDataCount * 8) {
|
|
14919
|
+
break;
|
|
14920
|
+
}
|
|
14921
|
+
buffer.put(QRCode.PAD0, 8);
|
|
14922
|
+
|
|
14923
|
+
if (buffer.getLengthInBits() >= totalDataCount * 8) {
|
|
14924
|
+
break;
|
|
14925
|
+
}
|
|
14926
|
+
buffer.put(QRCode.PAD1, 8);
|
|
14927
|
+
}
|
|
14928
|
+
|
|
14929
|
+
return QRCode.createBytes(buffer, rsBlocks);
|
|
14930
|
+
};
|
|
14931
|
+
|
|
14932
|
+
QRCode.createBytes = function(buffer, rsBlocks) {
|
|
14933
|
+
|
|
14934
|
+
var offset = 0;
|
|
14935
|
+
|
|
14936
|
+
var maxDcCount = 0;
|
|
14937
|
+
var maxEcCount = 0;
|
|
14938
|
+
|
|
14939
|
+
var dcdata = new Array(rsBlocks.length);
|
|
14940
|
+
var ecdata = new Array(rsBlocks.length);
|
|
14941
|
+
|
|
14942
|
+
for (var r = 0; r < rsBlocks.length; r++) {
|
|
14943
|
+
|
|
14944
|
+
var dcCount = rsBlocks[r].dataCount;
|
|
14945
|
+
var ecCount = rsBlocks[r].totalCount - dcCount;
|
|
14946
|
+
|
|
14947
|
+
maxDcCount = Math.max(maxDcCount, dcCount);
|
|
14948
|
+
maxEcCount = Math.max(maxEcCount, ecCount);
|
|
14949
|
+
|
|
14950
|
+
dcdata[r] = new Array(dcCount);
|
|
14951
|
+
|
|
14952
|
+
for (var i = 0; i < dcdata[r].length; i++) {
|
|
14953
|
+
dcdata[r][i] = 0xff & buffer.buffer[i + offset];
|
|
14954
|
+
}
|
|
14955
|
+
offset += dcCount;
|
|
14956
|
+
|
|
14957
|
+
var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
|
|
14958
|
+
var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1);
|
|
14959
|
+
|
|
14960
|
+
var modPoly = rawPoly.mod(rsPoly);
|
|
14961
|
+
ecdata[r] = new Array(rsPoly.getLength() - 1);
|
|
14962
|
+
for (var x = 0; x < ecdata[r].length; x++) {
|
|
14963
|
+
var modIndex = x + modPoly.getLength() - ecdata[r].length;
|
|
14964
|
+
ecdata[r][x] = (modIndex >= 0)? modPoly.get(modIndex) : 0;
|
|
14965
|
+
}
|
|
14966
|
+
|
|
14967
|
+
}
|
|
14968
|
+
|
|
14969
|
+
var totalCodeCount = 0;
|
|
14970
|
+
for (var y = 0; y < rsBlocks.length; y++) {
|
|
14971
|
+
totalCodeCount += rsBlocks[y].totalCount;
|
|
14972
|
+
}
|
|
14973
|
+
|
|
14974
|
+
var data = new Array(totalCodeCount);
|
|
14975
|
+
var index = 0;
|
|
14976
|
+
|
|
14977
|
+
for (var z = 0; z < maxDcCount; z++) {
|
|
14978
|
+
for (var s = 0; s < rsBlocks.length; s++) {
|
|
14979
|
+
if (z < dcdata[s].length) {
|
|
14980
|
+
data[index++] = dcdata[s][z];
|
|
14981
|
+
}
|
|
14982
|
+
}
|
|
14983
|
+
}
|
|
14984
|
+
|
|
14985
|
+
for (var xx = 0; xx < maxEcCount; xx++) {
|
|
14986
|
+
for (var t = 0; t < rsBlocks.length; t++) {
|
|
14987
|
+
if (xx < ecdata[t].length) {
|
|
14988
|
+
data[index++] = ecdata[t][xx];
|
|
14989
|
+
}
|
|
14990
|
+
}
|
|
14991
|
+
}
|
|
14992
|
+
|
|
14993
|
+
return data;
|
|
14994
|
+
|
|
14995
|
+
};
|
|
14996
|
+
|
|
14997
|
+
module.exports = QRCode;
|
|
14998
|
+
|
|
14999
|
+
|
|
14037
15000
|
/***/ }),
|
|
14038
15001
|
|
|
14039
15002
|
/***/ 2309:
|
|
@@ -16257,6 +17220,35 @@ function raceInit(sources) {
|
|
|
16257
17220
|
exports.raceInit = raceInit;
|
|
16258
17221
|
//# sourceMappingURL=race.js.map
|
|
16259
17222
|
|
|
17223
|
+
/***/ }),
|
|
17224
|
+
|
|
17225
|
+
/***/ 2696:
|
|
17226
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
17227
|
+
|
|
17228
|
+
var QRMode = __webpack_require__(9802);
|
|
17229
|
+
|
|
17230
|
+
function QR8bitByte(data) {
|
|
17231
|
+
this.mode = QRMode.MODE_8BIT_BYTE;
|
|
17232
|
+
this.data = data;
|
|
17233
|
+
}
|
|
17234
|
+
|
|
17235
|
+
QR8bitByte.prototype = {
|
|
17236
|
+
|
|
17237
|
+
getLength : function() {
|
|
17238
|
+
return this.data.length;
|
|
17239
|
+
},
|
|
17240
|
+
|
|
17241
|
+
write : function(buffer) {
|
|
17242
|
+
for (var i = 0; i < this.data.length; i++) {
|
|
17243
|
+
// not JIS ...
|
|
17244
|
+
buffer.put(this.data.charCodeAt(i), 8);
|
|
17245
|
+
}
|
|
17246
|
+
}
|
|
17247
|
+
};
|
|
17248
|
+
|
|
17249
|
+
module.exports = QR8bitByte;
|
|
17250
|
+
|
|
17251
|
+
|
|
16260
17252
|
/***/ }),
|
|
16261
17253
|
|
|
16262
17254
|
/***/ 2752:
|
|
@@ -19114,6 +20106,37 @@ function popNumber(args, defaultValue) {
|
|
|
19114
20106
|
exports.popNumber = popNumber;
|
|
19115
20107
|
//# sourceMappingURL=args.js.map
|
|
19116
20108
|
|
|
20109
|
+
/***/ }),
|
|
20110
|
+
|
|
20111
|
+
/***/ 3523:
|
|
20112
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
20113
|
+
|
|
20114
|
+
/**
|
|
20115
|
+
* @otplib/plugin-thirty-two
|
|
20116
|
+
*
|
|
20117
|
+
* @author Gerald Yeo <contact@fusedthought.com>
|
|
20118
|
+
* @version: 12.0.1
|
|
20119
|
+
* @license: MIT
|
|
20120
|
+
**/
|
|
20121
|
+
|
|
20122
|
+
|
|
20123
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
20124
|
+
|
|
20125
|
+
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
20126
|
+
|
|
20127
|
+
var thirtyTwo = _interopDefault(__webpack_require__(942));
|
|
20128
|
+
|
|
20129
|
+
const keyDecoder = (encodedSecret, encoding) => {
|
|
20130
|
+
return thirtyTwo.decode(encodedSecret).toString(encoding);
|
|
20131
|
+
};
|
|
20132
|
+
const keyEncoder = (secret, encoding) => {
|
|
20133
|
+
return thirtyTwo.encode(Buffer.from(secret, encoding).toString('ascii')).toString().replace(/=/g, '');
|
|
20134
|
+
};
|
|
20135
|
+
|
|
20136
|
+
exports.keyDecoder = keyDecoder;
|
|
20137
|
+
exports.keyEncoder = keyEncoder;
|
|
20138
|
+
|
|
20139
|
+
|
|
19117
20140
|
/***/ }),
|
|
19118
20141
|
|
|
19119
20142
|
/***/ 3544:
|
|
@@ -23758,6 +24781,36 @@ function zipWith() {
|
|
|
23758
24781
|
exports.zipWith = zipWith;
|
|
23759
24782
|
//# sourceMappingURL=zipWith.js.map
|
|
23760
24783
|
|
|
24784
|
+
/***/ }),
|
|
24785
|
+
|
|
24786
|
+
/***/ 4283:
|
|
24787
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
24788
|
+
|
|
24789
|
+
/**
|
|
24790
|
+
* otplib
|
|
24791
|
+
*
|
|
24792
|
+
* @author Gerald Yeo <contact@fusedthought.com>
|
|
24793
|
+
* @version: 12.0.1
|
|
24794
|
+
* @license: MIT
|
|
24795
|
+
**/
|
|
24796
|
+
|
|
24797
|
+
|
|
24798
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
24799
|
+
|
|
24800
|
+
var presetDefault = __webpack_require__(8095);
|
|
24801
|
+
|
|
24802
|
+
|
|
24803
|
+
|
|
24804
|
+
Object.keys(presetDefault).forEach(function (k) {
|
|
24805
|
+
if (k !== 'default') Object.defineProperty(exports, k, {
|
|
24806
|
+
enumerable: true,
|
|
24807
|
+
get: function () {
|
|
24808
|
+
return presetDefault[k];
|
|
24809
|
+
}
|
|
24810
|
+
});
|
|
24811
|
+
});
|
|
24812
|
+
|
|
24813
|
+
|
|
23761
24814
|
/***/ }),
|
|
23762
24815
|
|
|
23763
24816
|
/***/ 4301:
|
|
@@ -27483,6 +28536,51 @@ module.exports = {
|
|
|
27483
28536
|
};
|
|
27484
28537
|
|
|
27485
28538
|
|
|
28539
|
+
/***/ }),
|
|
28540
|
+
|
|
28541
|
+
/***/ 4880:
|
|
28542
|
+
/***/ ((module) => {
|
|
28543
|
+
|
|
28544
|
+
function QRBitBuffer() {
|
|
28545
|
+
this.buffer = [];
|
|
28546
|
+
this.length = 0;
|
|
28547
|
+
}
|
|
28548
|
+
|
|
28549
|
+
QRBitBuffer.prototype = {
|
|
28550
|
+
|
|
28551
|
+
get : function(index) {
|
|
28552
|
+
var bufIndex = Math.floor(index / 8);
|
|
28553
|
+
return ( (this.buffer[bufIndex] >>> (7 - index % 8) ) & 1) == 1;
|
|
28554
|
+
},
|
|
28555
|
+
|
|
28556
|
+
put : function(num, length) {
|
|
28557
|
+
for (var i = 0; i < length; i++) {
|
|
28558
|
+
this.putBit( ( (num >>> (length - i - 1) ) & 1) == 1);
|
|
28559
|
+
}
|
|
28560
|
+
},
|
|
28561
|
+
|
|
28562
|
+
getLengthInBits : function() {
|
|
28563
|
+
return this.length;
|
|
28564
|
+
},
|
|
28565
|
+
|
|
28566
|
+
putBit : function(bit) {
|
|
28567
|
+
|
|
28568
|
+
var bufIndex = Math.floor(this.length / 8);
|
|
28569
|
+
if (this.buffer.length <= bufIndex) {
|
|
28570
|
+
this.buffer.push(0);
|
|
28571
|
+
}
|
|
28572
|
+
|
|
28573
|
+
if (bit) {
|
|
28574
|
+
this.buffer[bufIndex] |= (0x80 >>> (this.length % 8) );
|
|
28575
|
+
}
|
|
28576
|
+
|
|
28577
|
+
this.length++;
|
|
28578
|
+
}
|
|
28579
|
+
};
|
|
28580
|
+
|
|
28581
|
+
module.exports = QRBitBuffer;
|
|
28582
|
+
|
|
28583
|
+
|
|
27486
28584
|
/***/ }),
|
|
27487
28585
|
|
|
27488
28586
|
/***/ 4884:
|
|
@@ -30477,6 +31575,79 @@ function mergeAll(concurrent) {
|
|
|
30477
31575
|
exports.mergeAll = mergeAll;
|
|
30478
31576
|
//# sourceMappingURL=mergeAll.js.map
|
|
30479
31577
|
|
|
31578
|
+
/***/ }),
|
|
31579
|
+
|
|
31580
|
+
/***/ 5739:
|
|
31581
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
31582
|
+
|
|
31583
|
+
var QRMath = __webpack_require__(6543);
|
|
31584
|
+
|
|
31585
|
+
function QRPolynomial(num, shift) {
|
|
31586
|
+
if (num.length === undefined) {
|
|
31587
|
+
throw new Error(num.length + "/" + shift);
|
|
31588
|
+
}
|
|
31589
|
+
|
|
31590
|
+
var offset = 0;
|
|
31591
|
+
|
|
31592
|
+
while (offset < num.length && num[offset] === 0) {
|
|
31593
|
+
offset++;
|
|
31594
|
+
}
|
|
31595
|
+
|
|
31596
|
+
this.num = new Array(num.length - offset + shift);
|
|
31597
|
+
for (var i = 0; i < num.length - offset; i++) {
|
|
31598
|
+
this.num[i] = num[i + offset];
|
|
31599
|
+
}
|
|
31600
|
+
}
|
|
31601
|
+
|
|
31602
|
+
QRPolynomial.prototype = {
|
|
31603
|
+
|
|
31604
|
+
get : function(index) {
|
|
31605
|
+
return this.num[index];
|
|
31606
|
+
},
|
|
31607
|
+
|
|
31608
|
+
getLength : function() {
|
|
31609
|
+
return this.num.length;
|
|
31610
|
+
},
|
|
31611
|
+
|
|
31612
|
+
multiply : function(e) {
|
|
31613
|
+
|
|
31614
|
+
var num = new Array(this.getLength() + e.getLength() - 1);
|
|
31615
|
+
|
|
31616
|
+
for (var i = 0; i < this.getLength(); i++) {
|
|
31617
|
+
for (var j = 0; j < e.getLength(); j++) {
|
|
31618
|
+
num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i) ) + QRMath.glog(e.get(j) ) );
|
|
31619
|
+
}
|
|
31620
|
+
}
|
|
31621
|
+
|
|
31622
|
+
return new QRPolynomial(num, 0);
|
|
31623
|
+
},
|
|
31624
|
+
|
|
31625
|
+
mod : function(e) {
|
|
31626
|
+
|
|
31627
|
+
if (this.getLength() - e.getLength() < 0) {
|
|
31628
|
+
return this;
|
|
31629
|
+
}
|
|
31630
|
+
|
|
31631
|
+
var ratio = QRMath.glog(this.get(0) ) - QRMath.glog(e.get(0) );
|
|
31632
|
+
|
|
31633
|
+
var num = new Array(this.getLength() );
|
|
31634
|
+
|
|
31635
|
+
for (var i = 0; i < this.getLength(); i++) {
|
|
31636
|
+
num[i] = this.get(i);
|
|
31637
|
+
}
|
|
31638
|
+
|
|
31639
|
+
for (var x = 0; x < e.getLength(); x++) {
|
|
31640
|
+
num[x] ^= QRMath.gexp(QRMath.glog(e.get(x) ) + ratio);
|
|
31641
|
+
}
|
|
31642
|
+
|
|
31643
|
+
// recursive call
|
|
31644
|
+
return new QRPolynomial(num, 0).mod(e);
|
|
31645
|
+
}
|
|
31646
|
+
};
|
|
31647
|
+
|
|
31648
|
+
module.exports = QRPolynomial;
|
|
31649
|
+
|
|
31650
|
+
|
|
30480
31651
|
/***/ }),
|
|
30481
31652
|
|
|
30482
31653
|
/***/ 5743:
|
|
@@ -32048,6 +33219,113 @@ function timestamp(timestampProvider) {
|
|
|
32048
33219
|
exports.timestamp = timestamp;
|
|
32049
33220
|
//# sourceMappingURL=timestamp.js.map
|
|
32050
33221
|
|
|
33222
|
+
/***/ }),
|
|
33223
|
+
|
|
33224
|
+
/***/ 6273:
|
|
33225
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
33226
|
+
|
|
33227
|
+
var QRCode = __webpack_require__(2304),
|
|
33228
|
+
QRErrorCorrectLevel = __webpack_require__(543),
|
|
33229
|
+
black = "\x1b[40m \x1b[0m",
|
|
33230
|
+
white = "\x1b[47m \x1b[0m",
|
|
33231
|
+
toCell = function (isBlack) {
|
|
33232
|
+
return isBlack ? black : white;
|
|
33233
|
+
},
|
|
33234
|
+
repeat = function (color) {
|
|
33235
|
+
return {
|
|
33236
|
+
times: function (count) {
|
|
33237
|
+
return new Array(count).join(color);
|
|
33238
|
+
}
|
|
33239
|
+
};
|
|
33240
|
+
},
|
|
33241
|
+
fill = function(length, value) {
|
|
33242
|
+
var arr = new Array(length);
|
|
33243
|
+
for (var i = 0; i < length; i++) {
|
|
33244
|
+
arr[i] = value;
|
|
33245
|
+
}
|
|
33246
|
+
return arr;
|
|
33247
|
+
};
|
|
33248
|
+
|
|
33249
|
+
module.exports = {
|
|
33250
|
+
|
|
33251
|
+
error: QRErrorCorrectLevel.L,
|
|
33252
|
+
|
|
33253
|
+
generate: function (input, opts, cb) {
|
|
33254
|
+
if (typeof opts === 'function') {
|
|
33255
|
+
cb = opts;
|
|
33256
|
+
opts = {};
|
|
33257
|
+
}
|
|
33258
|
+
|
|
33259
|
+
var qrcode = new QRCode(-1, this.error);
|
|
33260
|
+
qrcode.addData(input);
|
|
33261
|
+
qrcode.make();
|
|
33262
|
+
|
|
33263
|
+
var output = '';
|
|
33264
|
+
if (opts && opts.small) {
|
|
33265
|
+
var BLACK = true, WHITE = false;
|
|
33266
|
+
var moduleCount = qrcode.getModuleCount();
|
|
33267
|
+
var moduleData = qrcode.modules.slice();
|
|
33268
|
+
|
|
33269
|
+
var oddRow = moduleCount % 2 === 1;
|
|
33270
|
+
if (oddRow) {
|
|
33271
|
+
moduleData.push(fill(moduleCount, WHITE));
|
|
33272
|
+
}
|
|
33273
|
+
|
|
33274
|
+
var platte= {
|
|
33275
|
+
WHITE_ALL: '\u2588',
|
|
33276
|
+
WHITE_BLACK: '\u2580',
|
|
33277
|
+
BLACK_WHITE: '\u2584',
|
|
33278
|
+
BLACK_ALL: ' ',
|
|
33279
|
+
};
|
|
33280
|
+
|
|
33281
|
+
var borderTop = repeat(platte.BLACK_WHITE).times(moduleCount + 3);
|
|
33282
|
+
var borderBottom = repeat(platte.WHITE_BLACK).times(moduleCount + 3);
|
|
33283
|
+
output += borderTop + '\n';
|
|
33284
|
+
|
|
33285
|
+
for (var row = 0; row < moduleCount; row += 2) {
|
|
33286
|
+
output += platte.WHITE_ALL;
|
|
33287
|
+
|
|
33288
|
+
for (var col = 0; col < moduleCount; col++) {
|
|
33289
|
+
if (moduleData[row][col] === WHITE && moduleData[row + 1][col] === WHITE) {
|
|
33290
|
+
output += platte.WHITE_ALL;
|
|
33291
|
+
} else if (moduleData[row][col] === WHITE && moduleData[row + 1][col] === BLACK) {
|
|
33292
|
+
output += platte.WHITE_BLACK;
|
|
33293
|
+
} else if (moduleData[row][col] === BLACK && moduleData[row + 1][col] === WHITE) {
|
|
33294
|
+
output += platte.BLACK_WHITE;
|
|
33295
|
+
} else {
|
|
33296
|
+
output += platte.BLACK_ALL;
|
|
33297
|
+
}
|
|
33298
|
+
}
|
|
33299
|
+
|
|
33300
|
+
output += platte.WHITE_ALL + '\n';
|
|
33301
|
+
}
|
|
33302
|
+
|
|
33303
|
+
if (!oddRow) {
|
|
33304
|
+
output += borderBottom;
|
|
33305
|
+
}
|
|
33306
|
+
} else {
|
|
33307
|
+
var border = repeat(white).times(qrcode.getModuleCount() + 3);
|
|
33308
|
+
|
|
33309
|
+
output += border + '\n';
|
|
33310
|
+
qrcode.modules.forEach(function (row) {
|
|
33311
|
+
output += white;
|
|
33312
|
+
output += row.map(toCell).join('');
|
|
33313
|
+
output += white + '\n';
|
|
33314
|
+
});
|
|
33315
|
+
output += border;
|
|
33316
|
+
}
|
|
33317
|
+
|
|
33318
|
+
if (cb) cb(output);
|
|
33319
|
+
else console.log(output);
|
|
33320
|
+
},
|
|
33321
|
+
|
|
33322
|
+
setErrorLevel: function (error) {
|
|
33323
|
+
this.error = QRErrorCorrectLevel[error] || this.error;
|
|
33324
|
+
}
|
|
33325
|
+
|
|
33326
|
+
};
|
|
33327
|
+
|
|
33328
|
+
|
|
32051
33329
|
/***/ }),
|
|
32052
33330
|
|
|
32053
33331
|
/***/ 6311:
|
|
@@ -32680,6 +33958,57 @@ function debounceTime(dueTime, scheduler) {
|
|
|
32680
33958
|
exports.debounceTime = debounceTime;
|
|
32681
33959
|
//# sourceMappingURL=debounceTime.js.map
|
|
32682
33960
|
|
|
33961
|
+
/***/ }),
|
|
33962
|
+
|
|
33963
|
+
/***/ 6543:
|
|
33964
|
+
/***/ ((module) => {
|
|
33965
|
+
|
|
33966
|
+
var QRMath = {
|
|
33967
|
+
|
|
33968
|
+
glog : function(n) {
|
|
33969
|
+
|
|
33970
|
+
if (n < 1) {
|
|
33971
|
+
throw new Error("glog(" + n + ")");
|
|
33972
|
+
}
|
|
33973
|
+
|
|
33974
|
+
return QRMath.LOG_TABLE[n];
|
|
33975
|
+
},
|
|
33976
|
+
|
|
33977
|
+
gexp : function(n) {
|
|
33978
|
+
|
|
33979
|
+
while (n < 0) {
|
|
33980
|
+
n += 255;
|
|
33981
|
+
}
|
|
33982
|
+
|
|
33983
|
+
while (n >= 256) {
|
|
33984
|
+
n -= 255;
|
|
33985
|
+
}
|
|
33986
|
+
|
|
33987
|
+
return QRMath.EXP_TABLE[n];
|
|
33988
|
+
},
|
|
33989
|
+
|
|
33990
|
+
EXP_TABLE : new Array(256),
|
|
33991
|
+
|
|
33992
|
+
LOG_TABLE : new Array(256)
|
|
33993
|
+
|
|
33994
|
+
};
|
|
33995
|
+
|
|
33996
|
+
for (var i = 0; i < 8; i++) {
|
|
33997
|
+
QRMath.EXP_TABLE[i] = 1 << i;
|
|
33998
|
+
}
|
|
33999
|
+
for (var i = 8; i < 256; i++) {
|
|
34000
|
+
QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4]
|
|
34001
|
+
^ QRMath.EXP_TABLE[i - 5]
|
|
34002
|
+
^ QRMath.EXP_TABLE[i - 6]
|
|
34003
|
+
^ QRMath.EXP_TABLE[i - 8];
|
|
34004
|
+
}
|
|
34005
|
+
for (var i = 0; i < 255; i++) {
|
|
34006
|
+
QRMath.LOG_TABLE[QRMath.EXP_TABLE[i] ] = i;
|
|
34007
|
+
}
|
|
34008
|
+
|
|
34009
|
+
module.exports = QRMath;
|
|
34010
|
+
|
|
34011
|
+
|
|
32683
34012
|
/***/ }),
|
|
32684
34013
|
|
|
32685
34014
|
/***/ 6546:
|
|
@@ -37520,6 +38849,311 @@ if (process.env.READABLE_STREAM === 'disable' && Stream) {
|
|
|
37520
38849
|
}
|
|
37521
38850
|
|
|
37522
38851
|
|
|
38852
|
+
/***/ }),
|
|
38853
|
+
|
|
38854
|
+
/***/ 7129:
|
|
38855
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
38856
|
+
|
|
38857
|
+
var QRErrorCorrectLevel = __webpack_require__(543);
|
|
38858
|
+
|
|
38859
|
+
function QRRSBlock(totalCount, dataCount) {
|
|
38860
|
+
this.totalCount = totalCount;
|
|
38861
|
+
this.dataCount = dataCount;
|
|
38862
|
+
}
|
|
38863
|
+
|
|
38864
|
+
QRRSBlock.RS_BLOCK_TABLE = [
|
|
38865
|
+
|
|
38866
|
+
// L
|
|
38867
|
+
// M
|
|
38868
|
+
// Q
|
|
38869
|
+
// H
|
|
38870
|
+
|
|
38871
|
+
// 1
|
|
38872
|
+
[1, 26, 19],
|
|
38873
|
+
[1, 26, 16],
|
|
38874
|
+
[1, 26, 13],
|
|
38875
|
+
[1, 26, 9],
|
|
38876
|
+
|
|
38877
|
+
// 2
|
|
38878
|
+
[1, 44, 34],
|
|
38879
|
+
[1, 44, 28],
|
|
38880
|
+
[1, 44, 22],
|
|
38881
|
+
[1, 44, 16],
|
|
38882
|
+
|
|
38883
|
+
// 3
|
|
38884
|
+
[1, 70, 55],
|
|
38885
|
+
[1, 70, 44],
|
|
38886
|
+
[2, 35, 17],
|
|
38887
|
+
[2, 35, 13],
|
|
38888
|
+
|
|
38889
|
+
// 4
|
|
38890
|
+
[1, 100, 80],
|
|
38891
|
+
[2, 50, 32],
|
|
38892
|
+
[2, 50, 24],
|
|
38893
|
+
[4, 25, 9],
|
|
38894
|
+
|
|
38895
|
+
// 5
|
|
38896
|
+
[1, 134, 108],
|
|
38897
|
+
[2, 67, 43],
|
|
38898
|
+
[2, 33, 15, 2, 34, 16],
|
|
38899
|
+
[2, 33, 11, 2, 34, 12],
|
|
38900
|
+
|
|
38901
|
+
// 6
|
|
38902
|
+
[2, 86, 68],
|
|
38903
|
+
[4, 43, 27],
|
|
38904
|
+
[4, 43, 19],
|
|
38905
|
+
[4, 43, 15],
|
|
38906
|
+
|
|
38907
|
+
// 7
|
|
38908
|
+
[2, 98, 78],
|
|
38909
|
+
[4, 49, 31],
|
|
38910
|
+
[2, 32, 14, 4, 33, 15],
|
|
38911
|
+
[4, 39, 13, 1, 40, 14],
|
|
38912
|
+
|
|
38913
|
+
// 8
|
|
38914
|
+
[2, 121, 97],
|
|
38915
|
+
[2, 60, 38, 2, 61, 39],
|
|
38916
|
+
[4, 40, 18, 2, 41, 19],
|
|
38917
|
+
[4, 40, 14, 2, 41, 15],
|
|
38918
|
+
|
|
38919
|
+
// 9
|
|
38920
|
+
[2, 146, 116],
|
|
38921
|
+
[3, 58, 36, 2, 59, 37],
|
|
38922
|
+
[4, 36, 16, 4, 37, 17],
|
|
38923
|
+
[4, 36, 12, 4, 37, 13],
|
|
38924
|
+
|
|
38925
|
+
// 10
|
|
38926
|
+
[2, 86, 68, 2, 87, 69],
|
|
38927
|
+
[4, 69, 43, 1, 70, 44],
|
|
38928
|
+
[6, 43, 19, 2, 44, 20],
|
|
38929
|
+
[6, 43, 15, 2, 44, 16],
|
|
38930
|
+
|
|
38931
|
+
// 11
|
|
38932
|
+
[4, 101, 81],
|
|
38933
|
+
[1, 80, 50, 4, 81, 51],
|
|
38934
|
+
[4, 50, 22, 4, 51, 23],
|
|
38935
|
+
[3, 36, 12, 8, 37, 13],
|
|
38936
|
+
|
|
38937
|
+
// 12
|
|
38938
|
+
[2, 116, 92, 2, 117, 93],
|
|
38939
|
+
[6, 58, 36, 2, 59, 37],
|
|
38940
|
+
[4, 46, 20, 6, 47, 21],
|
|
38941
|
+
[7, 42, 14, 4, 43, 15],
|
|
38942
|
+
|
|
38943
|
+
// 13
|
|
38944
|
+
[4, 133, 107],
|
|
38945
|
+
[8, 59, 37, 1, 60, 38],
|
|
38946
|
+
[8, 44, 20, 4, 45, 21],
|
|
38947
|
+
[12, 33, 11, 4, 34, 12],
|
|
38948
|
+
|
|
38949
|
+
// 14
|
|
38950
|
+
[3, 145, 115, 1, 146, 116],
|
|
38951
|
+
[4, 64, 40, 5, 65, 41],
|
|
38952
|
+
[11, 36, 16, 5, 37, 17],
|
|
38953
|
+
[11, 36, 12, 5, 37, 13],
|
|
38954
|
+
|
|
38955
|
+
// 15
|
|
38956
|
+
[5, 109, 87, 1, 110, 88],
|
|
38957
|
+
[5, 65, 41, 5, 66, 42],
|
|
38958
|
+
[5, 54, 24, 7, 55, 25],
|
|
38959
|
+
[11, 36, 12],
|
|
38960
|
+
|
|
38961
|
+
// 16
|
|
38962
|
+
[5, 122, 98, 1, 123, 99],
|
|
38963
|
+
[7, 73, 45, 3, 74, 46],
|
|
38964
|
+
[15, 43, 19, 2, 44, 20],
|
|
38965
|
+
[3, 45, 15, 13, 46, 16],
|
|
38966
|
+
|
|
38967
|
+
// 17
|
|
38968
|
+
[1, 135, 107, 5, 136, 108],
|
|
38969
|
+
[10, 74, 46, 1, 75, 47],
|
|
38970
|
+
[1, 50, 22, 15, 51, 23],
|
|
38971
|
+
[2, 42, 14, 17, 43, 15],
|
|
38972
|
+
|
|
38973
|
+
// 18
|
|
38974
|
+
[5, 150, 120, 1, 151, 121],
|
|
38975
|
+
[9, 69, 43, 4, 70, 44],
|
|
38976
|
+
[17, 50, 22, 1, 51, 23],
|
|
38977
|
+
[2, 42, 14, 19, 43, 15],
|
|
38978
|
+
|
|
38979
|
+
// 19
|
|
38980
|
+
[3, 141, 113, 4, 142, 114],
|
|
38981
|
+
[3, 70, 44, 11, 71, 45],
|
|
38982
|
+
[17, 47, 21, 4, 48, 22],
|
|
38983
|
+
[9, 39, 13, 16, 40, 14],
|
|
38984
|
+
|
|
38985
|
+
// 20
|
|
38986
|
+
[3, 135, 107, 5, 136, 108],
|
|
38987
|
+
[3, 67, 41, 13, 68, 42],
|
|
38988
|
+
[15, 54, 24, 5, 55, 25],
|
|
38989
|
+
[15, 43, 15, 10, 44, 16],
|
|
38990
|
+
|
|
38991
|
+
// 21
|
|
38992
|
+
[4, 144, 116, 4, 145, 117],
|
|
38993
|
+
[17, 68, 42],
|
|
38994
|
+
[17, 50, 22, 6, 51, 23],
|
|
38995
|
+
[19, 46, 16, 6, 47, 17],
|
|
38996
|
+
|
|
38997
|
+
// 22
|
|
38998
|
+
[2, 139, 111, 7, 140, 112],
|
|
38999
|
+
[17, 74, 46],
|
|
39000
|
+
[7, 54, 24, 16, 55, 25],
|
|
39001
|
+
[34, 37, 13],
|
|
39002
|
+
|
|
39003
|
+
// 23
|
|
39004
|
+
[4, 151, 121, 5, 152, 122],
|
|
39005
|
+
[4, 75, 47, 14, 76, 48],
|
|
39006
|
+
[11, 54, 24, 14, 55, 25],
|
|
39007
|
+
[16, 45, 15, 14, 46, 16],
|
|
39008
|
+
|
|
39009
|
+
// 24
|
|
39010
|
+
[6, 147, 117, 4, 148, 118],
|
|
39011
|
+
[6, 73, 45, 14, 74, 46],
|
|
39012
|
+
[11, 54, 24, 16, 55, 25],
|
|
39013
|
+
[30, 46, 16, 2, 47, 17],
|
|
39014
|
+
|
|
39015
|
+
// 25
|
|
39016
|
+
[8, 132, 106, 4, 133, 107],
|
|
39017
|
+
[8, 75, 47, 13, 76, 48],
|
|
39018
|
+
[7, 54, 24, 22, 55, 25],
|
|
39019
|
+
[22, 45, 15, 13, 46, 16],
|
|
39020
|
+
|
|
39021
|
+
// 26
|
|
39022
|
+
[10, 142, 114, 2, 143, 115],
|
|
39023
|
+
[19, 74, 46, 4, 75, 47],
|
|
39024
|
+
[28, 50, 22, 6, 51, 23],
|
|
39025
|
+
[33, 46, 16, 4, 47, 17],
|
|
39026
|
+
|
|
39027
|
+
// 27
|
|
39028
|
+
[8, 152, 122, 4, 153, 123],
|
|
39029
|
+
[22, 73, 45, 3, 74, 46],
|
|
39030
|
+
[8, 53, 23, 26, 54, 24],
|
|
39031
|
+
[12, 45, 15, 28, 46, 16],
|
|
39032
|
+
|
|
39033
|
+
// 28
|
|
39034
|
+
[3, 147, 117, 10, 148, 118],
|
|
39035
|
+
[3, 73, 45, 23, 74, 46],
|
|
39036
|
+
[4, 54, 24, 31, 55, 25],
|
|
39037
|
+
[11, 45, 15, 31, 46, 16],
|
|
39038
|
+
|
|
39039
|
+
// 29
|
|
39040
|
+
[7, 146, 116, 7, 147, 117],
|
|
39041
|
+
[21, 73, 45, 7, 74, 46],
|
|
39042
|
+
[1, 53, 23, 37, 54, 24],
|
|
39043
|
+
[19, 45, 15, 26, 46, 16],
|
|
39044
|
+
|
|
39045
|
+
// 30
|
|
39046
|
+
[5, 145, 115, 10, 146, 116],
|
|
39047
|
+
[19, 75, 47, 10, 76, 48],
|
|
39048
|
+
[15, 54, 24, 25, 55, 25],
|
|
39049
|
+
[23, 45, 15, 25, 46, 16],
|
|
39050
|
+
|
|
39051
|
+
// 31
|
|
39052
|
+
[13, 145, 115, 3, 146, 116],
|
|
39053
|
+
[2, 74, 46, 29, 75, 47],
|
|
39054
|
+
[42, 54, 24, 1, 55, 25],
|
|
39055
|
+
[23, 45, 15, 28, 46, 16],
|
|
39056
|
+
|
|
39057
|
+
// 32
|
|
39058
|
+
[17, 145, 115],
|
|
39059
|
+
[10, 74, 46, 23, 75, 47],
|
|
39060
|
+
[10, 54, 24, 35, 55, 25],
|
|
39061
|
+
[19, 45, 15, 35, 46, 16],
|
|
39062
|
+
|
|
39063
|
+
// 33
|
|
39064
|
+
[17, 145, 115, 1, 146, 116],
|
|
39065
|
+
[14, 74, 46, 21, 75, 47],
|
|
39066
|
+
[29, 54, 24, 19, 55, 25],
|
|
39067
|
+
[11, 45, 15, 46, 46, 16],
|
|
39068
|
+
|
|
39069
|
+
// 34
|
|
39070
|
+
[13, 145, 115, 6, 146, 116],
|
|
39071
|
+
[14, 74, 46, 23, 75, 47],
|
|
39072
|
+
[44, 54, 24, 7, 55, 25],
|
|
39073
|
+
[59, 46, 16, 1, 47, 17],
|
|
39074
|
+
|
|
39075
|
+
// 35
|
|
39076
|
+
[12, 151, 121, 7, 152, 122],
|
|
39077
|
+
[12, 75, 47, 26, 76, 48],
|
|
39078
|
+
[39, 54, 24, 14, 55, 25],
|
|
39079
|
+
[22, 45, 15, 41, 46, 16],
|
|
39080
|
+
|
|
39081
|
+
// 36
|
|
39082
|
+
[6, 151, 121, 14, 152, 122],
|
|
39083
|
+
[6, 75, 47, 34, 76, 48],
|
|
39084
|
+
[46, 54, 24, 10, 55, 25],
|
|
39085
|
+
[2, 45, 15, 64, 46, 16],
|
|
39086
|
+
|
|
39087
|
+
// 37
|
|
39088
|
+
[17, 152, 122, 4, 153, 123],
|
|
39089
|
+
[29, 74, 46, 14, 75, 47],
|
|
39090
|
+
[49, 54, 24, 10, 55, 25],
|
|
39091
|
+
[24, 45, 15, 46, 46, 16],
|
|
39092
|
+
|
|
39093
|
+
// 38
|
|
39094
|
+
[4, 152, 122, 18, 153, 123],
|
|
39095
|
+
[13, 74, 46, 32, 75, 47],
|
|
39096
|
+
[48, 54, 24, 14, 55, 25],
|
|
39097
|
+
[42, 45, 15, 32, 46, 16],
|
|
39098
|
+
|
|
39099
|
+
// 39
|
|
39100
|
+
[20, 147, 117, 4, 148, 118],
|
|
39101
|
+
[40, 75, 47, 7, 76, 48],
|
|
39102
|
+
[43, 54, 24, 22, 55, 25],
|
|
39103
|
+
[10, 45, 15, 67, 46, 16],
|
|
39104
|
+
|
|
39105
|
+
// 40
|
|
39106
|
+
[19, 148, 118, 6, 149, 119],
|
|
39107
|
+
[18, 75, 47, 31, 76, 48],
|
|
39108
|
+
[34, 54, 24, 34, 55, 25],
|
|
39109
|
+
[20, 45, 15, 61, 46, 16]
|
|
39110
|
+
];
|
|
39111
|
+
|
|
39112
|
+
QRRSBlock.getRSBlocks = function(typeNumber, errorCorrectLevel) {
|
|
39113
|
+
|
|
39114
|
+
var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel);
|
|
39115
|
+
|
|
39116
|
+
if (rsBlock === undefined) {
|
|
39117
|
+
throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel);
|
|
39118
|
+
}
|
|
39119
|
+
|
|
39120
|
+
var length = rsBlock.length / 3;
|
|
39121
|
+
|
|
39122
|
+
var list = [];
|
|
39123
|
+
|
|
39124
|
+
for (var i = 0; i < length; i++) {
|
|
39125
|
+
|
|
39126
|
+
var count = rsBlock[i * 3 + 0];
|
|
39127
|
+
var totalCount = rsBlock[i * 3 + 1];
|
|
39128
|
+
var dataCount = rsBlock[i * 3 + 2];
|
|
39129
|
+
|
|
39130
|
+
for (var j = 0; j < count; j++) {
|
|
39131
|
+
list.push(new QRRSBlock(totalCount, dataCount) );
|
|
39132
|
+
}
|
|
39133
|
+
}
|
|
39134
|
+
|
|
39135
|
+
return list;
|
|
39136
|
+
};
|
|
39137
|
+
|
|
39138
|
+
QRRSBlock.getRsBlockTable = function(typeNumber, errorCorrectLevel) {
|
|
39139
|
+
|
|
39140
|
+
switch(errorCorrectLevel) {
|
|
39141
|
+
case QRErrorCorrectLevel.L :
|
|
39142
|
+
return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
|
|
39143
|
+
case QRErrorCorrectLevel.M :
|
|
39144
|
+
return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
|
|
39145
|
+
case QRErrorCorrectLevel.Q :
|
|
39146
|
+
return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
|
|
39147
|
+
case QRErrorCorrectLevel.H :
|
|
39148
|
+
return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
|
|
39149
|
+
default :
|
|
39150
|
+
return undefined;
|
|
39151
|
+
}
|
|
39152
|
+
};
|
|
39153
|
+
|
|
39154
|
+
module.exports = QRRSBlock;
|
|
39155
|
+
|
|
39156
|
+
|
|
37523
39157
|
/***/ }),
|
|
37524
39158
|
|
|
37525
39159
|
/***/ 7145:
|
|
@@ -41463,6 +43097,504 @@ function executeSchedule(parentSubscription, scheduler, work, delay, repeat) {
|
|
|
41463
43097
|
exports.executeSchedule = executeSchedule;
|
|
41464
43098
|
//# sourceMappingURL=executeSchedule.js.map
|
|
41465
43099
|
|
|
43100
|
+
/***/ }),
|
|
43101
|
+
|
|
43102
|
+
/***/ 7735:
|
|
43103
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
43104
|
+
|
|
43105
|
+
/**
|
|
43106
|
+
* @otplib/core
|
|
43107
|
+
*
|
|
43108
|
+
* @author Gerald Yeo <contact@fusedthought.com>
|
|
43109
|
+
* @version: 12.0.1
|
|
43110
|
+
* @license: MIT
|
|
43111
|
+
**/
|
|
43112
|
+
|
|
43113
|
+
|
|
43114
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
43115
|
+
|
|
43116
|
+
function objectValues(value) {
|
|
43117
|
+
return Object.keys(value).map(key => value[key]);
|
|
43118
|
+
}
|
|
43119
|
+
(function (HashAlgorithms) {
|
|
43120
|
+
HashAlgorithms["SHA1"] = "sha1";
|
|
43121
|
+
HashAlgorithms["SHA256"] = "sha256";
|
|
43122
|
+
HashAlgorithms["SHA512"] = "sha512";
|
|
43123
|
+
})(exports.HashAlgorithms || (exports.HashAlgorithms = {}));
|
|
43124
|
+
const HASH_ALGORITHMS = objectValues(exports.HashAlgorithms);
|
|
43125
|
+
(function (KeyEncodings) {
|
|
43126
|
+
KeyEncodings["ASCII"] = "ascii";
|
|
43127
|
+
KeyEncodings["BASE64"] = "base64";
|
|
43128
|
+
KeyEncodings["HEX"] = "hex";
|
|
43129
|
+
KeyEncodings["LATIN1"] = "latin1";
|
|
43130
|
+
KeyEncodings["UTF8"] = "utf8";
|
|
43131
|
+
})(exports.KeyEncodings || (exports.KeyEncodings = {}));
|
|
43132
|
+
const KEY_ENCODINGS = objectValues(exports.KeyEncodings);
|
|
43133
|
+
(function (Strategy) {
|
|
43134
|
+
Strategy["HOTP"] = "hotp";
|
|
43135
|
+
Strategy["TOTP"] = "totp";
|
|
43136
|
+
})(exports.Strategy || (exports.Strategy = {}));
|
|
43137
|
+
const STRATEGY = objectValues(exports.Strategy);
|
|
43138
|
+
const createDigestPlaceholder = () => {
|
|
43139
|
+
throw new Error('Please provide an options.createDigest implementation.');
|
|
43140
|
+
};
|
|
43141
|
+
function isTokenValid(value) {
|
|
43142
|
+
return /^(\d+)$/.test(value);
|
|
43143
|
+
}
|
|
43144
|
+
function padStart(value, maxLength, fillString) {
|
|
43145
|
+
if (value.length >= maxLength) {
|
|
43146
|
+
return value;
|
|
43147
|
+
}
|
|
43148
|
+
const padding = Array(maxLength + 1).join(fillString);
|
|
43149
|
+
return `${padding}${value}`.slice(-1 * maxLength);
|
|
43150
|
+
}
|
|
43151
|
+
function keyuri(options) {
|
|
43152
|
+
const tmpl = `otpauth://${options.type}/{labelPrefix}:{accountName}?secret={secret}{query}`;
|
|
43153
|
+
const params = [];
|
|
43154
|
+
if (STRATEGY.indexOf(options.type) < 0) {
|
|
43155
|
+
throw new Error(`Expecting options.type to be one of ${STRATEGY.join(', ')}. Received ${options.type}.`);
|
|
43156
|
+
}
|
|
43157
|
+
if (options.type === 'hotp') {
|
|
43158
|
+
if (options.counter == null || typeof options.counter !== 'number') {
|
|
43159
|
+
throw new Error('Expecting options.counter to be a number when options.type is "hotp".');
|
|
43160
|
+
}
|
|
43161
|
+
params.push(`&counter=${options.counter}`);
|
|
43162
|
+
}
|
|
43163
|
+
if (options.type === 'totp' && options.step) {
|
|
43164
|
+
params.push(`&period=${options.step}`);
|
|
43165
|
+
}
|
|
43166
|
+
if (options.digits) {
|
|
43167
|
+
params.push(`&digits=${options.digits}`);
|
|
43168
|
+
}
|
|
43169
|
+
if (options.algorithm) {
|
|
43170
|
+
params.push(`&algorithm=${options.algorithm.toUpperCase()}`);
|
|
43171
|
+
}
|
|
43172
|
+
if (options.issuer) {
|
|
43173
|
+
params.push(`&issuer=${encodeURIComponent(options.issuer)}`);
|
|
43174
|
+
}
|
|
43175
|
+
return tmpl.replace('{labelPrefix}', encodeURIComponent(options.issuer || options.accountName)).replace('{accountName}', encodeURIComponent(options.accountName)).replace('{secret}', options.secret).replace('{query}', params.join(''));
|
|
43176
|
+
}
|
|
43177
|
+
class OTP {
|
|
43178
|
+
constructor(defaultOptions = {}) {
|
|
43179
|
+
this._defaultOptions = Object.freeze({ ...defaultOptions
|
|
43180
|
+
});
|
|
43181
|
+
this._options = Object.freeze({});
|
|
43182
|
+
}
|
|
43183
|
+
create(defaultOptions = {}) {
|
|
43184
|
+
return new OTP(defaultOptions);
|
|
43185
|
+
}
|
|
43186
|
+
clone(defaultOptions = {}) {
|
|
43187
|
+
const instance = this.create({ ...this._defaultOptions,
|
|
43188
|
+
...defaultOptions
|
|
43189
|
+
});
|
|
43190
|
+
instance.options = this._options;
|
|
43191
|
+
return instance;
|
|
43192
|
+
}
|
|
43193
|
+
get options() {
|
|
43194
|
+
return Object.freeze({ ...this._defaultOptions,
|
|
43195
|
+
...this._options
|
|
43196
|
+
});
|
|
43197
|
+
}
|
|
43198
|
+
set options(options) {
|
|
43199
|
+
this._options = Object.freeze({ ...this._options,
|
|
43200
|
+
...options
|
|
43201
|
+
});
|
|
43202
|
+
}
|
|
43203
|
+
allOptions() {
|
|
43204
|
+
return this.options;
|
|
43205
|
+
}
|
|
43206
|
+
resetOptions() {
|
|
43207
|
+
this._options = Object.freeze({});
|
|
43208
|
+
}
|
|
43209
|
+
}
|
|
43210
|
+
|
|
43211
|
+
function hotpOptionsValidator(options) {
|
|
43212
|
+
if (typeof options.createDigest !== 'function') {
|
|
43213
|
+
throw new Error('Expecting options.createDigest to be a function.');
|
|
43214
|
+
}
|
|
43215
|
+
if (typeof options.createHmacKey !== 'function') {
|
|
43216
|
+
throw new Error('Expecting options.createHmacKey to be a function.');
|
|
43217
|
+
}
|
|
43218
|
+
if (typeof options.digits !== 'number') {
|
|
43219
|
+
throw new Error('Expecting options.digits to be a number.');
|
|
43220
|
+
}
|
|
43221
|
+
if (!options.algorithm || HASH_ALGORITHMS.indexOf(options.algorithm) < 0) {
|
|
43222
|
+
throw new Error(`Expecting options.algorithm to be one of ${HASH_ALGORITHMS.join(', ')}. Received ${options.algorithm}.`);
|
|
43223
|
+
}
|
|
43224
|
+
if (!options.encoding || KEY_ENCODINGS.indexOf(options.encoding) < 0) {
|
|
43225
|
+
throw new Error(`Expecting options.encoding to be one of ${KEY_ENCODINGS.join(', ')}. Received ${options.encoding}.`);
|
|
43226
|
+
}
|
|
43227
|
+
}
|
|
43228
|
+
const hotpCreateHmacKey = (algorithm, secret, encoding) => {
|
|
43229
|
+
return Buffer.from(secret, encoding).toString('hex');
|
|
43230
|
+
};
|
|
43231
|
+
function hotpDefaultOptions() {
|
|
43232
|
+
const options = {
|
|
43233
|
+
algorithm: exports.HashAlgorithms.SHA1,
|
|
43234
|
+
createHmacKey: hotpCreateHmacKey,
|
|
43235
|
+
createDigest: createDigestPlaceholder,
|
|
43236
|
+
digits: 6,
|
|
43237
|
+
encoding: exports.KeyEncodings.ASCII
|
|
43238
|
+
};
|
|
43239
|
+
return options;
|
|
43240
|
+
}
|
|
43241
|
+
function hotpOptions(opt) {
|
|
43242
|
+
const options = { ...hotpDefaultOptions(),
|
|
43243
|
+
...opt
|
|
43244
|
+
};
|
|
43245
|
+
hotpOptionsValidator(options);
|
|
43246
|
+
return Object.freeze(options);
|
|
43247
|
+
}
|
|
43248
|
+
function hotpCounter(counter) {
|
|
43249
|
+
const hexCounter = counter.toString(16);
|
|
43250
|
+
return padStart(hexCounter, 16, '0');
|
|
43251
|
+
}
|
|
43252
|
+
function hotpDigestToToken(hexDigest, digits) {
|
|
43253
|
+
const digest = Buffer.from(hexDigest, 'hex');
|
|
43254
|
+
const offset = digest[digest.length - 1] & 0xf;
|
|
43255
|
+
const binary = (digest[offset] & 0x7f) << 24 | (digest[offset + 1] & 0xff) << 16 | (digest[offset + 2] & 0xff) << 8 | digest[offset + 3] & 0xff;
|
|
43256
|
+
const token = binary % Math.pow(10, digits);
|
|
43257
|
+
return padStart(String(token), digits, '0');
|
|
43258
|
+
}
|
|
43259
|
+
function hotpDigest(secret, counter, options) {
|
|
43260
|
+
const hexCounter = hotpCounter(counter);
|
|
43261
|
+
const hmacKey = options.createHmacKey(options.algorithm, secret, options.encoding);
|
|
43262
|
+
return options.createDigest(options.algorithm, hmacKey, hexCounter);
|
|
43263
|
+
}
|
|
43264
|
+
function hotpToken(secret, counter, options) {
|
|
43265
|
+
const hexDigest = options.digest || hotpDigest(secret, counter, options);
|
|
43266
|
+
return hotpDigestToToken(hexDigest, options.digits);
|
|
43267
|
+
}
|
|
43268
|
+
function hotpCheck(token, secret, counter, options) {
|
|
43269
|
+
if (!isTokenValid(token)) {
|
|
43270
|
+
return false;
|
|
43271
|
+
}
|
|
43272
|
+
const systemToken = hotpToken(secret, counter, options);
|
|
43273
|
+
return token === systemToken;
|
|
43274
|
+
}
|
|
43275
|
+
function hotpKeyuri(accountName, issuer, secret, counter, options) {
|
|
43276
|
+
return keyuri({
|
|
43277
|
+
algorithm: options.algorithm,
|
|
43278
|
+
digits: options.digits,
|
|
43279
|
+
type: exports.Strategy.HOTP,
|
|
43280
|
+
accountName,
|
|
43281
|
+
counter,
|
|
43282
|
+
issuer,
|
|
43283
|
+
secret
|
|
43284
|
+
});
|
|
43285
|
+
}
|
|
43286
|
+
class HOTP extends OTP {
|
|
43287
|
+
create(defaultOptions = {}) {
|
|
43288
|
+
return new HOTP(defaultOptions);
|
|
43289
|
+
}
|
|
43290
|
+
allOptions() {
|
|
43291
|
+
return hotpOptions(this.options);
|
|
43292
|
+
}
|
|
43293
|
+
generate(secret, counter) {
|
|
43294
|
+
return hotpToken(secret, counter, this.allOptions());
|
|
43295
|
+
}
|
|
43296
|
+
check(token, secret, counter) {
|
|
43297
|
+
return hotpCheck(token, secret, counter, this.allOptions());
|
|
43298
|
+
}
|
|
43299
|
+
verify(opts) {
|
|
43300
|
+
if (typeof opts !== 'object') {
|
|
43301
|
+
throw new Error('Expecting argument 0 of verify to be an object');
|
|
43302
|
+
}
|
|
43303
|
+
return this.check(opts.token, opts.secret, opts.counter);
|
|
43304
|
+
}
|
|
43305
|
+
keyuri(accountName, issuer, secret, counter) {
|
|
43306
|
+
return hotpKeyuri(accountName, issuer, secret, counter, this.allOptions());
|
|
43307
|
+
}
|
|
43308
|
+
}
|
|
43309
|
+
|
|
43310
|
+
function parseWindowBounds(win) {
|
|
43311
|
+
if (typeof win === 'number') {
|
|
43312
|
+
return [Math.abs(win), Math.abs(win)];
|
|
43313
|
+
}
|
|
43314
|
+
if (Array.isArray(win)) {
|
|
43315
|
+
const [past, future] = win;
|
|
43316
|
+
if (typeof past === 'number' && typeof future === 'number') {
|
|
43317
|
+
return [Math.abs(past), Math.abs(future)];
|
|
43318
|
+
}
|
|
43319
|
+
}
|
|
43320
|
+
throw new Error('Expecting options.window to be an number or [number, number].');
|
|
43321
|
+
}
|
|
43322
|
+
function totpOptionsValidator(options) {
|
|
43323
|
+
hotpOptionsValidator(options);
|
|
43324
|
+
parseWindowBounds(options.window);
|
|
43325
|
+
if (typeof options.epoch !== 'number') {
|
|
43326
|
+
throw new Error('Expecting options.epoch to be a number.');
|
|
43327
|
+
}
|
|
43328
|
+
if (typeof options.step !== 'number') {
|
|
43329
|
+
throw new Error('Expecting options.step to be a number.');
|
|
43330
|
+
}
|
|
43331
|
+
}
|
|
43332
|
+
const totpPadSecret = (secret, encoding, minLength) => {
|
|
43333
|
+
const currentLength = secret.length;
|
|
43334
|
+
const hexSecret = Buffer.from(secret, encoding).toString('hex');
|
|
43335
|
+
if (currentLength < minLength) {
|
|
43336
|
+
const newSecret = new Array(minLength - currentLength + 1).join(hexSecret);
|
|
43337
|
+
return Buffer.from(newSecret, 'hex').slice(0, minLength).toString('hex');
|
|
43338
|
+
}
|
|
43339
|
+
return hexSecret;
|
|
43340
|
+
};
|
|
43341
|
+
const totpCreateHmacKey = (algorithm, secret, encoding) => {
|
|
43342
|
+
switch (algorithm) {
|
|
43343
|
+
case exports.HashAlgorithms.SHA1:
|
|
43344
|
+
return totpPadSecret(secret, encoding, 20);
|
|
43345
|
+
case exports.HashAlgorithms.SHA256:
|
|
43346
|
+
return totpPadSecret(secret, encoding, 32);
|
|
43347
|
+
case exports.HashAlgorithms.SHA512:
|
|
43348
|
+
return totpPadSecret(secret, encoding, 64);
|
|
43349
|
+
default:
|
|
43350
|
+
throw new Error(`Expecting algorithm to be one of ${HASH_ALGORITHMS.join(', ')}. Received ${algorithm}.`);
|
|
43351
|
+
}
|
|
43352
|
+
};
|
|
43353
|
+
function totpDefaultOptions() {
|
|
43354
|
+
const options = {
|
|
43355
|
+
algorithm: exports.HashAlgorithms.SHA1,
|
|
43356
|
+
createDigest: createDigestPlaceholder,
|
|
43357
|
+
createHmacKey: totpCreateHmacKey,
|
|
43358
|
+
digits: 6,
|
|
43359
|
+
encoding: exports.KeyEncodings.ASCII,
|
|
43360
|
+
epoch: Date.now(),
|
|
43361
|
+
step: 30,
|
|
43362
|
+
window: 0
|
|
43363
|
+
};
|
|
43364
|
+
return options;
|
|
43365
|
+
}
|
|
43366
|
+
function totpOptions(opt) {
|
|
43367
|
+
const options = { ...totpDefaultOptions(),
|
|
43368
|
+
...opt
|
|
43369
|
+
};
|
|
43370
|
+
totpOptionsValidator(options);
|
|
43371
|
+
return Object.freeze(options);
|
|
43372
|
+
}
|
|
43373
|
+
function totpCounter(epoch, step) {
|
|
43374
|
+
return Math.floor(epoch / step / 1000);
|
|
43375
|
+
}
|
|
43376
|
+
function totpToken(secret, options) {
|
|
43377
|
+
const counter = totpCounter(options.epoch, options.step);
|
|
43378
|
+
return hotpToken(secret, counter, options);
|
|
43379
|
+
}
|
|
43380
|
+
function totpEpochsInWindow(epoch, direction, deltaPerEpoch, numOfEpoches) {
|
|
43381
|
+
const result = [];
|
|
43382
|
+
if (numOfEpoches === 0) {
|
|
43383
|
+
return result;
|
|
43384
|
+
}
|
|
43385
|
+
for (let i = 1; i <= numOfEpoches; i++) {
|
|
43386
|
+
const delta = direction * i * deltaPerEpoch;
|
|
43387
|
+
result.push(epoch + delta);
|
|
43388
|
+
}
|
|
43389
|
+
return result;
|
|
43390
|
+
}
|
|
43391
|
+
function totpEpochAvailable(epoch, step, win) {
|
|
43392
|
+
const bounds = parseWindowBounds(win);
|
|
43393
|
+
const delta = step * 1000;
|
|
43394
|
+
return {
|
|
43395
|
+
current: epoch,
|
|
43396
|
+
past: totpEpochsInWindow(epoch, -1, delta, bounds[0]),
|
|
43397
|
+
future: totpEpochsInWindow(epoch, 1, delta, bounds[1])
|
|
43398
|
+
};
|
|
43399
|
+
}
|
|
43400
|
+
function totpCheck(token, secret, options) {
|
|
43401
|
+
if (!isTokenValid(token)) {
|
|
43402
|
+
return false;
|
|
43403
|
+
}
|
|
43404
|
+
const systemToken = totpToken(secret, options);
|
|
43405
|
+
return token === systemToken;
|
|
43406
|
+
}
|
|
43407
|
+
function totpCheckByEpoch(epochs, token, secret, options) {
|
|
43408
|
+
let position = null;
|
|
43409
|
+
epochs.some((epoch, idx) => {
|
|
43410
|
+
if (totpCheck(token, secret, { ...options,
|
|
43411
|
+
epoch
|
|
43412
|
+
})) {
|
|
43413
|
+
position = idx + 1;
|
|
43414
|
+
return true;
|
|
43415
|
+
}
|
|
43416
|
+
return false;
|
|
43417
|
+
});
|
|
43418
|
+
return position;
|
|
43419
|
+
}
|
|
43420
|
+
function totpCheckWithWindow(token, secret, options) {
|
|
43421
|
+
if (totpCheck(token, secret, options)) {
|
|
43422
|
+
return 0;
|
|
43423
|
+
}
|
|
43424
|
+
const epochs = totpEpochAvailable(options.epoch, options.step, options.window);
|
|
43425
|
+
const backward = totpCheckByEpoch(epochs.past, token, secret, options);
|
|
43426
|
+
if (backward !== null) {
|
|
43427
|
+
return backward * -1;
|
|
43428
|
+
}
|
|
43429
|
+
return totpCheckByEpoch(epochs.future, token, secret, options);
|
|
43430
|
+
}
|
|
43431
|
+
function totpTimeUsed(epoch, step) {
|
|
43432
|
+
return Math.floor(epoch / 1000) % step;
|
|
43433
|
+
}
|
|
43434
|
+
function totpTimeRemaining(epoch, step) {
|
|
43435
|
+
return step - totpTimeUsed(epoch, step);
|
|
43436
|
+
}
|
|
43437
|
+
function totpKeyuri(accountName, issuer, secret, options) {
|
|
43438
|
+
return keyuri({
|
|
43439
|
+
algorithm: options.algorithm,
|
|
43440
|
+
digits: options.digits,
|
|
43441
|
+
step: options.step,
|
|
43442
|
+
type: exports.Strategy.TOTP,
|
|
43443
|
+
accountName,
|
|
43444
|
+
issuer,
|
|
43445
|
+
secret
|
|
43446
|
+
});
|
|
43447
|
+
}
|
|
43448
|
+
class TOTP extends HOTP {
|
|
43449
|
+
create(defaultOptions = {}) {
|
|
43450
|
+
return new TOTP(defaultOptions);
|
|
43451
|
+
}
|
|
43452
|
+
allOptions() {
|
|
43453
|
+
return totpOptions(this.options);
|
|
43454
|
+
}
|
|
43455
|
+
generate(secret) {
|
|
43456
|
+
return totpToken(secret, this.allOptions());
|
|
43457
|
+
}
|
|
43458
|
+
checkDelta(token, secret) {
|
|
43459
|
+
return totpCheckWithWindow(token, secret, this.allOptions());
|
|
43460
|
+
}
|
|
43461
|
+
check(token, secret) {
|
|
43462
|
+
const delta = this.checkDelta(token, secret);
|
|
43463
|
+
return typeof delta === 'number';
|
|
43464
|
+
}
|
|
43465
|
+
verify(opts) {
|
|
43466
|
+
if (typeof opts !== 'object') {
|
|
43467
|
+
throw new Error('Expecting argument 0 of verify to be an object');
|
|
43468
|
+
}
|
|
43469
|
+
return this.check(opts.token, opts.secret);
|
|
43470
|
+
}
|
|
43471
|
+
timeRemaining() {
|
|
43472
|
+
const options = this.allOptions();
|
|
43473
|
+
return totpTimeRemaining(options.epoch, options.step);
|
|
43474
|
+
}
|
|
43475
|
+
timeUsed() {
|
|
43476
|
+
const options = this.allOptions();
|
|
43477
|
+
return totpTimeUsed(options.epoch, options.step);
|
|
43478
|
+
}
|
|
43479
|
+
keyuri(accountName, issuer, secret) {
|
|
43480
|
+
return totpKeyuri(accountName, issuer, secret, this.allOptions());
|
|
43481
|
+
}
|
|
43482
|
+
}
|
|
43483
|
+
|
|
43484
|
+
function authenticatorOptionValidator(options) {
|
|
43485
|
+
totpOptionsValidator(options);
|
|
43486
|
+
if (typeof options.keyDecoder !== 'function') {
|
|
43487
|
+
throw new Error('Expecting options.keyDecoder to be a function.');
|
|
43488
|
+
}
|
|
43489
|
+
if (options.keyEncoder && typeof options.keyEncoder !== 'function') {
|
|
43490
|
+
throw new Error('Expecting options.keyEncoder to be a function.');
|
|
43491
|
+
}
|
|
43492
|
+
}
|
|
43493
|
+
function authenticatorDefaultOptions() {
|
|
43494
|
+
const options = {
|
|
43495
|
+
algorithm: exports.HashAlgorithms.SHA1,
|
|
43496
|
+
createDigest: createDigestPlaceholder,
|
|
43497
|
+
createHmacKey: totpCreateHmacKey,
|
|
43498
|
+
digits: 6,
|
|
43499
|
+
encoding: exports.KeyEncodings.HEX,
|
|
43500
|
+
epoch: Date.now(),
|
|
43501
|
+
step: 30,
|
|
43502
|
+
window: 0
|
|
43503
|
+
};
|
|
43504
|
+
return options;
|
|
43505
|
+
}
|
|
43506
|
+
function authenticatorOptions(opt) {
|
|
43507
|
+
const options = { ...authenticatorDefaultOptions(),
|
|
43508
|
+
...opt
|
|
43509
|
+
};
|
|
43510
|
+
authenticatorOptionValidator(options);
|
|
43511
|
+
return Object.freeze(options);
|
|
43512
|
+
}
|
|
43513
|
+
function authenticatorEncoder(secret, options) {
|
|
43514
|
+
return options.keyEncoder(secret, options.encoding);
|
|
43515
|
+
}
|
|
43516
|
+
function authenticatorDecoder(secret, options) {
|
|
43517
|
+
return options.keyDecoder(secret, options.encoding);
|
|
43518
|
+
}
|
|
43519
|
+
function authenticatorGenerateSecret(numberOfBytes, options) {
|
|
43520
|
+
const key = options.createRandomBytes(numberOfBytes, options.encoding);
|
|
43521
|
+
return authenticatorEncoder(key, options);
|
|
43522
|
+
}
|
|
43523
|
+
function authenticatorToken(secret, options) {
|
|
43524
|
+
return totpToken(authenticatorDecoder(secret, options), options);
|
|
43525
|
+
}
|
|
43526
|
+
function authenticatorCheckWithWindow(token, secret, options) {
|
|
43527
|
+
return totpCheckWithWindow(token, authenticatorDecoder(secret, options), options);
|
|
43528
|
+
}
|
|
43529
|
+
class Authenticator extends TOTP {
|
|
43530
|
+
create(defaultOptions = {}) {
|
|
43531
|
+
return new Authenticator(defaultOptions);
|
|
43532
|
+
}
|
|
43533
|
+
allOptions() {
|
|
43534
|
+
return authenticatorOptions(this.options);
|
|
43535
|
+
}
|
|
43536
|
+
generate(secret) {
|
|
43537
|
+
return authenticatorToken(secret, this.allOptions());
|
|
43538
|
+
}
|
|
43539
|
+
checkDelta(token, secret) {
|
|
43540
|
+
return authenticatorCheckWithWindow(token, secret, this.allOptions());
|
|
43541
|
+
}
|
|
43542
|
+
encode(secret) {
|
|
43543
|
+
return authenticatorEncoder(secret, this.allOptions());
|
|
43544
|
+
}
|
|
43545
|
+
decode(secret) {
|
|
43546
|
+
return authenticatorDecoder(secret, this.allOptions());
|
|
43547
|
+
}
|
|
43548
|
+
generateSecret(numberOfBytes = 10) {
|
|
43549
|
+
return authenticatorGenerateSecret(numberOfBytes, this.allOptions());
|
|
43550
|
+
}
|
|
43551
|
+
}
|
|
43552
|
+
|
|
43553
|
+
exports.Authenticator = Authenticator;
|
|
43554
|
+
exports.HASH_ALGORITHMS = HASH_ALGORITHMS;
|
|
43555
|
+
exports.HOTP = HOTP;
|
|
43556
|
+
exports.KEY_ENCODINGS = KEY_ENCODINGS;
|
|
43557
|
+
exports.OTP = OTP;
|
|
43558
|
+
exports.STRATEGY = STRATEGY;
|
|
43559
|
+
exports.TOTP = TOTP;
|
|
43560
|
+
exports.authenticatorCheckWithWindow = authenticatorCheckWithWindow;
|
|
43561
|
+
exports.authenticatorDecoder = authenticatorDecoder;
|
|
43562
|
+
exports.authenticatorDefaultOptions = authenticatorDefaultOptions;
|
|
43563
|
+
exports.authenticatorEncoder = authenticatorEncoder;
|
|
43564
|
+
exports.authenticatorGenerateSecret = authenticatorGenerateSecret;
|
|
43565
|
+
exports.authenticatorOptionValidator = authenticatorOptionValidator;
|
|
43566
|
+
exports.authenticatorOptions = authenticatorOptions;
|
|
43567
|
+
exports.authenticatorToken = authenticatorToken;
|
|
43568
|
+
exports.createDigestPlaceholder = createDigestPlaceholder;
|
|
43569
|
+
exports.hotpCheck = hotpCheck;
|
|
43570
|
+
exports.hotpCounter = hotpCounter;
|
|
43571
|
+
exports.hotpCreateHmacKey = hotpCreateHmacKey;
|
|
43572
|
+
exports.hotpDefaultOptions = hotpDefaultOptions;
|
|
43573
|
+
exports.hotpDigestToToken = hotpDigestToToken;
|
|
43574
|
+
exports.hotpKeyuri = hotpKeyuri;
|
|
43575
|
+
exports.hotpOptions = hotpOptions;
|
|
43576
|
+
exports.hotpOptionsValidator = hotpOptionsValidator;
|
|
43577
|
+
exports.hotpToken = hotpToken;
|
|
43578
|
+
exports.isTokenValid = isTokenValid;
|
|
43579
|
+
exports.keyuri = keyuri;
|
|
43580
|
+
exports.objectValues = objectValues;
|
|
43581
|
+
exports.padStart = padStart;
|
|
43582
|
+
exports.totpCheck = totpCheck;
|
|
43583
|
+
exports.totpCheckByEpoch = totpCheckByEpoch;
|
|
43584
|
+
exports.totpCheckWithWindow = totpCheckWithWindow;
|
|
43585
|
+
exports.totpCounter = totpCounter;
|
|
43586
|
+
exports.totpCreateHmacKey = totpCreateHmacKey;
|
|
43587
|
+
exports.totpDefaultOptions = totpDefaultOptions;
|
|
43588
|
+
exports.totpEpochAvailable = totpEpochAvailable;
|
|
43589
|
+
exports.totpKeyuri = totpKeyuri;
|
|
43590
|
+
exports.totpOptions = totpOptions;
|
|
43591
|
+
exports.totpOptionsValidator = totpOptionsValidator;
|
|
43592
|
+
exports.totpPadSecret = totpPadSecret;
|
|
43593
|
+
exports.totpTimeRemaining = totpTimeRemaining;
|
|
43594
|
+
exports.totpTimeUsed = totpTimeUsed;
|
|
43595
|
+
exports.totpToken = totpToken;
|
|
43596
|
+
|
|
43597
|
+
|
|
41466
43598
|
/***/ }),
|
|
41467
43599
|
|
|
41468
43600
|
/***/ 7739:
|
|
@@ -42063,6 +44195,44 @@ function exhaustAll() {
|
|
|
42063
44195
|
exports.exhaustAll = exhaustAll;
|
|
42064
44196
|
//# sourceMappingURL=exhaustAll.js.map
|
|
42065
44197
|
|
|
44198
|
+
/***/ }),
|
|
44199
|
+
|
|
44200
|
+
/***/ 8095:
|
|
44201
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
44202
|
+
|
|
44203
|
+
/**
|
|
44204
|
+
* @otplib/preset-default
|
|
44205
|
+
*
|
|
44206
|
+
* @author Gerald Yeo <contact@fusedthought.com>
|
|
44207
|
+
* @version: 12.0.1
|
|
44208
|
+
* @license: MIT
|
|
44209
|
+
**/
|
|
44210
|
+
|
|
44211
|
+
|
|
44212
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
44213
|
+
|
|
44214
|
+
var pluginCrypto = __webpack_require__(279);
|
|
44215
|
+
var pluginThirtyTwo = __webpack_require__(3523);
|
|
44216
|
+
var core = __webpack_require__(7735);
|
|
44217
|
+
|
|
44218
|
+
const hotp = new core.HOTP({
|
|
44219
|
+
createDigest: pluginCrypto.createDigest
|
|
44220
|
+
});
|
|
44221
|
+
const totp = new core.TOTP({
|
|
44222
|
+
createDigest: pluginCrypto.createDigest
|
|
44223
|
+
});
|
|
44224
|
+
const authenticator = new core.Authenticator({
|
|
44225
|
+
createDigest: pluginCrypto.createDigest,
|
|
44226
|
+
createRandomBytes: pluginCrypto.createRandomBytes,
|
|
44227
|
+
keyDecoder: pluginThirtyTwo.keyDecoder,
|
|
44228
|
+
keyEncoder: pluginThirtyTwo.keyEncoder
|
|
44229
|
+
});
|
|
44230
|
+
|
|
44231
|
+
exports.authenticator = authenticator;
|
|
44232
|
+
exports.hotp = hotp;
|
|
44233
|
+
exports.totp = totp;
|
|
44234
|
+
|
|
44235
|
+
|
|
42066
44236
|
/***/ }),
|
|
42067
44237
|
|
|
42068
44238
|
/***/ 8109:
|
|
@@ -44557,6 +46727,23 @@ function isPOJO(obj) {
|
|
|
44557
46727
|
}
|
|
44558
46728
|
//# sourceMappingURL=argsArgArrayOrObject.js.map
|
|
44559
46729
|
|
|
46730
|
+
/***/ }),
|
|
46731
|
+
|
|
46732
|
+
/***/ 9207:
|
|
46733
|
+
/***/ ((module) => {
|
|
46734
|
+
|
|
46735
|
+
module.exports = {
|
|
46736
|
+
PATTERN000 : 0,
|
|
46737
|
+
PATTERN001 : 1,
|
|
46738
|
+
PATTERN010 : 2,
|
|
46739
|
+
PATTERN011 : 3,
|
|
46740
|
+
PATTERN100 : 4,
|
|
46741
|
+
PATTERN101 : 5,
|
|
46742
|
+
PATTERN110 : 6,
|
|
46743
|
+
PATTERN111 : 7
|
|
46744
|
+
};
|
|
46745
|
+
|
|
46746
|
+
|
|
44560
46747
|
/***/ }),
|
|
44561
46748
|
|
|
44562
46749
|
/***/ 9232:
|
|
@@ -47934,6 +50121,19 @@ function bufferTime(bufferTimeSpan) {
|
|
|
47934
50121
|
exports.bufferTime = bufferTime;
|
|
47935
50122
|
//# sourceMappingURL=bufferTime.js.map
|
|
47936
50123
|
|
|
50124
|
+
/***/ }),
|
|
50125
|
+
|
|
50126
|
+
/***/ 9802:
|
|
50127
|
+
/***/ ((module) => {
|
|
50128
|
+
|
|
50129
|
+
module.exports = {
|
|
50130
|
+
MODE_NUMBER : 1 << 0,
|
|
50131
|
+
MODE_ALPHA_NUM : 1 << 1,
|
|
50132
|
+
MODE_8BIT_BYTE : 1 << 2,
|
|
50133
|
+
MODE_KANJI : 1 << 3
|
|
50134
|
+
};
|
|
50135
|
+
|
|
50136
|
+
|
|
47937
50137
|
/***/ }),
|
|
47938
50138
|
|
|
47939
50139
|
/***/ 9815:
|
|
@@ -49725,7 +51925,7 @@ async function createProjectFromTemplate(options) {
|
|
|
49725
51925
|
if (projectName === '.') {
|
|
49726
51926
|
projectPath = process.cwd();
|
|
49727
51927
|
actualProjectName = external_path_.basename(process.cwd());
|
|
49728
|
-
// Check if current directory is empty
|
|
51928
|
+
// Check if current directory is empty (allow if user is already in intended dir)
|
|
49729
51929
|
const currentDirContents = await fs_extra_lib.readdir(projectPath);
|
|
49730
51930
|
if (currentDirContents.length > 0) {
|
|
49731
51931
|
const hasImportantFiles = currentDirContents.some(file => !file.startsWith('.') && file !== 'node_modules');
|
|
@@ -49758,8 +51958,56 @@ async function createProjectFromTemplate(options) {
|
|
|
49758
51958
|
// Copy template files with filtering
|
|
49759
51959
|
spinner.text = source/* default */.Ay.hex('#00d2d3')('Copying template files...');
|
|
49760
51960
|
if (projectName === '.') {
|
|
49761
|
-
//
|
|
49762
|
-
|
|
51961
|
+
// If template has a single top-level directory, copy its contents into current dir
|
|
51962
|
+
const nonSystemFiles = templateContents.filter(item => !item.startsWith('.') &&
|
|
51963
|
+
item !== 'node_modules' &&
|
|
51964
|
+
item !== 'dist' &&
|
|
51965
|
+
item !== 'build');
|
|
51966
|
+
if (nonSystemFiles.length === 1) {
|
|
51967
|
+
const singleItem = nonSystemFiles[0];
|
|
51968
|
+
const singleItemPath = external_path_.join(templatePath, singleItem);
|
|
51969
|
+
const stats = await fs_extra_lib.stat(singleItemPath);
|
|
51970
|
+
if (stats.isDirectory()) {
|
|
51971
|
+
await fs_extra_lib.copy(singleItemPath, projectPath, {
|
|
51972
|
+
filter: (src) => {
|
|
51973
|
+
const fileName = external_path_.basename(src);
|
|
51974
|
+
if (fileName === '.DS_Store' || fileName === 'Thumbs.db' || fileName === '.gitkeep')
|
|
51975
|
+
return false;
|
|
51976
|
+
const rel = external_path_.relative(singleItemPath, src);
|
|
51977
|
+
if (rel.split(external_path_.sep).includes('node_modules') || rel.split(external_path_.sep).includes('.git') || rel.split(external_path_.sep).includes('dist') || rel.split(external_path_.sep).includes('build') || rel.split(external_path_.sep).includes('.next'))
|
|
51978
|
+
return false;
|
|
51979
|
+
return true;
|
|
51980
|
+
}
|
|
51981
|
+
});
|
|
51982
|
+
}
|
|
51983
|
+
else {
|
|
51984
|
+
// Single file, just copy it
|
|
51985
|
+
await fs_extra_lib.copy(singleItemPath, external_path_.join(projectPath, singleItem));
|
|
51986
|
+
}
|
|
51987
|
+
}
|
|
51988
|
+
else {
|
|
51989
|
+
// Multiple items in template root, copy all to current dir
|
|
51990
|
+
for (const item of templateContents) {
|
|
51991
|
+
const sourcePath = external_path_.join(templatePath, item);
|
|
51992
|
+
const destPath = external_path_.join(projectPath, item);
|
|
51993
|
+
const stats = await fs_extra_lib.stat(sourcePath);
|
|
51994
|
+
if (stats.isDirectory()) {
|
|
51995
|
+
if (item === 'node_modules' || item === '.git' || item === 'dist' || item === 'build' || item === '.next')
|
|
51996
|
+
continue;
|
|
51997
|
+
await fs_extra_lib.copy(sourcePath, destPath, {
|
|
51998
|
+
filter: (src) => {
|
|
51999
|
+
const fileName = external_path_.basename(src);
|
|
52000
|
+
return fileName !== '.DS_Store' && fileName !== 'Thumbs.db' && fileName !== '.gitkeep';
|
|
52001
|
+
}
|
|
52002
|
+
});
|
|
52003
|
+
}
|
|
52004
|
+
else {
|
|
52005
|
+
if (item === '.DS_Store' || item === 'Thumbs.db' || item === '.gitkeep')
|
|
52006
|
+
continue;
|
|
52007
|
+
await fs_extra_lib.copy(sourcePath, destPath);
|
|
52008
|
+
}
|
|
52009
|
+
}
|
|
52010
|
+
}
|
|
49763
52011
|
}
|
|
49764
52012
|
else {
|
|
49765
52013
|
// Create directory and copy files
|
|
@@ -49846,20 +52094,46 @@ async function copyTemplateFiles(templatePath, projectPath) {
|
|
|
49846
52094
|
* Copy template files to current directory (for "." project name)
|
|
49847
52095
|
*/
|
|
49848
52096
|
async function copyTemplateFilesToCurrentDir(templatePath, projectPath) {
|
|
49849
|
-
const templateContents = await
|
|
52097
|
+
const templateContents = await fs.readdir(templatePath);
|
|
52098
|
+
// Filter out system and unwanted files/directories
|
|
52099
|
+
const nonSystemFiles = templateContents.filter(item => !item.startsWith('.') &&
|
|
52100
|
+
item !== 'node_modules' &&
|
|
52101
|
+
item !== 'dist' &&
|
|
52102
|
+
item !== 'build');
|
|
52103
|
+
// If the template has a single top-level directory, copy its contents into current dir
|
|
52104
|
+
if (nonSystemFiles.length === 1) {
|
|
52105
|
+
const singleItem = nonSystemFiles[0];
|
|
52106
|
+
const singleItemPath = path.join(templatePath, singleItem);
|
|
52107
|
+
const stats = await fs.stat(singleItemPath);
|
|
52108
|
+
if (stats.isDirectory()) {
|
|
52109
|
+
await fs.copy(singleItemPath, projectPath, {
|
|
52110
|
+
filter: (src) => {
|
|
52111
|
+
const fileName = path.basename(src);
|
|
52112
|
+
if (fileName === '.DS_Store' || fileName === 'Thumbs.db' || fileName === '.gitkeep')
|
|
52113
|
+
return false;
|
|
52114
|
+
// Skip unwanted directories inside the template
|
|
52115
|
+
const rel = path.relative(singleItemPath, src);
|
|
52116
|
+
if (rel.split(path.sep).includes('node_modules') || rel.split(path.sep).includes('.git') || rel.split(path.sep).includes('dist') || rel.split(path.sep).includes('build') || rel.split(path.sep).includes('.next'))
|
|
52117
|
+
return false;
|
|
52118
|
+
return true;
|
|
52119
|
+
}
|
|
52120
|
+
});
|
|
52121
|
+
return;
|
|
52122
|
+
}
|
|
52123
|
+
}
|
|
49850
52124
|
for (const item of templateContents) {
|
|
49851
|
-
const sourcePath =
|
|
49852
|
-
const destPath =
|
|
49853
|
-
const stats = await
|
|
52125
|
+
const sourcePath = path.join(templatePath, item);
|
|
52126
|
+
const destPath = path.join(projectPath, item);
|
|
52127
|
+
const stats = await fs.stat(sourcePath);
|
|
49854
52128
|
if (stats.isDirectory()) {
|
|
49855
52129
|
// Skip common directories that shouldn't be copied
|
|
49856
52130
|
if (item === 'node_modules' || item === '.git' ||
|
|
49857
52131
|
item === 'dist' || item === 'build' || item === '.next') {
|
|
49858
52132
|
continue;
|
|
49859
52133
|
}
|
|
49860
|
-
await
|
|
52134
|
+
await fs.copy(sourcePath, destPath, {
|
|
49861
52135
|
filter: (src) => {
|
|
49862
|
-
const fileName =
|
|
52136
|
+
const fileName = path.basename(src);
|
|
49863
52137
|
return fileName !== '.DS_Store' && fileName !== 'Thumbs.db' && fileName !== '.gitkeep';
|
|
49864
52138
|
}
|
|
49865
52139
|
});
|
|
@@ -49869,7 +52143,7 @@ async function copyTemplateFilesToCurrentDir(templatePath, projectPath) {
|
|
|
49869
52143
|
if (item === '.DS_Store' || item === 'Thumbs.db' || item === '.gitkeep') {
|
|
49870
52144
|
continue;
|
|
49871
52145
|
}
|
|
49872
|
-
await
|
|
52146
|
+
await fs.copy(sourcePath, destPath);
|
|
49873
52147
|
}
|
|
49874
52148
|
}
|
|
49875
52149
|
}
|
|
@@ -62172,6 +64446,7 @@ function showCacheHelp() {
|
|
|
62172
64446
|
};
|
|
62173
64447
|
(0,helpFormatter/* createStandardHelp */.ht)(helpConfig);
|
|
62174
64448
|
}
|
|
64449
|
+
const CLI_CACHE_DIR = '.package-installer-cli';
|
|
62175
64450
|
/**
|
|
62176
64451
|
* Main cache command function
|
|
62177
64452
|
*/
|
|
@@ -62236,7 +64511,7 @@ async function cacheCommand(subcommand, type, options = {}) {
|
|
|
62236
64511
|
console.log(source/* default */.Ay.gray(` Cached Projects: ${stats.projects?.length || 0}`));
|
|
62237
64512
|
console.log(source/* default */.Ay.gray(` Template Files: ${stats.templateFiles?.size || Object.keys(stats.templateFiles || {}).length || 0}`));
|
|
62238
64513
|
// Show cache size
|
|
62239
|
-
const cacheDir = external_path_.join(external_os_.homedir(),
|
|
64514
|
+
const cacheDir = external_path_.join(external_os_.homedir(), CLI_CACHE_DIR);
|
|
62240
64515
|
if (await fs_extra_lib.pathExists(cacheDir)) {
|
|
62241
64516
|
const size = await (0,utils_cacheManager/* getDirectorySize */.fC)(cacheDir);
|
|
62242
64517
|
console.log(source/* default */.Ay.gray(` Cache Size: ${(size / 1024 / 1024).toFixed(2)} MB`));
|
|
@@ -62271,7 +64546,7 @@ async function cacheStatsCommand() {
|
|
|
62271
64546
|
const hitRatio = totalRequests > 0 ? ((stats.hits || 0) / totalRequests * 100).toFixed(1) : '0';
|
|
62272
64547
|
console.log(source/* default */.Ay.gray(` Hit Ratio: ${hitRatio}%`));
|
|
62273
64548
|
// Storage information
|
|
62274
|
-
const cacheDir = external_path_.join(external_os_.homedir(),
|
|
64549
|
+
const cacheDir = external_path_.join(external_os_.homedir(), CLI_CACHE_DIR);
|
|
62275
64550
|
if (await fs_extra_lib.pathExists(cacheDir)) {
|
|
62276
64551
|
const size = await (0,utils_cacheManager/* getDirectorySize */.fC)(cacheDir);
|
|
62277
64552
|
console.log(source/* default */.Ay.gray(` Cache Size: ${(size / 1024 / 1024).toFixed(2)} MB`));
|
|
@@ -62290,7 +64565,7 @@ async function cacheClearCommand(type) {
|
|
|
62290
64565
|
console.log((0,dist/* default */.Ay)(['#00d2d3', '#0084ff'])('\n🗑️ Cache Cleaner\n'));
|
|
62291
64566
|
const spinner = (0,node_modules_ora/* default */.Ay)('Clearing cache...').start();
|
|
62292
64567
|
try {
|
|
62293
|
-
const cacheDir = external_path_.join(external_os_.homedir(),
|
|
64568
|
+
const cacheDir = external_path_.join(external_os_.homedir(), CLI_CACHE_DIR);
|
|
62294
64569
|
if (type) {
|
|
62295
64570
|
// Clear specific cache type
|
|
62296
64571
|
const cacheFile = external_path_.join(cacheDir, 'cache.json');
|
|
@@ -62342,21 +64617,17 @@ async function cacheClearCommand(type) {
|
|
|
62342
64617
|
*/
|
|
62343
64618
|
async function cacheInfoCommand() {
|
|
62344
64619
|
console.log((0,dist/* default */.Ay)(['#00d2d3', '#0084ff'])('\n🔧 Cache Configuration\n'));
|
|
62345
|
-
const
|
|
62346
|
-
const
|
|
62347
|
-
const cacheDir = path.join(os.homedir(), '.pi-cache');
|
|
62348
|
-
const cacheFile = path.join(cacheDir, 'cache.json');
|
|
64620
|
+
const cacheDir = external_path_.join(external_os_.homedir(), CLI_CACHE_DIR);
|
|
64621
|
+
const cacheFile = external_path_.join(cacheDir, 'cache.json');
|
|
62349
64622
|
console.log(source/* default */.Ay.cyan('Cache Configuration:'));
|
|
62350
64623
|
console.log(source/* default */.Ay.gray(` Cache Directory: ${cacheDir}`));
|
|
62351
64624
|
console.log(source/* default */.Ay.gray(` Cache File: ${cacheFile}`));
|
|
62352
|
-
console.log(source/* default */.Ay.gray(` Cache Version:
|
|
62353
|
-
|
|
62354
|
-
const fs = require('fs-extra');
|
|
62355
|
-
const exists = await fs.pathExists(cacheFile);
|
|
64625
|
+
console.log(source/* default */.Ay.gray(` Cache Version: 3.11.2`));
|
|
64626
|
+
const exists = await fs_extra_lib.pathExists(cacheFile);
|
|
62356
64627
|
console.log(source/* default */.Ay.gray(` Cache File Exists: ${exists ? 'Yes' : 'No'}`));
|
|
62357
64628
|
if (exists) {
|
|
62358
64629
|
try {
|
|
62359
|
-
const stats = await
|
|
64630
|
+
const stats = await fs_extra_lib.stat(cacheFile);
|
|
62360
64631
|
const size = (stats.size / 1024).toFixed(2);
|
|
62361
64632
|
const modified = stats.mtime.toLocaleString();
|
|
62362
64633
|
console.log(source/* default */.Ay.gray(` File Size: ${size} KB`));
|
|
@@ -62381,7 +64652,7 @@ async function cacheSizeCommand() {
|
|
|
62381
64652
|
console.log((0,dist/* default */.Ay)(['#00d2d3', '#0084ff'])('\n📊 Cache Size Information\n'));
|
|
62382
64653
|
const spinner = (0,node_modules_ora/* default */.Ay)('Calculating cache size...').start();
|
|
62383
64654
|
try {
|
|
62384
|
-
const cacheDir = external_path_.join(external_os_.homedir(),
|
|
64655
|
+
const cacheDir = external_path_.join(external_os_.homedir(), CLI_CACHE_DIR);
|
|
62385
64656
|
if (!await fs_extra_lib.pathExists(cacheDir)) {
|
|
62386
64657
|
spinner.warn('Cache directory not found');
|
|
62387
64658
|
console.log(source/* default */.Ay.yellow('⚠️ Cache has not been initialized yet'));
|
|
@@ -62421,7 +64692,7 @@ async function cacheOptimizeCommand() {
|
|
|
62421
64692
|
console.log((0,dist/* default */.Ay)(['#00d2d3', '#0084ff'])('\n⚡ Cache Optimizer\n'));
|
|
62422
64693
|
const spinner = (0,node_modules_ora/* default */.Ay)('Optimizing cache...').start();
|
|
62423
64694
|
try {
|
|
62424
|
-
const cacheDir = external_path_.join(external_os_.homedir(),
|
|
64695
|
+
const cacheDir = external_path_.join(external_os_.homedir(), CLI_CACHE_DIR);
|
|
62425
64696
|
const cacheFile = external_path_.join(cacheDir, 'cache.json');
|
|
62426
64697
|
if (!await fs_extra_lib.pathExists(cacheFile)) {
|
|
62427
64698
|
spinner.warn('Cache file not found');
|
|
@@ -62538,16 +64809,13 @@ function checkDevelopmentTools() {
|
|
|
62538
64809
|
const tools = [
|
|
62539
64810
|
{ name: 'Node.js', command: 'node', flag: '--version' },
|
|
62540
64811
|
{ name: 'npm', command: 'npm', flag: '--version' },
|
|
62541
|
-
{ name: 'yarn', command: 'yarn', flag: '--version' },
|
|
62542
64812
|
{ name: 'pnpm', command: 'pnpm', flag: '--version' },
|
|
62543
64813
|
{ name: 'Git', command: 'git', flag: '--version' },
|
|
62544
64814
|
{ name: 'Docker', command: 'docker', flag: '--version' },
|
|
62545
64815
|
{ name: 'Python', command: 'python3', flag: '--version' },
|
|
62546
64816
|
{ name: 'Rust', command: 'rustc', flag: '--version' },
|
|
62547
64817
|
{ name: 'Go', command: 'go', flag: 'version' },
|
|
62548
|
-
{ name: 'PHP', command: 'php', flag: '--version' },
|
|
62549
64818
|
{ name: 'Ruby', command: 'ruby', flag: '--version' },
|
|
62550
|
-
{ name: 'Java', command: 'java', flag: '--version' },
|
|
62551
64819
|
{ name: 'VS Code', command: 'code', flag: '--version' }
|
|
62552
64820
|
];
|
|
62553
64821
|
return tools.map(tool => ({
|
|
@@ -62632,7 +64900,7 @@ STRIPE_SECRET_KEY=sk_test_...
|
|
|
62632
64900
|
STRIPE_PUBLISHABLE_KEY=pk_test_...
|
|
62633
64901
|
`;
|
|
62634
64902
|
await fs_extra_lib.writeFile(envPath, envContent);
|
|
62635
|
-
console.log(source/* default */.Ay.green(`✅ Generated .env
|
|
64903
|
+
console.log(source/* default */.Ay.green(`✅ Generated .env template at ${envPath}`));
|
|
62636
64904
|
}
|
|
62637
64905
|
catch (error) {
|
|
62638
64906
|
console.error(source/* default */.Ay.red('❌ Failed to generate .env template:'), error);
|
|
@@ -66758,6 +69026,569 @@ async function emailCommand(category, options = {}) {
|
|
|
66758
69026
|
}
|
|
66759
69027
|
}
|
|
66760
69028
|
|
|
69029
|
+
// EXTERNAL MODULE: external "crypto"
|
|
69030
|
+
var external_crypto_ = __webpack_require__(6982);
|
|
69031
|
+
;// ./dist/utils/authStore.js
|
|
69032
|
+
|
|
69033
|
+
|
|
69034
|
+
|
|
69035
|
+
|
|
69036
|
+
class AuthStore {
|
|
69037
|
+
constructor() {
|
|
69038
|
+
this.records = [];
|
|
69039
|
+
this.failedAttempts = {};
|
|
69040
|
+
this.dir = external_path_.join(external_os_.homedir(), '.package-installer-cli');
|
|
69041
|
+
this.file = external_path_.join(this.dir, 'auth.json');
|
|
69042
|
+
this.sessionFile = external_path_.join(this.dir, 'session.json');
|
|
69043
|
+
}
|
|
69044
|
+
async init() {
|
|
69045
|
+
await fs_extra_lib.ensureDir(this.dir);
|
|
69046
|
+
// Restrict directory permissions to user only
|
|
69047
|
+
try {
|
|
69048
|
+
await fs_extra_lib.chmod(this.dir, 0o700);
|
|
69049
|
+
}
|
|
69050
|
+
catch { }
|
|
69051
|
+
if (await fs_extra_lib.pathExists(this.file)) {
|
|
69052
|
+
try {
|
|
69053
|
+
const data = await fs_extra_lib.readJson(this.file);
|
|
69054
|
+
this.records = Array.isArray(data) ? data : [];
|
|
69055
|
+
}
|
|
69056
|
+
catch {
|
|
69057
|
+
this.records = [];
|
|
69058
|
+
}
|
|
69059
|
+
}
|
|
69060
|
+
}
|
|
69061
|
+
async save() {
|
|
69062
|
+
await fs_extra_lib.writeJson(this.file, this.records, { spaces: 2 });
|
|
69063
|
+
// Restrict file permissions to user only
|
|
69064
|
+
try {
|
|
69065
|
+
await fs_extra_lib.chmod(this.file, 0o600);
|
|
69066
|
+
}
|
|
69067
|
+
catch { }
|
|
69068
|
+
}
|
|
69069
|
+
hashPassword(password, salt) {
|
|
69070
|
+
// Use scrypt for password hashing (built-in, fast and secure)
|
|
69071
|
+
return external_crypto_.scryptSync(password, salt, 64);
|
|
69072
|
+
}
|
|
69073
|
+
async createUser(email, password) {
|
|
69074
|
+
const existing = this.records.find(r => r.email === email.toLowerCase());
|
|
69075
|
+
if (existing)
|
|
69076
|
+
throw new Error('User already exists');
|
|
69077
|
+
// Basic validation
|
|
69078
|
+
const normalizedEmail = email.trim().toLowerCase();
|
|
69079
|
+
if (!/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(normalizedEmail)) {
|
|
69080
|
+
throw new Error('Invalid email address');
|
|
69081
|
+
}
|
|
69082
|
+
if (password.length < 8) {
|
|
69083
|
+
throw new Error('Password must be at least 8 characters long');
|
|
69084
|
+
}
|
|
69085
|
+
const salt = external_crypto_.randomBytes(16);
|
|
69086
|
+
const hash = this.hashPassword(password, salt);
|
|
69087
|
+
const record = {
|
|
69088
|
+
email: email.toLowerCase(),
|
|
69089
|
+
salt: salt.toString('hex'),
|
|
69090
|
+
hash: hash.toString('hex'),
|
|
69091
|
+
createdAt: new Date().toISOString(),
|
|
69092
|
+
usageCount: 0,
|
|
69093
|
+
usageLimit: 3,
|
|
69094
|
+
};
|
|
69095
|
+
this.records.push(record);
|
|
69096
|
+
await this.save();
|
|
69097
|
+
return record;
|
|
69098
|
+
}
|
|
69099
|
+
// Increment usage for unverified user, return true if allowed, false if over limit
|
|
69100
|
+
async incrementUsage(email) {
|
|
69101
|
+
const rec = this.records.find(r => r.email === email.toLowerCase());
|
|
69102
|
+
if (!rec)
|
|
69103
|
+
throw new Error('User not found');
|
|
69104
|
+
if (rec.verified)
|
|
69105
|
+
return true; // No limit for verified users
|
|
69106
|
+
if (typeof rec.usageCount !== 'number')
|
|
69107
|
+
rec.usageCount = 0;
|
|
69108
|
+
if (typeof rec.usageLimit !== 'number')
|
|
69109
|
+
rec.usageLimit = 3;
|
|
69110
|
+
if (rec.usageCount >= rec.usageLimit)
|
|
69111
|
+
return false;
|
|
69112
|
+
rec.usageCount += 1;
|
|
69113
|
+
await this.save();
|
|
69114
|
+
return true;
|
|
69115
|
+
}
|
|
69116
|
+
async verifyUser(email, password) {
|
|
69117
|
+
const record = this.records.find(r => r.email === email.toLowerCase());
|
|
69118
|
+
if (!record)
|
|
69119
|
+
return false;
|
|
69120
|
+
// Simple rate limiting/backoff
|
|
69121
|
+
const key = email.toLowerCase();
|
|
69122
|
+
const now = Date.now();
|
|
69123
|
+
const entry = this.failedAttempts[key];
|
|
69124
|
+
if (entry && entry.count >= 5 && now - entry.lastAttempt < 60_000) {
|
|
69125
|
+
// Lockout for 60s after 5 failed attempts
|
|
69126
|
+
throw new Error('Too many failed attempts. Try again later.');
|
|
69127
|
+
}
|
|
69128
|
+
const salt = Buffer.from(record.salt, 'hex');
|
|
69129
|
+
const hash = this.hashPassword(password, salt);
|
|
69130
|
+
const stored = Buffer.from(record.hash, 'hex');
|
|
69131
|
+
// Use timingSafeEqual to avoid timing attacks
|
|
69132
|
+
if (stored.length !== hash.length)
|
|
69133
|
+
return false;
|
|
69134
|
+
const ok = external_crypto_.timingSafeEqual(stored, hash);
|
|
69135
|
+
if (!ok) {
|
|
69136
|
+
// record failed attempt
|
|
69137
|
+
if (!this.failedAttempts[key])
|
|
69138
|
+
this.failedAttempts[key] = { count: 0, lastAttempt: now };
|
|
69139
|
+
this.failedAttempts[key].count += 1;
|
|
69140
|
+
this.failedAttempts[key].lastAttempt = now;
|
|
69141
|
+
}
|
|
69142
|
+
else {
|
|
69143
|
+
// reset on success
|
|
69144
|
+
delete this.failedAttempts[key];
|
|
69145
|
+
}
|
|
69146
|
+
return ok;
|
|
69147
|
+
}
|
|
69148
|
+
async login(email, password) {
|
|
69149
|
+
const ok = await this.verifyUser(email, password);
|
|
69150
|
+
return !!ok;
|
|
69151
|
+
}
|
|
69152
|
+
// Create a session file for an already-verified authentication (does not verify password)
|
|
69153
|
+
async createSession(email) {
|
|
69154
|
+
await fs_extra_lib.writeJson(this.sessionFile, { email: email.toLowerCase(), loggedAt: new Date().toISOString() }, { spaces: 2 });
|
|
69155
|
+
}
|
|
69156
|
+
async logout() {
|
|
69157
|
+
if (await fs_extra_lib.pathExists(this.sessionFile)) {
|
|
69158
|
+
await fs_extra_lib.remove(this.sessionFile);
|
|
69159
|
+
}
|
|
69160
|
+
}
|
|
69161
|
+
async getSession() {
|
|
69162
|
+
if (!(await fs_extra_lib.pathExists(this.sessionFile)))
|
|
69163
|
+
return null;
|
|
69164
|
+
try {
|
|
69165
|
+
const data = await fs_extra_lib.readJson(this.sessionFile);
|
|
69166
|
+
return { email: (data.email || '').toLowerCase() };
|
|
69167
|
+
}
|
|
69168
|
+
catch {
|
|
69169
|
+
return null;
|
|
69170
|
+
}
|
|
69171
|
+
}
|
|
69172
|
+
async isLoggedIn() {
|
|
69173
|
+
const s = await this.getSession();
|
|
69174
|
+
return !!s?.email;
|
|
69175
|
+
}
|
|
69176
|
+
async getUsers() {
|
|
69177
|
+
return this.records.slice();
|
|
69178
|
+
}
|
|
69179
|
+
async setTotpSecret(email, secret) {
|
|
69180
|
+
const rec = this.records.find(r => r.email === email.toLowerCase());
|
|
69181
|
+
if (!rec)
|
|
69182
|
+
throw new Error('User not found');
|
|
69183
|
+
rec.totpSecret = secret;
|
|
69184
|
+
await this.save();
|
|
69185
|
+
}
|
|
69186
|
+
async setVerified(email, verified) {
|
|
69187
|
+
const rec = this.records.find(r => r.email === email.toLowerCase());
|
|
69188
|
+
if (!rec)
|
|
69189
|
+
throw new Error('User not found');
|
|
69190
|
+
rec.verified = verified;
|
|
69191
|
+
await this.save();
|
|
69192
|
+
}
|
|
69193
|
+
async getTotpSecret(email) {
|
|
69194
|
+
const rec = this.records.find(r => r.email === email.toLowerCase());
|
|
69195
|
+
return rec?.totpSecret;
|
|
69196
|
+
}
|
|
69197
|
+
async isVerified(email) {
|
|
69198
|
+
const rec = this.records.find(r => r.email === email.toLowerCase());
|
|
69199
|
+
return !!rec?.verified;
|
|
69200
|
+
}
|
|
69201
|
+
}
|
|
69202
|
+
const authStore_authStore = new AuthStore();
|
|
69203
|
+
async function initAuthStore() {
|
|
69204
|
+
await authStore_authStore.init();
|
|
69205
|
+
}
|
|
69206
|
+
|
|
69207
|
+
// EXTERNAL MODULE: ./node_modules/.pnpm/otplib@12.0.1/node_modules/otplib/index.js
|
|
69208
|
+
var otplib = __webpack_require__(4283);
|
|
69209
|
+
// EXTERNAL MODULE: ./node_modules/.pnpm/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/lib/main.js
|
|
69210
|
+
var main = __webpack_require__(6273);
|
|
69211
|
+
;// ./dist/commands/auth.js
|
|
69212
|
+
|
|
69213
|
+
|
|
69214
|
+
|
|
69215
|
+
|
|
69216
|
+
|
|
69217
|
+
|
|
69218
|
+
|
|
69219
|
+
async function setupTotp(email) {
|
|
69220
|
+
// Generate TOTP secret
|
|
69221
|
+
const secret = otplib.authenticator.generateSecret();
|
|
69222
|
+
const otpauth = otplib.authenticator.keyuri(email, 'Package-Installer-CLI', secret);
|
|
69223
|
+
// Show QR code in terminal
|
|
69224
|
+
console.log(source/* default */.Ay.cyan('\nScan this QR code with Google Authenticator or a compatible app:'));
|
|
69225
|
+
main.generate(otpauth, { small: true });
|
|
69226
|
+
console.log(source/* default */.Ay.gray(`If you can't scan, use this secret: ${source/* default */.Ay.yellow(secret)}`));
|
|
69227
|
+
return secret;
|
|
69228
|
+
}
|
|
69229
|
+
async function verifyTotpPrompt(secret) {
|
|
69230
|
+
for (let i = 0; i < 3; ++i) {
|
|
69231
|
+
const { code } = await lib["default"].prompt([
|
|
69232
|
+
{ name: 'code', message: 'Enter 6-digit code from your Authenticator app:', type: 'input', validate: (v) => /^\d{6}$/.test(v) || 'Enter a 6-digit code' }
|
|
69233
|
+
]);
|
|
69234
|
+
if (otplib.authenticator.check(code, secret))
|
|
69235
|
+
return true;
|
|
69236
|
+
console.log(source/* default */.Ay.red('❌ Invalid code. Try again.'));
|
|
69237
|
+
}
|
|
69238
|
+
return false;
|
|
69239
|
+
}
|
|
69240
|
+
// Add a function for 2FA setup and verification (used in both register and verify)
|
|
69241
|
+
async function setupAndVerifyTotp(email) {
|
|
69242
|
+
const secret = await setupTotp(email);
|
|
69243
|
+
await authStore_authStore.setTotpSecret(email, secret);
|
|
69244
|
+
const verified = await verifyTotpPrompt(secret);
|
|
69245
|
+
if (!verified) {
|
|
69246
|
+
console.log(source/* default */.Ay.red('❌ Verification failed. 2FA not enabled.'));
|
|
69247
|
+
return false;
|
|
69248
|
+
}
|
|
69249
|
+
await authStore_authStore.setVerified(email, true);
|
|
69250
|
+
console.log(source/* default */.Ay.green('✅ 2FA enabled and verified!'));
|
|
69251
|
+
return true;
|
|
69252
|
+
}
|
|
69253
|
+
// Patch interactiveRegister to make 2FA optional
|
|
69254
|
+
async function interactiveRegister() {
|
|
69255
|
+
const { email, password, confirm } = await lib["default"].prompt([
|
|
69256
|
+
{ name: 'email', message: 'Email:', type: 'input', validate: (v) => /^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(v) || 'Enter a valid email' },
|
|
69257
|
+
{ name: 'password', message: 'Password (min 8 chars):', type: 'password', validate: (v) => v.length >= 8 || 'Password must be at least 8 characters' },
|
|
69258
|
+
{ name: 'confirm', message: 'Confirm Password:', type: 'password', mask: '*' },
|
|
69259
|
+
]);
|
|
69260
|
+
if (password !== confirm) {
|
|
69261
|
+
console.log(source/* default */.Ay.red('Passwords do not match'));
|
|
69262
|
+
return;
|
|
69263
|
+
}
|
|
69264
|
+
let created = false;
|
|
69265
|
+
try {
|
|
69266
|
+
console.log((0,node_modules_boxen/* default */.A)(source/* default */.Ay.bold('Registering new user'), { padding: 1, borderColor: 'green' }));
|
|
69267
|
+
await authStore_authStore.createUser(email, password);
|
|
69268
|
+
created = true;
|
|
69269
|
+
}
|
|
69270
|
+
catch (err) {
|
|
69271
|
+
if (err.message && err.message.includes('already exists')) {
|
|
69272
|
+
console.log((0,node_modules_boxen/* default */.A)(source/* default */.Ay.red('User already exists. Please login or use a different email.'), { padding: 1, borderColor: 'red' }));
|
|
69273
|
+
return;
|
|
69274
|
+
}
|
|
69275
|
+
console.log((0,node_modules_boxen/* default */.A)(source/* default */.Ay.red('Registration failed: ' + (err.message || String(err))), { padding: 1, borderColor: 'red' }));
|
|
69276
|
+
return;
|
|
69277
|
+
}
|
|
69278
|
+
// Suggest 2FA setup
|
|
69279
|
+
const { enable2fa } = await lib["default"].prompt([
|
|
69280
|
+
{ name: 'enable2fa', type: 'confirm', message: 'Would you like to enable 2FA (recommended)?', default: true }
|
|
69281
|
+
]);
|
|
69282
|
+
if (enable2fa) {
|
|
69283
|
+
console.log(source/* default */.Ay.gray('Setting up 2FA...'));
|
|
69284
|
+
const verified = await setupAndVerifyTotp(email);
|
|
69285
|
+
if (!verified) {
|
|
69286
|
+
console.log((0,node_modules_boxen/* default */.A)(source/* default */.Ay.yellow('2FA setup incomplete. You can enable it later with: pi auth verify'), { padding: 1 }));
|
|
69287
|
+
}
|
|
69288
|
+
}
|
|
69289
|
+
else {
|
|
69290
|
+
console.log((0,node_modules_boxen/* default */.A)(source/* default */.Ay.yellow('⚠️ 2FA is not enabled. You can enable it anytime with: pi auth verify'), { padding: 1 }));
|
|
69291
|
+
}
|
|
69292
|
+
// Always auto-login after registration if user was created
|
|
69293
|
+
if (created) {
|
|
69294
|
+
// Create session (auto-login)
|
|
69295
|
+
await authStore_authStore.createSession(email);
|
|
69296
|
+
console.log((0,node_modules_boxen/* default */.A)(source/* default */.Ay.green('✅ Registered and logged in — welcome!'), { padding: 1, borderColor: 'green' }));
|
|
69297
|
+
if (!enable2fa)
|
|
69298
|
+
console.log(source/* default */.Ay.yellow('Note: 2FA not enabled. Enable with: pi auth verify'));
|
|
69299
|
+
}
|
|
69300
|
+
}
|
|
69301
|
+
async function interactiveLogin() {
|
|
69302
|
+
const responses = await inquirer.prompt([
|
|
69303
|
+
{ name: 'email', message: 'Email:', type: 'input', validate: (v) => /^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(v) || 'Enter a valid email' },
|
|
69304
|
+
{ name: 'password', message: 'Password:', type: 'password', validate: (v) => v.length >= 8 || 'Password must be at least 8 characters' },
|
|
69305
|
+
]);
|
|
69306
|
+
const { email, password } = responses;
|
|
69307
|
+
try {
|
|
69308
|
+
const ok = await authStore.login(email, password);
|
|
69309
|
+
if (!ok) {
|
|
69310
|
+
console.log(chalk.red('❌ Invalid email or password'));
|
|
69311
|
+
return;
|
|
69312
|
+
}
|
|
69313
|
+
// Check verification
|
|
69314
|
+
const secret = await authStore.getTotpSecret(email);
|
|
69315
|
+
const isVerified = await authStore.isVerified(email);
|
|
69316
|
+
if (!secret) {
|
|
69317
|
+
console.log(chalk.red('❌ This account does not have 2FA set up. Please register again.'));
|
|
69318
|
+
await authStore.logout();
|
|
69319
|
+
return;
|
|
69320
|
+
}
|
|
69321
|
+
if (!isVerified) {
|
|
69322
|
+
console.log(chalk.red('❌ This account is not verified. Please complete TOTP verification during registration.'));
|
|
69323
|
+
await authStore.logout();
|
|
69324
|
+
return;
|
|
69325
|
+
}
|
|
69326
|
+
// Prompt for TOTP code
|
|
69327
|
+
const { code } = await inquirer.prompt([
|
|
69328
|
+
{ name: 'code', message: 'Enter 6-digit code from your Authenticator app:', type: 'input', validate: (v) => /^\d{6}$/.test(v) || 'Enter a 6-digit code' }
|
|
69329
|
+
]);
|
|
69330
|
+
if (!authenticator.check(code, secret)) {
|
|
69331
|
+
console.log(chalk.red('❌ Invalid code. Login aborted.'));
|
|
69332
|
+
await authStore.logout();
|
|
69333
|
+
return;
|
|
69334
|
+
}
|
|
69335
|
+
console.log(chalk.green('✅ Logged in successfully'));
|
|
69336
|
+
}
|
|
69337
|
+
catch (err) {
|
|
69338
|
+
if (err.message && err.message.includes('already exists')) {
|
|
69339
|
+
console.log(chalk.red('❌ User already exists. Please login or use a different email.'));
|
|
69340
|
+
return;
|
|
69341
|
+
}
|
|
69342
|
+
console.log(chalk.red('❌'), err.message || String(err));
|
|
69343
|
+
}
|
|
69344
|
+
}
|
|
69345
|
+
async function handleAuthOptions(subcommand, value, opts = {}) {
|
|
69346
|
+
await initAuthStore();
|
|
69347
|
+
// Help flag or no subcommand: show help
|
|
69348
|
+
if (opts.help || opts['--help'] || opts['-h'] || subcommand === '--help' || subcommand === '-h' || !subcommand) {
|
|
69349
|
+
showAuthHelp();
|
|
69350
|
+
return;
|
|
69351
|
+
}
|
|
69352
|
+
try {
|
|
69353
|
+
// Normalize subcommand for robust matching
|
|
69354
|
+
const cmd = (subcommand || '').toLowerCase();
|
|
69355
|
+
switch (cmd) {
|
|
69356
|
+
case 'login': {
|
|
69357
|
+
if (opts.email && opts.password) {
|
|
69358
|
+
try {
|
|
69359
|
+
const ok = await authStore_authStore.login(opts.email, opts.password);
|
|
69360
|
+
if (!ok) {
|
|
69361
|
+
console.log(source/* default */.Ay.red('❌ Invalid email or password'));
|
|
69362
|
+
return;
|
|
69363
|
+
}
|
|
69364
|
+
// Check verification and handle totp provided for non-interactive flows
|
|
69365
|
+
const secret = await authStore_authStore.getTotpSecret(opts.email);
|
|
69366
|
+
const isVerified = await authStore_authStore.isVerified(opts.email);
|
|
69367
|
+
if (!secret) {
|
|
69368
|
+
console.log(source/* default */.Ay.red('❌ This account does not have 2FA set up. Please register again.'));
|
|
69369
|
+
return;
|
|
69370
|
+
}
|
|
69371
|
+
if (!isVerified) {
|
|
69372
|
+
console.log(source/* default */.Ay.red('❌ This account is not verified. Please complete TOTP verification with: pi auth verify'));
|
|
69373
|
+
return;
|
|
69374
|
+
}
|
|
69375
|
+
// TOTP: allow up to 3 interactive attempts. If --totp provided, use it (single check).
|
|
69376
|
+
let code = opts.totp;
|
|
69377
|
+
if (code) {
|
|
69378
|
+
if (!otplib.authenticator.check(code, secret)) {
|
|
69379
|
+
console.log(source/* default */.Ay.red('❌ Invalid TOTP code provided. Login failed.'));
|
|
69380
|
+
return;
|
|
69381
|
+
}
|
|
69382
|
+
}
|
|
69383
|
+
else {
|
|
69384
|
+
let ok = false;
|
|
69385
|
+
for (let i = 0; i < 3; ++i) {
|
|
69386
|
+
const resp = await lib["default"].prompt([{ name: 'code', message: 'Enter 6-digit code from your Authenticator app:', type: 'input', validate: (v) => /^\d{6}$/.test(v) || 'Enter a 6-digit code' }]);
|
|
69387
|
+
if (otplib.authenticator.check(resp.code, secret)) {
|
|
69388
|
+
ok = true;
|
|
69389
|
+
break;
|
|
69390
|
+
}
|
|
69391
|
+
console.log(source/* default */.Ay.red('❌ Invalid code. Try again.'));
|
|
69392
|
+
}
|
|
69393
|
+
if (!ok) {
|
|
69394
|
+
console.log(source/* default */.Ay.red('❌ Too many invalid attempts. Login failed.'));
|
|
69395
|
+
return;
|
|
69396
|
+
}
|
|
69397
|
+
}
|
|
69398
|
+
// Create session now that password and 2FA are verified
|
|
69399
|
+
await authStore_authStore.createSession(opts.email);
|
|
69400
|
+
console.log(source/* default */.Ay.green('✅ Logged in successfully'));
|
|
69401
|
+
}
|
|
69402
|
+
catch (err) {
|
|
69403
|
+
if (err.message && err.message.includes('already exists')) {
|
|
69404
|
+
console.log(source/* default */.Ay.red('❌ User already exists. Please login or use a different email.'));
|
|
69405
|
+
return;
|
|
69406
|
+
}
|
|
69407
|
+
console.log(source/* default */.Ay.red('❌'), err.message || String(err));
|
|
69408
|
+
}
|
|
69409
|
+
}
|
|
69410
|
+
else {
|
|
69411
|
+
// Interactive login
|
|
69412
|
+
const responses = await lib["default"].prompt([
|
|
69413
|
+
{ name: 'email', message: 'Email:', type: 'input', validate: (v) => /^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(v) || 'Enter a valid email' },
|
|
69414
|
+
{ name: 'password', message: 'Password:', type: 'password', mask: '*', validate: (v) => v.length >= 8 || 'Password must be at least 8 characters' },
|
|
69415
|
+
]);
|
|
69416
|
+
const { email, password } = responses;
|
|
69417
|
+
const ok = await authStore_authStore.login(email, password);
|
|
69418
|
+
if (!ok) {
|
|
69419
|
+
console.log(source/* default */.Ay.red('❌ Invalid email or password'));
|
|
69420
|
+
return;
|
|
69421
|
+
}
|
|
69422
|
+
const secret = await authStore_authStore.getTotpSecret(email);
|
|
69423
|
+
const isVerified = await authStore_authStore.isVerified(email);
|
|
69424
|
+
if (!secret) {
|
|
69425
|
+
console.log(source/* default */.Ay.red('❌ This account does not have 2FA set up. Please register again.'));
|
|
69426
|
+
return;
|
|
69427
|
+
}
|
|
69428
|
+
if (!isVerified) {
|
|
69429
|
+
console.log(source/* default */.Ay.red('❌ This account is not verified. Please complete TOTP verification with: pi auth verify'));
|
|
69430
|
+
return;
|
|
69431
|
+
}
|
|
69432
|
+
// Interactive login: allow up to 3 attempts
|
|
69433
|
+
let okTotp = false;
|
|
69434
|
+
for (let i = 0; i < 3; ++i) {
|
|
69435
|
+
const { code } = await lib["default"].prompt([{ name: 'code', message: 'Enter 6-digit code from your Authenticator app:', type: 'input', validate: (v) => /^\d{6}$/.test(v) || 'Enter a 6-digit code' }]);
|
|
69436
|
+
if (otplib.authenticator.check(code, secret)) {
|
|
69437
|
+
okTotp = true;
|
|
69438
|
+
break;
|
|
69439
|
+
}
|
|
69440
|
+
console.log(source/* default */.Ay.red('❌ Invalid code. Try again.'));
|
|
69441
|
+
}
|
|
69442
|
+
if (!okTotp) {
|
|
69443
|
+
console.log(source/* default */.Ay.red('❌ Too many invalid attempts. Login failed.'));
|
|
69444
|
+
return;
|
|
69445
|
+
}
|
|
69446
|
+
await authStore_authStore.createSession(email);
|
|
69447
|
+
console.log(source/* default */.Ay.green('✅ Logged in successfully'));
|
|
69448
|
+
}
|
|
69449
|
+
return;
|
|
69450
|
+
}
|
|
69451
|
+
case 'register': {
|
|
69452
|
+
if (opts.email && opts.password) {
|
|
69453
|
+
try {
|
|
69454
|
+
console.log((0,node_modules_boxen/* default */.A)(source/* default */.Ay.bold('Registering new user'), { padding: 1, borderColor: 'green' }));
|
|
69455
|
+
await authStore_authStore.createUser(opts.email, opts.password);
|
|
69456
|
+
// Suggest 2FA setup flow same as interactive
|
|
69457
|
+
if (opts.enable2fa || opts.enable2fa === undefined) {
|
|
69458
|
+
const secret = await setupTotp(opts.email);
|
|
69459
|
+
await authStore_authStore.setTotpSecret(opts.email, secret);
|
|
69460
|
+
const verified = await verifyTotpPrompt(secret);
|
|
69461
|
+
if (!verified) {
|
|
69462
|
+
console.log((0,node_modules_boxen/* default */.A)(source/* default */.Ay.yellow('2FA verification failed. Registration saved but 2FA incomplete.'), { padding: 1 }));
|
|
69463
|
+
await authStore_authStore.createSession(opts.email);
|
|
69464
|
+
return;
|
|
69465
|
+
}
|
|
69466
|
+
await authStore_authStore.setVerified(opts.email, true);
|
|
69467
|
+
}
|
|
69468
|
+
// Create session
|
|
69469
|
+
await authStore_authStore.createSession(opts.email);
|
|
69470
|
+
console.log((0,node_modules_boxen/* default */.A)(source/* default */.Ay.green('✅ User registered and logged in.'), { padding: 1, borderColor: 'green' }));
|
|
69471
|
+
}
|
|
69472
|
+
catch (err) {
|
|
69473
|
+
console.log((0,node_modules_boxen/* default */.A)(source/* default */.Ay.red('Registration failed: ' + (err.message || String(err))), { padding: 1, borderColor: 'red' }));
|
|
69474
|
+
}
|
|
69475
|
+
}
|
|
69476
|
+
else {
|
|
69477
|
+
await interactiveRegister();
|
|
69478
|
+
}
|
|
69479
|
+
return;
|
|
69480
|
+
}
|
|
69481
|
+
case 'verify': {
|
|
69482
|
+
// Get current session or prompt for email
|
|
69483
|
+
let email = opts.email;
|
|
69484
|
+
if (!email) {
|
|
69485
|
+
const session = await authStore_authStore.getSession();
|
|
69486
|
+
if (session && session.email) {
|
|
69487
|
+
email = session.email;
|
|
69488
|
+
}
|
|
69489
|
+
else {
|
|
69490
|
+
const resp = await lib["default"].prompt([
|
|
69491
|
+
{ name: 'email', message: 'Email to verify:', type: 'input', validate: (v) => /^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(v) || 'Enter a valid email' }
|
|
69492
|
+
]);
|
|
69493
|
+
email = resp.email;
|
|
69494
|
+
}
|
|
69495
|
+
}
|
|
69496
|
+
// Check if user exists
|
|
69497
|
+
const users = await authStore_authStore.getUsers();
|
|
69498
|
+
const user = users.find(u => u.email === email.toLowerCase());
|
|
69499
|
+
if (!user) {
|
|
69500
|
+
console.log(source/* default */.Ay.red('❌ User not found. Please register first.'));
|
|
69501
|
+
return;
|
|
69502
|
+
}
|
|
69503
|
+
// If already verified, skip
|
|
69504
|
+
if (user.verified) {
|
|
69505
|
+
console.log(source/* default */.Ay.green('✅ 2FA is already enabled for this user.'));
|
|
69506
|
+
return;
|
|
69507
|
+
}
|
|
69508
|
+
await setupAndVerifyTotp(email);
|
|
69509
|
+
return;
|
|
69510
|
+
}
|
|
69511
|
+
case 'logout': {
|
|
69512
|
+
await authStore_authStore.logout();
|
|
69513
|
+
console.log(source/* default */.Ay.green('✅ Logged out'));
|
|
69514
|
+
return;
|
|
69515
|
+
}
|
|
69516
|
+
case 'status': {
|
|
69517
|
+
const s = await authStore_authStore.getSession();
|
|
69518
|
+
if (s)
|
|
69519
|
+
console.log(source/* default */.Ay.green(`Logged in as ${s.email}`));
|
|
69520
|
+
else
|
|
69521
|
+
console.log(source/* default */.Ay.yellow('Not logged in'));
|
|
69522
|
+
return;
|
|
69523
|
+
}
|
|
69524
|
+
case 'whoami': {
|
|
69525
|
+
const s = await authStore_authStore.getSession();
|
|
69526
|
+
if (s)
|
|
69527
|
+
console.log(source/* default */.Ay.green(`${s.email}`));
|
|
69528
|
+
else
|
|
69529
|
+
console.log(source/* default */.Ay.yellow('Not logged in'));
|
|
69530
|
+
return;
|
|
69531
|
+
}
|
|
69532
|
+
case 'list-users': {
|
|
69533
|
+
const users = await authStore_authStore.getUsers();
|
|
69534
|
+
if (!users || users.length === 0) {
|
|
69535
|
+
console.log(source/* default */.Ay.yellow('No users registered'));
|
|
69536
|
+
return;
|
|
69537
|
+
}
|
|
69538
|
+
console.log(source/* default */.Ay.green('Registered users:'));
|
|
69539
|
+
users.forEach(u => console.log(' - ' + u.email));
|
|
69540
|
+
return;
|
|
69541
|
+
}
|
|
69542
|
+
default: {
|
|
69543
|
+
showAuthHelp();
|
|
69544
|
+
return;
|
|
69545
|
+
}
|
|
69546
|
+
}
|
|
69547
|
+
}
|
|
69548
|
+
catch (err) {
|
|
69549
|
+
console.log(source/* default */.Ay.red('❌'), err.message || String(err));
|
|
69550
|
+
}
|
|
69551
|
+
}
|
|
69552
|
+
function showAuthHelp() {
|
|
69553
|
+
const cfg = {
|
|
69554
|
+
commandName: 'auth',
|
|
69555
|
+
emoji: '🔐',
|
|
69556
|
+
description: 'Manage authentication for the CLI (register, login, logout, status, 2FA verification).',
|
|
69557
|
+
usage: [
|
|
69558
|
+
'auth register',
|
|
69559
|
+
'auth login',
|
|
69560
|
+
'auth login --email <email> --password <password>',
|
|
69561
|
+
'auth logout',
|
|
69562
|
+
'auth status',
|
|
69563
|
+
'auth verify',
|
|
69564
|
+
'auth whoami',
|
|
69565
|
+
'auth list-users',
|
|
69566
|
+
],
|
|
69567
|
+
options: [
|
|
69568
|
+
{ flag: '--email <email>', description: 'Email for non-interactive actions' },
|
|
69569
|
+
{ flag: '--password <password>', description: 'Password for non-interactive actions' },
|
|
69570
|
+
{ flag: '-h, --help', description: 'Show help for the auth command' },
|
|
69571
|
+
],
|
|
69572
|
+
examples: [
|
|
69573
|
+
{ command: 'auth register', description: 'Interactive registration' },
|
|
69574
|
+
{ command: 'auth login', description: 'Interactive login' },
|
|
69575
|
+
{ command: 'auth login --email me@you.com --password hunter2', description: 'Non-interactive login (use with care)' },
|
|
69576
|
+
{ command: 'auth verify', description: 'Enable and verify 2FA for your account' },
|
|
69577
|
+
{ command: 'auth logout', description: 'Logout from the CLI' },
|
|
69578
|
+
{ command: 'auth status', description: 'Show current login status' },
|
|
69579
|
+
{ command: 'auth whoami', description: 'Show current user email' },
|
|
69580
|
+
{ command: 'auth list-users', description: 'List all registered users' },
|
|
69581
|
+
],
|
|
69582
|
+
tips: [
|
|
69583
|
+
'🔒 2FA (Google Authenticator) is required for unlimited CLI access.',
|
|
69584
|
+
'Unverified users can only use 3 commands before verification is required.',
|
|
69585
|
+
'Passwords are stored as scrypt hashes with per-user salt. Keep your machine secure.',
|
|
69586
|
+
'Use "pi auth verify" to enable 2FA and unlock all features.',
|
|
69587
|
+
],
|
|
69588
|
+
};
|
|
69589
|
+
(0,helpFormatter/* createStandardHelp */.ht)(cfg);
|
|
69590
|
+
}
|
|
69591
|
+
|
|
66761
69592
|
;// ./dist/index.js
|
|
66762
69593
|
//#!/usr/bin/env node
|
|
66763
69594
|
|
|
@@ -66785,10 +69616,12 @@ globalThis.path = external_path_;
|
|
|
66785
69616
|
|
|
66786
69617
|
|
|
66787
69618
|
|
|
69619
|
+
|
|
66788
69620
|
// Import utilities
|
|
66789
69621
|
|
|
66790
69622
|
|
|
66791
69623
|
|
|
69624
|
+
|
|
66792
69625
|
// Get current file directory for ESM
|
|
66793
69626
|
const dist_filename = (0,external_url_.fileURLToPath)("file:///home/sharique/desktop/shariq-projects/package-installer-cli/dist/index.js");
|
|
66794
69627
|
const dist_dirname = (0,external_path_.dirname)(dist_filename);
|
|
@@ -66809,6 +69642,15 @@ const packageJson = JSON.parse((0,external_fs_.readFileSync)(packageJsonPath, 'u
|
|
|
66809
69642
|
const VERSION = packageJson.version;
|
|
66810
69643
|
// Initialize CLI program
|
|
66811
69644
|
const dist_program = new Command();
|
|
69645
|
+
// Initialize auth store early
|
|
69646
|
+
(async () => {
|
|
69647
|
+
try {
|
|
69648
|
+
await initAuthStore();
|
|
69649
|
+
}
|
|
69650
|
+
catch (err) {
|
|
69651
|
+
// non-fatal
|
|
69652
|
+
}
|
|
69653
|
+
})();
|
|
66812
69654
|
// Create beautiful blue gradient for CLI name
|
|
66813
69655
|
const gradientTitle = (0,dist/* default */.Ay)(['#0072ff', '#00c6ff', '#0072ff']);
|
|
66814
69656
|
const piGradient = (0,dist/* default */.Ay)(['#00c6ff', '#0072ff']);
|
|
@@ -66821,6 +69663,44 @@ dist_program
|
|
|
66821
69663
|
sortSubcommands: true,
|
|
66822
69664
|
subcommandTerm: (cmd) => cmd.name(),
|
|
66823
69665
|
});
|
|
69666
|
+
// Global preAction: enforce login for most commands, whitelist a few
|
|
69667
|
+
dist_program.hook('preAction', async (thisCommand, actionCommand) => {
|
|
69668
|
+
const name = actionCommand.name();
|
|
69669
|
+
// Commands allowed without login (help, version, auth, cache --help etc.)
|
|
69670
|
+
const allowed = ['auth', 'help', 'version', 'cache'];
|
|
69671
|
+
if (allowed.includes(name))
|
|
69672
|
+
return;
|
|
69673
|
+
// Also allow if user requested help/version via flags anywhere on the command line
|
|
69674
|
+
const argv = process.argv.slice(2).map(a => a.toLowerCase());
|
|
69675
|
+
const helpFlags = ['-h', '--help'];
|
|
69676
|
+
const versionFlags = ['-v', '-V', '--version'];
|
|
69677
|
+
if (argv.some(a => helpFlags.includes(a) || versionFlags.includes(a)))
|
|
69678
|
+
return;
|
|
69679
|
+
const logged = await authStore_authStore.isLoggedIn();
|
|
69680
|
+
if (!logged) {
|
|
69681
|
+
console.log('\n' + source/* default */.Ay.red('❌ You must be logged in to use this command.'));
|
|
69682
|
+
console.log(source/* default */.Ay.gray(`Run: pi auth --help to see authentication options`));
|
|
69683
|
+
process.exit(1);
|
|
69684
|
+
}
|
|
69685
|
+
// Previously there were additional 2FA/usage checks here. Per request, only enforce login at preAction.
|
|
69686
|
+
// Enforce usage limit for unverified users: allow auth verify/logout/help/version
|
|
69687
|
+
const session = await authStore_authStore.getSession();
|
|
69688
|
+
if (session && session.email) {
|
|
69689
|
+
const isVerified = await authStore_authStore.isVerified(session.email);
|
|
69690
|
+
if (!isVerified) {
|
|
69691
|
+
const authSub = argv[1] || '';
|
|
69692
|
+
if (name === 'auth' && ['verify', 'logout', '', undefined].includes(authSub))
|
|
69693
|
+
return;
|
|
69694
|
+
const allowedUsage = await authStore_authStore.incrementUsage(session.email).catch(() => false);
|
|
69695
|
+
if (!allowedUsage) {
|
|
69696
|
+
console.log('\n' + source/* default */.Ay.red('❌ You have reached the maximum number of allowed commands as an unverified user.'));
|
|
69697
|
+
console.log(source/* default */.Ay.yellow('Please verify your account with: pi auth verify'));
|
|
69698
|
+
process.exit(1);
|
|
69699
|
+
}
|
|
69700
|
+
console.log(source/* default */.Ay.yellow('⚠️ Your account is not verified. You have limited access until you complete 2FA.'));
|
|
69701
|
+
}
|
|
69702
|
+
}
|
|
69703
|
+
});
|
|
66824
69704
|
/**
|
|
66825
69705
|
* Enhanced error handler with better formatting
|
|
66826
69706
|
*/
|
|
@@ -66939,6 +69819,26 @@ dist_program
|
|
|
66939
69819
|
handleCommandError('add feature', error);
|
|
66940
69820
|
}
|
|
66941
69821
|
});
|
|
69822
|
+
// AUTH COMMAND - authentication and user management (subcommand pattern like cache)
|
|
69823
|
+
dist_program
|
|
69824
|
+
.command('auth')
|
|
69825
|
+
.description(source/* default */.Ay.hex('#00d2d3')('🔐 ') + source/* default */.Ay.hex('#95afc0')('Authentication and user management'))
|
|
69826
|
+
.argument('[subcommand]', 'Auth subcommand (login, register, logout, status, whoami, list-users)')
|
|
69827
|
+
.argument('[value]', 'Optional value for subcommand (not used)')
|
|
69828
|
+
.option('--email <email>', 'Email for login/register')
|
|
69829
|
+
.option('--password <password>', 'Password for login/register')
|
|
69830
|
+
.option('--totp <code>', 'TOTP code for non-interactive login')
|
|
69831
|
+
.option('-h, --help', 'Show help for auth command')
|
|
69832
|
+
.allowUnknownOption(true)
|
|
69833
|
+
.on('--help', () => { showAuthHelp(); })
|
|
69834
|
+
.action(async (subcommand, value, options) => {
|
|
69835
|
+
try {
|
|
69836
|
+
await handleAuthOptions(subcommand, value, options);
|
|
69837
|
+
}
|
|
69838
|
+
catch (error) {
|
|
69839
|
+
handleCommandError('auth', error);
|
|
69840
|
+
}
|
|
69841
|
+
});
|
|
66942
69842
|
// UPGRADE-CLI COMMAND - Update CLI to latest version
|
|
66943
69843
|
dist_program
|
|
66944
69844
|
.command('upgrade-cli')
|
|
@@ -67165,6 +70065,7 @@ dist_program.on('--help', () => {
|
|
|
67165
70065
|
source/* default */.Ay.hex('#95afc0')(' ') + piGradient('pi') + ' ' + commandGradient('check') + source/* default */.Ay.hex('#95afc0')(' # Check package versions') + '\n' +
|
|
67166
70066
|
source/* default */.Ay.hex('#95afc0')(' ') + piGradient('pi') + ' ' + commandGradient('check') + source/* default */.Ay.hex('#95afc0')(' react # Check specific package') + '\n' +
|
|
67167
70067
|
source/* default */.Ay.hex('#95afc0')(' ') + piGradient('pi') + ' ' + commandGradient('email') + source/* default */.Ay.hex('#95afc0')(' # Contact developer with feedback') + '\n' +
|
|
70068
|
+
source/* default */.Ay.hex('#95afc0')(' ') + piGradient('pi') + ' ' + commandGradient('auth') + source/* default */.Ay.hex('#95afc0')(' # Manage CLI authentication (login/register/status)') + '\n' +
|
|
67168
70069
|
source/* default */.Ay.hex('#ff6b6b')('🌍 REPOSITORY & DEPLOYMENT') + '\n' +
|
|
67169
70070
|
source/* default */.Ay.hex('#95afc0')(' ') + piGradient('pi') + ' ' + commandGradient('clone') + source/* default */.Ay.hex('#95afc0')(' # Clone repositories interactively') + '\n' +
|
|
67170
70071
|
source/* default */.Ay.hex('#95afc0')(' ') + piGradient('pi') + ' ' + commandGradient('clone') + source/* default */.Ay.hex('#95afc0')(' facebook/react # Clone popular repositories') + '\n' +
|
|
@@ -67205,6 +70106,7 @@ if (process.argv.length === 2) {
|
|
|
67205
70106
|
source/* default */.Ay.hex('#ffa502')('Need help? Try these:') + '\n\n' +
|
|
67206
70107
|
source/* default */.Ay.hex('#ff6b6b')(' ') + piGradient('pi') + ' ' + source/* default */.Ay.hex('#ff6b6b')('--help') + source/* default */.Ay.hex('#95afc0')(' # See all available commands') + '\n' +
|
|
67207
70108
|
source/* default */.Ay.hex('#95afc0')(' ') + piGradient('pi') + ' ' + source/* default */.Ay.hex('#95afc0')('command --help') + source/* default */.Ay.hex('#95afc0')(' # Get detailed help for any command') + '\n\n' +
|
|
70109
|
+
source/* default */.Ay.hex('#95afc0')(' ') + piGradient('pi') + ' ' + source/* default */.Ay.hex('#95afc0')('auth --help') + source/* default */.Ay.hex('#95afc0')(' # Detailed help for authentication commands') + '\n\n' +
|
|
67208
70110
|
source/* default */.Ay.hex('#00d2d3')('💡 Pro tip: All commands are interactive - just run them and follow prompts!'), {
|
|
67209
70111
|
padding: 1,
|
|
67210
70112
|
borderStyle: 'round',
|
|
@@ -67222,5 +70124,15 @@ if (process.argv.length === 2) {
|
|
|
67222
70124
|
}
|
|
67223
70125
|
})();
|
|
67224
70126
|
// Parse command line arguments
|
|
70127
|
+
// If user asked for auth help explicitly (pi auth --help), show our formatted auth help and exit
|
|
70128
|
+
const preArgs = process.argv.slice(2).map(a => String(a).toLowerCase());
|
|
70129
|
+
if (preArgs[0] === 'auth' && (preArgs.includes('--help') || preArgs.includes('-h'))) {
|
|
70130
|
+
try {
|
|
70131
|
+
showAuthHelp();
|
|
70132
|
+
}
|
|
70133
|
+
catch { }
|
|
70134
|
+
;
|
|
70135
|
+
process.exit(0);
|
|
70136
|
+
}
|
|
67225
70137
|
dist_program.parse();
|
|
67226
70138
|
|