@certscore/sdk
Advanced tools
| #!/usr/bin/env node | ||
| export {}; | ||
| //# sourceMappingURL=doctor.d.ts.map |
| {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":""} |
+100
| #!/usr/bin/env node | ||
| import { CertScoreClient } from "./client.js"; | ||
| import { CertScoreApiError } from "./errors.js"; | ||
| function argValue(name) { | ||
| const index = process.argv.indexOf(name); | ||
| return index >= 0 ? process.argv[index + 1] : undefined; | ||
| } | ||
| function hasArg(name) { | ||
| return process.argv.includes(name); | ||
| } | ||
| function printResult(result) { | ||
| const marker = result.ok ? "OK" : "WARN"; | ||
| console.log(`${marker} ${result.check}: ${result.detail}`); | ||
| } | ||
| async function fetchJson(url) { | ||
| const response = await fetch(url, { headers: { Accept: "application/json" } }); | ||
| const body = await response.json().catch(() => null); | ||
| return { body, response }; | ||
| } | ||
| async function main() { | ||
| const baseUrl = (argValue("--base-url") ?? process.env.CERTSCORE_BASE_URL ?? "https://certscore.ai").replace(/\/+$/, ""); | ||
| const domain = argValue("--domain") ?? "example.com"; | ||
| const apiKey = process.env.CERTSCORE_API_KEY; | ||
| const json = hasArg("--json"); | ||
| const results = []; | ||
| try { | ||
| const { body, response } = await fetchJson(`${baseUrl}/api/v2/health`); | ||
| results.push({ | ||
| check: "api_v2_health", | ||
| detail: response.ok ? `reachable at ${baseUrl}` : `HTTP ${response.status}`, | ||
| ok: response.ok && Boolean(body) | ||
| }); | ||
| } | ||
| catch (error) { | ||
| results.push({ | ||
| check: "api_v2_health", | ||
| detail: error instanceof Error ? error.message : String(error), | ||
| ok: false | ||
| }); | ||
| } | ||
| if (!apiKey) { | ||
| results.push({ | ||
| check: "api_key", | ||
| detail: "CERTSCORE_API_KEY is not set; skipping authenticated SDK checks.", | ||
| ok: false | ||
| }); | ||
| } | ||
| else { | ||
| const prefix = apiKey.startsWith("cs_rw_") ? "cs_rw_" : apiKey.startsWith("cs_ro_") ? "cs_ro_" : apiKey.slice(0, 8); | ||
| results.push({ | ||
| check: "api_key", | ||
| detail: `found ${prefix} key in CERTSCORE_API_KEY`, | ||
| ok: true | ||
| }); | ||
| const client = new CertScoreClient({ apiKey, baseUrl }); | ||
| try { | ||
| const latest = await client.domains.latest(domain); | ||
| results.push({ | ||
| check: "sdk_read", | ||
| detail: latest.scan ? `latest scan found for ${latest.domain}` : `no latest scan for ${latest.domain}; auth/read path succeeded`, | ||
| ok: true | ||
| }); | ||
| } | ||
| catch (error) { | ||
| results.push({ | ||
| check: "sdk_read", | ||
| detail: error instanceof CertScoreApiError | ||
| ? `HTTP ${error.status}${error.code ? ` ${error.code}` : ""}: ${error.message}` | ||
| : error instanceof Error | ||
| ? error.message | ||
| : String(error), | ||
| ok: false | ||
| }); | ||
| } | ||
| } | ||
| results.push({ | ||
| check: "scan_create", | ||
| detail: "not exercised by doctor; use a cs_rw_ key with scans.create() to create a real scan.", | ||
| ok: true | ||
| }); | ||
| if (json) { | ||
| console.log(JSON.stringify({ | ||
| baseUrl, | ||
| domain, | ||
| ok: results.every((result) => result.ok || result.check === "api_key"), | ||
| results | ||
| }, null, 2)); | ||
| return; | ||
| } | ||
| for (const result of results) { | ||
| printResult(result); | ||
| } | ||
| if (results.some((result) => !result.ok && result.check !== "api_key")) { | ||
| process.exitCode = 1; | ||
| } | ||
| } | ||
| main().catch((error) => { | ||
| console.error(error instanceof Error ? error.message : String(error)); | ||
| process.exitCode = 1; | ||
| }); |
+6
-0
| # @certscore/sdk | ||
| ## 0.2.2 | ||
| - Added `CertScore` as a friendly alias for `CertScoreClient`. | ||
| - Added the `certscore-sdk-doctor` CLI smoke check. | ||
| - Expanded first-run and error-handling documentation for self-serve `cs_ro_` and `cs_rw_` keys. | ||
| ## 0.2.1 | ||
@@ -4,0 +10,0 @@ |
+1
-1
@@ -1,4 +0,4 @@ | ||
| export { CertScoreClient } from "./client.js"; | ||
| export { CertScoreClient, CertScoreClient as CertScore } from "./client.js"; | ||
| export { CertScoreApiError, CertScoreError, CertScoreScanFailedError, CertScoreTimeoutError, InvalidUrlError, ScanFailedError, ScanTimeoutError, ThrottledError } from "./errors.js"; | ||
| export type { AgentInterpretation, ApiV2RequestOptions, Capabilities, CoverageInterruption, CertScoreClientOptions, CoverageInfo, CreateScanResourceOptions, DomainLatestScan, DomainLatestScanOptions, DomainResourceClient, Evidence, EvidenceDigest, FeedbackInfo, FindingDetail, FindingList, FindingResourceClient, FreshnessInfo, FreshnessMode, GetScanOptions, JobStatus, Links, NormalizedPulseDetail, PendingJob, PreConsentCookiesTrackers, PulseDetail, PulseErrorResponse, PulseFormat, PulseMeta, PulseRequest, PulseResult, PulseResultFull, PulseResultStandard, PulseResultTiny, PulseScan, ReviewContext, ReviewLens, ScanFrom, ScanJob, ScanOptions, ScanPulse, ScanResource, ScanResourceClient, SubmitScanOptions, TopFinding } from "./types.js"; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,wBAAwB,EACxB,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,cAAc,EACf,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,oBAAoB,EACpB,sBAAsB,EACtB,YAAY,EACZ,yBAAyB,EACzB,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,cAAc,EACd,SAAS,EACT,KAAK,EACL,qBAAqB,EACrB,UAAU,EACV,yBAAyB,EACzB,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,aAAa,EACb,UAAU,EACV,QAAQ,EACR,OAAO,EACP,WAAW,EACX,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACX,MAAM,YAAY,CAAC"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,wBAAwB,EACxB,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,cAAc,EACf,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,oBAAoB,EACpB,sBAAsB,EACtB,YAAY,EACZ,yBAAyB,EACzB,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,cAAc,EACd,SAAS,EACT,KAAK,EACL,qBAAqB,EACrB,UAAU,EACV,yBAAyB,EACzB,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,aAAa,EACb,UAAU,EACV,QAAQ,EACR,OAAO,EACP,WAAW,EACX,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACX,MAAM,YAAY,CAAC"} |
+1
-1
@@ -1,2 +0,2 @@ | ||
| export { CertScoreClient } from "./client.js"; | ||
| export { CertScoreClient, CertScoreClient as CertScore } from "./client.js"; | ||
| export { CertScoreApiError, CertScoreError, CertScoreScanFailedError, CertScoreTimeoutError, InvalidUrlError, ScanFailedError, ScanTimeoutError, ThrottledError } from "./errors.js"; |
+4
-1
| { | ||
| "name": "@certscore/sdk", | ||
| "version": "0.2.1", | ||
| "version": "0.2.2", | ||
| "description": "Official TypeScript SDK for the CertScore Pulse API.", | ||
@@ -17,2 +17,5 @@ "type": "module", | ||
| }, | ||
| "bin": { | ||
| "certscore-sdk-doctor": "./dist/doctor.js" | ||
| }, | ||
| "files": [ | ||
@@ -19,0 +22,0 @@ "dist", |
+20
-2
@@ -16,5 +16,5 @@ # CertScore TypeScript SDK | ||
| ```ts | ||
| import { CertScoreClient } from "@certscore/sdk"; | ||
| import { CertScore } from "@certscore/sdk"; | ||
| const certscore = new CertScoreClient({ | ||
| const certscore = new CertScore({ | ||
| apiKey: process.env.CERTSCORE_API_KEY | ||
@@ -34,2 +34,3 @@ }); | ||
| `CertScoreClient` is the canonical class name; `CertScore` is a friendly alias for shorter examples. | ||
| `certscore.scan()` remains available as a Pulse v1 compatibility helper when you want one call to return a concise Pulse projection. | ||
@@ -46,4 +47,21 @@ | ||
| - Self-serve scan-creation keys are prefixed `cs_rw_`, expire after 90 days, and are conservatively capped for launch. | ||
| - Create keys from CertScore Settings > Developer API keys, or by posting to `/api/v2/keys/request` from a signed-in browser session. | ||
| - Higher-volume scan creation is available through support at `support@certscore.ai`. | ||
| | Key | Default scopes | Use | | ||
| | --- | --- | --- | | ||
| | `cs_ro_` | `scan:read`, `mcp` | Read existing scans, findings, reports, latest-domain resources, and MCP read tools. | | ||
| | `cs_rw_` | `scan:read`, `scan:create`, `mcp` | Everything in `cs_ro_`, plus 5 fresh scan creations/day for SDK and REST trials. | | ||
| ## Doctor | ||
| Check your install and key without creating a scan: | ||
| ```bash | ||
| CERTSCORE_API_KEY="cs_ro_or_cs_rw_..." npx -y @certscore/sdk@latest certscore-sdk-doctor | ||
| CERTSCORE_API_KEY="cs_ro_or_cs_rw_..." npx -y @certscore/sdk@latest certscore-sdk-doctor --json | ||
| ``` | ||
| The doctor checks API v2 health and a read request. It intentionally does not create scans or consume `scan:create` quota. | ||
| ## Resource Clients | ||
@@ -50,0 +68,0 @@ |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances
Unidentified License
LicenseSomething that seems like a license was found, but its contents could not be matched with a known license.
Found 2 instances
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Unidentified License
LicenseSomething that seems like a license was found, but its contents could not be matched with a known license.
Found 2 instances
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
87381
6.05%22
15.79%1350
8.17%319
5.98%3
200%13
8.33%