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 |
浏览器兼容性
加载中…