WorldPackageCheck

csharp
public static class WorldPackageCheck

Namespace NodeWorld.SDK.Shared.

The checks the game makes on a world's package before using any of its files, in this order: the format version (ReadManifest), the creator's signature of the manifest (VerifySignature), then the size and SHA-256 of each file as it is downloaded (VerifyFile). Each refusal throws WorldPackageRejectedException. The game server makes the same checks on the packages it hosts.

Constants

ManifestFileName

csharp
public const string ManifestFileName = "manifest.json"

Name of the manifest at the root of the package.

OldestSchemaVersion

csharp
public const int OldestSchemaVersion = 3

The oldest manifest format this game reads; an older world must be published again by its creator.

NewestSchemaVersion

csharp
public const int NewestSchemaVersion = WorldManifest.CurrentSchemaVersion

The newest manifest format this game reads; a newer world needs a newer NodeWorld.

Methods

ReadManifest

csharp
public static WorldManifest ReadManifest(byte[] manifestBytes)

The manifest of manifestBytes when this game reads its format. Throws WorldPackageRejectedException for a format too old or too new, and for bytes that are no manifest.

VerifySignature

csharp
public static void VerifySignature(byte[] manifestBytes, byte[] signatureBytes, WorldManifest manifest, string worldId)

Throws WorldPackageRejectedException unless signatureBytes (manifest.sig) is the signature of manifestBytes by the creator's key the manifest carries, and the manifest is the world worldId.

VerifyFile

csharp
public static void VerifyFile(WorldManifest manifest, string path, byte[] bytes)

Throws WorldPackageRejectedException unless bytes is the file path (from the root of the package) the signed manifest lists, with its size and SHA-256.

FindFile

csharp
public static WorldManifestFile FindFile(WorldManifest manifest, string path)

The entry of path (from the root of the package) in the manifest's file list, or null.

PlatformFilePath

csharp
public static string PlatformFilePath(WorldManifestPlatform platform, string relativePath)

The path from the root of the package of relativePath, a file of platform's folder.