Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0d5196b
Added Windows Support
Mar 23, 2026
fba49fb
Added build/support doc for windows
Mar 23, 2026
8421bc3
Updated to use 2 webviews with thier own contexts
Mar 30, 2026
3360415
fix: align C# DllImport names with two-webview native exports
lucasloisp Apr 16, 2026
d6fc115
chore: bumps vs to 18 2026
lucasloisp Apr 17, 2026
b5423f7
chore: refactor options
lucasloisp Apr 17, 2026
e3fef61
fix: pass cmake options as array to avoid PowerShell argument collapsing
lucasloisp Apr 17, 2026
e2c6449
ci: add Windows native plugin build workflow
lucasloisp Apr 17, 2026
57d2ac8
chore: remove build-plugins.ps1 in favor of CI workflow
lucasloisp Apr 17, 2026
e361c61
chore: remove Linux plugin references, scope to Windows only
lucasloisp Apr 17, 2026
5c63c35
chore: recompiles the Windows PrivyWebView dll
lucasloisp Apr 17, 2026
815546a
fix: removes the windows-specific callback
lucasloisp Apr 17, 2026
189ca57
chore: clean up
lucasloisp Apr 17, 2026
e0a83ac
fix: harden native WebView2 plugin security
lucasloisp Apr 22, 2026
e2d9aaa
fix: validate OAuth state parameter to prevent CSRF attacks
lucasloisp Apr 22, 2026
021e53c
fix: use separate message callbacks for wallet and OAuth WebViews
lucasloisp Apr 22, 2026
e794947
Add non-Windows fallback for Windows WebView handler
lucasloisp May 27, 2026
9240609
Use UTF-8 marshaling for Windows WebView
lucasloisp May 27, 2026
7bcc36e
Dispose Windows WebView callbacks
lucasloisp May 27, 2026
9291cec
Clean up Windows OAuth timeout
lucasloisp May 27, 2026
b08db98
Limit app identifier fallback to Windows
lucasloisp May 27, 2026
a14d0a4
Pin Windows plugin build dependencies
lucasloisp May 27, 2026
1bad18d
Fix WebView2 settings interface usage
lucasloisp May 27, 2026
7678094
chore: recompiles the Windows PrivyWebView dll
lucasloisp May 27, 2026
0af16f3
Marshal Windows WebView calls to owner thread
lucasloisp May 27, 2026
fa4df23
Verify committed Windows DLL is current
lucasloisp May 27, 2026
c0c7c58
Rebuild Windows PrivyWebView DLL
lucasloisp May 27, 2026
207005b
Remove Windows DLL freshness check
lucasloisp May 27, 2026
d1a4acc
chore: recompiles the Windows PrivyWebView dll
lucasloisp May 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/build-windows-plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build Windows Plugin

on:
pull_request:
paths:
- "SDK/Plugins/Windows/**/*.cpp"
- "SDK/Plugins/Windows/**/*.h"
- "SDK/Plugins/Windows/CMakeLists.txt"
- "SDK/Plugins/CMakeLists.txt"
- ".github/workflows/build-windows-plugin.yml"
push:
branches: [main]
paths:
- "SDK/Plugins/Windows/**/*.cpp"
- "SDK/Plugins/Windows/**/*.h"
- "SDK/Plugins/Windows/CMakeLists.txt"
- "SDK/Plugins/CMakeLists.txt"
- ".github/workflows/build-windows-plugin.yml"

jobs:
build:
name: Build PrivyWebView.dll
runs-on: windows-2022
env:
WEBVIEW2_VERSION: 1.0.3296.44
WEBVIEW2_PACKAGE_DIR: .webview2

steps:
- uses: actions/checkout@v4

- name: Cache WebView2 SDK
uses: actions/cache@v4
with:
path: ${{ env.WEBVIEW2_PACKAGE_DIR }}
key: webview2-${{ runner.os }}-${{ env.WEBVIEW2_VERSION }}

- name: Install WebView2 SDK
run: |
nuget install Microsoft.Web.WebView2 -Version $env:WEBVIEW2_VERSION -OutputDirectory $env:WEBVIEW2_PACKAGE_DIR -NonInteractive

- name: Configure CMake
run: |
$wv2 = Get-Item (Join-Path $env:WEBVIEW2_PACKAGE_DIR "Microsoft.Web.WebView2.$env:WEBVIEW2_VERSION")
$wv2Root = "$($wv2.FullName)/build/native"
cmake -S SDK/Plugins -B SDK/Plugins/build -G "Visual Studio 17 2022" -A x64 -D WEBVIEW2_ROOT="$wv2Root"

- name: Build
run: cmake --build SDK/Plugins/build --config Release

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: PrivyWebView-windows-x64
path: SDK/Plugins/Windows/x86_64/Release/PrivyWebView.dll
if-no-files-found: error
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,16 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Build artifact folders for C Windows plugin
/SDK/Plugins/Windows/**/bin/
/SDK/Plugins/Windows/**/obj/
/SDK/Plugins/Windows/**/Debug/
/SDK/Plugins/Windows/**/Release/*.lib*
/SDK/Plugins/Windows/**/Release/*.exp*
/SDK/Plugins/Build*

# Temporary build/test folders
SampleApp/Test*/

# Environment secrets
.env
6 changes: 6 additions & 0 deletions SDK/Plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cmake_minimum_required(VERSION 3.16)
project(PrivyWebViewPlugins LANGUAGES C CXX)

if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_subdirectory(Windows)
endif()
7 changes: 7 additions & 0 deletions SDK/Plugins/CMakeLists.txt.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions SDK/Plugins/Windows.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 79 additions & 0 deletions SDK/Plugins/Windows/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
cmake_minimum_required(VERSION 3.16)
project(PrivyWebViewWindows LANGUAGES CXX)

set(PLUGIN_OUTPUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/x86_64")

add_library(PrivyWebView SHARED PrivyWebView.cpp)

# Ensure output is placed in the Unity plugin folder
set_target_properties(PrivyWebView PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
RUNTIME_OUTPUT_DIRECTORY "${PLUGIN_OUTPUT_DIR}"
LIBRARY_OUTPUT_DIRECTORY "${PLUGIN_OUTPUT_DIR}"
ARCHIVE_OUTPUT_DIRECTORY "${PLUGIN_OUTPUT_DIR}"
)

# WebView2 SDK support
# User can specify WEBVIEW2_ROOT to point to the WebView2 SDK root (contains include/ and lib/)
if(NOT WEBVIEW2_ROOT)
# ProgramFiles(x86) contains parentheses and cannot be referenced directly in CMake variables.
# Use cmd to expand it instead.
execute_process(COMMAND cmd /c "echo %ProgramFiles(x86)%" OUTPUT_VARIABLE _progfiles_x86 OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND cmd /c "echo %ProgramFiles%" OUTPUT_VARIABLE _progfiles OUTPUT_STRIP_TRAILING_WHITESPACE)

if(_progfiles_x86)
set(_webview2_candidate "${_progfiles_x86}/Microsoft WebView2 SDK")
elseif(_progfiles)
set(_webview2_candidate "${_progfiles}/Microsoft WebView2 SDK")
endif()

if(_webview2_candidate)
set(WEBVIEW2_ROOT "${_webview2_candidate}")
endif()
endif()

# Primary (recommended) include path
find_path(WEBVIEW2_INCLUDE_DIR WebView2.h
PATHS
"${WEBVIEW2_ROOT}/include"
"${WEBVIEW2_ROOT}/*/include"
NO_DEFAULT_PATH
)

# Primary lib path
find_library(WEBVIEW2_LIB WebView2LoaderStatic
PATHS
"${WEBVIEW2_ROOT}/x64"
"${WEBVIEW2_ROOT}/x86"
"${WEBVIEW2_ROOT}/*/x64"
"${WEBVIEW2_ROOT}/*/x86"
NO_DEFAULT_PATH
)

# Fallback: if we still don't find it, check the expected folder layout directly.
if(NOT WEBVIEW2_INCLUDE_DIR)
if(EXISTS "${WEBVIEW2_ROOT}/include/WebView2.h")
set(WEBVIEW2_INCLUDE_DIR "${WEBVIEW2_ROOT}/include")
endif()
endif()

if(NOT WEBVIEW2_LIB)
if(EXISTS "${WEBVIEW2_ROOT}/x64/WebView2LoaderStatic.lib")
set(WEBVIEW2_LIB "${WEBVIEW2_ROOT}/x64/WebView2LoaderStatic.lib")
elseif(EXISTS "${WEBVIEW2_ROOT}/x86/WebView2LoaderStatic.lib")
set(WEBVIEW2_LIB "${WEBVIEW2_ROOT}/x86/WebView2LoaderStatic.lib")
endif()
endif()

message(STATUS "WebView2 SDK root candidate: ${WEBVIEW2_ROOT}")
message(STATUS "Searching for WebView2.h under: ${WEBVIEW2_ROOT}/include")

if(WEBVIEW2_INCLUDE_DIR AND WEBVIEW2_LIB)
message(STATUS "Found WebView2 include: ${WEBVIEW2_INCLUDE_DIR}")
message(STATUS "Found WebView2 lib: ${WEBVIEW2_LIB}")
target_include_directories(PrivyWebView PRIVATE "${WEBVIEW2_INCLUDE_DIR}")
target_link_libraries(PrivyWebView PRIVATE "${WEBVIEW2_LIB}")
else()
message(FATAL_ERROR "WebView2 SDK not found. Please install WebView2 SDK (https://developer.microsoft.com/microsoft-edge/webview2/) and ensure WebView2.h and WebView2.lib are available. You can also set WEBVIEW2_ROOT to the SDK root folder.")
endif()
7 changes: 7 additions & 0 deletions SDK/Plugins/Windows/CMakeLists.txt.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading