// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module blink.mojom;
import "mojo/public/mojom/base/string16.mojom";
import "url/mojom/scheme_host_port.mojom";
import "url/mojom/url.mojom";
enum CredentialType {
EMPTY,
PASSWORD,
FEDERATED
};
enum CredentialMediationRequirement {
kSilent,
kOptional,
kRequired
};
enum CredentialManagerError {
SUCCESS,
PENDING_REQUEST,
PASSWORD_STORE_UNAVAILABLE,
UNKNOWN
};
struct CredentialInfo {
CredentialType type;
mojo_base.mojom.String16? id;
mojo_base.mojom.String16? name;
url.mojom.Url icon;
mojo_base.mojom.String16? password;
url.mojom.SchemeHostPort federation;
};
interface CredentialManager {
// Store credential. For navigator.credentials.store().
Store(CredentialInfo credential) => ();
// Require user mediation. For navigator.credentials.preventSilentAccess().
PreventSilentAccess() => ();
// Get Credential. For navigator.credentials.get().
// The result callback will return a non-null and valid CredentialInfo
// if succeeded, or null with a CredentialManagerError if failed.
Get(CredentialMediationRequirement mediation,
bool include_passwords,
array<url.mojom.Url> federations)
=> (CredentialManagerError error, CredentialInfo? credential);
};