1. 開発者向けのウェブ技術
  2. Web API
  3. PublicKeyCredential
  4. PublicKeyCredential.id

このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

PublicKeyCredential.id

安全なコンテキスト用: この機能は一部またはすべての対応しているブラウザーにおいて、安全なコンテキスト (HTTPS) でのみ利用できます。

idPublicKeyCredential インターフェイスの読み取り専用プロパティで、 Credential から継承した文字列であり、現在の PublicKeyCredential インスタンスの識別子を表します。

このプロパティは PublicKeyCredential.rawIdbase64url エンコード版です。

メモ: このプロパティは最上位のコンテキストでのみ使用することができ、例えば <iframe> では使用することができません。

PublicKeyCredential.rawIdbase64url エンコード 版である文字列です。

js
const publicKey = {
 challenge: new Uint8Array(26) /* this actually is given from the server */,
 rp: {
 name: "Example CORP",
 id: "login.example.com",
 },
 user: {
 id: new Uint8Array(26) /* To be changed for each user */,
 name: "canand@example.com",
 displayName: "Carina Anand",
 },
 pubKeyCredParams: [
 {
 type: "public-key",
 alg: -7,
 },
 ],
};
navigator.credentials
 .create({ publicKey })
 .then((newCredentialInfo) => {
 const id = newCredentialInfo.id;
 // Do something with the id
 // send attestation response and client extensions
 // to the server to proceed with the registration
 // of the credential
 })
 .catch((err) => {
 console.error(err);
 });

仕様書

この機能は、どの仕様書にも定義されていません。

ブラウザーの互換性

関連情報

MDN の改良に協力

協力方法を知る

このページは MDN の貢献者によって に最終更新されました。

AltStyle によって変換されたページ (->オリジナル) /