mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 01:00:05 +00:00
LibWeb: Stub for Credential Management API
Stub out basic Credential Management APIs and import IDL tests. Spec: https://w3c.github.io/webappsec-credential-management/
This commit is contained in:
parent
e14511468f
commit
da9eaf8788
Notes:
github-actions[bot]
2025-02-05 20:19:50 +00:00
Author: https://github.com/devgianlu
Commit: da9eaf8788
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3117
Reviewed-by: https://github.com/ADKaster ✅
20 changed files with 534 additions and 0 deletions
55
Libraries/LibWeb/CredentialManagement/CredentialsContainer.h
Normal file
55
Libraries/LibWeb/CredentialManagement/CredentialsContainer.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Altomani Gianluca <altomanigianluca@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Optional.h>
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibWeb/Bindings/CredentialsContainerPrototype.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/CredentialManagement/Credential.h>
|
||||
#include <LibWeb/CredentialManagement/FederatedCredential.h>
|
||||
#include <LibWeb/CredentialManagement/PasswordCredential.h>
|
||||
#include <LibWeb/DOM/AbortSignal.h>
|
||||
|
||||
namespace Web::CredentialManagement {
|
||||
|
||||
class CredentialsContainer final : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(CredentialsContainer, Bindings::PlatformObject);
|
||||
GC_DECLARE_ALLOCATOR(CredentialsContainer);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static GC::Ref<CredentialsContainer> create(JS::Realm&);
|
||||
|
||||
virtual ~CredentialsContainer() override;
|
||||
|
||||
GC::Ref<WebIDL::Promise> get(CredentialRequestOptions const& options);
|
||||
GC::Ref<WebIDL::Promise> store(Credential const& credential);
|
||||
GC::Ref<WebIDL::Promise> create(CredentialCreationOptions const& options);
|
||||
GC::Ref<WebIDL::Promise> prevent_silent_access();
|
||||
|
||||
private:
|
||||
explicit CredentialsContainer(JS::Realm&);
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
struct CredentialRequestOptions {
|
||||
Bindings::CredentialMediationRequirement mediation { Bindings::CredentialMediationRequirement::Optional };
|
||||
GC::Ptr<DOM::AbortSignal> signal;
|
||||
|
||||
Optional<bool> password;
|
||||
Optional<FederatedCredentialRequestOptions> federated;
|
||||
};
|
||||
|
||||
struct CredentialCreationOptions {
|
||||
Bindings::CredentialMediationRequirement mediation { Bindings::CredentialMediationRequirement::Optional };
|
||||
GC::Ptr<DOM::AbortSignal> signal;
|
||||
|
||||
Optional<PasswordCredentialInit> password;
|
||||
Optional<FederatedCredentialInit> federated;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue