@nativescript/windows-hermes 1.0.0-beta.17 → 1.0.0-beta.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,6 +30,5 @@
30
30
  <Capabilities>
31
31
  <rescap:Capability Name="runFullTrust" />
32
32
  <Capability Name="internetClient" />
33
- <Capability Name="privateNetworkClientServer" />
34
33
  </Capabilities>
35
34
  </Package>
@@ -32,11 +32,7 @@ namespace __PROJECT_NAME__
32
32
  [DllImport(NativeScriptLibrary, EntryPoint = nameof(runtime_set_local_folder))]
33
33
  private static extern void runtime_set_local_folder([MarshalAs(UnmanagedType.LPUTF8Str)] string localFolder);
34
34
 
35
- // Escape hatch for apps packed with `nsbundle_pack --key-hex <hex>` (custom-key
36
- // app.nsbundle containers). Must be called before runtime_init if used at all: apps
37
- // packed with the default pepper (no --key-hex) never need to call this. Not wired to a
38
- // default call site here; an app author supplies their own key material and calls this
39
- // from Initialize() before runtime_init(...).
35
+ // Must be called before runtime_init, which opens app.nsbundle.
40
36
  [DllImport(NativeScriptLibrary, EntryPoint = nameof(runtime_set_bundle_key))]
41
37
  private static extern int runtime_set_bundle_key([MarshalAs(UnmanagedType.LPUTF8Str)] string keyHex);
42
38
 
@@ -252,6 +248,15 @@ namespace __PROJECT_NAME__
252
248
  }
253
249
  }
254
250
 
251
+ private static void ApplyBundleKey()
252
+ {
253
+ using var stream = typeof(RuntimeHost).Assembly.GetManifestResourceStream("NSBundleKey");
254
+ if (stream == null) return;
255
+ using var reader = new StreamReader(stream);
256
+ try { runtime_set_bundle_key(reader.ReadToEnd().Trim()); }
257
+ catch (EntryPointNotFoundException) { }
258
+ }
259
+
255
260
  public void Initialize()
256
261
  {
257
262
  if (_initialized) return;
@@ -259,6 +264,7 @@ namespace __PROJECT_NAME__
259
264
  try { attached = AttachConsole(ATTACH_PARENT_PROCESS); } catch { }
260
265
  runtime_install_ctrlc_handler(0);
261
266
  runtime_set_local_folder(LocalFolderPath);
267
+ ApplyBundleKey();
262
268
  _runtime = runtime_init(AppContext.BaseDirectory);
263
269
  #if DEBUG
264
270
  TrySetDebugBuild();
@@ -87,6 +87,9 @@
87
87
  <Content Include="app.nsbundle" Condition="Exists('app.nsbundle')">
88
88
  <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
89
89
  </Content>
90
+ <!-- app.nsbundle's per-build key; RuntimeHost passes it to the runtime. -->
91
+ <EmbeddedResource Include="nsbundle.key" LogicalName="NSBundleKey"
92
+ Condition="Exists('app.nsbundle') and Exists('nsbundle.key')" />
90
93
  <Content Include="app\**\*" Condition="!Exists('app.nsbundle')">
91
94
  <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
92
95
  </Content>
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript/windows-hermes",
3
- "version": "1.0.0-beta.17",
3
+ "version": "1.0.0-beta.19",
4
4
  "description": "NativeScript Windows runtime (Hermes engine) with a WinUI 3 app template",
5
5
  "keywords": [
6
6
  "NativeScript",