@elastic/synthetics 1.13.0 → 1.14.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.
- package/dist/core/mfa.d.ts +61 -0
- package/dist/core/mfa.d.ts.map +1 -0
- package/dist/core/mfa.js +33 -0
- package/dist/core/mfa.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -1
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +26 -1
- package/dist/loader.js.map +1 -1
- package/package.json +4 -3
- package/src/core/mfa.ts +65 -0
- package/src/index.ts +1 -0
- package/src/loader.ts +3 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2020-present, Elastic NV
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in
|
|
14
|
+
* all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
* THE SOFTWARE.
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
type TOTPOptions = {
|
|
26
|
+
/**
|
|
27
|
+
* Provider or Service the secret is associated with
|
|
28
|
+
*/
|
|
29
|
+
issuer?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Account Identifier.
|
|
32
|
+
* @default 'SyntheticsTOTP'
|
|
33
|
+
*/
|
|
34
|
+
label?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Include issuer prefix in label.
|
|
37
|
+
*/
|
|
38
|
+
issuerInLabel?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* The encoded secret key used to generate the TOTP.
|
|
41
|
+
*/
|
|
42
|
+
secret?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The algorithm used to generate the TOTP.
|
|
45
|
+
* @default 'SHA1'
|
|
46
|
+
*/
|
|
47
|
+
algorithm?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Number of digits in the generated token.
|
|
50
|
+
* @default 6
|
|
51
|
+
*/
|
|
52
|
+
digits?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Validity period in seconds for the token.
|
|
55
|
+
* @default 30
|
|
56
|
+
*/
|
|
57
|
+
period?: number;
|
|
58
|
+
};
|
|
59
|
+
export declare function totp(secret?: string, options?: TOTPOptions): string;
|
|
60
|
+
export {};
|
|
61
|
+
//# sourceMappingURL=mfa.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mfa.d.ts","sourceRoot":"","sources":["../../src/core/mfa.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,KAAK,WAAW,GAAG;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAC;AAEF,wBAAgB,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,UAE9D"}
|
package/dist/core/mfa.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MIT License
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2020-present, Elastic NV
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
|
15
|
+
* all copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
* THE SOFTWARE.
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.totp = void 0;
|
|
28
|
+
const otpauth_1 = require("otpauth");
|
|
29
|
+
function totp(secret, options = {}) {
|
|
30
|
+
return new otpauth_1.TOTP({ label: "SyntheticsTOTP", secret, ...options }).generate();
|
|
31
|
+
}
|
|
32
|
+
exports.totp = totp;
|
|
33
|
+
//# sourceMappingURL=mfa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mfa.js","sourceRoot":"","sources":["../../src/core/mfa.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,qCAA+B;AAqC/B,SAAgB,IAAI,CAAC,MAAe,EAAE,UAAuB,EAAE;IAC7D,OAAO,IAAI,cAAI,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;AAC9E,CAAC;AAFD,oBAEC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export declare function run(options: RunOptions): Promise<{
|
|
|
31
31
|
*/
|
|
32
32
|
export { journey, step, monitor, beforeAll, afterAll, before, after, } from './core';
|
|
33
33
|
export { expect } from './core/expect';
|
|
34
|
+
export * as mfa from './core/mfa';
|
|
34
35
|
/**
|
|
35
36
|
* Export all the driver related types to be consumed
|
|
36
37
|
* and used by suites
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AA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ACZ,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -23,8 +23,31 @@
|
|
|
23
23
|
* THE SOFTWARE.
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
27
|
+
if (k2 === undefined) k2 = k;
|
|
28
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
29
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
30
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
31
|
+
}
|
|
32
|
+
Object.defineProperty(o, k2, desc);
|
|
33
|
+
}) : (function(o, m, k, k2) {
|
|
34
|
+
if (k2 === undefined) k2 = k;
|
|
35
|
+
o[k2] = m[k];
|
|
36
|
+
}));
|
|
37
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
38
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
39
|
+
}) : function(o, v) {
|
|
40
|
+
o["default"] = v;
|
|
41
|
+
});
|
|
42
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
43
|
+
if (mod && mod.__esModule) return mod;
|
|
44
|
+
var result = {};
|
|
45
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
46
|
+
__setModuleDefault(result, mod);
|
|
47
|
+
return result;
|
|
48
|
+
};
|
|
26
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.expect = exports.after = exports.before = exports.afterAll = exports.beforeAll = exports.monitor = exports.step = exports.journey = exports.run = void 0;
|
|
50
|
+
exports.mfa = exports.expect = exports.after = exports.before = exports.afterAll = exports.beforeAll = exports.monitor = exports.step = exports.journey = exports.run = void 0;
|
|
28
51
|
const core_1 = require("./core");
|
|
29
52
|
async function run(options) {
|
|
30
53
|
return core_1.runner.run(options);
|
|
@@ -43,4 +66,5 @@ Object.defineProperty(exports, "before", { enumerable: true, get: function () {
|
|
|
43
66
|
Object.defineProperty(exports, "after", { enumerable: true, get: function () { return core_2.after; } });
|
|
44
67
|
var expect_1 = require("./core/expect");
|
|
45
68
|
Object.defineProperty(exports, "expect", { enumerable: true, get: function () { return expect_1.expect; } });
|
|
69
|
+
exports.mfa = __importStar(require("./core/mfa"));
|
|
46
70
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iCAAgC;AAGzB,KAAK,UAAU,GAAG,CAAC,OAAmB;IAC3C,OAAO,aAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC;AAFD,kBAEC;AAED;;GAEG;AACH,+BAQgB;AAPd,+FAAA,OAAO,OAAA;AACP,4FAAA,IAAI,OAAA;AACJ,+FAAA,OAAO,OAAA;AACP,iGAAA,SAAS,OAAA;AACT,gGAAA,QAAQ,OAAA;AACR,8FAAA,MAAM,OAAA;AACN,6FAAA,KAAK,OAAA;AAEP,wCAAuC;AAA9B,gGAAA,MAAM,OAAA;AACf,kDAAkC"}
|
package/dist/loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAgBzC;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,uBAMjE;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,iBA0BnE"}
|
package/dist/loader.js
CHANGED
|
@@ -23,6 +23,29 @@
|
|
|
23
23
|
* THE SOFTWARE.
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
27
|
+
if (k2 === undefined) k2 = k;
|
|
28
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
29
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
30
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
31
|
+
}
|
|
32
|
+
Object.defineProperty(o, k2, desc);
|
|
33
|
+
}) : (function(o, m, k, k2) {
|
|
34
|
+
if (k2 === undefined) k2 = k;
|
|
35
|
+
o[k2] = m[k];
|
|
36
|
+
}));
|
|
37
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
38
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
39
|
+
}) : function(o, v) {
|
|
40
|
+
o["default"] = v;
|
|
41
|
+
});
|
|
42
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
43
|
+
if (mod && mod.__esModule) return mod;
|
|
44
|
+
var result = {};
|
|
45
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
46
|
+
__setModuleDefault(result, mod);
|
|
47
|
+
return result;
|
|
48
|
+
};
|
|
26
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
50
|
exports.loadTestFiles = exports.globalSetup = void 0;
|
|
28
51
|
const process_1 = require("process");
|
|
@@ -30,6 +53,7 @@ const path_1 = require("path");
|
|
|
30
53
|
const core_1 = require("./core");
|
|
31
54
|
const logger_1 = require("./core/logger");
|
|
32
55
|
const expect_1 = require("./core/expect");
|
|
56
|
+
const mfa = __importStar(require("./core/mfa"));
|
|
33
57
|
const helpers_1 = require("./helpers");
|
|
34
58
|
const transform_1 = require("./core/transform");
|
|
35
59
|
const resolvedCwd = (0, process_1.cwd)();
|
|
@@ -76,7 +100,7 @@ async function loadTestFiles(options, args) {
|
|
|
76
100
|
}
|
|
77
101
|
exports.loadTestFiles = loadTestFiles;
|
|
78
102
|
const loadInlineScript = source => {
|
|
79
|
-
const scriptFn = new Function('step', 'page', 'context', 'browser', 'params', 'expect', 'request', source);
|
|
103
|
+
const scriptFn = new Function('step', 'page', 'context', 'browser', 'params', 'expect', 'request', 'mfa', source);
|
|
80
104
|
(0, core_1.journey)('inline', ({ page, context, browser, params, request }) => {
|
|
81
105
|
scriptFn.apply(null, [
|
|
82
106
|
core_1.step,
|
|
@@ -86,6 +110,7 @@ const loadInlineScript = source => {
|
|
|
86
110
|
params,
|
|
87
111
|
expect_1.expect,
|
|
88
112
|
request,
|
|
113
|
+
mfa,
|
|
89
114
|
]);
|
|
90
115
|
});
|
|
91
116
|
};
|
package/dist/loader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,qCAAqC;AACrC,+BAAwC;AAExC,iCAAuC;AACvC,0CAAoC;AACpC,0CAAuC;AACvC,gDAAkC;AA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A,cAAO,EAAC,OAAO,CAAC,CAAC,EAAE;YAClD,OAAO;SACR;QACD,IAAA,YAAG,EAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;QACnC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACvC,CAAC,CAAC;IACF;;;OAGG;IACH,MAAM,OAAO,GAAG,WAAW;QACzB,CAAC,CAAC,IAAI,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC;QAC9B,CAAC,CAAC,+BAA+B,CAAC;IACpC;;OAEG;IACH,MAAM,OAAO,GAAG,eAAe,CAAC;IAEhC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;QAC1B,MAAM,OAAO,GAAG,IAAA,cAAO,EAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QAC5C;;;WAGG;QACH,IAAA,iCAAuB,EAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAC9C,IAAI,IAAA,qBAAW,EAAC,OAAO,CAAC,EAAE;YACxB,MAAM,IAAA,kBAAQ,EAAC,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;gBACnC,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;oBAC3C,QAAQ,CAAC,GAAG,CAAC,CAAC;iBACf;YACH,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,QAAQ,CAAC,OAAO,CAAC,CAAC;SACnB;KACF;IACD,OAAO,MAAM,CAAC,MAAM,EAAE,CAAC;AACzB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elastic/synthetics",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "Elastic synthetic monitoring agent",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -59,7 +59,8 @@
|
|
|
59
59
|
"esbuild": "^0.19.11",
|
|
60
60
|
"http-proxy": "^1.18.1",
|
|
61
61
|
"kleur": "^4.1.5",
|
|
62
|
-
"micromatch": "^4.0.
|
|
62
|
+
"micromatch": "^4.0.8",
|
|
63
|
+
"otpauth": "^9.3.2",
|
|
63
64
|
"pirates": "^4.0.5",
|
|
64
65
|
"playwright": "=1.47.0",
|
|
65
66
|
"playwright-chromium": "=1.47.0",
|
|
@@ -79,7 +80,7 @@
|
|
|
79
80
|
"@semantic-release/exec": "^6.0.3",
|
|
80
81
|
"@types/babel__code-frame": "^7.0.3",
|
|
81
82
|
"@types/jest": "^28.1.8",
|
|
82
|
-
"@types/micromatch": "^4.0.
|
|
83
|
+
"@types/micromatch": "^4.0.9",
|
|
83
84
|
"@types/node": "^16.11.59",
|
|
84
85
|
"@types/semver": "^7",
|
|
85
86
|
"@types/stack-utils": "^2.0.1",
|
package/src/core/mfa.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2020-present, Elastic NV
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in
|
|
14
|
+
* all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
* THE SOFTWARE.
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { TOTP } from "otpauth";
|
|
27
|
+
|
|
28
|
+
type TOTPOptions = {
|
|
29
|
+
/**
|
|
30
|
+
* Provider or Service the secret is associated with
|
|
31
|
+
*/
|
|
32
|
+
issuer?: string
|
|
33
|
+
/**
|
|
34
|
+
* Account Identifier.
|
|
35
|
+
* @default 'SyntheticsTOTP'
|
|
36
|
+
*/
|
|
37
|
+
label?: string
|
|
38
|
+
/**
|
|
39
|
+
* Include issuer prefix in label.
|
|
40
|
+
*/
|
|
41
|
+
issuerInLabel?: boolean
|
|
42
|
+
/**
|
|
43
|
+
* The encoded secret key used to generate the TOTP.
|
|
44
|
+
*/
|
|
45
|
+
secret?: string
|
|
46
|
+
/**
|
|
47
|
+
* The algorithm used to generate the TOTP.
|
|
48
|
+
* @default 'SHA1'
|
|
49
|
+
*/
|
|
50
|
+
algorithm?: string
|
|
51
|
+
/**
|
|
52
|
+
* Number of digits in the generated token.
|
|
53
|
+
* @default 6
|
|
54
|
+
*/
|
|
55
|
+
digits?: number
|
|
56
|
+
/**
|
|
57
|
+
* Validity period in seconds for the token.
|
|
58
|
+
* @default 30
|
|
59
|
+
*/
|
|
60
|
+
period?: number
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export function totp(secret?: string, options: TOTPOptions = {}) {
|
|
64
|
+
return new TOTP({ label: "SyntheticsTOTP", secret, ...options }).generate();
|
|
65
|
+
}
|
package/src/index.ts
CHANGED
package/src/loader.ts
CHANGED
|
@@ -29,6 +29,7 @@ import { CliArgs } from './common_types';
|
|
|
29
29
|
import { step, journey } from './core';
|
|
30
30
|
import { log } from './core/logger';
|
|
31
31
|
import { expect } from './core/expect';
|
|
32
|
+
import * as mfa from "./core/mfa";
|
|
32
33
|
import {
|
|
33
34
|
isDepInstalled,
|
|
34
35
|
isDirectory,
|
|
@@ -91,6 +92,7 @@ const loadInlineScript = source => {
|
|
|
91
92
|
'params',
|
|
92
93
|
'expect',
|
|
93
94
|
'request',
|
|
95
|
+
'mfa',
|
|
94
96
|
source
|
|
95
97
|
);
|
|
96
98
|
journey('inline', ({ page, context, browser, params, request }) => {
|
|
@@ -102,6 +104,7 @@ const loadInlineScript = source => {
|
|
|
102
104
|
params,
|
|
103
105
|
expect,
|
|
104
106
|
request,
|
|
107
|
+
mfa,
|
|
105
108
|
]);
|
|
106
109
|
});
|
|
107
110
|
};
|