@dcl/sdk-commands 7.31.1-41508430758.commit-0af8af0 → 7.32.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/README.md +0 -48
- package/dist/commands/start/index.d.ts +0 -1
- package/dist/commands/start/index.js +6 -24
- package/dist/commands/start/index.js.map +1 -1
- package/dist/commands/start/server/routes.d.ts +1 -1
- package/dist/commands/start/server/routes.js +2 -6
- package/dist/commands/start/server/routes.js.map +1 -1
- package/dist/commands/start/utils.d.ts +0 -32
- package/dist/commands/start/utils.js +0 -72
- package/dist/commands/start/utils.js.map +1 -1
- package/dist/components/analytics.d.ts +1 -75
- package/dist/components/analytics.js +2 -3
- package/dist/components/analytics.js.map +1 -1
- package/dist/logic/bundle.js +0 -32
- package/dist/logic/bundle.js.map +1 -1
- package/dist/logic/config.d.ts +0 -1
- package/dist/logic/config.js +0 -7
- package/dist/logic/config.js.map +1 -1
- package/dist/logic/error.d.ts +1 -1
- package/dist/logic/error.js.map +1 -1
- package/dist/logic/exec.d.ts +0 -1
- package/dist/logic/exec.js +2 -2
- package/dist/logic/exec.js.map +1 -1
- package/dist/logic/lang.js +1 -1
- package/dist/logic/project-files.js +0 -2
- package/dist/logic/project-files.js.map +1 -1
- package/dist/logic/scene-validations.d.ts +1 -8
- package/dist/logic/scene-validations.js.map +1 -1
- package/dist/run-command.js +2 -3
- package/dist/run-command.js.map +1 -1
- package/package.json +5 -6
- package/dist/commands/scene-insights/actions.d.ts +0 -63
- package/dist/commands/scene-insights/actions.js +0 -106
- package/dist/commands/scene-insights/actions.js.map +0 -1
- package/dist/commands/scene-insights/client.d.ts +0 -51
- package/dist/commands/scene-insights/client.js +0 -294
- package/dist/commands/scene-insights/client.js.map +0 -1
- package/dist/commands/scene-insights/format.d.ts +0 -23
- package/dist/commands/scene-insights/format.js +0 -143
- package/dist/commands/scene-insights/format.js.map +0 -1
- package/dist/commands/scene-insights/index.d.ts +0 -51
- package/dist/commands/scene-insights/index.js +0 -315
- package/dist/commands/scene-insights/index.js.map +0 -1
- package/dist/commands/scene-insights/inputs.d.ts +0 -49
- package/dist/commands/scene-insights/inputs.js +0 -166
- package/dist/commands/scene-insights/inputs.js.map +0 -1
- package/dist/commands/scene-insights/session-store.d.ts +0 -43
- package/dist/commands/scene-insights/session-store.js +0 -132
- package/dist/commands/scene-insights/session-store.js.map +0 -1
- package/dist/commands/scene-insights/session.d.ts +0 -46
- package/dist/commands/scene-insights/session.js +0 -92
- package/dist/commands/scene-insights/session.js.map +0 -1
- package/dist/commands/scene-insights/sign-in.d.ts +0 -48
- package/dist/commands/scene-insights/sign-in.js +0 -125
- package/dist/commands/scene-insights/sign-in.js.map +0 -1
- package/dist/commands/scene-insights/signature-validation.d.ts +0 -6
- package/dist/commands/scene-insights/signature-validation.js +0 -100
- package/dist/commands/scene-insights/signature-validation.js.map +0 -1
- package/dist/commands/scene-insights/types.d.ts +0 -61
- package/dist/commands/scene-insights/types.js +0 -4
- package/dist/commands/scene-insights/types.js.map +0 -1
- package/dist/commands/sdk-server-logs/index.d.ts +0 -24
- package/dist/commands/sdk-server-logs/index.js +0 -315
- package/dist/commands/sdk-server-logs/index.js.map +0 -1
- package/dist/commands/start/dcl-env.d.ts +0 -16
- package/dist/commands/start/dcl-env.js +0 -51
- package/dist/commands/start/dcl-env.js.map +0 -1
- package/dist/commands/start/multiplayer-server.d.ts +0 -35
- package/dist/commands/start/multiplayer-server.js +0 -244
- package/dist/commands/start/multiplayer-server.js.map +0 -1
- package/dist/commands/start/server/runtime-env.d.ts +0 -84
- package/dist/commands/start/server/runtime-env.js +0 -415
- package/dist/commands/start/server/runtime-env.js.map +0 -1
- package/dist/commands/start/server/storage-service.d.ts +0 -8
- package/dist/commands/start/server/storage-service.js +0 -243
- package/dist/commands/start/server/storage-service.js.map +0 -1
- package/dist/commands/storage/env.d.ts +0 -5
- package/dist/commands/storage/env.js +0 -86
- package/dist/commands/storage/env.js.map +0 -1
- package/dist/commands/storage/index.d.ts +0 -26
- package/dist/commands/storage/index.js +0 -142
- package/dist/commands/storage/index.js.map +0 -1
- package/dist/commands/storage/player.d.ts +0 -5
- package/dist/commands/storage/player.js +0 -143
- package/dist/commands/storage/player.js.map +0 -1
- package/dist/commands/storage/scene.d.ts +0 -5
- package/dist/commands/storage/scene.js +0 -105
- package/dist/commands/storage/scene.js.map +0 -1
- package/dist/commands/storage/shared.d.ts +0 -62
- package/dist/commands/storage/shared.js +0 -260
- package/dist/commands/storage/shared.js.map +0 -1
- package/dist/commands/storage/types.d.ts +0 -56
- package/dist/commands/storage/types.js +0 -23
- package/dist/commands/storage/types.js.map +0 -1
- package/dist/logic/auth-chain-headers.d.ts +0 -11
- package/dist/logic/auth-chain-headers.js +0 -25
- package/dist/logic/auth-chain-headers.js.map +0 -1
- package/dist/logic/lsd-realm.d.ts +0 -5
- package/dist/logic/lsd-realm.js +0 -28
- package/dist/logic/lsd-realm.js.map +0 -1
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SESSION_DIR_ENV = void 0;
|
|
7
|
-
exports.getSessionFilePath = getSessionFilePath;
|
|
8
|
-
exports.loadSession = loadSession;
|
|
9
|
-
exports.assertSessionFileIsNotTracked = assertSessionFileIsNotTracked;
|
|
10
|
-
exports.saveSession = saveSession;
|
|
11
|
-
exports.deleteSession = deleteSession;
|
|
12
|
-
const os_1 = require("os");
|
|
13
|
-
const signature_validation_1 = require("./signature-validation");
|
|
14
|
-
const path_1 = __importDefault(require("path"));
|
|
15
|
-
const crypto_1 = require("crypto");
|
|
16
|
-
const child_process_1 = require("child_process");
|
|
17
|
-
const crypto_2 = require("@dcl/crypto");
|
|
18
|
-
const error_1 = require("../../logic/error");
|
|
19
|
-
const session_1 = require("./session");
|
|
20
|
-
/** Environment variable naming the folder whose .dcl/ holds the session, e.g. a sandbox an agent can read. */
|
|
21
|
-
exports.SESSION_DIR_ENV = 'DCL_SCENE_INSIGHTS_SESSION_DIR';
|
|
22
|
-
/**
|
|
23
|
-
* Sessions are only saved in a .dcl folder: a dot folder is never deployed (whatever .dclignore
|
|
24
|
-
* says), and its own `*` .gitignore keeps git from adding anything in it.
|
|
25
|
-
*/
|
|
26
|
-
const SESSION_FOLDER = '.dcl';
|
|
27
|
-
/** A saved session is not used in its last minute, so a request never races its expiry. */
|
|
28
|
-
const EXPIRY_MARGIN_MS = 60 * 1000;
|
|
29
|
-
function getSessionFilePath(base = process.env[exports.SESSION_DIR_ENV] || (0, os_1.homedir)()) {
|
|
30
|
-
return path_1.default.resolve(base, SESSION_FOLDER, 'scene-insights-session.json');
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Reads the saved session. Returns undefined when there is none, it is malformed, it expires within
|
|
34
|
-
* a minute, or its delegation does not verify (tampered, or not a delegation to its key).
|
|
35
|
-
*/
|
|
36
|
-
async function loadSession(components, file, now = Date.now(), provider) {
|
|
37
|
-
const { fs } = components;
|
|
38
|
-
if (!(await fs.fileExists(file)))
|
|
39
|
-
return undefined;
|
|
40
|
-
let saved;
|
|
41
|
-
try {
|
|
42
|
-
saved = JSON.parse(await fs.readFile(file, 'utf8'));
|
|
43
|
-
}
|
|
44
|
-
catch {
|
|
45
|
-
return undefined;
|
|
46
|
-
}
|
|
47
|
-
if (saved?.version !== 1 ||
|
|
48
|
-
typeof saved.expiration !== 'string' ||
|
|
49
|
-
typeof saved.ephemeralIdentity?.privateKey !== 'string' ||
|
|
50
|
-
typeof saved.ephemeralIdentity?.address !== 'string' ||
|
|
51
|
-
!Array.isArray(saved.authChain)) {
|
|
52
|
-
return undefined;
|
|
53
|
-
}
|
|
54
|
-
const expiration = new Date(saved.expiration);
|
|
55
|
-
if (!(expiration.getTime() - EXPIRY_MARGIN_MS > now))
|
|
56
|
-
return undefined;
|
|
57
|
-
const check = await (0, signature_validation_1.validateInsightsSignature)(saved.ephemeralIdentity.address.toLowerCase(), saved.authChain, now, provider);
|
|
58
|
-
if (!check.ok ||
|
|
59
|
-
!check.scope ||
|
|
60
|
-
!session_1.INSIGHTS_OPERATIONS.every((operation) => (0, crypto_2.isOperationGranted)(check.scope, operation)))
|
|
61
|
-
return undefined;
|
|
62
|
-
expiration.setTime(Math.min(expiration.getTime(), check.scope.expiration));
|
|
63
|
-
if (!(expiration.getTime() - EXPIRY_MARGIN_MS > now))
|
|
64
|
-
return undefined;
|
|
65
|
-
return { session: (0, session_1.createSessionFromChain)(saved.ephemeralIdentity, expiration, saved.authChain), saved };
|
|
66
|
-
}
|
|
67
|
-
/** Whether git tracks the file, so a .gitignore no longer keeps it out of commits. */
|
|
68
|
-
function isTrackedByGit(file) {
|
|
69
|
-
// exits 0 only for a tracked file; untracked, outside a repository or without git, it fails
|
|
70
|
-
return new Promise((resolve) => {
|
|
71
|
-
(0, child_process_1.execFile)('git', ['ls-files', '--error-unmatch', '--', path_1.default.basename(file)], { cwd: path_1.default.dirname(file) }, (error) => resolve(!error));
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Refuses a session file git already tracks, e.g. a .dcl folder committed before it ignored
|
|
76
|
-
* itself: its .gitignore doesn't stop a tracked file being committed again.
|
|
77
|
-
*
|
|
78
|
-
* @throws CliError `SCENE_INSIGHTS_UNSAFE_SESSION_FILE` when git tracks it.
|
|
79
|
-
*/
|
|
80
|
-
async function assertSessionFileIsNotTracked(file) {
|
|
81
|
-
const resolved = path_1.default.resolve(file);
|
|
82
|
-
if (await isTrackedByGit(resolved)) {
|
|
83
|
-
throw new error_1.CliError('SCENE_INSIGHTS_UNSAFE_SESSION_FILE', `The session file ${resolved} is tracked by git, so it would be committed. Remove it from the repository ` +
|
|
84
|
-
`(git rm --cached) or set ${exports.SESSION_DIR_ENV} to a folder outside it`);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
/** Makes the session's folder ignore everything in it, so git never adds the session or its temporary copies. */
|
|
88
|
-
async function ignoreFolderInGit(components, folder) {
|
|
89
|
-
const { fs } = components;
|
|
90
|
-
const gitignore = path_1.default.join(folder, '.gitignore');
|
|
91
|
-
const existing = (await fs.fileExists(gitignore)) ? await fs.readFile(gitignore, 'utf8') : '';
|
|
92
|
-
if (existing.split(/\r?\n/).includes('*'))
|
|
93
|
-
return;
|
|
94
|
-
const separator = existing && !existing.endsWith('\n') ? '\n' : '';
|
|
95
|
-
await fs.appendFile(gitignore, separator + '*\n');
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Saves the session readable only by the user (0600, in a 0700 directory), replacing any other.
|
|
99
|
-
* Its folder's .gitignore ignores everything in it, so git never commits it.
|
|
100
|
-
*
|
|
101
|
-
* @throws CliError `SCENE_INSIGHTS_UNSAFE_SESSION_FILE` when git tracks the file.
|
|
102
|
-
*/
|
|
103
|
-
async function saveSession(components, file, ephemeralIdentity, expiration, authChain) {
|
|
104
|
-
const { fs } = components;
|
|
105
|
-
const saved = {
|
|
106
|
-
version: 1,
|
|
107
|
-
address: crypto_2.Authenticator.ownerAddress(authChain),
|
|
108
|
-
expiration: expiration.toISOString(),
|
|
109
|
-
ephemeralIdentity: {
|
|
110
|
-
address: ephemeralIdentity.address,
|
|
111
|
-
publicKey: '0x',
|
|
112
|
-
privateKey: ephemeralIdentity.privateKey
|
|
113
|
-
},
|
|
114
|
-
authChain
|
|
115
|
-
};
|
|
116
|
-
await assertSessionFileIsNotTracked(file);
|
|
117
|
-
await fs.mkdir(path_1.default.dirname(file), { recursive: true, mode: 0o700 });
|
|
118
|
-
await ignoreFolderInGit(components, path_1.default.dirname(file));
|
|
119
|
-
// a fresh file always gets the mode, unlike rewriting an existing one; rename makes it atomic
|
|
120
|
-
const temporary = `${file}.${(0, crypto_1.randomBytes)(6).toString('hex')}.tmp`;
|
|
121
|
-
await fs.writeFile(temporary, JSON.stringify(saved, null, 2), { mode: 0o600 });
|
|
122
|
-
await fs.rename(temporary, file);
|
|
123
|
-
}
|
|
124
|
-
/** Removes the saved session. Returns whether there was one. */
|
|
125
|
-
async function deleteSession(components, file) {
|
|
126
|
-
const { fs } = components;
|
|
127
|
-
if (!(await fs.fileExists(file)))
|
|
128
|
-
return false;
|
|
129
|
-
await fs.unlink(file);
|
|
130
|
-
return true;
|
|
131
|
-
}
|
|
132
|
-
//# sourceMappingURL=session-store.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session-store.js","sourceRoot":"","sources":["../../../src/commands/scene-insights/session-store.ts"],"names":[],"mappings":";;;;;;AAqCA,gDAEC;AAMD,kCA4CC;AAkBD,sEASC;AAkBD,kCA0BC;AAGD,sCAKC;AAxKD,2BAA4B;AAE5B,iEAAkE;AAClE,gDAAuB;AACvB,mCAAoC;AACpC,iDAAwC;AACxC,wCAAwF;AAGxF,6CAA4C;AAC5C,uCAAwF;AAExF,8GAA8G;AACjG,QAAA,eAAe,GAAG,gCAAgC,CAAA;AAE/D;;;GAGG;AACH,MAAM,cAAc,GAAG,MAAM,CAAA;AAE7B,2FAA2F;AAC3F,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,CAAA;AAelC,SAAgB,kBAAkB,CAAC,OAAe,OAAO,CAAC,GAAG,CAAC,uBAAe,CAAC,IAAI,IAAA,YAAO,GAAE;IACzF,OAAO,cAAI,CAAC,OAAO,CAAC,IAAI,EAAE,cAAc,EAAE,6BAA6B,CAAC,CAAA;AAC1E,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,WAAW,CAC/B,UAAqC,EACrC,IAAY,EACZ,MAAc,IAAI,CAAC,GAAG,EAAE,EACxB,QAA4B;IAE5B,MAAM,EAAE,EAAE,EAAE,GAAG,UAAU,CAAA;IACzB,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,SAAS,CAAA;IAElD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C,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAA;IACjE,MAAM,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;IAC9E,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;AAClC,CAAC;AAED,gEAAgE;AACzD,KAAK,UAAU,aAAa,CAAC,UAAqC,EAAE,IAAY;IACrF,MAAM,EAAE,EAAE,EAAE,GAAG,UAAU,CAAA;IACzB,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,KAAK,CAAA;IAC9C,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACrB,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { AuthChainProvider } from '@dcl/crypto-middleware';
|
|
2
|
-
import { AuthChain, AuthIdentity, ScopedLoginScope } from '@dcl/crypto';
|
|
3
|
-
/** How long one signature lasts; after that, `scene-insights login` signs a new session. */
|
|
4
|
-
export declare const SESSION_MINUTES: number;
|
|
5
|
-
export declare const INSIGHTS_SERVICE = "insights";
|
|
6
|
-
export declare const INSIGHTS_OPERATIONS: readonly ["logs-read", "metrics-read", "executions-read"];
|
|
7
|
-
export declare function getInsightsSessionMessage(address: string, expiration: Date): string;
|
|
8
|
-
/**
|
|
9
|
-
* Signs any number of requests after a single wallet signature.
|
|
10
|
-
*
|
|
11
|
-
* Every insights request is a signed fetch over `method:path:timestamp:metadata`, so paging, tail
|
|
12
|
-
* reconnects and repeated commands need many signatures. Instead of asking the wallet for each one,
|
|
13
|
-
* the wallet signs once to delegate to an ephemeral key held by the CLI, and that key signs each
|
|
14
|
-
* request (session-store.ts keeps it between commands).
|
|
15
|
-
*/
|
|
16
|
-
export interface InsightsSession {
|
|
17
|
-
/** The wallet address the requests are made as */
|
|
18
|
-
address: string;
|
|
19
|
-
/** When the delegation stops being accepted */
|
|
20
|
-
expiration: Date;
|
|
21
|
-
/** Signed-fetch headers for one request */
|
|
22
|
-
sign(method: string, pathname: string, metadata: string): Record<string, string>;
|
|
23
|
-
}
|
|
24
|
-
/** The payload a signed fetch signs (crypto-middleware 6): method, path and timestamp lowercased, metadata verbatim. */
|
|
25
|
-
export declare function buildSignedFetchPayload(method: string, pathname: string, timestamp: string, metadata: string): string;
|
|
26
|
-
/** A fresh ephemeral key from a secure random source. */
|
|
27
|
-
export declare function createEphemeralIdentity(): AuthIdentity['ephemeralIdentity'];
|
|
28
|
-
/** Builds a session from a delegation chain whose final authority is the ephemeral key. */
|
|
29
|
-
export declare function createSessionFromChain(ephemeralIdentity: AuthIdentity['ephemeralIdentity'], expiration: Date, authChain: AuthChain): InsightsSession;
|
|
30
|
-
/** A delegation signed directly with a private key (`DCL_PRIVATE_KEY`). */
|
|
31
|
-
export declare function createSessionFromPrivateKey(privateKey: string, now?: number): InsightsSession;
|
|
32
|
-
export interface ValidatedInsightsDelegation {
|
|
33
|
-
authChain: AuthChain;
|
|
34
|
-
scope: ScopedLoginScope;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Turns what the linker dApp returns into a delegation to our ephemeral key.
|
|
38
|
-
*
|
|
39
|
-
* The dApp signs whatever it is given with its own browser-side ephemeral key, closing the chain
|
|
40
|
-
* with an `ECDSA_SIGNED_ENTITY` link. Handing it our ephemeral key's login message makes that last
|
|
41
|
-
* link a signature of the message by the dApp's key, which is exactly a scoped delegation, so
|
|
42
|
-
* it is relabeled as one: wallet → dApp key → our key.
|
|
43
|
-
*
|
|
44
|
-
* @throws CliError when the chain does not sign the message or RPC validation is unavailable.
|
|
45
|
-
*/
|
|
46
|
-
export declare function delegationFromLinkerChain(authChain: AuthChain, ephemeralAddress: string, message: string, now?: number, provider?: AuthChainProvider): Promise<ValidatedInsightsDelegation>;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.INSIGHTS_OPERATIONS = exports.INSIGHTS_SERVICE = exports.SESSION_MINUTES = void 0;
|
|
4
|
-
exports.getInsightsSessionMessage = getInsightsSessionMessage;
|
|
5
|
-
exports.buildSignedFetchPayload = buildSignedFetchPayload;
|
|
6
|
-
exports.createEphemeralIdentity = createEphemeralIdentity;
|
|
7
|
-
exports.createSessionFromChain = createSessionFromChain;
|
|
8
|
-
exports.createSessionFromPrivateKey = createSessionFromPrivateKey;
|
|
9
|
-
exports.delegationFromLinkerChain = delegationFromLinkerChain;
|
|
10
|
-
const crypto_1 = require("crypto");
|
|
11
|
-
const signature_validation_1 = require("./signature-validation");
|
|
12
|
-
const crypto_2 = require("@dcl/crypto");
|
|
13
|
-
const crypto_3 = require("@dcl/crypto/dist/crypto");
|
|
14
|
-
const eth_connect_1 = require("eth-connect");
|
|
15
|
-
const error_1 = require("../../logic/error");
|
|
16
|
-
const account_1 = require("../../logic/account");
|
|
17
|
-
const auth_chain_headers_1 = require("../../logic/auth-chain-headers");
|
|
18
|
-
/** How long one signature lasts; after that, `scene-insights login` signs a new session. */
|
|
19
|
-
exports.SESSION_MINUTES = 12 * 60;
|
|
20
|
-
exports.INSIGHTS_SERVICE = 'insights';
|
|
21
|
-
exports.INSIGHTS_OPERATIONS = ['logs-read', 'metrics-read', 'executions-read'];
|
|
22
|
-
function getInsightsSessionMessage(address, expiration) {
|
|
23
|
-
return (0, crypto_2.getScopedEphemeralMessage)(address, expiration, exports.INSIGHTS_OPERATIONS.map((operation) => ({ service: exports.INSIGHTS_SERVICE, operation })));
|
|
24
|
-
}
|
|
25
|
-
/** The payload a signed fetch signs (crypto-middleware 6): method, path and timestamp lowercased, metadata verbatim. */
|
|
26
|
-
function buildSignedFetchPayload(method, pathname, timestamp, metadata) {
|
|
27
|
-
return [method.toLowerCase(), pathname.toLowerCase(), timestamp, metadata].join(':');
|
|
28
|
-
}
|
|
29
|
-
/** A fresh ephemeral key from a secure random source. */
|
|
30
|
-
function createEphemeralIdentity() {
|
|
31
|
-
const privateKey = `0x${(0, crypto_1.randomBytes)(32).toString('hex')}`;
|
|
32
|
-
const { address } = (0, account_1.createWallet)(privateKey);
|
|
33
|
-
return { privateKey, publicKey: '0x', address };
|
|
34
|
-
}
|
|
35
|
-
/** Builds a session from a delegation chain whose final authority is the ephemeral key. */
|
|
36
|
-
function createSessionFromChain(ephemeralIdentity, expiration, authChain) {
|
|
37
|
-
const identity = { ephemeralIdentity, expiration, authChain };
|
|
38
|
-
return {
|
|
39
|
-
address: crypto_2.Authenticator.ownerAddress(authChain),
|
|
40
|
-
expiration,
|
|
41
|
-
sign(method, pathname, metadata) {
|
|
42
|
-
const timestamp = String(Date.now());
|
|
43
|
-
const requestChain = crypto_2.Authenticator.signPayload(identity, buildSignedFetchPayload(method, pathname, timestamp, metadata));
|
|
44
|
-
return (0, auth_chain_headers_1.createAuthChainHeaders)(requestChain, timestamp, metadata);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
/** A delegation signed directly with a private key (`DCL_PRIVATE_KEY`). */
|
|
49
|
-
function createSessionFromPrivateKey(privateKey, now = Date.now()) {
|
|
50
|
-
const wallet = (0, account_1.createWallet)(privateKey);
|
|
51
|
-
const ephemeralIdentity = createEphemeralIdentity();
|
|
52
|
-
const expiration = new Date(now + exports.SESSION_MINUTES * 60 * 1000);
|
|
53
|
-
const message = getInsightsSessionMessage(ephemeralIdentity.address, expiration);
|
|
54
|
-
const authChain = [
|
|
55
|
-
{ type: crypto_2.AuthLinkType.SIGNER, payload: wallet.address, signature: '' },
|
|
56
|
-
{
|
|
57
|
-
type: crypto_2.ScopedAuthLinkType.ECDSA_PERSONAL_SCOPED_EPHEMERAL,
|
|
58
|
-
payload: message,
|
|
59
|
-
signature: (0, crypto_3.ethSign)((0, eth_connect_1.hexToBytes)(wallet.privateKey), message)
|
|
60
|
-
}
|
|
61
|
-
];
|
|
62
|
-
return createSessionFromChain(ephemeralIdentity, expiration, authChain);
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Turns what the linker dApp returns into a delegation to our ephemeral key.
|
|
66
|
-
*
|
|
67
|
-
* The dApp signs whatever it is given with its own browser-side ephemeral key, closing the chain
|
|
68
|
-
* with an `ECDSA_SIGNED_ENTITY` link. Handing it our ephemeral key's login message makes that last
|
|
69
|
-
* link a signature of the message by the dApp's key, which is exactly a scoped delegation, so
|
|
70
|
-
* it is relabeled as one: wallet → dApp key → our key.
|
|
71
|
-
*
|
|
72
|
-
* @throws CliError when the chain does not sign the message or RPC validation is unavailable.
|
|
73
|
-
*/
|
|
74
|
-
async function delegationFromLinkerChain(authChain, ephemeralAddress, message, now = Date.now(), provider) {
|
|
75
|
-
const last = authChain[authChain.length - 1];
|
|
76
|
-
if (authChain.length < 2 ||
|
|
77
|
-
!last ||
|
|
78
|
-
last.type !== crypto_2.AuthLinkType.ECDSA_PERSONAL_SIGNED_ENTITY ||
|
|
79
|
-
last.payload !== message) {
|
|
80
|
-
throw new error_1.CliError('SCENE_INSIGHTS_INVALID_SIGNATURE', 'The wallet did not sign the insights session');
|
|
81
|
-
}
|
|
82
|
-
const delegation = [
|
|
83
|
-
...authChain.slice(0, -1),
|
|
84
|
-
{ ...last, type: crypto_2.ScopedAuthLinkType.ECDSA_PERSONAL_SCOPED_EPHEMERAL }
|
|
85
|
-
];
|
|
86
|
-
const result = await (0, signature_validation_1.validateInsightsSignature)(ephemeralAddress.toLowerCase(), delegation, now, provider);
|
|
87
|
-
if (!result.ok || !result.scope) {
|
|
88
|
-
throw new error_1.CliError('SCENE_INSIGHTS_INVALID_SIGNATURE', `The insights session signature is invalid: ${result.message}`);
|
|
89
|
-
}
|
|
90
|
-
return { authChain: delegation, scope: result.scope };
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=session.js.map
|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
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { AuthChainProvider } from '@dcl/crypto-middleware';
|
|
2
|
-
import { Router } from '@well-known-components/http-server';
|
|
3
|
-
import { CliComponents } from '../../components';
|
|
4
|
-
import { dAppOptions } from '../../run-dapp';
|
|
5
|
-
import { InsightsSession, ValidatedInsightsDelegation } from './session';
|
|
6
|
-
/** What the linker dApp shows while signing. */
|
|
7
|
-
export interface SignInLabel {
|
|
8
|
-
label: string;
|
|
9
|
-
world?: string;
|
|
10
|
-
parcel?: string;
|
|
11
|
-
}
|
|
12
|
-
export interface SessionOptions {
|
|
13
|
-
/** Where the session is saved */
|
|
14
|
-
file: string;
|
|
15
|
-
/** The service URL, shown in the linker dApp */
|
|
16
|
-
targetUrl: string;
|
|
17
|
-
linkOptions: Omit<dAppOptions, 'uri'>;
|
|
18
|
-
/** Whether a person can answer the browser prompt; without one, a missing session is an error */
|
|
19
|
-
interactive: boolean;
|
|
20
|
-
/** Sign a new session even when a saved one is still valid (`login`) */
|
|
21
|
-
forceNew?: boolean;
|
|
22
|
-
}
|
|
23
|
-
export type SessionSource = 'private-key' | 'saved' | 'signed';
|
|
24
|
-
/**
|
|
25
|
-
* Gets a session to sign requests with, in order:
|
|
26
|
-
* 1. `DCL_PRIVATE_KEY`, signed locally and never saved;
|
|
27
|
-
* 2. the saved session, while it is valid (unless `forceNew`);
|
|
28
|
-
* 3. a new browser signature through the linker dApp, which is then saved.
|
|
29
|
-
*
|
|
30
|
-
* @throws CliError `SCENE_INSIGHTS_SESSION_REQUIRED` when it would have to open the browser but
|
|
31
|
-
* nobody is there to sign (an agent or script): `scene-insights login` has to be run first.
|
|
32
|
-
* @throws CliError `SCENE_INSIGHTS_UNSAFE_SESSION_FILE` when git tracks the session file, before
|
|
33
|
-
* asking for a signature.
|
|
34
|
-
*/
|
|
35
|
-
export declare function getSession(components: Pick<CliComponents, 'fs' | 'logger' | 'fetch' | 'config'>, label: SignInLabel, options: SessionOptions): Promise<{
|
|
36
|
-
session: InsightsSession;
|
|
37
|
-
source: SessionSource;
|
|
38
|
-
}>;
|
|
39
|
-
/**
|
|
40
|
-
* Whether a request comes from the linker dApp's own page. The browser sets Origin and Host, so
|
|
41
|
-
* another page open in it (or a rebinding domain) can't pass for the dApp.
|
|
42
|
-
*/
|
|
43
|
-
export declare function isLinkerOrigin(origin: string | null, host: string | null): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* The linker dApp posts `view-logs` signatures to `/api/logs`. Only its own page is accepted: any
|
|
46
|
-
* other page could sign the message with its own wallet and sign the CLI in as that address.
|
|
47
|
-
*/
|
|
48
|
-
export declare function setSignInRoutes(router: Router<object>, ephemeralAddress: string, message: string, onSigned: (delegation: ValidatedInsightsDelegation) => void, provider?: AuthChainProvider, onError?: (error: Error) => void): Router<object>;
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getSession = getSession;
|
|
7
|
-
exports.isLinkerOrigin = isLinkerOrigin;
|
|
8
|
-
exports.setSignInRoutes = setSignInRoutes;
|
|
9
|
-
const fp_future_1 = __importDefault(require("fp-future"));
|
|
10
|
-
const signature_validation_1 = require("./signature-validation");
|
|
11
|
-
const error_1 = require("../../logic/error");
|
|
12
|
-
const routes_1 = require("../../linker-dapp/routes");
|
|
13
|
-
const run_dapp_1 = require("../../run-dapp");
|
|
14
|
-
const session_1 = require("./session");
|
|
15
|
-
const session_store_1 = require("./session-store");
|
|
16
|
-
/**
|
|
17
|
-
* Gets a session to sign requests with, in order:
|
|
18
|
-
* 1. `DCL_PRIVATE_KEY`, signed locally and never saved;
|
|
19
|
-
* 2. the saved session, while it is valid (unless `forceNew`);
|
|
20
|
-
* 3. a new browser signature through the linker dApp, which is then saved.
|
|
21
|
-
*
|
|
22
|
-
* @throws CliError `SCENE_INSIGHTS_SESSION_REQUIRED` when it would have to open the browser but
|
|
23
|
-
* nobody is there to sign (an agent or script): `scene-insights login` has to be run first.
|
|
24
|
-
* @throws CliError `SCENE_INSIGHTS_UNSAFE_SESSION_FILE` when git tracks the session file, before
|
|
25
|
-
* asking for a signature.
|
|
26
|
-
*/
|
|
27
|
-
async function getSession(components, label, options) {
|
|
28
|
-
if (process.env.DCL_PRIVATE_KEY) {
|
|
29
|
-
return { session: (0, session_1.createSessionFromPrivateKey)(process.env.DCL_PRIVATE_KEY), source: 'private-key' };
|
|
30
|
-
}
|
|
31
|
-
const provider = (0, signature_validation_1.createInsightsProvider)(options.targetUrl);
|
|
32
|
-
if (!options.forceNew) {
|
|
33
|
-
const saved = await (0, session_store_1.loadSession)(components, options.file, Date.now(), provider);
|
|
34
|
-
if (saved)
|
|
35
|
-
return { session: saved.session, source: 'saved' };
|
|
36
|
-
if (!options.interactive) {
|
|
37
|
-
throw new error_1.CliError('SCENE_INSIGHTS_SESSION_REQUIRED', 'No signed-in session. Ask the user to run "sdk-commands scene-insights login" (it opens the browser to sign once, for 12 hours), or set DCL_PRIVATE_KEY');
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
// before the browser opens: nobody should sign a session that can't be saved
|
|
41
|
-
await (0, session_store_1.assertSessionFileIsNotTracked)(options.file);
|
|
42
|
-
const ephemeralIdentity = (0, session_1.createEphemeralIdentity)();
|
|
43
|
-
const expiration = new Date(Date.now() + session_1.SESSION_MINUTES * 60 * 1000);
|
|
44
|
-
const message = (0, session_1.getInsightsSessionMessage)(ephemeralIdentity.address, expiration);
|
|
45
|
-
const signed = (0, fp_future_1.default)();
|
|
46
|
-
// A browser callback can fail while runDapp is still starting; await signed below still propagates it.
|
|
47
|
-
void signed.catch(() => undefined);
|
|
48
|
-
const { router: commonRouter } = (0, routes_1.setRoutes)(components, {
|
|
49
|
-
rootCID: message,
|
|
50
|
-
baseParcel: label.parcel ?? '0,0',
|
|
51
|
-
parcels: [label.parcel ?? '0,0'],
|
|
52
|
-
skipValidations: true,
|
|
53
|
-
debug: !!process.env.DEBUG,
|
|
54
|
-
isWorld: !!label.world,
|
|
55
|
-
world: label.label,
|
|
56
|
-
targetUrl: options.targetUrl,
|
|
57
|
-
action: 'view-logs'
|
|
58
|
-
});
|
|
59
|
-
const router = setSignInRoutes(commonRouter, ephemeralIdentity.address, message, (chain) => signed.resolve(chain), provider, (error) => signed.reject(error));
|
|
60
|
-
components.logger.info(`Sign read-only access to logs, metrics and executions for the next ${session_1.SESSION_MINUTES / 60} hours`);
|
|
61
|
-
components.logger.info('This credential works across Insights environments sharing the insights service identifier where the wallet signatures verify on the configured network.');
|
|
62
|
-
const { program } = await (0, run_dapp_1.runDapp)(components, router, { ...options.linkOptions, uri: '/' });
|
|
63
|
-
let validated;
|
|
64
|
-
try {
|
|
65
|
-
validated = await signed;
|
|
66
|
-
}
|
|
67
|
-
finally {
|
|
68
|
-
// Cleanup must not replace a signature validation error.
|
|
69
|
-
await program.stop().catch(() => undefined);
|
|
70
|
-
}
|
|
71
|
-
const { authChain, scope } = validated;
|
|
72
|
-
expiration.setTime(Math.min(expiration.getTime(), scope.expiration));
|
|
73
|
-
await (0, session_store_1.saveSession)(components, options.file, ephemeralIdentity, expiration, authChain);
|
|
74
|
-
return { session: (0, session_1.createSessionFromChain)(ephemeralIdentity, expiration, authChain), source: 'signed' };
|
|
75
|
-
}
|
|
76
|
-
const LOOPBACK_HOSTNAMES = ['localhost', '127.0.0.1', '[::1]'];
|
|
77
|
-
/**
|
|
78
|
-
* Whether a request comes from the linker dApp's own page. The browser sets Origin and Host, so
|
|
79
|
-
* another page open in it (or a rebinding domain) can't pass for the dApp.
|
|
80
|
-
*/
|
|
81
|
-
function isLinkerOrigin(origin, host) {
|
|
82
|
-
if (!origin || !host)
|
|
83
|
-
return false;
|
|
84
|
-
try {
|
|
85
|
-
const url = new URL(origin);
|
|
86
|
-
return url.host === host && LOOPBACK_HOSTNAMES.includes(url.hostname);
|
|
87
|
-
}
|
|
88
|
-
catch {
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* The linker dApp posts `view-logs` signatures to `/api/logs`. Only its own page is accepted: any
|
|
94
|
-
* other page could sign the message with its own wallet and sign the CLI in as that address.
|
|
95
|
-
*/
|
|
96
|
-
function setSignInRoutes(router, ephemeralAddress, message, onSigned, provider, onError) {
|
|
97
|
-
router.post('/api/logs', async (ctx) => {
|
|
98
|
-
if (!isLinkerOrigin(ctx.request.headers.get('origin'), ctx.request.headers.get('host'))) {
|
|
99
|
-
return { status: 403, body: { success: false, error: 'Sign from the page the CLI opened on localhost' } };
|
|
100
|
-
}
|
|
101
|
-
const value = (await ctx.request.json());
|
|
102
|
-
try {
|
|
103
|
-
if (!value.address || !Array.isArray(value.authChain)) {
|
|
104
|
-
throw new error_1.CliError('SCENE_INSIGHTS_INVALID_SIGNATURE', 'The wallet did not sign the insights session');
|
|
105
|
-
}
|
|
106
|
-
const delegation = await (0, session_1.delegationFromLinkerChain)(value.authChain, ephemeralAddress, message, Date.now(), provider);
|
|
107
|
-
// answer the dApp before its server is stopped
|
|
108
|
-
setTimeout(() => onSigned(delegation), 100);
|
|
109
|
-
return { body: { success: true } };
|
|
110
|
-
}
|
|
111
|
-
catch (e) {
|
|
112
|
-
if (e instanceof error_1.CliError &&
|
|
113
|
-
(e.name === 'SCENE_INSIGHTS_UNAVAILABLE' || e.name === 'SCENE_INSIGHTS_INVALID_ARGUMENT')) {
|
|
114
|
-
setTimeout(() => onError?.(e), 100);
|
|
115
|
-
return {
|
|
116
|
-
status: e.name === 'SCENE_INSIGHTS_UNAVAILABLE' ? 503 : 400,
|
|
117
|
-
body: { success: false, error: e.message }
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
return { status: 400, body: { success: false, error: e.message } };
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
return router;
|
|
124
|
-
}
|
|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AI,KAAK,iCAAiC,CAAC,EACzF,CAAC;gBACD,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;gBACnC,OAAO;oBACL,MAAM,EAAE,CAAC,CAAC,IAAI,KAAK,4BAA4B,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;oBAC3D,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE;iBAC3C,CAAA;YACH,CAAC;YACD,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAG,CAAW,CAAC,OAAO,EAAE,EAAE,CAAA;QAC/E,CAAC;IACH,CAAC,CAAC,CAAA;IACF,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { AuthChain, Authenticator } from '@dcl/crypto';
|
|
2
|
-
import { AuthChainProvider } from '@dcl/crypto-middleware';
|
|
3
|
-
/** Select RPC from trusted CLI configuration, never from the wallet response. */
|
|
4
|
-
export declare function createInsightsProvider(target: string): AuthChainProvider;
|
|
5
|
-
/** Validate a saved or newly signed delegation without unbounded RPC fallback work. */
|
|
6
|
-
export declare function validateInsightsSignature(expected: string, chain: AuthChain, now?: number, provider?: AuthChainProvider): ReturnType<typeof Authenticator.validateSignature>;
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createInsightsProvider = createInsightsProvider;
|
|
4
|
-
exports.validateInsightsSignature = validateInsightsSignature;
|
|
5
|
-
const crypto_1 = require("@dcl/crypto");
|
|
6
|
-
const crypto_middleware_1 = require("@dcl/crypto-middleware");
|
|
7
|
-
const error_1 = require("../../logic/error");
|
|
8
|
-
/** Select RPC from trusted CLI configuration, never from the wallet response. */
|
|
9
|
-
function createInsightsProvider(target) {
|
|
10
|
-
let provider;
|
|
11
|
-
return {
|
|
12
|
-
sendAsync(payload, callback, signal) {
|
|
13
|
-
if (!provider) {
|
|
14
|
-
const hostname = new URL(target).hostname;
|
|
15
|
-
const network = hostname === 'decentraland.zone' || hostname.endsWith('.decentraland.zone')
|
|
16
|
-
? 'sepolia'
|
|
17
|
-
: hostname === 'decentraland.org' || hostname.endsWith('.decentraland.org')
|
|
18
|
-
? 'mainnet'
|
|
19
|
-
: undefined;
|
|
20
|
-
const url = network
|
|
21
|
-
? `https://rpc.decentraland.org/${network}?project=sdk-commands`
|
|
22
|
-
: process.env.DCL_SCENE_INSIGHTS_RPC_URL;
|
|
23
|
-
if (!url) {
|
|
24
|
-
callback(new error_1.CliError('SCENE_INSIGHTS_INVALID_ARGUMENT', 'Set DCL_SCENE_INSIGHTS_RPC_URL for contract wallets on a custom Insights target'));
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
try {
|
|
28
|
-
provider = (0, crypto_middleware_1.createSignatureRpcProvider)(url);
|
|
29
|
-
}
|
|
30
|
-
catch {
|
|
31
|
-
callback(new error_1.CliError('SCENE_INSIGHTS_INVALID_ARGUMENT', 'DCL_SCENE_INSIGHTS_RPC_URL must be an HTTP(S) URL without user information'));
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
provider.sendAsync(payload, callback, signal);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
/** Validate a saved or newly signed delegation without unbounded RPC fallback work. */
|
|
40
|
-
async function validateInsightsSignature(expected, chain, now = Date.now(), provider) {
|
|
41
|
-
if (chain.length < 2 || chain.length > 10)
|
|
42
|
-
return { ok: false, message: 'Invalid auth chain length' };
|
|
43
|
-
const controller = new AbortController();
|
|
44
|
-
let rejectValidation = () => undefined;
|
|
45
|
-
let invalidate = () => undefined;
|
|
46
|
-
const interrupted = new Promise((resolve, reject) => {
|
|
47
|
-
invalidate = resolve;
|
|
48
|
-
rejectValidation = reject;
|
|
49
|
-
});
|
|
50
|
-
const interrupt = (error) => {
|
|
51
|
-
if (!controller.signal.aborted) {
|
|
52
|
-
rejectValidation(error);
|
|
53
|
-
controller.abort();
|
|
54
|
-
}
|
|
55
|
-
return error;
|
|
56
|
-
};
|
|
57
|
-
let calls = 0;
|
|
58
|
-
const bounded = provider && {
|
|
59
|
-
sendAsync(payload, callback) {
|
|
60
|
-
if (controller.signal.aborted) {
|
|
61
|
-
callback(new Error('Signature validation stopped'));
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (++calls > 16) {
|
|
65
|
-
const message = 'Signature validation exceeded its RPC budget';
|
|
66
|
-
invalidate({ ok: false, message });
|
|
67
|
-
controller.abort();
|
|
68
|
-
callback(new Error(message));
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
try {
|
|
72
|
-
provider.sendAsync(payload, (error, response) => {
|
|
73
|
-
if (error) {
|
|
74
|
-
callback(interrupt(error instanceof error_1.CliError
|
|
75
|
-
? error
|
|
76
|
-
: new error_1.CliError('SCENE_INSIGHTS_UNAVAILABLE', 'Contract-wallet signature verification unavailable; retry shortly')));
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
callback(null, response);
|
|
80
|
-
}
|
|
81
|
-
}, controller.signal);
|
|
82
|
-
}
|
|
83
|
-
catch {
|
|
84
|
-
callback(interrupt(new error_1.CliError('SCENE_INSIGHTS_UNAVAILABLE', 'Contract-wallet signature verification unavailable; retry shortly')));
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
const timer = setTimeout(() => interrupt(new error_1.CliError('SCENE_INSIGHTS_UNAVAILABLE', 'Contract-wallet signature verification timed out; retry shortly')), 15000);
|
|
89
|
-
try {
|
|
90
|
-
return await Promise.race([
|
|
91
|
-
crypto_1.Authenticator.validateSignature(expected, chain, bounded ?? null, now, { service: 'insights' }),
|
|
92
|
-
interrupted
|
|
93
|
-
]);
|
|
94
|
-
}
|
|
95
|
-
finally {
|
|
96
|
-
clearTimeout(timer);
|
|
97
|
-
controller.abort();
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
//# sourceMappingURL=signature-validation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signature-validation.js","sourceRoot":"","sources":["../../../src/commands/scene-insights/signature-validation.ts"],"names":[],"mappings":";;AAKA,wDAuCC;AAGD,8DAoFC;AAnID,wCAAwE;AACxE,8DAAsF;AACtF,6CAA4C;AAE5C,iFAAiF;AACjF,SAAgB,sBAAsB,CAAC,MAAc;IACnD,IAAI,QAAuC,CAAA;IAC3C,OAAO;QACL,SAAS,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM;YACjC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAA;gBACzC,MAAM,OAAO,GACX,QAAQ,KAAK,mBAAmB,IAAI,QAAQ,CAAC,QAAQ,CAAC,oBAAoB,CAAC;oBACzE,CAAC,CAAC,SAAS;oBACX,CAAC,CAAC,QAAQ,KAAK,kBAAkB,IAAI,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,CAAC;wBACzE,CAAC,CAAC,SAAS;wBACX,CAAC,CAAC,SAAS,CAAA;gBACjB,MAAM,GAAG,GAAG,OAAO;oBACjB,CAAC,CAAC,gCAAgC,OAAO,uBAAuB;oBAChE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAA;gBAC1C,IAAI,CAAC,GAAG,EAAE,CAAC;oBACT,QAAQ,CACN,IAAI,gBAAQ,CACV,iCAAiC,EACjC,iFAAiF,CAClF,CACF,CAAA;oBACD,OAAM;gBACR,CAAC;gBACD,IAAI,CAAC;oBACH,QAAQ,GAAG,IAAA,8CAA0B,EAAC,GAAG,CAAC,CAAA;gBAC5C,CAAC;gBAAC,MAAM,CAAC;oBACP,QAA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