| OLD | NEW | 
|    1 // Copyright 2017 The Chromium Authors. All rights reserved. |    1 // Copyright 2017 The Chromium Authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 [JavaPackage="org.chromium.webauth.mojom"] |    5 [JavaPackage="org.chromium.webauth.mojom"] | 
|    6 module webauth.mojom; |    6 module webauth.mojom; | 
|    7  |    7  | 
 |    8 import "mojo/common/time.mojom"; | 
 |    9 import "url/mojo/url.mojom"; | 
 |   10  | 
|    8 // This file describes the communication between the WebAuthentication renderer |   11 // This file describes the communication between the WebAuthentication renderer | 
|    9 // implementation and browser-side implementations to create scoped credentials |   12 // implementation and browser-side implementations to create public key | 
|   10 // and use already-created credentials to get assertions. |   13 // credentials and use already-created credentials to get assertions. | 
|   11 // See https://w3c.github.io/webauthn/. |   14 // See https://w3c.github.io/webauthn/. | 
|   12  |   15  | 
|   13 enum AuthenticatorStatus { |   16 enum AuthenticatorStatus { | 
|   14   SUCCESS, |   17   SUCCESS, | 
|   15   CANCELLED, |   18   CANCELLED, | 
|   16   UNKNOWN_ERROR, |   19   UNKNOWN_ERROR, | 
|   17   NOT_ALLOWED_ERROR, |   20   NOT_ALLOWED_ERROR, | 
|   18   NOT_SUPPORTED_ERROR, |   21   NOT_SUPPORTED_ERROR, | 
|   19   SECURITY_ERROR, |   22   SECURITY_ERROR, | 
|   20   NOT_IMPLEMENTED, |   23   NOT_IMPLEMENTED, | 
|   21 }; |   24 }; | 
|   22  |   25  | 
|   23 // The public key and attestation that is returned by an authenticator's  |   26 // The public key and attestation that is returned by an authenticator's  | 
|   24 // call to makeCredential. |   27 // call to makeCredential. | 
|   25 struct ScopedCredentialInfo { |   28 struct PublicKeyCredentialInfo { | 
 |   29   // The base64url encoding of |raw_id|. | 
 |   30   string id; | 
 |   31  | 
 |   32   // An identifier for the credential. | 
 |   33   array<uint8> raw_id; | 
 |   34  | 
|   26   // A blob of data containing the JSON serialization of client data passed |   35   // A blob of data containing the JSON serialization of client data passed | 
|   27   // to the authenticator. |   36   // to the authenticator. | 
|   28   array<uint8> client_data; |   37   array<uint8> client_data_json; | 
|   29   // A blob of data returned from the authenticator. |   38  | 
|   30   array<uint8> attestation; |   39   // The response data from the authenticator. | 
 |   40   AuthenticatorResponse response; | 
|   31 }; |   41 }; | 
|   32  |   42  | 
|   33 // Information about the relying party and the user account held by that  |   43 // Contains the authenticator's response to the request to either | 
|   34 // relying party. This information is used by the authenticator to create  |   44 // create a public key credential, or generate an authentication assertion. | 
|   35 // or retrieve an appropriate scoped credential for this account. |   45 struct AuthenticatorResponse { | 
|   36 // These fields take arbitrary input. |   46   // A blob of data returned by the authenticator after creating a credential. | 
|   37 struct RelyingPartyAccount { |   47   array<uint8> attestation_object; | 
|   38   // Friendly name of the Relying Party, e.g. "Acme Corporation" |   48  | 
|   39   string relying_party_display_name; |   49   // A blob of data returned by the authenticator after generating an assertion. | 
|   40   // Friendly name associated with the user account, e.g. "John P. Smith" |   50   array<uint8> authenticator_data; | 
|   41   string display_name; |   51  | 
|   42   // Identifier for the account, corresponding to no more than one credential  |   52   // Cryptographic signature proving possession of the credential private key. | 
|   43   // per authenticator and Relying Party. |   53   array<uint8> signature; | 
|   44   string id; |  | 
|   45   // Detailed name for the account, e.g. john.p.smith@example.com |  | 
|   46   string? name; |  | 
|   47   // User image, if any. |  | 
|   48   // TODO(kpaulhamus): make this url.mojom.Url in a followup CL |  | 
|   49   string? image_url; |  | 
|   50 }; |   54 }; | 
|   51  |   55  | 
|   52 // Parameters that are used to generate an appropriate scoped credential. |   56 // Information about the relying party and the account held by the user at  | 
|   53 struct ScopedCredentialParameters { |   57 // that relying party. This information is used by the authenticator to create | 
|   54   ScopedCredentialType type; |   58 // or retrieve an appropriate public key credential for this account. | 
 |   59 // These fields take arbitrary input. | 
 |   60 struct PublicKeyCredentialEntity { | 
 |   61   // A unique identifier for the entity. An ASCII serialization of an origin | 
 |   62   // for a relying party, and an arbitrary string specified by the relying party | 
 |   63   // for user accounts. | 
 |   64   string id; | 
 |   65  | 
 |   66   // Friendly name associated with the entity intended for display. | 
 |   67   // e.g. "Acme Corporation" for a relying party and "john.p.smith@example.com" | 
 |   68   // or "+14255551234" for a user. | 
 |   69   string name; | 
 |   70  | 
 |   71   // Image associated with the entity. | 
 |   72   // For example, this could be a user’s avatar or a relying party's logo. | 
 |   73   url.mojom.Url? icon; | 
 |   74  | 
 |   75   // Contains a friendly name for the user account (e.g., "John P. Smith"). | 
 |   76   string? display_name; | 
 |   77 }; | 
 |   78  | 
 |   79 // Parameters that are used to generate an appropriate public key credential. | 
 |   80 struct PublicKeyCredentialParameters { | 
 |   81   PublicKeyCredentialType type; | 
|   55   // TODO(kpaulhamus): add AlgorithmIdentifier algorithm; |   82   // TODO(kpaulhamus): add AlgorithmIdentifier algorithm; | 
|   56 }; |   83 }; | 
|   57  |   84  | 
|   58 // Optional parameters that are used during makeCredential.  |   85 // Parameters passed into calls to MakeCredential. | 
|   59 struct ScopedCredentialOptions { |   86 struct MakeCredentialOptions { | 
|   60   //TODO(kpaulhamus): Make this mojo.common.mojom.TimeDelta in followup CL |   87   // Relying party information.  | 
|   61   double adjusted_timeout; |   88   // Corresponds to |rp| in MakeCredentialOptions.idl. | 
|   62   string? relying_party_id; |   89   PublicKeyCredentialEntity relying_party; | 
|   63   array<ScopedCredentialDescriptor> exclude_list; |   90  | 
|   64   // TODO(kpaulhamus): add Extensions |   91   // Information about the user. | 
 |   92   PublicKeyCredentialEntity user; | 
 |   93    | 
 |   94   // A blob passed from the the relying party server. | 
 |   95   array<uint8> challenge;  | 
 |   96  | 
 |   97   array<PublicKeyCredentialParameters> crypto_parameters; | 
 |   98  | 
 |   99   mojo.common.mojom.TimeDelta adjusted_timeout; | 
 |  100  | 
 |  101   array<PublicKeyCredentialDescriptor> exclude_credentials; | 
 |  102  | 
 |  103   // TODO(kpaulhamus): add AuthenticatorSelectionCriteria   | 
|   65 }; |  104 }; | 
|   66  |  105  | 
|   67 enum ScopedCredentialType { |  106 enum PublicKeyCredentialType { | 
|   68   SCOPEDCRED, |  107   PUBLIC_KEY, | 
|   69 }; |  108 }; | 
|   70  |  109  | 
|   71 // Describes the credentials that the relying party already knows about for |  110 // Describes the credentials that the relying party already knows about for | 
|   72 // the given account. If any of these are known to the authenticator,  |  111 // the given account. If any of these are known to the authenticator, | 
|   73 // it should not create a new credential. |  112 // it should not create a new credential. | 
|   74 struct ScopedCredentialDescriptor { |  113 struct PublicKeyCredentialDescriptor { | 
|   75   ScopedCredentialType type; |  114   PublicKeyCredentialType type; | 
|   76   // Blob representing a credential key handle. Up to 255 bytes for  |  115  | 
 |  116   // Blob representing a credential key handle. Up to 255 bytes for | 
|   77   // U2F authenticators. |  117   // U2F authenticators. | 
|   78   array<uint8> id; |  118   array<uint8> id; | 
|   79   array<Transport> transports; |  119  | 
 |  120   array<AuthenticatorTransport> transports; | 
|   80 }; |  121 }; | 
|   81  |  122  | 
|   82 enum Transport { |  123 enum AuthenticatorTransport { | 
|   83   USB, |  124   USB, | 
|   84   NFC, |  125   NFC, | 
|   85   BLE, |  126   BLE, | 
|   86 }; |  127 }; | 
|   87  |  128  | 
|   88 // Interface to direct authenticators to create or use a scoped credential. |  129 // Interface to direct authenticators to create or use a public key credential. | 
|   89 interface Authenticator { |  130 interface Authenticator { | 
|   90   // Gets the credential info for a new credential created by an authenticator |  131   // Gets the credential info for a new public key credential created by an | 
|   91   // for the given relying party and account.  |  132   // authenticator for the given |MakeCredentialOptions| | 
|   92   // |attestation_challenge| is a blob passed from the relying party server. |  133   // [PublicKeyCredentialInfo] will only be set if status == SUCCESS.    | 
|   93   // [ScopedCredentialInfo] will only be set if status == SUCCESS.  |  134   MakeCredential(MakeCredentialOptions options) | 
|   94   MakeCredential(RelyingPartyAccount account_information, |  135       => (AuthenticatorStatus status, PublicKeyCredentialInfo? credential); | 
|   95                  array<ScopedCredentialParameters> crypto_parameters, |  | 
|   96                  array<uint8> attestation_challenge, |  | 
|   97                  ScopedCredentialOptions options) |  | 
|   98       => (AuthenticatorStatus status,  |  | 
|   99           ScopedCredentialInfo? scoped_credential); |  | 
|  100 }; |  136 }; | 
| OLD | NEW |