RTCCertificate: expires 屬性
RTCCertificate 介面的只讀 expires 屬性返回證書的過期日期。
預設情況下,新證書的 expires 設定為 2592000000 毫秒(即 30 天)。過期時間不能超過 31536000000 毫秒(即 365 天)。還需要注意的是,瀏覽器可能會根據其選擇進一步限制證書的過期時間。
值
一個時間戳,以毫秒為單位的 Unix 時間,包含證書的過期日期。
示例
js
RTCPeerConnection.generateCertificate({
name: "RSASSA-PKCS1-v1_5",
hash: "SHA-256",
modulusLength: 2048,
publicExponent: new Uint8Array([1, 0, 1]),
}).then((cert) => {
const pc = new RTCPeerConnection({ certificates: [cert] });
console.log(cert.expires); // 2592000000 (30 days, the default)
});
規範
| 規範 |
|---|
| WebRTC:瀏覽器中的即時通訊 # dom-rtccertificate-expires |
瀏覽器相容性
載入中…