WebAuthnUtil.h (1233B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_dom_WebAuthnUtil_h 8 #define mozilla_dom_WebAuthnUtil_h 9 10 #include "ipc/IPCMessageUtils.h" 11 #include "mozilla/dom/WebAuthenticationBinding.h" 12 13 namespace mozilla::dom { 14 15 class WindowGlobalParent; 16 17 bool IsValidAppId(const nsCOMPtr<nsIPrincipal>& aPrincipal, 18 const nsCString& aAppId); 19 20 bool IsWebAuthnAllowedInDocument(const nsCOMPtr<Document>& aDoc); 21 22 bool IsWebAuthnAllowedInContext(WindowGlobalParent* aContext); 23 24 bool IsWebAuthnAllowedForTransportSecurityInfo( 25 nsITransportSecurityInfo* aSecurityInfo); 26 27 nsresult DefaultRpId(const nsCOMPtr<nsIPrincipal>& aPrincipal, 28 /* out */ nsACString& aRpId); 29 30 bool IsValidRpId(const nsCOMPtr<nsIPrincipal>& aPrincipal, 31 const nsACString& aRpId); 32 33 nsresult HashCString(const nsACString& aIn, /* out */ nsTArray<uint8_t>& aOut); 34 35 } // namespace mozilla::dom 36 37 #endif // mozilla_dom_WebAuthnUtil_h