aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/authenticatorresponse/index.html
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/authenticatorresponse/index.html
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/authenticatorresponse/index.html')
-rw-r--r--files/zh-cn/web/api/authenticatorresponse/index.html110
1 files changed, 110 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/authenticatorresponse/index.html b/files/zh-cn/web/api/authenticatorresponse/index.html
new file mode 100644
index 0000000000..d682aa678b
--- /dev/null
+++ b/files/zh-cn/web/api/authenticatorresponse/index.html
@@ -0,0 +1,110 @@
+---
+title: AuthenticatorResponse
+slug: Web/API/AuthenticatorResponse
+translation_of: Web/API/AuthenticatorResponse
+---
+<div>{{APIRef("Web Authentication API")}}{{securecontext_header}}</div>
+
+<p>The <code><strong>AuthenticatorResponse</strong></code> interface of the <a href="/en-US/docs/Web/API/Web_Authentication_API">Web Authentication API</a> is the base interface for interfaces that provide a cryptographic root of trust for a key pair. The child interfaces include information from the browser such as the challenge origin and either may be returned from {{domxref("PublicKeyCredential.response")}}.</p>
+
+<h2 id="Interfaces_based_on_AuthenticatorResponse">Interfaces based on AuthenticatorResponse</h2>
+
+<p>Below is a list of interfaces based on the AuthenticatorResponse interface.</p>
+
+<div class="index">
+<ul>
+ <li>{{domxref("AuthenticatorAssertionResponse")}}</li>
+ <li>{{domxref("AuthenticatorAttestationResponse")}}</li>
+</ul>
+</div>
+
+<h2 id="Properties">Properties</h2>
+
+<dl>
+ <dt>{{domxref("AuthenticatorResponse.clientDataJSON")}}</dt>
+ <dd>A <a href="/en-US/docs/Learn/JavaScript/Objects/JSON">JSON</a> string in an {{domxref("ArrayBuffer")}}, representing the client data that was passed to {{domxref("CredentialsContainer.create()")}} or {{domxref("CredentialsContainer.get()")}}.</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<p>无</p>
+
+<h2 id="示例">示例</h2>
+
+<h3 id="Getting_an_AuthenticatorAssertionResponse">Getting an AuthenticatorAssertionResponse</h3>
+
+<pre class="brush: js notranslate">var options = {
+ challenge: new Uint8Array([/* bytes sent from the server */])
+};
+
+navigator.credentials.get({ "publicKey": options })
+ .then(function (credentialInfoAssertion) {
+ var assertionResponse = credentialInfoAssertion.response;
+ // send assertion response back to the server
+ // to proceed with the control of the credential
+}).catch(function (err) {
+ console.error(err);
+});
+
+</pre>
+
+<h3 id="Getting_an_AuthenticatorAttestationResponse">Getting an AuthenticatorAttestationResponse</h3>
+
+<pre class="brush: js notranslate">var publicKey = {
+ challenge: /* from the server */,
+ rp: {
+ name: "Example CORP",
+ id : "login.example.com"
+ },
+ user: {
+ id: new Uint8Array(16),
+ name: "jdoe@example.com",
+ displayName: "John Doe"
+ },
+ pubKeyCredParams: [
+ {
+ type: "public-key",
+ alg: -7
+ }
+ ]
+};
+
+navigator.credentials.create({ publicKey })
+ .then(function (newCredentialInfo) {
+ var attestationResponse = newCredentialInfo.response;
+ }).catch(function (err) {
+ console.error(err);
+ });</pre>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('WebAuthn','#authenticatorresponse', 'AuthenticatorResponse interface')}}</td>
+ <td>{{Spec2('WebAuthn')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+
+
+<p>{{Compat("api.AuthenticatorResponse")}}</p>
+
+<h2 id="参见">参见</h2>
+
+<ul>
+ <li>{{domxref("AuthenticatorAttestationResponse")}}</li>
+ <li>{{domxref("AuthenticatorAssertionResponse")}}</li>
+ <li>{{domxref("PublicKeyCredential.response")}}</li>
+</ul>