1// Copyright 2016 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5module blink.mojom; 6 7import "mojo/public/mojom/base/string16.mojom"; 8import "url/mojom/origin.mojom"; 9import "url/mojom/url.mojom"; 10 11enum CredentialType { 12 EMPTY, 13 PASSWORD, 14 FEDERATED 15}; 16 17enum CredentialMediationRequirement { 18 kSilent, 19 kOptional, 20 kRequired 21}; 22 23enum CredentialManagerError { 24 SUCCESS, 25 PENDING_REQUEST, 26 PASSWORD_STORE_UNAVAILABLE, 27 NOT_ALLOWED, 28 INVALID_DOMAIN, 29 INVALID_ICON_URL, 30 CREDENTIAL_EXCLUDED, 31 32 // TODO(crbug/964439): Unused in Desktop, but kept around for Android. Delete 33 // once it's fully obsolete. 34 CREDENTIAL_NOT_RECOGNIZED, 35 36 NOT_IMPLEMENTED, 37 NOT_FOCUSED, 38 RESIDENT_CREDENTIALS_UNSUPPORTED, 39 PROTECTION_POLICY_INCONSISTENT, 40 ANDROID_ALGORITHM_UNSUPPORTED, 41 ANDROID_EMPTY_ALLOW_CREDENTIALS, 42 ANDROID_NOT_SUPPORTED_ERROR, 43 ANDROID_USER_VERIFICATION_UNSUPPORTED, 44 ABORT, 45 OPAQUE_DOMAIN, 46 INVALID_PROTOCOL, 47 BAD_RELYING_PARTY_ID, 48 UNKNOWN 49}; 50 51struct CredentialInfo { 52 CredentialType type; 53 mojo_base.mojom.String16? id; 54 mojo_base.mojom.String16? name; 55 url.mojom.Url icon; 56 mojo_base.mojom.String16? password; 57 url.mojom.Origin federation; 58}; 59 60interface CredentialManager { 61 // Store credential. For navigator.credentials.store(). 62 Store(CredentialInfo credential) => (); 63 64 // Require user mediation. For navigator.credentials.preventSilentAccess(). 65 PreventSilentAccess() => (); 66 67 // Get Credential. For navigator.credentials.get(). 68 // The result callback will return a non-null and valid CredentialInfo 69 // if succeeded, or null with a CredentialManagerError if failed. 70 Get(CredentialMediationRequirement mediation, 71 bool include_passwords, 72 array<url.mojom.Url> federations) 73 => (CredentialManagerError error, CredentialInfo? credential); 74}; 75