AuthenticatorAttestationResponse: phương thức getPublicKey()

Baseline 2023
Newly available

Since October 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

Phương thức getPublicKey() của giao diện AuthenticatorAttestationResponse trả về một ArrayBuffer chứa SubjectPublicKeyInfo dạng DER của thông tin xác thực mới (xem Subject Public Key Info), hoặc null nếu không có sẵn.

Đây là một hàm tiện ích được tạo ra để cho phép truy cập dễ dàng vào khóa công khai. Khóa này sẽ cần được lưu lại để xác minh các thao tác xác thực trong tương lai (tức là dùng navigator.credentials.get()).

Cú pháp

js
getPublicKey()

Tham số

Không có.

Giá trị trả về

Một ArrayBuffer chứa SubjectPublicKeyInfo dạng DER của thông tin xác thực mới (xem Subject Public Key Info), hoặc null nếu không có sẵn.

Ví dụ

Xem Creating a public key credential để có ví dụ chi tiết.

Thông số kỹ thuật

Thông số kỹ thuật
Web Authentication: An API for accessing Public Key Credentials - Level 3
# dom-authenticatorattestationresponse-getpublickey

Khả năng tương thích với trình duyệt