agentplugged 0.0.0-stage → 1.0.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/LICENSE +110 -0
- package/LICENSE-METHOD +21 -0
- package/README.md +250 -2
- package/dist/agent-commands.js +46532 -0
- package/dist/bin.js +13 -0
- package/dist/cli.js +44 -0
- package/dist/esm.js +920 -0
- package/dist/forge-follow.js +231 -0
- package/dist/helpers.js +18526 -0
- package/dist/helpers2.js +1 -0
- package/dist/launcher-env.js +13 -0
- package/dist/launcher.js +308 -0
- package/dist/libsodium-wrappers.js +4384 -0
- package/dist/libsodium-wrappers2.js +4384 -0
- package/dist/main.js +17732 -0
- package/dist/method/LICENSE +21 -0
- package/dist/method/agents/alex/SKILL.md +87 -0
- package/dist/method/agents/alex/agent.yaml +94 -0
- package/dist/method/agents/chloe/SKILL.md +97 -0
- package/dist/method/agents/chloe/agent.yaml +87 -0
- package/dist/method/agents/ethan/SKILL.md +55 -0
- package/dist/method/agents/ethan/agent.yaml +94 -0
- package/dist/method/agents/hugo/SKILL.md +52 -0
- package/dist/method/agents/hugo/agent.yaml +93 -0
- package/dist/method/agents/iris/SKILL.md +69 -0
- package/dist/method/agents/iris/agent.yaml +86 -0
- package/dist/method/agents/izzy/SKILL.md +137 -0
- package/dist/method/agents/izzy/agent.yaml +104 -0
- package/dist/method/agents/jade/SKILL.md +54 -0
- package/dist/method/agents/jade/agent.yaml +94 -0
- package/dist/method/agents/julien/SKILL.md +96 -0
- package/dist/method/agents/julien/agent.yaml +95 -0
- package/dist/method/agents/lina/SKILL.md +54 -0
- package/dist/method/agents/lina/agent.yaml +94 -0
- package/dist/method/agents/lou/SKILL.md +67 -0
- package/dist/method/agents/lou/agent.yaml +84 -0
- package/dist/method/agents/maya/SKILL.md +82 -0
- package/dist/method/agents/maya/agent.yaml +98 -0
- package/dist/method/agents/milo/SKILL.md +79 -0
- package/dist/method/agents/milo/agent.yaml +80 -0
- package/dist/method/agents/noah/SKILL.md +80 -0
- package/dist/method/agents/noah/agent.yaml +73 -0
- package/dist/method/agents/noah/references/conduct.md +98 -0
- package/dist/method/agents/noah/references/decisions.md +122 -0
- package/dist/method/agents/noah/references/environment.md +72 -0
- package/dist/method/agents/noah/references/facts.md +13 -0
- package/dist/method/agents/noah/references/journey.md +80 -0
- package/dist/method/agents/noah/references/team.md +195 -0
- package/dist/method/agents/omar/SKILL.md +92 -0
- package/dist/method/agents/omar/agent.yaml +86 -0
- package/dist/method/agents/quentin/SKILL.md +78 -0
- package/dist/method/agents/quentin/agent.yaml +82 -0
- package/dist/method/agents/sam/SKILL.md +54 -0
- package/dist/method/agents/sam/agent.yaml +94 -0
- package/dist/method/agents/stella/SKILL.md +80 -0
- package/dist/method/agents/stella/agent.yaml +89 -0
- package/dist/method/agents/tess/SKILL.md +64 -0
- package/dist/method/agents/tess/agent.yaml +94 -0
- package/dist/method/agents/zoe/SKILL.md +85 -0
- package/dist/method/agents/zoe/agent.yaml +91 -0
- package/dist/method/doctor.yaml +1029 -0
- package/dist/method/models.yaml +73 -0
- package/dist/method/skills/.gitkeep +0 -0
- package/dist/method/skills/acceptance-qa/SKILL.md +40 -0
- package/dist/method/skills/acceptance-qa/references/run.md +54 -0
- package/dist/method/skills/acceptance-qa/references/scenarios.md +32 -0
- package/dist/method/skills/acceptance-qa/references/verdicts.md +43 -0
- package/dist/method/skills/api-e2e-tests/SKILL.md +61 -0
- package/dist/method/skills/api-e2e-tests/references/ci.md +33 -0
- package/dist/method/skills/api-e2e-tests/references/frameworks.md +58 -0
- package/dist/method/skills/api-e2e-tests/references/generate.md +67 -0
- package/dist/method/skills/audit-pillars/SKILL.md +28 -0
- package/dist/method/skills/audit-pillars/references/accessibility.md +13 -0
- package/dist/method/skills/audit-pillars/references/architecture.md +13 -0
- package/dist/method/skills/audit-pillars/references/dependencies.md +13 -0
- package/dist/method/skills/audit-pillars/references/format.md +20 -0
- package/dist/method/skills/audit-pillars/references/interface.md +13 -0
- package/dist/method/skills/audit-pillars/references/method.md +33 -0
- package/dist/method/skills/audit-pillars/references/performance.md +17 -0
- package/dist/method/skills/audit-pillars/references/quality.md +11 -0
- package/dist/method/skills/audit-pillars/references/security.md +13 -0
- package/dist/method/skills/audit-pillars/references/tests.md +17 -0
- package/dist/method/skills/chain-stories/SKILL.md +30 -0
- package/dist/method/skills/chain-stories/references/attempts.md +19 -0
- package/dist/method/skills/chain-stories/references/stops.md +27 -0
- package/dist/method/skills/check-readiness/SKILL.md +34 -0
- package/dist/method/skills/check-readiness/references/judge.md +21 -0
- package/dist/method/skills/check-readiness/references/settle.md +17 -0
- package/dist/method/skills/check-requirements/SKILL.md +97 -0
- package/dist/method/skills/check-requirements/references/engine-proofs.md +43 -0
- package/dist/method/skills/check-requirements/references/proofs-and-gaps.md +45 -0
- package/dist/method/skills/correct-course/SKILL.md +15 -0
- package/dist/method/skills/correct-course/references/gestures.md +20 -0
- package/dist/method/skills/correct-course/references/starts.md +18 -0
- package/dist/method/skills/correct-course/references/steps.md +14 -0
- package/dist/method/skills/critique-deliverable/SKILL.md +25 -0
- package/dist/method/skills/critique-deliverable/references/assumption-audit.md +11 -0
- package/dist/method/skills/critique-deliverable/references/choose.md +27 -0
- package/dist/method/skills/critique-deliverable/references/compare-existing.md +13 -0
- package/dist/method/skills/critique-deliverable/references/devils-advocate.md +13 -0
- package/dist/method/skills/critique-deliverable/references/divergence.md +15 -0
- package/dist/method/skills/critique-deliverable/references/domain-expert.md +14 -0
- package/dist/method/skills/critique-deliverable/references/extreme-user.md +13 -0
- package/dist/method/skills/critique-deliverable/references/failure-modes.md +13 -0
- package/dist/method/skills/critique-deliverable/references/first-principles.md +12 -0
- package/dist/method/skills/critique-deliverable/references/format.md +25 -0
- package/dist/method/skills/critique-deliverable/references/gestures.md +24 -0
- package/dist/method/skills/critique-deliverable/references/inversion.md +13 -0
- package/dist/method/skills/critique-deliverable/references/judgment.md +14 -0
- package/dist/method/skills/critique-deliverable/references/pre-mortem.md +12 -0
- package/dist/method/skills/critique-deliverable/references/reconcile.md +15 -0
- package/dist/method/skills/critique-deliverable/references/red-team.md +12 -0
- package/dist/method/skills/critique-deliverable/references/reframe.md +12 -0
- package/dist/method/skills/critique-deliverable/references/second-order.md +12 -0
- package/dist/method/skills/critique-deliverable/references/socratic.md +15 -0
- package/dist/method/skills/critique-deliverable/references/steelman.md +13 -0
- package/dist/method/skills/critique-deliverable/references/subtraction.md +12 -0
- package/dist/method/skills/deep-research/SKILL.md +43 -0
- package/dist/method/skills/deep-research/assets/page-template.md +37 -0
- package/dist/method/skills/deep-research/references/candidates.md +29 -0
- package/dist/method/skills/deep-research/references/external.md +37 -0
- package/dist/method/skills/deep-research/references/page-format.md +51 -0
- package/dist/method/skills/deep-research/references/types.md +31 -0
- package/dist/method/skills/develop-story/SKILL.md +211 -0
- package/dist/method/skills/develop-story/evals/cases.yaml +45 -0
- package/dist/method/skills/develop-story/references/acceptance-tests.md +73 -0
- package/dist/method/skills/develop-story/references/self-check.md +46 -0
- package/dist/method/skills/diagnose-bug/SKILL.md +73 -0
- package/dist/method/skills/diagnose-bug/references/hypotheses.md +45 -0
- package/dist/method/skills/diagnose-bug/references/probes.md +40 -0
- package/dist/method/skills/generate-knowledge-base/SKILL.md +251 -0
- package/dist/method/skills/generate-knowledge-base/assets/guide-template.md +49 -0
- package/dist/method/skills/generate-knowledge-base/assets/index-template.md +58 -0
- package/dist/method/skills/generate-knowledge-base/assets/page-template.md +61 -0
- package/dist/method/skills/generate-knowledge-base/assets/release-notes-template.md +38 -0
- package/dist/method/skills/generate-knowledge-base/references/kb-checklist.md +49 -0
- package/dist/method/skills/generate-knowledge-base/references/living-docs.md +81 -0
- package/dist/method/skills/generate-knowledge-base/references/repository-scan.md +48 -0
- package/dist/method/skills/generate-knowledge-base/references/reuse-map.md +21 -0
- package/dist/method/skills/ideation/SKILL.md +44 -0
- package/dist/method/skills/ideation/assets/session-template.md +46 -0
- package/dist/method/skills/ideation/references/choose.md +21 -0
- package/dist/method/skills/ideation/references/close.md +17 -0
- package/dist/method/skills/ideation/references/converge.md +24 -0
- package/dist/method/skills/ideation/references/gestures.md +15 -0
- package/dist/method/skills/ideation/references/stances.md +21 -0
- package/dist/method/skills/ideation/references/techniques-borrowed.md +8 -0
- package/dist/method/skills/ideation/references/techniques-deep.md +12 -0
- package/dist/method/skills/ideation/references/techniques-frames.md +12 -0
- package/dist/method/skills/ideation/references/techniques-futures.md +8 -0
- package/dist/method/skills/ideation/references/techniques-limits.md +9 -0
- package/dist/method/skills/ideation/references/techniques-people.md +7 -0
- package/dist/method/skills/ideation/references/techniques-sparks.md +10 -0
- package/dist/method/skills/ideation/references/techniques-together.md +11 -0
- package/dist/method/skills/improve-code/SKILL.md +74 -0
- package/dist/method/skills/improve-code/references/axes.md +45 -0
- package/dist/method/skills/improve-session/SKILL.md +47 -0
- package/dist/method/skills/order-merges/SKILL.md +71 -0
- package/dist/method/skills/pitch/SKILL.md +40 -0
- package/dist/method/skills/pitch/assets/deck-template.md +31 -0
- package/dist/method/skills/pitch/assets/design-template.md +45 -0
- package/dist/method/skills/pitch/assets/narrative-template.md +40 -0
- package/dist/method/skills/pitch/references/deck-types.md +17 -0
- package/dist/method/skills/pitch/references/deck.md +24 -0
- package/dist/method/skills/pitch/references/design-implementation.md +25 -0
- package/dist/method/skills/pitch/references/design-methods.md +45 -0
- package/dist/method/skills/pitch/references/design-thinking.md +28 -0
- package/dist/method/skills/pitch/references/story-frameworks.md +39 -0
- package/dist/method/skills/pitch/references/story.md +22 -0
- package/dist/method/skills/plan-sprint/SKILL.md +162 -0
- package/dist/method/skills/quick-lane/SKILL.md +143 -0
- package/dist/method/skills/resolve-merge-conflict/SKILL.md +83 -0
- package/dist/method/skills/review-story/SKILL.md +96 -0
- package/dist/method/skills/review-story/evals/cases.yaml +59 -0
- package/dist/method/skills/review-story/references/amend-story.md +16 -0
- package/dist/method/skills/review-story/references/export.md +20 -0
- package/dist/method/skills/review-story/references/format.md +33 -0
- package/dist/method/skills/review-story/references/free-review.md +22 -0
- package/dist/method/skills/review-story/references/judge.md +44 -0
- package/dist/method/skills/review-story/references/lens-adversarial.md +15 -0
- package/dist/method/skills/review-story/references/lens-edge-cases.md +24 -0
- package/dist/method/skills/review-story/references/lens-prose.md +11 -0
- package/dist/method/skills/review-story/references/lens-relevance.md +13 -0
- package/dist/method/skills/review-story/references/lens-security.md +10 -0
- package/dist/method/skills/review-story/references/lens-structure.md +16 -0
- package/dist/method/skills/review-story/references/lens-verification-gaps.md +13 -0
- package/dist/method/skills/review-story/references/pass-assertions.md +17 -0
- package/dist/method/skills/review-story/references/pass-removals.md +13 -0
- package/dist/method/skills/review-tests/SKILL.md +32 -0
- package/dist/method/skills/review-tests/references/check.md +25 -0
- package/dist/method/skills/review-tests/references/grid.md +27 -0
- package/dist/method/skills/round-table/SKILL.md +31 -0
- package/dist/method/skills/round-table/evals/cases.yaml +27 -0
- package/dist/method/skills/round-table/references/cast.md +14 -0
- package/dist/method/skills/round-table/references/gestures.md +24 -0
- package/dist/method/skills/round-table/references/guests.md +17 -0
- package/dist/method/skills/round-table/references/independence.md +21 -0
- package/dist/method/skills/round-table/references/rooms.md +29 -0
- package/dist/method/skills/round-table/references/three-views.md +17 -0
- package/dist/method/skills/round-table/references/turns.md +19 -0
- package/dist/method/skills/run-retrospective/SKILL.md +201 -0
- package/dist/method/skills/security-review-architecture/SKILL.md +129 -0
- package/dist/method/skills/security-review-architecture/assets/architecture-review-template.md +47 -0
- package/dist/method/skills/security-review-architecture/references/spec-review.md +48 -0
- package/dist/method/skills/setup-ci/SKILL.md +121 -0
- package/dist/method/skills/setup-ci/assets/github-actions.yml +52 -0
- package/dist/method/skills/setup-ci/assets/gitlab-ci.yml +34 -0
- package/dist/method/skills/split-into-stories/SKILL.md +205 -0
- package/dist/method/skills/split-into-stories/assets/epic.md.tmpl +31 -0
- package/dist/method/skills/split-into-stories/assets/story.md.tmpl +36 -0
- package/dist/method/skills/strategy/SKILL.md +44 -0
- package/dist/method/skills/strategy/assets/innovation-template.md +60 -0
- package/dist/method/skills/strategy/assets/problem-template.md +54 -0
- package/dist/method/skills/strategy/references/costs.md +28 -0
- package/dist/method/skills/strategy/references/gestures.md +24 -0
- package/dist/method/skills/strategy/references/innovate-frameworks.md +48 -0
- package/dist/method/skills/strategy/references/innovate.md +40 -0
- package/dist/method/skills/strategy/references/solve-methods.md +45 -0
- package/dist/method/skills/strategy/references/solve.md +35 -0
- package/dist/method/skills/test-idea/SKILL.md +29 -0
- package/dist/method/skills/test-idea/assets/forge-template.md +27 -0
- package/dist/method/skills/test-idea/assets/prfaq-template.md +33 -0
- package/dist/method/skills/test-idea/references/bets.md +14 -0
- package/dist/method/skills/test-idea/references/concept.md +24 -0
- package/dist/method/skills/test-idea/references/faq.md +34 -0
- package/dist/method/skills/test-idea/references/forge.md +36 -0
- package/dist/method/skills/test-idea/references/personas.md +23 -0
- package/dist/method/skills/test-idea/references/prfaq.md +33 -0
- package/dist/method/skills/test-idea/references/verdict.md +26 -0
- package/dist/method/skills/workshop/SKILL.md +40 -0
- package/dist/method/skills/workshop/references/analyze.md +36 -0
- package/dist/method/skills/workshop/references/create.md +45 -0
- package/dist/method/skills/workshop/references/customize.md +45 -0
- package/dist/method/skills/workshop/references/evaluate.md +44 -0
- package/dist/method/skills/workshop/references/rules.md +35 -0
- package/dist/method/skills/write-architecture/SKILL.md +233 -0
- package/dist/method/skills/write-architecture/assets/architecture-template.md +110 -0
- package/dist/method/skills/write-architecture/references/guard.md +40 -0
- package/dist/method/skills/write-architecture/references/self-check.md +47 -0
- package/dist/method/skills/write-brand/SKILL.md +36 -0
- package/dist/method/skills/write-brand/assets/brand-template.md +59 -0
- package/dist/method/skills/write-brand/assets/identity-page.html +141 -0
- package/dist/method/skills/write-brand/assets/identity-template.md +132 -0
- package/dist/method/skills/write-brand/references/identity.md +38 -0
- package/dist/method/skills/write-brand/references/platform.md +29 -0
- package/dist/method/skills/write-brand/references/rules.md +43 -0
- package/dist/method/skills/write-brief/SKILL.md +171 -0
- package/dist/method/skills/write-brief/assets/brief-template.md +87 -0
- package/dist/method/skills/write-brief/assets/research-note-template.md +43 -0
- package/dist/method/skills/write-brief/references/brief-checklist.md +37 -0
- package/dist/method/skills/write-content/SKILL.md +233 -0
- package/dist/method/skills/write-content/assets/campaign-template.md +94 -0
- package/dist/method/skills/write-content/assets/content-template.md +76 -0
- package/dist/method/skills/write-content/references/content-checklist.md +67 -0
- package/dist/method/skills/write-positioning/SKILL.md +218 -0
- package/dist/method/skills/write-positioning/assets/page-template.md +85 -0
- package/dist/method/skills/write-positioning/assets/positioning-template.md +79 -0
- package/dist/method/skills/write-positioning/references/positioning-checklist.md +44 -0
- package/dist/method/skills/write-positioning/references/seo-checklist.md +62 -0
- package/dist/method/skills/write-prd/SKILL.md +204 -0
- package/dist/method/skills/write-prd/assets/prd-template.md +121 -0
- package/dist/method/skills/write-prd/evals/cases.yaml +46 -0
- package/dist/method/skills/write-prd/references/prd-checklist.md +68 -0
- package/dist/method/skills/write-sales/SKILL.md +236 -0
- package/dist/method/skills/write-sales/assets/offer-template.md +93 -0
- package/dist/method/skills/write-sales/assets/sequence-template.md +110 -0
- package/dist/method/skills/write-sales/references/before-you-send.md +54 -0
- package/dist/method/skills/write-sales/references/sales-checklist.md +71 -0
- package/dist/method/skills/write-spec/SKILL.md +25 -0
- package/dist/method/skills/write-spec/assets/spec-template.md +59 -0
- package/dist/method/skills/write-spec/references/spec-guide.md +47 -0
- package/dist/method/skills/write-ux-spec/SKILL.md +191 -0
- package/dist/method/skills/write-ux-spec/assets/mockup-page.html +36 -0
- package/dist/method/skills/write-ux-spec/assets/ux-template.md +206 -0
- package/dist/method/skills/write-ux-spec/references/accessibility-check.md +74 -0
- package/dist/method/skills/write-ux-spec/references/mockups.md +71 -0
- package/dist/method/skills/write-ux-spec/references/tokens-and-sketches.md +83 -0
- package/dist/method/skills/write-ux-spec/references/ux-checklist.md +74 -0
- package/dist/product-root.js +21527 -0
- package/dist/rolldown-runtime.js +38 -0
- package/dist/webauthn-verify.js +1 -0
- package/dist/webauthn-verify2.js +107 -0
- package/dist/webauthn.js +9798 -0
- package/package.json +68 -3
package/dist/esm.js
ADDED
|
@@ -0,0 +1,920 @@
|
|
|
1
|
+
import { a as __toCommonJS, t as __commonJSMin } from "./rolldown-runtime.js";
|
|
2
|
+
import { C as require_cjs$1, E as PQCNotSupportedError, M as isBase64URL, N as toBuffer, S as require_cjs$2, T as tslib_es6_exports, b as concat, c as parseAuthenticatorData, f as decodeCredentialPublicKey, i as verifySignature, j as isPQCCOSEAlg, k as COSEKEYS, m as decodeClientDataJSON, n as SettingsService, o as toHash, t as verifyMDSBlob, u as fetch, v as convertAAGUIDToString, w as init_tslib_es6, x as fromASCIIString, y as areEqual } from "./helpers.js";
|
|
3
|
+
//#region ../../node_modules/.pnpm/@simplewebauthn+server@14.0.3/node_modules/@simplewebauthn/server/esm/helpers/parseBackupFlags.js
|
|
4
|
+
/**
|
|
5
|
+
* Make sense of Bits 3 and 4 in authenticator indicating:
|
|
6
|
+
*
|
|
7
|
+
* - Whether the credential can be used on multiple devices
|
|
8
|
+
* - Whether the credential is backed up or not
|
|
9
|
+
*
|
|
10
|
+
* Invalid configurations will raise an `Error`
|
|
11
|
+
*/
|
|
12
|
+
function parseBackupFlags({ be, bs }) {
|
|
13
|
+
const credentialBackedUp = bs;
|
|
14
|
+
let credentialDeviceType = "singleDevice";
|
|
15
|
+
if (be) credentialDeviceType = "multiDevice";
|
|
16
|
+
if (credentialDeviceType === "singleDevice" && credentialBackedUp) throw new InvalidBackupFlags("Single-device credential indicated that it was backed up, which should be impossible.");
|
|
17
|
+
return {
|
|
18
|
+
credentialDeviceType,
|
|
19
|
+
credentialBackedUp
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
var InvalidBackupFlags = class extends Error {
|
|
23
|
+
constructor(message) {
|
|
24
|
+
super(message);
|
|
25
|
+
this.name = "InvalidBackupFlags";
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region ../../node_modules/.pnpm/@simplewebauthn+server@14.0.3/node_modules/@simplewebauthn/server/esm/helpers/matchExpectedRPID.js
|
|
30
|
+
/**
|
|
31
|
+
* Go through each expected RP ID and try to find one that matches. Returns the unhashed RP ID
|
|
32
|
+
* that matched the hash in the response.
|
|
33
|
+
*
|
|
34
|
+
* Raises an `UnexpectedRPIDHash` error if no match is found
|
|
35
|
+
*/
|
|
36
|
+
async function matchExpectedRPID(rpIDHash, expectedRPIDs) {
|
|
37
|
+
try {
|
|
38
|
+
return await Promise.any(expectedRPIDs.map((expected) => {
|
|
39
|
+
return new Promise((resolve, reject) => {
|
|
40
|
+
toHash(fromASCIIString(expected)).then((expectedRPIDHash) => {
|
|
41
|
+
if (areEqual(rpIDHash, expectedRPIDHash)) resolve(expected);
|
|
42
|
+
else reject();
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}));
|
|
46
|
+
} catch (err) {
|
|
47
|
+
if (err.name === "AggregateError") throw new UnexpectedRPIDHash();
|
|
48
|
+
throw err;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
var UnexpectedRPIDHash = class extends Error {
|
|
52
|
+
constructor() {
|
|
53
|
+
super("Unexpected RP ID hash");
|
|
54
|
+
this.name = "UnexpectedRPIDHash";
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
require_cjs$1();
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region ../../node_modules/.pnpm/@simplewebauthn+server@14.0.3/node_modules/@simplewebauthn/server/esm/helpers/logging.js
|
|
60
|
+
/**
|
|
61
|
+
* A logger instance that doesn't do anything. Useful as a default argument when no custom instance
|
|
62
|
+
* of the `SimpleWebAuthnLogger` interface is specified.
|
|
63
|
+
*/
|
|
64
|
+
const DefaultNoopLogger = {
|
|
65
|
+
debug() {},
|
|
66
|
+
info() {},
|
|
67
|
+
warn() {},
|
|
68
|
+
error() {}
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Generate an instance of SimpleWebAuthnLogger that defines all methods. Any logging method not
|
|
72
|
+
* defined on `logger` will be a no-op.
|
|
73
|
+
*/
|
|
74
|
+
function buildLoggerAllMethods(logger) {
|
|
75
|
+
const toReturn = { ...DefaultNoopLogger };
|
|
76
|
+
if (logger.debug) toReturn.debug = logger.debug;
|
|
77
|
+
if (logger.info) toReturn.info = logger.info;
|
|
78
|
+
if (logger.warn) toReturn.warn = logger.warn;
|
|
79
|
+
if (logger.error) toReturn.error = logger.error;
|
|
80
|
+
return toReturn;
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region ../../node_modules/.pnpm/@simplewebauthn+server@14.0.3/node_modules/@simplewebauthn/server/esm/services/metadataService.js
|
|
84
|
+
/**
|
|
85
|
+
* An instance of `CachedMDS` that will not trigger attempts to refresh the associated entry's blob
|
|
86
|
+
*/
|
|
87
|
+
const NonRefreshingMDS = {
|
|
88
|
+
url: "",
|
|
89
|
+
no: 0,
|
|
90
|
+
nextUpdate: /* @__PURE__ */ new Date(0)
|
|
91
|
+
};
|
|
92
|
+
const defaultURLMDS = "https://mds.fidoalliance.org/";
|
|
93
|
+
var SERVICE_STATE;
|
|
94
|
+
(function(SERVICE_STATE) {
|
|
95
|
+
SERVICE_STATE[SERVICE_STATE["DISABLED"] = 0] = "DISABLED";
|
|
96
|
+
SERVICE_STATE[SERVICE_STATE["REFRESHING"] = 1] = "REFRESHING";
|
|
97
|
+
SERVICE_STATE[SERVICE_STATE["READY"] = 2] = "READY";
|
|
98
|
+
})(SERVICE_STATE || (SERVICE_STATE = {}));
|
|
99
|
+
/**
|
|
100
|
+
* An implementation of `MetadataService` that can download and parse BLOBs, and support on-demand
|
|
101
|
+
* requesting and caching of individual metadata statements.
|
|
102
|
+
*
|
|
103
|
+
* https://fidoalliance.org/metadata/
|
|
104
|
+
*/
|
|
105
|
+
var BaseMetadataService = class {
|
|
106
|
+
constructor() {
|
|
107
|
+
Object.defineProperty(this, "mdsCache", {
|
|
108
|
+
enumerable: true,
|
|
109
|
+
configurable: true,
|
|
110
|
+
writable: true,
|
|
111
|
+
value: {}
|
|
112
|
+
});
|
|
113
|
+
Object.defineProperty(this, "statementCache", {
|
|
114
|
+
enumerable: true,
|
|
115
|
+
configurable: true,
|
|
116
|
+
writable: true,
|
|
117
|
+
value: {}
|
|
118
|
+
});
|
|
119
|
+
Object.defineProperty(this, "state", {
|
|
120
|
+
enumerable: true,
|
|
121
|
+
configurable: true,
|
|
122
|
+
writable: true,
|
|
123
|
+
value: SERVICE_STATE.DISABLED
|
|
124
|
+
});
|
|
125
|
+
Object.defineProperty(this, "verificationMode", {
|
|
126
|
+
enumerable: true,
|
|
127
|
+
configurable: true,
|
|
128
|
+
writable: true,
|
|
129
|
+
value: "strict"
|
|
130
|
+
});
|
|
131
|
+
Object.defineProperty(this, "logger", {
|
|
132
|
+
enumerable: true,
|
|
133
|
+
configurable: true,
|
|
134
|
+
writable: true,
|
|
135
|
+
value: DefaultNoopLogger
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
async initialize(opts = {}) {
|
|
139
|
+
this.statementCache = {};
|
|
140
|
+
const { mdsServers = [defaultURLMDS], statements, verificationMode, logger = DefaultNoopLogger } = opts;
|
|
141
|
+
this.logger = buildLoggerAllMethods(logger);
|
|
142
|
+
this.setState(SERVICE_STATE.REFRESHING);
|
|
143
|
+
/**
|
|
144
|
+
* If metadata statements are provided, load them into the cache first. These statements will
|
|
145
|
+
* not be refreshed when a stale one is detected.
|
|
146
|
+
*/
|
|
147
|
+
if (statements?.length) {
|
|
148
|
+
let statementsAdded = 0;
|
|
149
|
+
statements.forEach((statement) => {
|
|
150
|
+
if (statement.aaguid) {
|
|
151
|
+
this.statementCache[statement.aaguid] = {
|
|
152
|
+
entry: {
|
|
153
|
+
metadataStatement: statement,
|
|
154
|
+
statusReports: [],
|
|
155
|
+
timeOfLastStatusChange: "1970-01-01"
|
|
156
|
+
},
|
|
157
|
+
url: NonRefreshingMDS.url
|
|
158
|
+
};
|
|
159
|
+
statementsAdded += 1;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
this.logger.info(`Cached ${statementsAdded} local statements`);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* If MDS servers are provided, then download blobs from them, verify them, and then add their
|
|
166
|
+
* entries to the cache. Blobs loaded in this way will be refreshed when a stale entry within is
|
|
167
|
+
* detected.
|
|
168
|
+
*/
|
|
169
|
+
if (mdsServers?.length) {
|
|
170
|
+
const currentCacheCount = Object.keys(this.statementCache).length;
|
|
171
|
+
let numServers = mdsServers.length;
|
|
172
|
+
for (const url of mdsServers) try {
|
|
173
|
+
const cachedMDS = {
|
|
174
|
+
url,
|
|
175
|
+
no: 0,
|
|
176
|
+
nextUpdate: /* @__PURE__ */ new Date(0)
|
|
177
|
+
};
|
|
178
|
+
const blob = await this.downloadBlob(cachedMDS);
|
|
179
|
+
await this.verifyBlob(blob, cachedMDS);
|
|
180
|
+
} catch (err) {
|
|
181
|
+
this.logger.error(`Could not download BLOB from ${url}:`, err);
|
|
182
|
+
numServers -= 1;
|
|
183
|
+
}
|
|
184
|
+
const cacheDiff = Object.keys(this.statementCache).length - currentCacheCount;
|
|
185
|
+
this.logger.info(`Cached ${cacheDiff} statements from ${numServers} metadata server(s)`);
|
|
186
|
+
}
|
|
187
|
+
if (verificationMode) this.verificationMode = verificationMode;
|
|
188
|
+
this.setState(SERVICE_STATE.READY);
|
|
189
|
+
}
|
|
190
|
+
async getStatement(aaguid) {
|
|
191
|
+
if (this.state === SERVICE_STATE.DISABLED) return;
|
|
192
|
+
if (!aaguid) return;
|
|
193
|
+
if (aaguid instanceof Uint8Array) aaguid = convertAAGUIDToString(aaguid);
|
|
194
|
+
await this.pauseUntilReady();
|
|
195
|
+
const cachedStatement = this.statementCache[aaguid];
|
|
196
|
+
if (!cachedStatement) {
|
|
197
|
+
if (this.verificationMode === "strict") throw new Error(`No metadata statement found for aaguid "${aaguid}"`);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (cachedStatement.url) {
|
|
201
|
+
const mds = this.mdsCache[cachedStatement.url];
|
|
202
|
+
if (/* @__PURE__ */ new Date() > mds.nextUpdate) try {
|
|
203
|
+
this.setState(SERVICE_STATE.REFRESHING);
|
|
204
|
+
const blob = await this.downloadBlob(mds);
|
|
205
|
+
await this.verifyBlob(blob, mds);
|
|
206
|
+
} finally {
|
|
207
|
+
this.setState(SERVICE_STATE.READY);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
const { entry } = cachedStatement;
|
|
211
|
+
for (const report of entry.statusReports) {
|
|
212
|
+
const { status } = report;
|
|
213
|
+
if (status === "USER_VERIFICATION_BYPASS" || status === "ATTESTATION_KEY_COMPROMISE" || status === "USER_KEY_REMOTE_COMPROMISE" || status === "USER_KEY_PHYSICAL_COMPROMISE") throw new Error(`Detected compromised aaguid "${aaguid}"`);
|
|
214
|
+
}
|
|
215
|
+
return entry.metadataStatement;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Download and process the latest BLOB from MDS
|
|
219
|
+
*/
|
|
220
|
+
async downloadBlob(cachedMDS) {
|
|
221
|
+
const { url } = cachedMDS;
|
|
222
|
+
return await (await fetch(url)).text();
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Verify and process the MDS metadata blob
|
|
226
|
+
*/
|
|
227
|
+
async verifyBlob(blob, cachedMDS) {
|
|
228
|
+
const { url, no } = cachedMDS;
|
|
229
|
+
const { payload, parsedNextUpdate } = await verifyMDSBlob(blob);
|
|
230
|
+
if (payload.no <= no) throw new Error(`Latest BLOB no. ${payload.no} is not greater than previous no. ${no}`);
|
|
231
|
+
for (const entry of payload.entries) if (entry.aaguid) this.statementCache[entry.aaguid] = {
|
|
232
|
+
entry,
|
|
233
|
+
url
|
|
234
|
+
};
|
|
235
|
+
if (url) this.mdsCache[url] = {
|
|
236
|
+
...cachedMDS,
|
|
237
|
+
no: payload.no,
|
|
238
|
+
nextUpdate: parsedNextUpdate
|
|
239
|
+
};
|
|
240
|
+
else if (parsedNextUpdate < /* @__PURE__ */ new Date()) this.logger.warn(`⚠️ This MDS blob (serial: ${payload.no}) contains stale data as of ${parsedNextUpdate.toISOString()}. Please consider re-initializing MetadataService with a newer MDS blob.`);
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* A helper method to pause execution until the service is ready
|
|
244
|
+
*/
|
|
245
|
+
pauseUntilReady() {
|
|
246
|
+
if (this.state === SERVICE_STATE.READY) return new Promise((resolve) => {
|
|
247
|
+
resolve();
|
|
248
|
+
});
|
|
249
|
+
return new Promise((resolve, reject) => {
|
|
250
|
+
const totalTimeoutMS = 7e4;
|
|
251
|
+
const intervalMS = 100;
|
|
252
|
+
let iterations = totalTimeoutMS / intervalMS;
|
|
253
|
+
const intervalID = globalThis.setInterval(() => {
|
|
254
|
+
if (iterations < 1) {
|
|
255
|
+
clearInterval(intervalID);
|
|
256
|
+
reject(`State did not become ready in ${totalTimeoutMS / 1e3} seconds`);
|
|
257
|
+
} else if (this.state === SERVICE_STATE.READY) {
|
|
258
|
+
clearInterval(intervalID);
|
|
259
|
+
resolve();
|
|
260
|
+
}
|
|
261
|
+
iterations -= 1;
|
|
262
|
+
}, intervalMS);
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Report service status on change
|
|
267
|
+
*/
|
|
268
|
+
setState(newState) {
|
|
269
|
+
this.state = newState;
|
|
270
|
+
if (newState === SERVICE_STATE.DISABLED) this.logger.debug("MetadataService is DISABLED");
|
|
271
|
+
else if (newState === SERVICE_STATE.REFRESHING) this.logger.debug("MetadataService is REFRESHING");
|
|
272
|
+
else if (newState === SERVICE_STATE.READY) this.logger.debug("MetadataService is READY");
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
new BaseMetadataService();
|
|
276
|
+
require_cjs$2();
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region ../../node_modules/.pnpm/@peculiar+asn1-android@2.11.0/node_modules/@peculiar/asn1-android/build/cjs/key_description.js
|
|
279
|
+
var require_key_description = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
280
|
+
var IntegerSet_1;
|
|
281
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
282
|
+
exports.KeyMintKeyDescription = exports.KeyDescription = exports.Version = exports.SecurityLevel = exports.AuthorizationList = exports.IntegerSet = exports.RootOfTrust = exports.VerifiedBootState = exports.id_ce_keyDescription = void 0;
|
|
283
|
+
const tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
284
|
+
const asn1_schema_1 = require_cjs$1();
|
|
285
|
+
exports.id_ce_keyDescription = "1.3.6.1.4.1.11129.2.1.17";
|
|
286
|
+
var VerifiedBootState;
|
|
287
|
+
(function(VerifiedBootState) {
|
|
288
|
+
VerifiedBootState[VerifiedBootState["verified"] = 0] = "verified";
|
|
289
|
+
VerifiedBootState[VerifiedBootState["selfSigned"] = 1] = "selfSigned";
|
|
290
|
+
VerifiedBootState[VerifiedBootState["unverified"] = 2] = "unverified";
|
|
291
|
+
VerifiedBootState[VerifiedBootState["failed"] = 3] = "failed";
|
|
292
|
+
})(VerifiedBootState || (exports.VerifiedBootState = VerifiedBootState = {}));
|
|
293
|
+
var RootOfTrust = class {
|
|
294
|
+
verifiedBootKey = new asn1_schema_1.OctetString();
|
|
295
|
+
deviceLocked = false;
|
|
296
|
+
verifiedBootState = VerifiedBootState.verified;
|
|
297
|
+
verifiedBootHash;
|
|
298
|
+
constructor(params = {}) {
|
|
299
|
+
Object.assign(this, params);
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
exports.RootOfTrust = RootOfTrust;
|
|
303
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })], RootOfTrust.prototype, "verifiedBootKey", void 0);
|
|
304
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Boolean })], RootOfTrust.prototype, "deviceLocked", void 0);
|
|
305
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })], RootOfTrust.prototype, "verifiedBootState", void 0);
|
|
306
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
307
|
+
type: asn1_schema_1.OctetString,
|
|
308
|
+
optional: true
|
|
309
|
+
})], RootOfTrust.prototype, "verifiedBootHash", void 0);
|
|
310
|
+
let IntegerSet = IntegerSet_1 = class IntegerSet extends asn1_schema_1.AsnArray {
|
|
311
|
+
constructor(items) {
|
|
312
|
+
super(items);
|
|
313
|
+
Object.setPrototypeOf(this, IntegerSet_1.prototype);
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
exports.IntegerSet = IntegerSet;
|
|
317
|
+
exports.IntegerSet = IntegerSet = IntegerSet_1 = tslib_1.__decorate([(0, asn1_schema_1.AsnType)({
|
|
318
|
+
type: asn1_schema_1.AsnTypeTypes.Set,
|
|
319
|
+
itemType: asn1_schema_1.AsnPropTypes.Integer
|
|
320
|
+
})], IntegerSet);
|
|
321
|
+
var AuthorizationList = class {
|
|
322
|
+
purpose;
|
|
323
|
+
algorithm;
|
|
324
|
+
keySize;
|
|
325
|
+
digest;
|
|
326
|
+
padding;
|
|
327
|
+
ecCurve;
|
|
328
|
+
rsaPublicExponent;
|
|
329
|
+
mgfDigest;
|
|
330
|
+
rollbackResistance;
|
|
331
|
+
earlyBootOnly;
|
|
332
|
+
activeDateTime;
|
|
333
|
+
originationExpireDateTime;
|
|
334
|
+
usageExpireDateTime;
|
|
335
|
+
usageCountLimit;
|
|
336
|
+
noAuthRequired;
|
|
337
|
+
userAuthType;
|
|
338
|
+
authTimeout;
|
|
339
|
+
allowWhileOnBody;
|
|
340
|
+
trustedUserPresenceRequired;
|
|
341
|
+
trustedConfirmationRequired;
|
|
342
|
+
unlockedDeviceRequired;
|
|
343
|
+
allApplications;
|
|
344
|
+
applicationId;
|
|
345
|
+
creationDateTime;
|
|
346
|
+
origin;
|
|
347
|
+
rollbackResistant;
|
|
348
|
+
rootOfTrust;
|
|
349
|
+
osVersion;
|
|
350
|
+
osPatchLevel;
|
|
351
|
+
attestationApplicationId;
|
|
352
|
+
attestationIdBrand;
|
|
353
|
+
attestationIdDevice;
|
|
354
|
+
attestationIdProduct;
|
|
355
|
+
attestationIdSerial;
|
|
356
|
+
attestationIdImei;
|
|
357
|
+
attestationIdMeid;
|
|
358
|
+
attestationIdManufacturer;
|
|
359
|
+
attestationIdModel;
|
|
360
|
+
vendorPatchLevel;
|
|
361
|
+
bootPatchLevel;
|
|
362
|
+
deviceUniqueAttestation;
|
|
363
|
+
attestationIdSecondImei;
|
|
364
|
+
moduleHash;
|
|
365
|
+
constructor(params = {}) {
|
|
366
|
+
Object.assign(this, params);
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
exports.AuthorizationList = AuthorizationList;
|
|
370
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
371
|
+
context: 1,
|
|
372
|
+
type: IntegerSet,
|
|
373
|
+
optional: true
|
|
374
|
+
})], AuthorizationList.prototype, "purpose", void 0);
|
|
375
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
376
|
+
context: 2,
|
|
377
|
+
type: asn1_schema_1.AsnPropTypes.Integer,
|
|
378
|
+
optional: true
|
|
379
|
+
})], AuthorizationList.prototype, "algorithm", void 0);
|
|
380
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
381
|
+
context: 3,
|
|
382
|
+
type: asn1_schema_1.AsnPropTypes.Integer,
|
|
383
|
+
optional: true
|
|
384
|
+
})], AuthorizationList.prototype, "keySize", void 0);
|
|
385
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
386
|
+
context: 5,
|
|
387
|
+
type: IntegerSet,
|
|
388
|
+
optional: true
|
|
389
|
+
})], AuthorizationList.prototype, "digest", void 0);
|
|
390
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
391
|
+
context: 6,
|
|
392
|
+
type: IntegerSet,
|
|
393
|
+
optional: true
|
|
394
|
+
})], AuthorizationList.prototype, "padding", void 0);
|
|
395
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
396
|
+
context: 10,
|
|
397
|
+
type: asn1_schema_1.AsnPropTypes.Integer,
|
|
398
|
+
optional: true
|
|
399
|
+
})], AuthorizationList.prototype, "ecCurve", void 0);
|
|
400
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
401
|
+
context: 200,
|
|
402
|
+
type: asn1_schema_1.AsnPropTypes.Integer,
|
|
403
|
+
optional: true
|
|
404
|
+
})], AuthorizationList.prototype, "rsaPublicExponent", void 0);
|
|
405
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
406
|
+
context: 203,
|
|
407
|
+
type: IntegerSet,
|
|
408
|
+
optional: true
|
|
409
|
+
})], AuthorizationList.prototype, "mgfDigest", void 0);
|
|
410
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
411
|
+
context: 303,
|
|
412
|
+
type: asn1_schema_1.AsnPropTypes.Null,
|
|
413
|
+
optional: true
|
|
414
|
+
})], AuthorizationList.prototype, "rollbackResistance", void 0);
|
|
415
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
416
|
+
context: 305,
|
|
417
|
+
type: asn1_schema_1.AsnPropTypes.Null,
|
|
418
|
+
optional: true
|
|
419
|
+
})], AuthorizationList.prototype, "earlyBootOnly", void 0);
|
|
420
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
421
|
+
context: 400,
|
|
422
|
+
type: asn1_schema_1.AsnPropTypes.Integer,
|
|
423
|
+
optional: true
|
|
424
|
+
})], AuthorizationList.prototype, "activeDateTime", void 0);
|
|
425
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
426
|
+
context: 401,
|
|
427
|
+
type: asn1_schema_1.AsnPropTypes.Integer,
|
|
428
|
+
optional: true
|
|
429
|
+
})], AuthorizationList.prototype, "originationExpireDateTime", void 0);
|
|
430
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
431
|
+
context: 402,
|
|
432
|
+
type: asn1_schema_1.AsnPropTypes.Integer,
|
|
433
|
+
optional: true
|
|
434
|
+
})], AuthorizationList.prototype, "usageExpireDateTime", void 0);
|
|
435
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
436
|
+
context: 405,
|
|
437
|
+
type: asn1_schema_1.AsnPropTypes.Integer,
|
|
438
|
+
optional: true
|
|
439
|
+
})], AuthorizationList.prototype, "usageCountLimit", void 0);
|
|
440
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
441
|
+
context: 503,
|
|
442
|
+
type: asn1_schema_1.AsnPropTypes.Null,
|
|
443
|
+
optional: true
|
|
444
|
+
})], AuthorizationList.prototype, "noAuthRequired", void 0);
|
|
445
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
446
|
+
context: 504,
|
|
447
|
+
type: asn1_schema_1.AsnPropTypes.Integer,
|
|
448
|
+
optional: true
|
|
449
|
+
})], AuthorizationList.prototype, "userAuthType", void 0);
|
|
450
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
451
|
+
context: 505,
|
|
452
|
+
type: asn1_schema_1.AsnPropTypes.Integer,
|
|
453
|
+
optional: true
|
|
454
|
+
})], AuthorizationList.prototype, "authTimeout", void 0);
|
|
455
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
456
|
+
context: 506,
|
|
457
|
+
type: asn1_schema_1.AsnPropTypes.Null,
|
|
458
|
+
optional: true
|
|
459
|
+
})], AuthorizationList.prototype, "allowWhileOnBody", void 0);
|
|
460
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
461
|
+
context: 507,
|
|
462
|
+
type: asn1_schema_1.AsnPropTypes.Null,
|
|
463
|
+
optional: true
|
|
464
|
+
})], AuthorizationList.prototype, "trustedUserPresenceRequired", void 0);
|
|
465
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
466
|
+
context: 508,
|
|
467
|
+
type: asn1_schema_1.AsnPropTypes.Null,
|
|
468
|
+
optional: true
|
|
469
|
+
})], AuthorizationList.prototype, "trustedConfirmationRequired", void 0);
|
|
470
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
471
|
+
context: 509,
|
|
472
|
+
type: asn1_schema_1.AsnPropTypes.Null,
|
|
473
|
+
optional: true
|
|
474
|
+
})], AuthorizationList.prototype, "unlockedDeviceRequired", void 0);
|
|
475
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
476
|
+
context: 600,
|
|
477
|
+
type: asn1_schema_1.AsnPropTypes.Null,
|
|
478
|
+
optional: true
|
|
479
|
+
})], AuthorizationList.prototype, "allApplications", void 0);
|
|
480
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
481
|
+
context: 601,
|
|
482
|
+
type: asn1_schema_1.OctetString,
|
|
483
|
+
optional: true
|
|
484
|
+
})], AuthorizationList.prototype, "applicationId", void 0);
|
|
485
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
486
|
+
context: 701,
|
|
487
|
+
type: asn1_schema_1.AsnPropTypes.Integer,
|
|
488
|
+
optional: true
|
|
489
|
+
})], AuthorizationList.prototype, "creationDateTime", void 0);
|
|
490
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
491
|
+
context: 702,
|
|
492
|
+
type: asn1_schema_1.AsnPropTypes.Integer,
|
|
493
|
+
optional: true
|
|
494
|
+
})], AuthorizationList.prototype, "origin", void 0);
|
|
495
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
496
|
+
context: 703,
|
|
497
|
+
type: asn1_schema_1.AsnPropTypes.Null,
|
|
498
|
+
optional: true
|
|
499
|
+
})], AuthorizationList.prototype, "rollbackResistant", void 0);
|
|
500
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
501
|
+
context: 704,
|
|
502
|
+
type: RootOfTrust,
|
|
503
|
+
optional: true
|
|
504
|
+
})], AuthorizationList.prototype, "rootOfTrust", void 0);
|
|
505
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
506
|
+
context: 705,
|
|
507
|
+
type: asn1_schema_1.AsnPropTypes.Integer,
|
|
508
|
+
optional: true
|
|
509
|
+
})], AuthorizationList.prototype, "osVersion", void 0);
|
|
510
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
511
|
+
context: 706,
|
|
512
|
+
type: asn1_schema_1.AsnPropTypes.Integer,
|
|
513
|
+
optional: true
|
|
514
|
+
})], AuthorizationList.prototype, "osPatchLevel", void 0);
|
|
515
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
516
|
+
context: 709,
|
|
517
|
+
type: asn1_schema_1.OctetString,
|
|
518
|
+
optional: true
|
|
519
|
+
})], AuthorizationList.prototype, "attestationApplicationId", void 0);
|
|
520
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
521
|
+
context: 710,
|
|
522
|
+
type: asn1_schema_1.OctetString,
|
|
523
|
+
optional: true
|
|
524
|
+
})], AuthorizationList.prototype, "attestationIdBrand", void 0);
|
|
525
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
526
|
+
context: 711,
|
|
527
|
+
type: asn1_schema_1.OctetString,
|
|
528
|
+
optional: true
|
|
529
|
+
})], AuthorizationList.prototype, "attestationIdDevice", void 0);
|
|
530
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
531
|
+
context: 712,
|
|
532
|
+
type: asn1_schema_1.OctetString,
|
|
533
|
+
optional: true
|
|
534
|
+
})], AuthorizationList.prototype, "attestationIdProduct", void 0);
|
|
535
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
536
|
+
context: 713,
|
|
537
|
+
type: asn1_schema_1.OctetString,
|
|
538
|
+
optional: true
|
|
539
|
+
})], AuthorizationList.prototype, "attestationIdSerial", void 0);
|
|
540
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
541
|
+
context: 714,
|
|
542
|
+
type: asn1_schema_1.OctetString,
|
|
543
|
+
optional: true
|
|
544
|
+
})], AuthorizationList.prototype, "attestationIdImei", void 0);
|
|
545
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
546
|
+
context: 715,
|
|
547
|
+
type: asn1_schema_1.OctetString,
|
|
548
|
+
optional: true
|
|
549
|
+
})], AuthorizationList.prototype, "attestationIdMeid", void 0);
|
|
550
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
551
|
+
context: 716,
|
|
552
|
+
type: asn1_schema_1.OctetString,
|
|
553
|
+
optional: true
|
|
554
|
+
})], AuthorizationList.prototype, "attestationIdManufacturer", void 0);
|
|
555
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
556
|
+
context: 717,
|
|
557
|
+
type: asn1_schema_1.OctetString,
|
|
558
|
+
optional: true
|
|
559
|
+
})], AuthorizationList.prototype, "attestationIdModel", void 0);
|
|
560
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
561
|
+
context: 718,
|
|
562
|
+
type: asn1_schema_1.AsnPropTypes.Integer,
|
|
563
|
+
optional: true
|
|
564
|
+
})], AuthorizationList.prototype, "vendorPatchLevel", void 0);
|
|
565
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
566
|
+
context: 719,
|
|
567
|
+
type: asn1_schema_1.AsnPropTypes.Integer,
|
|
568
|
+
optional: true
|
|
569
|
+
})], AuthorizationList.prototype, "bootPatchLevel", void 0);
|
|
570
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
571
|
+
context: 720,
|
|
572
|
+
type: asn1_schema_1.AsnPropTypes.Null,
|
|
573
|
+
optional: true
|
|
574
|
+
})], AuthorizationList.prototype, "deviceUniqueAttestation", void 0);
|
|
575
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
576
|
+
context: 723,
|
|
577
|
+
type: asn1_schema_1.OctetString,
|
|
578
|
+
optional: true
|
|
579
|
+
})], AuthorizationList.prototype, "attestationIdSecondImei", void 0);
|
|
580
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
581
|
+
context: 724,
|
|
582
|
+
type: asn1_schema_1.OctetString,
|
|
583
|
+
optional: true
|
|
584
|
+
})], AuthorizationList.prototype, "moduleHash", void 0);
|
|
585
|
+
var SecurityLevel;
|
|
586
|
+
(function(SecurityLevel) {
|
|
587
|
+
SecurityLevel[SecurityLevel["software"] = 0] = "software";
|
|
588
|
+
SecurityLevel[SecurityLevel["trustedEnvironment"] = 1] = "trustedEnvironment";
|
|
589
|
+
SecurityLevel[SecurityLevel["strongBox"] = 2] = "strongBox";
|
|
590
|
+
})(SecurityLevel || (exports.SecurityLevel = SecurityLevel = {}));
|
|
591
|
+
var Version;
|
|
592
|
+
(function(Version) {
|
|
593
|
+
Version[Version["KM2"] = 1] = "KM2";
|
|
594
|
+
Version[Version["KM3"] = 2] = "KM3";
|
|
595
|
+
Version[Version["KM4"] = 3] = "KM4";
|
|
596
|
+
Version[Version["KM4_1"] = 4] = "KM4_1";
|
|
597
|
+
Version[Version["keyMint1"] = 100] = "keyMint1";
|
|
598
|
+
Version[Version["keyMint2"] = 200] = "keyMint2";
|
|
599
|
+
Version[Version["keyMint3"] = 300] = "keyMint3";
|
|
600
|
+
Version[Version["keyMint4"] = 400] = "keyMint4";
|
|
601
|
+
})(Version || (exports.Version = Version = {}));
|
|
602
|
+
var KeyDescription = class {
|
|
603
|
+
attestationVersion = Version.KM4;
|
|
604
|
+
attestationSecurityLevel = SecurityLevel.software;
|
|
605
|
+
keymasterVersion = 0;
|
|
606
|
+
keymasterSecurityLevel = SecurityLevel.software;
|
|
607
|
+
attestationChallenge = new asn1_schema_1.OctetString();
|
|
608
|
+
uniqueId = new asn1_schema_1.OctetString();
|
|
609
|
+
softwareEnforced = new AuthorizationList();
|
|
610
|
+
teeEnforced = new AuthorizationList();
|
|
611
|
+
constructor(params = {}) {
|
|
612
|
+
Object.assign(this, params);
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
exports.KeyDescription = KeyDescription;
|
|
616
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })], KeyDescription.prototype, "attestationVersion", void 0);
|
|
617
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })], KeyDescription.prototype, "attestationSecurityLevel", void 0);
|
|
618
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })], KeyDescription.prototype, "keymasterVersion", void 0);
|
|
619
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })], KeyDescription.prototype, "keymasterSecurityLevel", void 0);
|
|
620
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })], KeyDescription.prototype, "attestationChallenge", void 0);
|
|
621
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })], KeyDescription.prototype, "uniqueId", void 0);
|
|
622
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: AuthorizationList })], KeyDescription.prototype, "softwareEnforced", void 0);
|
|
623
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: AuthorizationList })], KeyDescription.prototype, "teeEnforced", void 0);
|
|
624
|
+
var KeyMintKeyDescription = class KeyMintKeyDescription {
|
|
625
|
+
attestationVersion = Version.keyMint4;
|
|
626
|
+
attestationSecurityLevel = SecurityLevel.software;
|
|
627
|
+
keyMintVersion = 0;
|
|
628
|
+
keyMintSecurityLevel = SecurityLevel.software;
|
|
629
|
+
attestationChallenge = new asn1_schema_1.OctetString();
|
|
630
|
+
uniqueId = new asn1_schema_1.OctetString();
|
|
631
|
+
softwareEnforced = new AuthorizationList();
|
|
632
|
+
hardwareEnforced = new AuthorizationList();
|
|
633
|
+
constructor(params = {}) {
|
|
634
|
+
Object.assign(this, params);
|
|
635
|
+
}
|
|
636
|
+
toLegacyKeyDescription() {
|
|
637
|
+
return new KeyDescription({
|
|
638
|
+
attestationVersion: this.attestationVersion,
|
|
639
|
+
attestationSecurityLevel: this.attestationSecurityLevel,
|
|
640
|
+
keymasterVersion: this.keyMintVersion,
|
|
641
|
+
keymasterSecurityLevel: this.keyMintSecurityLevel,
|
|
642
|
+
attestationChallenge: this.attestationChallenge,
|
|
643
|
+
uniqueId: this.uniqueId,
|
|
644
|
+
softwareEnforced: this.softwareEnforced,
|
|
645
|
+
teeEnforced: this.hardwareEnforced
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
static fromLegacyKeyDescription(keyDesc) {
|
|
649
|
+
return new KeyMintKeyDescription({
|
|
650
|
+
attestationVersion: keyDesc.attestationVersion,
|
|
651
|
+
attestationSecurityLevel: keyDesc.attestationSecurityLevel,
|
|
652
|
+
keyMintVersion: keyDesc.keymasterVersion,
|
|
653
|
+
keyMintSecurityLevel: keyDesc.keymasterSecurityLevel,
|
|
654
|
+
attestationChallenge: keyDesc.attestationChallenge,
|
|
655
|
+
uniqueId: keyDesc.uniqueId,
|
|
656
|
+
softwareEnforced: keyDesc.softwareEnforced,
|
|
657
|
+
hardwareEnforced: keyDesc.teeEnforced
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
exports.KeyMintKeyDescription = KeyMintKeyDescription;
|
|
662
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })], KeyMintKeyDescription.prototype, "attestationVersion", void 0);
|
|
663
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })], KeyMintKeyDescription.prototype, "attestationSecurityLevel", void 0);
|
|
664
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })], KeyMintKeyDescription.prototype, "keyMintVersion", void 0);
|
|
665
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })], KeyMintKeyDescription.prototype, "keyMintSecurityLevel", void 0);
|
|
666
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })], KeyMintKeyDescription.prototype, "attestationChallenge", void 0);
|
|
667
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })], KeyMintKeyDescription.prototype, "uniqueId", void 0);
|
|
668
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: AuthorizationList })], KeyMintKeyDescription.prototype, "softwareEnforced", void 0);
|
|
669
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: AuthorizationList })], KeyMintKeyDescription.prototype, "hardwareEnforced", void 0);
|
|
670
|
+
}));
|
|
671
|
+
//#endregion
|
|
672
|
+
//#region ../../node_modules/.pnpm/@peculiar+asn1-android@2.11.0/node_modules/@peculiar/asn1-android/build/cjs/nonstandard.js
|
|
673
|
+
var require_nonstandard = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
674
|
+
var NonStandardAuthorizationList_1;
|
|
675
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
676
|
+
exports.NonStandardKeyMintKeyDescription = exports.NonStandardKeyDescription = exports.NonStandardAuthorizationList = exports.NonStandardAuthorization = void 0;
|
|
677
|
+
const tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
678
|
+
const asn1_schema_1 = require_cjs$1();
|
|
679
|
+
const key_description_1 = require_key_description();
|
|
680
|
+
let NonStandardAuthorization = class NonStandardAuthorization extends key_description_1.AuthorizationList {};
|
|
681
|
+
exports.NonStandardAuthorization = NonStandardAuthorization;
|
|
682
|
+
exports.NonStandardAuthorization = NonStandardAuthorization = tslib_1.__decorate([(0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Choice })], NonStandardAuthorization);
|
|
683
|
+
let NonStandardAuthorizationList = NonStandardAuthorizationList_1 = class NonStandardAuthorizationList extends asn1_schema_1.AsnArray {
|
|
684
|
+
constructor(items) {
|
|
685
|
+
super(items);
|
|
686
|
+
Object.setPrototypeOf(this, NonStandardAuthorizationList_1.prototype);
|
|
687
|
+
}
|
|
688
|
+
findProperty(key) {
|
|
689
|
+
const prop = this.find((o) => o[key] !== void 0);
|
|
690
|
+
if (prop) return prop[key];
|
|
691
|
+
}
|
|
692
|
+
};
|
|
693
|
+
exports.NonStandardAuthorizationList = NonStandardAuthorizationList;
|
|
694
|
+
exports.NonStandardAuthorizationList = NonStandardAuthorizationList = NonStandardAuthorizationList_1 = tslib_1.__decorate([(0, asn1_schema_1.AsnType)({
|
|
695
|
+
type: asn1_schema_1.AsnTypeTypes.Sequence,
|
|
696
|
+
itemType: NonStandardAuthorization
|
|
697
|
+
})], NonStandardAuthorizationList);
|
|
698
|
+
var NonStandardKeyDescription = class {
|
|
699
|
+
attestationVersion = key_description_1.Version.KM4;
|
|
700
|
+
attestationSecurityLevel = key_description_1.SecurityLevel.software;
|
|
701
|
+
keymasterVersion = 0;
|
|
702
|
+
keymasterSecurityLevel = key_description_1.SecurityLevel.software;
|
|
703
|
+
attestationChallenge = new asn1_schema_1.OctetString();
|
|
704
|
+
uniqueId = new asn1_schema_1.OctetString();
|
|
705
|
+
softwareEnforced = new NonStandardAuthorizationList();
|
|
706
|
+
teeEnforced = new NonStandardAuthorizationList();
|
|
707
|
+
get keyMintVersion() {
|
|
708
|
+
return this.keymasterVersion;
|
|
709
|
+
}
|
|
710
|
+
set keyMintVersion(value) {
|
|
711
|
+
this.keymasterVersion = value;
|
|
712
|
+
}
|
|
713
|
+
get keyMintSecurityLevel() {
|
|
714
|
+
return this.keymasterSecurityLevel;
|
|
715
|
+
}
|
|
716
|
+
set keyMintSecurityLevel(value) {
|
|
717
|
+
this.keymasterSecurityLevel = value;
|
|
718
|
+
}
|
|
719
|
+
get hardwareEnforced() {
|
|
720
|
+
return this.teeEnforced;
|
|
721
|
+
}
|
|
722
|
+
set hardwareEnforced(value) {
|
|
723
|
+
this.teeEnforced = value;
|
|
724
|
+
}
|
|
725
|
+
constructor(params = {}) {
|
|
726
|
+
Object.assign(this, params);
|
|
727
|
+
}
|
|
728
|
+
};
|
|
729
|
+
exports.NonStandardKeyDescription = NonStandardKeyDescription;
|
|
730
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })], NonStandardKeyDescription.prototype, "attestationVersion", void 0);
|
|
731
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })], NonStandardKeyDescription.prototype, "attestationSecurityLevel", void 0);
|
|
732
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })], NonStandardKeyDescription.prototype, "keymasterVersion", void 0);
|
|
733
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })], NonStandardKeyDescription.prototype, "keymasterSecurityLevel", void 0);
|
|
734
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })], NonStandardKeyDescription.prototype, "attestationChallenge", void 0);
|
|
735
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })], NonStandardKeyDescription.prototype, "uniqueId", void 0);
|
|
736
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: NonStandardAuthorizationList })], NonStandardKeyDescription.prototype, "softwareEnforced", void 0);
|
|
737
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: NonStandardAuthorizationList })], NonStandardKeyDescription.prototype, "teeEnforced", void 0);
|
|
738
|
+
let NonStandardKeyMintKeyDescription = class NonStandardKeyMintKeyDescription extends NonStandardKeyDescription {
|
|
739
|
+
constructor(params = {}) {
|
|
740
|
+
if ("keymasterVersion" in params && !("keyMintVersion" in params)) params.keyMintVersion = params.keymasterVersion;
|
|
741
|
+
if ("keymasterSecurityLevel" in params && !("keyMintSecurityLevel" in params)) params.keyMintSecurityLevel = params.keymasterSecurityLevel;
|
|
742
|
+
if ("teeEnforced" in params && !("hardwareEnforced" in params)) params.hardwareEnforced = params.teeEnforced;
|
|
743
|
+
super(params);
|
|
744
|
+
}
|
|
745
|
+
};
|
|
746
|
+
exports.NonStandardKeyMintKeyDescription = NonStandardKeyMintKeyDescription;
|
|
747
|
+
exports.NonStandardKeyMintKeyDescription = NonStandardKeyMintKeyDescription = tslib_1.__decorate([(0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Sequence })], NonStandardKeyMintKeyDescription);
|
|
748
|
+
}));
|
|
749
|
+
//#endregion
|
|
750
|
+
//#region ../../node_modules/.pnpm/@peculiar+asn1-android@2.11.0/node_modules/@peculiar/asn1-android/build/cjs/attestation.js
|
|
751
|
+
var require_attestation = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
752
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
753
|
+
exports.AttestationApplicationId = exports.AttestationPackageInfo = void 0;
|
|
754
|
+
const tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
755
|
+
const asn1_schema_1 = require_cjs$1();
|
|
756
|
+
var AttestationPackageInfo = class {
|
|
757
|
+
packageName;
|
|
758
|
+
version;
|
|
759
|
+
constructor(params = {}) {
|
|
760
|
+
Object.assign(this, params);
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
exports.AttestationPackageInfo = AttestationPackageInfo;
|
|
764
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.OctetString })], AttestationPackageInfo.prototype, "packageName", void 0);
|
|
765
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })], AttestationPackageInfo.prototype, "version", void 0);
|
|
766
|
+
var AttestationApplicationId = class {
|
|
767
|
+
packageInfos;
|
|
768
|
+
signatureDigests;
|
|
769
|
+
constructor(params = {}) {
|
|
770
|
+
Object.assign(this, params);
|
|
771
|
+
}
|
|
772
|
+
};
|
|
773
|
+
exports.AttestationApplicationId = AttestationApplicationId;
|
|
774
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
775
|
+
type: AttestationPackageInfo,
|
|
776
|
+
repeated: "set"
|
|
777
|
+
})], AttestationApplicationId.prototype, "packageInfos", void 0);
|
|
778
|
+
tslib_1.__decorate([(0, asn1_schema_1.AsnProp)({
|
|
779
|
+
type: asn1_schema_1.AsnPropTypes.OctetString,
|
|
780
|
+
repeated: "set"
|
|
781
|
+
})], AttestationApplicationId.prototype, "signatureDigests", void 0);
|
|
782
|
+
}));
|
|
783
|
+
(/* @__PURE__ */ __commonJSMin(((exports) => {
|
|
784
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
785
|
+
const tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
786
|
+
tslib_1.__exportStar(require_key_description(), exports);
|
|
787
|
+
tslib_1.__exportStar(require_nonstandard(), exports);
|
|
788
|
+
tslib_1.__exportStar(require_attestation(), exports);
|
|
789
|
+
})))();
|
|
790
|
+
//#endregion
|
|
791
|
+
//#region ../../node_modules/.pnpm/@simplewebauthn+server@14.0.3/node_modules/@simplewebauthn/server/esm/authentication/verifyAuthenticationResponse.js
|
|
792
|
+
/**
|
|
793
|
+
* Verify that the user has legitimately completed the authentication process
|
|
794
|
+
*
|
|
795
|
+
* **Options:**
|
|
796
|
+
*
|
|
797
|
+
* @param response - Response returned by **@simplewebauthn/browser**'s `startAuthentication()`
|
|
798
|
+
* @param expectedChallenge - The base64url-encoded `options.challenge` returned by `generateAuthenticationOptions()`
|
|
799
|
+
* @param expectedOrigin - Website URL (or array of URLs) that the registration should have occurred on
|
|
800
|
+
* @param expectedRPID - RP ID (or array of IDs) that was specified in the registration options
|
|
801
|
+
* @param credential - An internal {@link WebAuthnCredential} corresponding to `id` in the authentication response
|
|
802
|
+
* @param expectedType **(Optional)** - The response type expected ('webauthn.get')
|
|
803
|
+
* @param requireUserVerification **(Optional)** - Enforce user verification by the authenticator (via PIN, fingerprint, etc...) Defaults to `true`
|
|
804
|
+
* @param advancedFIDOConfig **(Optional)** - Options for satisfying more stringent FIDO RP feature requirements
|
|
805
|
+
* @param advancedFIDOConfig.userVerification **(Optional)** - Enable alternative rules for evaluating the User Presence and User Verified flags in authenticator data: UV (and UP) flags are optional unless this value is `"required"`
|
|
806
|
+
*/
|
|
807
|
+
async function verifyAuthenticationResponse(options) {
|
|
808
|
+
const { response, expectedChallenge, expectedOrigin, expectedRPID, expectedType, expectedTopOrigin, credential, requireUserVerification = true, advancedFIDOConfig } = options;
|
|
809
|
+
const { id, rawId, type: credentialType, response: assertionResponse } = response;
|
|
810
|
+
if (!id) throw new Error("Missing credential ID");
|
|
811
|
+
if (id !== rawId) throw new Error("Credential ID was not base64url-encoded");
|
|
812
|
+
if (credentialType !== "public-key") throw new Error(`Unexpected credential type ${credentialType}, expected "public-key"`);
|
|
813
|
+
if (!response) throw new Error("Credential missing response");
|
|
814
|
+
if (typeof assertionResponse?.clientDataJSON !== "string") throw new Error("Credential response clientDataJSON was not a string");
|
|
815
|
+
const clientDataJSON = decodeClientDataJSON(assertionResponse.clientDataJSON);
|
|
816
|
+
const { type, origin, challenge, tokenBinding, crossOrigin, topOrigin } = clientDataJSON;
|
|
817
|
+
if (Array.isArray(expectedType)) {
|
|
818
|
+
if (!expectedType.includes(type)) {
|
|
819
|
+
const joinedExpectedType = expectedType.join(", ");
|
|
820
|
+
throw new Error(`Unexpected authentication response type "${type}", expected one of: ${joinedExpectedType}`);
|
|
821
|
+
}
|
|
822
|
+
} else if (expectedType) {
|
|
823
|
+
if (type !== expectedType) throw new Error(`Unexpected authentication response type "${type}", expected "${expectedType}"`);
|
|
824
|
+
} else if (type !== "webauthn.get") throw new Error(`Unexpected authentication response type: ${type}`);
|
|
825
|
+
if (typeof expectedChallenge === "function") {
|
|
826
|
+
if (!await expectedChallenge(challenge)) throw new Error(`Custom challenge verifier returned false for registration response challenge "${challenge}"`);
|
|
827
|
+
} else if (challenge !== expectedChallenge) throw new Error(`Unexpected authentication response challenge "${challenge}", expected "${expectedChallenge}"`);
|
|
828
|
+
if (crossOrigin) {
|
|
829
|
+
/**
|
|
830
|
+
* TODO: Since Safari doesn't support `topOrigin` as of May 2026, only check this when
|
|
831
|
+
* `topOrigin` is available for now.
|
|
832
|
+
*/
|
|
833
|
+
if (topOrigin) {
|
|
834
|
+
if (!expectedTopOrigin)
|
|
835
|
+
/**
|
|
836
|
+
* If `expectedTopOrigin` is not set, this should be considered an unexpected cross-origin
|
|
837
|
+
* request. Reject the response while helping the RP understand how they need to update this
|
|
838
|
+
* method call if they want to support verification of such WebAuthn authentication requests.
|
|
839
|
+
*/
|
|
840
|
+
throw new Error(`Detected cross-origin authentication response from top origin of "${topOrigin}", but a value for \`expectedTopOrigin\` was not specified when calling \`verifyAuthenticationResponse()\``);
|
|
841
|
+
if (Array.isArray(expectedTopOrigin)) {
|
|
842
|
+
if (!expectedTopOrigin.includes(topOrigin)) {
|
|
843
|
+
const joinedExpectedTopOrigin = expectedTopOrigin.join(", ");
|
|
844
|
+
throw new Error(`Unexpected cross-origin authentication response top origin of "${topOrigin}", expected one of: ${joinedExpectedTopOrigin}`);
|
|
845
|
+
}
|
|
846
|
+
} else if (topOrigin !== expectedTopOrigin) throw new Error(`Unexpected cross-origin authentication response top origin of "${topOrigin}", expected: ${expectedTopOrigin}`);
|
|
847
|
+
}
|
|
848
|
+
} else if (topOrigin)
|
|
849
|
+
/**
|
|
850
|
+
* If `topOrigin` is set despite `crossOrigin` being false, this is an unexpected request.
|
|
851
|
+
*
|
|
852
|
+
* See https://w3c.github.io/webauthn/#dom-collectedclientdata-toporigin.
|
|
853
|
+
*/
|
|
854
|
+
throw new Error(`Unexpected top origin of "${topOrigin}" within a non-cross-origin authentication response. This error should be reported to the browser vendor as a WebAuthn specification violation with a link to https://w3c.github.io/webauthn/#dom-collectedclientdata-toporigin`);
|
|
855
|
+
if (Array.isArray(expectedOrigin)) {
|
|
856
|
+
if (!expectedOrigin.includes(origin)) {
|
|
857
|
+
const joinedExpectedOrigin = expectedOrigin.join(", ");
|
|
858
|
+
throw new Error(`Unexpected authentication response origin "${origin}", expected one of: ${joinedExpectedOrigin}`);
|
|
859
|
+
}
|
|
860
|
+
} else if (origin !== expectedOrigin) throw new Error(`Unexpected authentication response origin "${origin}", expected "${expectedOrigin}"`);
|
|
861
|
+
if (!isBase64URL(assertionResponse.authenticatorData)) throw new Error("Credential response authenticatorData was not a base64url string");
|
|
862
|
+
if (!isBase64URL(assertionResponse.signature)) throw new Error("Credential response signature was not a base64url string");
|
|
863
|
+
if (assertionResponse.userHandle && typeof assertionResponse.userHandle !== "string") throw new Error("Credential response userHandle was not a string");
|
|
864
|
+
if (tokenBinding) {
|
|
865
|
+
if (typeof tokenBinding !== "object") throw new Error("ClientDataJSON tokenBinding was not an object");
|
|
866
|
+
if ([
|
|
867
|
+
"present",
|
|
868
|
+
"supported",
|
|
869
|
+
"notSupported"
|
|
870
|
+
].indexOf(tokenBinding.status) < 0) throw new Error(`Unexpected tokenBinding status ${tokenBinding.status}`);
|
|
871
|
+
}
|
|
872
|
+
const authDataBuffer = toBuffer(assertionResponse.authenticatorData);
|
|
873
|
+
const { rpIdHash, flags, counter, extensionsData } = parseAuthenticatorData(authDataBuffer);
|
|
874
|
+
let expectedRPIDs = [];
|
|
875
|
+
if (typeof expectedRPID === "string") expectedRPIDs = [expectedRPID];
|
|
876
|
+
else expectedRPIDs = expectedRPID;
|
|
877
|
+
const matchedRPID = await matchExpectedRPID(rpIdHash, expectedRPIDs);
|
|
878
|
+
if (advancedFIDOConfig !== void 0) {
|
|
879
|
+
const { userVerification: fidoUserVerification } = advancedFIDOConfig;
|
|
880
|
+
/**
|
|
881
|
+
* Use FIDO Conformance-defined rules for verifying UP and UV flags
|
|
882
|
+
*/
|
|
883
|
+
if (fidoUserVerification === "required") {
|
|
884
|
+
if (!flags.uv) throw new Error("User verification required, but user could not be verified");
|
|
885
|
+
} else if (fidoUserVerification === "preferred" || fidoUserVerification === "discouraged") {}
|
|
886
|
+
} else {
|
|
887
|
+
/**
|
|
888
|
+
* Use WebAuthn spec-defined rules for verifying UP and UV flags
|
|
889
|
+
*/
|
|
890
|
+
if (!flags.up) throw new Error("User not present during authentication");
|
|
891
|
+
if (requireUserVerification && !flags.uv) throw new Error("User verification required, but user could not be verified");
|
|
892
|
+
}
|
|
893
|
+
const clientDataHash = await toHash(toBuffer(assertionResponse.clientDataJSON));
|
|
894
|
+
const signatureBase = concat([authDataBuffer, clientDataHash]);
|
|
895
|
+
const signature = toBuffer(assertionResponse.signature);
|
|
896
|
+
if ((counter > 0 || credential.counter > 0) && counter <= credential.counter) throw new Error(`Response counter value ${counter} was lower than expected ${credential.counter}`);
|
|
897
|
+
const pubKeyAlg = decodeCredentialPublicKey(credential.publicKey).get(COSEKEYS.alg);
|
|
898
|
+
if (typeof pubKeyAlg !== "number") throw new Error("Credential public key was missing numeric alg");
|
|
899
|
+
if (isPQCCOSEAlg(pubKeyAlg) && !SettingsService.runtimeSupportsPQC()) throw new PQCNotSupportedError(pubKeyAlg);
|
|
900
|
+
const { credentialDeviceType, credentialBackedUp } = parseBackupFlags(flags);
|
|
901
|
+
return {
|
|
902
|
+
verified: await verifySignature({
|
|
903
|
+
signature,
|
|
904
|
+
data: signatureBase,
|
|
905
|
+
credentialPublicKey: credential.publicKey
|
|
906
|
+
}),
|
|
907
|
+
authenticationInfo: {
|
|
908
|
+
newCounter: counter,
|
|
909
|
+
credentialID: credential.id,
|
|
910
|
+
userVerified: flags.uv,
|
|
911
|
+
credentialDeviceType,
|
|
912
|
+
credentialBackedUp,
|
|
913
|
+
authenticatorExtensionResults: extensionsData,
|
|
914
|
+
origin: clientDataJSON.origin,
|
|
915
|
+
rpID: matchedRPID
|
|
916
|
+
}
|
|
917
|
+
};
|
|
918
|
+
}
|
|
919
|
+
//#endregion
|
|
920
|
+
export { verifyAuthenticationResponse };
|