summaryrefslogtreecommitdiffstats
path: root/remote/test/puppeteer/packages/puppeteer-core/src/common/SecurityDetails.ts
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /remote/test/puppeteer/packages/puppeteer-core/src/common/SecurityDetails.ts
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'remote/test/puppeteer/packages/puppeteer-core/src/common/SecurityDetails.ts')
-rw-r--r--remote/test/puppeteer/packages/puppeteer-core/src/common/SecurityDetails.ts78
1 files changed, 78 insertions, 0 deletions
diff --git a/remote/test/puppeteer/packages/puppeteer-core/src/common/SecurityDetails.ts b/remote/test/puppeteer/packages/puppeteer-core/src/common/SecurityDetails.ts
new file mode 100644
index 0000000000..188eeea9ad
--- /dev/null
+++ b/remote/test/puppeteer/packages/puppeteer-core/src/common/SecurityDetails.ts
@@ -0,0 +1,78 @@
+/**
+ * @license
+ * Copyright 2020 Google Inc.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+import type {Protocol} from 'devtools-protocol';
+
+/**
+ * The SecurityDetails class represents the security details of a
+ * response that was received over a secure connection.
+ *
+ * @public
+ */
+export class SecurityDetails {
+ #subjectName: string;
+ #issuer: string;
+ #validFrom: number;
+ #validTo: number;
+ #protocol: string;
+ #sanList: string[];
+
+ /**
+ * @internal
+ */
+ constructor(securityPayload: Protocol.Network.SecurityDetails) {
+ this.#subjectName = securityPayload.subjectName;
+ this.#issuer = securityPayload.issuer;
+ this.#validFrom = securityPayload.validFrom;
+ this.#validTo = securityPayload.validTo;
+ this.#protocol = securityPayload.protocol;
+ this.#sanList = securityPayload.sanList;
+ }
+
+ /**
+ * The name of the issuer of the certificate.
+ */
+ issuer(): string {
+ return this.#issuer;
+ }
+
+ /**
+ * {@link https://en.wikipedia.org/wiki/Unix_time | Unix timestamp}
+ * marking the start of the certificate's validity.
+ */
+ validFrom(): number {
+ return this.#validFrom;
+ }
+
+ /**
+ * {@link https://en.wikipedia.org/wiki/Unix_time | Unix timestamp}
+ * marking the end of the certificate's validity.
+ */
+ validTo(): number {
+ return this.#validTo;
+ }
+
+ /**
+ * The security protocol being used, e.g. "TLS 1.2".
+ */
+ protocol(): string {
+ return this.#protocol;
+ }
+
+ /**
+ * The name of the subject to which the certificate was issued.
+ */
+ subjectName(): string {
+ return this.#subjectName;
+ }
+
+ /**
+ * The list of {@link https://en.wikipedia.org/wiki/Subject_Alternative_Name | subject alternative names (SANs)} of the certificate.
+ */
+ subjectAlternativeNames(): string[] {
+ return this.#sanList;
+ }
+}