From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../getclientextensionresults/index.html | 109 ++++++++++++++++++ files/ja/web/api/publickeycredential/index.html | 125 +++++++++++++++++++++ .../web/api/publickeycredential/rawid/index.html | 85 ++++++++++++++ 3 files changed, 319 insertions(+) create mode 100644 files/ja/web/api/publickeycredential/getclientextensionresults/index.html create mode 100644 files/ja/web/api/publickeycredential/index.html create mode 100644 files/ja/web/api/publickeycredential/rawid/index.html (limited to 'files/ja/web/api/publickeycredential') diff --git a/files/ja/web/api/publickeycredential/getclientextensionresults/index.html b/files/ja/web/api/publickeycredential/getclientextensionresults/index.html new file mode 100644 index 0000000000..325e75e058 --- /dev/null +++ b/files/ja/web/api/publickeycredential/getclientextensionresults/index.html @@ -0,0 +1,109 @@ +--- +title: PublicKeyCredential.getClientExtensionResults() +slug: Web/API/PublicKeyCredential/getClientExtensionResults +tags: + - API + - Method + - PublicKeyCredential + - Reference + - Web Authentication API + - WebAuthn +translation_of: Web/API/PublicKeyCredential/getClientExtensionResults +--- +
{{APIRef("Web Authentication API")}}{{securecontext_header}}
+ +

getClientExtensionResults() は {{domxref("PublicKeyCredential")}} インターフェイスのメソッドであり、 {{jsxref("ArrayBuffer")}} の形で拡張機能の識別子と、クライアントが処理した後の結果の対応表を返します。

+ +

PublicKeyCredential の生成または読み出し中 (それぞれ {{domxref("CredentialsContainer.create()","navigator.credentials.create()")}} および {{domxref("CredentialsContainer.get()","navigator.credentials.get()")}} で実施) に、それぞれ {{domxref("PublicKeyCredentialCreationOptions.extensions")}} および {{domxref("PublicKeyCredentialRequestOptions.extensions")}} によって与えられる別々の拡張機能のために、クライアントが処理する「専用の」処理を持つことができます。

+ +
+

メモ: 拡張機能はオプションであり、ブラウザーによって認識する拡張機能は異なります。すべての拡張機能はクライアントが処理することはオプションです。ブラウザーが指定された拡張機能を知らない場合、失敗としてはいけません。

+
+ +
+

メモ: このプロパティは最上位のコンテキストでしか使えない可能性があり、例えば {{HTMLElement("iframe")}} の中では利用できません。

+
+ +

構文

+ +
mapArrayBuffer = publicKeyCredential.getClientExtensionResults()
+ +

引数

+ +

なし。

+ +

返値

+ +

{{jsxref("ArrayBuffer")}} の形で、クライアントが様々な拡張機能を処理した結果です。拡張子の識別子と、クライアントが処理した後の結果の対応表を返します。このオブジェクトには拡張機能の識別子と処理の結果の対応表が入っています。

+ +
+

警告! 2019年3月時点で、 appId ({{domxref("PublicKeyCredentialRequestOptions.extensions")}} の生成の間に使用される) のみ、 Chrome および Edge が対応しています。 Firefox はどの拡張機能にも対応していないようです。

+
+ +

+ +
var publicKey = {
+  // Here are the extensions (as "inputs")
+  extensions: {
+    "loc": true, // This extension has been defined to include location information in attestation
+    "uvi": true  // user verification index: how the user was verified
+  },
+  challenge: new Uint8Array(16) /* from the server */,
+  rp: {
+    name: "Example CORP",
+    id  : "login.example.com"
+  },
+  user: {
+    id: new Uint8Array(16) /* from the server */,
+    name: "jdoe@example.com",
+    displayName: "John Doe"
+  },
+  pubKeyCredParams: [
+    {
+      type: "public-key",
+      alg: -7
+    }
+  ]
+};
+
+navigator.credentials.create({ publicKey })
+  .then(function (newCredentialInfo) {
+    var myBuffer = newCredentialInfo.getClientExtensionResults();
+    // myBuffer will contain the result of any of the processing of the "loc" and "uvi" extensions
+  }).catch(function (err) {
+     console.error(err);
+  });
+ +

仕様書

+ + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName('WebAuthn','#dom-publickeycredential-getclientextensionresults','getClientExtensionResults()')}}{{Spec2('WebAuthn')}}初回定義
+ +

ブラウザーの互換性

+ + + +

{{Compat("api.PublicKeyCredential.getClientExtensionResults")}}

+ +

関連情報

+ + diff --git a/files/ja/web/api/publickeycredential/index.html b/files/ja/web/api/publickeycredential/index.html new file mode 100644 index 0000000000..67c137d9eb --- /dev/null +++ b/files/ja/web/api/publickeycredential/index.html @@ -0,0 +1,125 @@ +--- +title: PublicKeyCredential +slug: Web/API/PublicKeyCredential +tags: + - API + - Authentication + - Interface + - PublicKeyCredential + - Reference + - Web Authentication API + - WebAuthn + - インターフェイス +translation_of: Web/API/PublicKeyCredential +--- +
{{APIRef("Web Authentication API")}}{{securecontext_header}}
+ +

PublicKeyCredential インターフェイスは、パスワードの代わりにフィッシングやデータ消去に耐性のある非対称の鍵ペアを使用してサービスにログインするための資格情報である、公開鍵と秘密鍵のペアについての情報を提供します。これは {{domxref("Credential")}} を継承しており、 Web Authentication APICredential Management API へ拡張された際に作成されました。 {{domxref("Credential")}} を継承している他のインターフェイスとしては、 {{domxref("PasswordCredential")}} や {{domxref("FederatedCredential")}} があります。

+ +
+

メモ: このインターフェイスは最上位のコンテキストに限定されています。 {{HTMLElement("iframe")}} 要素の中で使用しても、何も効果がありません。

+
+ +

プロパティ

+ +
+
PublicKeyCredential.type {{ReadOnlyInline()}}{{securecontext_inline}}
+
{{domxref("Credential")}} から継承しています。 PublicKeyCredential の場合は、常に public-key に設定されています。
+
{{domxref("PublicKeyCredential.id")}} {{ReadOnlyInline()}}{{securecontext_inline}}
+
{{domxref("Credential")}} から継承しており、 {{domxref("PublicKeyCredential.rawId")}} の base64url 符号化になるようオーバーライドしています。
+
{{domxref("PublicKeyCredential.rawId")}} {{ReadOnlyInline()}}{{securecontext_inline}}
+
{{domxref("ArrayBuffer")}} 型で、この PublicKeyCredential のグローバルに固有な識別子を保持します。この識別子は今後の {{domxref("CredentialsContainer.get")}} の呼び出しにおいて、資格情報を検索するのに使用することができます。
+
{{domxref("PublicKeyCredential.response")}} {{ReadOnlyInline()}} {{securecontext_inline}}
+
{{domxref("AuthenticatorResponse")}} オブジェクトのインスタンスです。これは PublicKeyCredential が {{domxref("CredentialsContainer.create()","navigator.credentials.create()")}} の呼び出しの結果だった場合であった場合は {{domxref("AuthenticatorAttestationResponse")}} 型に、 PublicKeyCredential が {{domxref("CredentialsContainer.get()","navigator.credentials.get()")}} の呼び出しの結果であった場合は {{domxref("AuthenticatorAssertionResponse")}} 型になります。
+
+ +

メソッド

+ +
+
{{domxref("PublicKeyCredential.getClientExtensionResults()")}}{{securecontext_inline}}
+
何らかの拡張機能がリクエストされた場合、このメソッドはその拡張機能が処理した結果を返します。
+
{{domxref("PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()")}}{{securecontext_inline}}
+
静的メソッドで、認証機器が所属するプラットフォームがユーザーを検証する能力を持っているならば true で解決する {{jsxref("Promise")}} を返します。現在の実装状況では、このメソッドは Windows Hello がシステムで利用可能な場合のみ true で解決します。
+
+ +

+ +

PublicKeyCredential の新しいインスタンスを生成

+ +

ここでは、 {{domxref("CredentialsContainer.create()","navigator.credentials.create()")}} を用いて新しい資格情報を生成します。

+ +
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 response = newCredentialInfo.response;
+    var clientExtensionsResults = newCredentialInfo.getClientExtensionResults();
+  }).catch(function (err) {
+     console.error(err);
+  });
+ +

PublicKeyCredential の既存のインスタンスを取得

+ +

ここでは、 {{domxref("CredentialsContainer.get()","navigator.credentials.get()")}} を用いて認証機器から既存の資格情報を読み取ります。

+ +
var options = {
+  challenge: new Uint8Array([/* bytes sent from the server */])
+};
+
+navigator.credentials.get({ "publicKey": options })
+    .then(function (credentialInfoAssertion) {
+    // send assertion response back to the server
+    // to proceed with the control of the credential
+}).catch(function (err) {
+     console.error(err);
+});
+
+
+ +

仕様書

+ + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName('WebAuthn','#iface-pkcredential','PublicKeyCredential interface')}}{{Spec2('WebAuthn')}}初回定義
+ +

ブラウザーの互換性

+ + + +

{{Compat("api.PublicKeyCredential")}}

+ +

関連情報

+ + diff --git a/files/ja/web/api/publickeycredential/rawid/index.html b/files/ja/web/api/publickeycredential/rawid/index.html new file mode 100644 index 0000000000..2d05c2892b --- /dev/null +++ b/files/ja/web/api/publickeycredential/rawid/index.html @@ -0,0 +1,85 @@ +--- +title: PublicKeyCredential.rawId +slug: Web/API/PublicKeyCredential/rawId +tags: + - API + - Property + - PublicKeyCredential + - Reference + - Web Authentication API + - WebAuthn + - プロパティ +translation_of: Web/API/PublicKeyCredential/rawId +--- +
{{APIRef("Web Authentication API")}}{{securecontext_header}}
+ +

rawId は {{domxref("PublicKeyCredential")}} インターフェイスの読み取り専用プロパティで、証明書の識別子が入った {{jsxref("ArrayBuffer")}} オブジェクトです。

+ +

{{domxref("PublicKeyCredential.id")}} プロパティはこの識別子が base64url エンコードされたものです。

+ +
+

メモ: このプロパティは最上位のコンテキストでしか使えない可能性があり、例えば {{HTMLElement("iframe")}} の中では利用できません。

+
+ +

構文

+ +
rawId = publicKeyCredential.rawId
+ +

+ +

{{jsxref("ArrayBuffer")}} で、証明書の識別子が入っています。この識別子はグローバルに固有で、現在の PublicKeyCredential および関連する {{domxref("AuthenticatorAssertionResponse")}} を指しています。

+ +

+ +
var options = {
+  challenge: new Uint8Array(26) /* from the server */,
+  rp: {
+    name: "Example CORP",
+    id  : "login.example.com"
+  },
+  user: {
+    id: new Uint8Array(26), /* To be changed for each user */
+    name: "jdoe@example.com",
+    displayName: "John Doe",
+  },
+  pubKeyCredParams: [
+    {
+      type: "public-key",
+      alg: -7
+    }
+  ]
+};
+
+navigator.credentials.create({  publickey: options })
+  .then(function (pubKeyCredential) {
+    var rawId = pubKeyCredential.rawId;
+    // Do something with rawId
+}).catch(function (err) {
+  // Deal with any error
+});
+
+ +

仕様書

+ + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName('WebAuthn','#dom-publickeycredential-rawid','rawId')}}{{Spec2('WebAuthn')}}初回定義
+ +

ブラウザーの対応

+ + + +

{{Compat("api.PublicKeyCredential.rawId")}}

-- cgit v1.2.3-54-g00ecf