PublicKeyCredential.rawId
        
        
          
                Baseline
                
                  Widely available
                
                
              
        
        
        
          
                
              
                
              
                
              
        
        
      
      This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2021年9月.
安全なコンテキスト用: この機能は一部またはすべての対応しているブラウザーにおいて、安全なコンテキスト (HTTPS) でのみ利用できます。
rawId は PublicKeyCredential インターフェイスの読み取り専用プロパティで、資格情報の識別子が入った ArrayBuffer オブジェクトです。
PublicKeyCredential.id プロパティはこの識別子が base64url エンコードされたものです。
メモ:
このプロパティは最上位のコンテキストでしか使えません。例えば <iframe> の中では利用できません。
値
ArrayBuffer で、資格情報の識別子が入っています。この識別子はグローバルに固有で、現在の PublicKeyCredential および関連する AuthenticatorAssertionResponse を指しています。
例
js
const 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: "canand@example.com",
    displayName: "Carina Anand",
  },
  pubKeyCredParams: [
    {
      type: "public-key",
      alg: -7,
    },
  ],
};
navigator.credentials
  .create({ publicKey: options })
  .then((pubKeyCredential) => {
    const rawId = pubKeyCredential.rawId;
    // Do something with rawId
  })
  .catch((err) => {
    // Deal with any error
  });
仕様書
| Specification | 
|---|
| Web Authentication: An API for accessing Public Key Credentials - Level 3> # dom-publickeycredential-rawid> | 
ブラウザーの互換性
Loading…