diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..ddb6ff8 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "visualstudiotoolsforunity.vstuc" + ] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..da60e25 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,10 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Attach to Unity", + "type": "vstuc", + "request": "attach" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..f9ba9a4 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,70 @@ +{ + "files.exclude": { + "**/.DS_Store": true, + "**/.git": true, + "**/.vs": true, + "**/.gitmodules": true, + "**/.vsconfig": true, + "**/*.booproj": true, + "**/*.pidb": true, + "**/*.suo": true, + "**/*.user": true, + "**/*.userprefs": true, + "**/*.unityproj": true, + "**/*.dll": true, + "**/*.exe": true, + "**/*.pdf": true, + "**/*.mid": true, + "**/*.midi": true, + "**/*.wav": true, + "**/*.gif": true, + "**/*.ico": true, + "**/*.jpg": true, + "**/*.jpeg": true, + "**/*.png": true, + "**/*.psd": true, + "**/*.tga": true, + "**/*.tif": true, + "**/*.tiff": true, + "**/*.3ds": true, + "**/*.3DS": true, + "**/*.fbx": true, + "**/*.FBX": true, + "**/*.lxo": true, + "**/*.LXO": true, + "**/*.ma": true, + "**/*.MA": true, + "**/*.obj": true, + "**/*.OBJ": true, + "**/*.asset": true, + "**/*.cubemap": true, + "**/*.flare": true, + "**/*.mat": true, + "**/*.meta": true, + "**/*.prefab": true, + "**/*.unity": true, + "build/": true, + "Build/": true, + "Library/": true, + "library/": true, + "obj/": true, + "Obj/": true, + "Logs/": true, + "logs/": true, + "ProjectSettings/": true, + "UserSettings/": true, + "temp/": true, + "Temp/": true + }, + "files.associations": { + "*.asset": "yaml", + "*.meta": "yaml", + "*.prefab": "yaml", + "*.unity": "yaml", + }, + "explorer.fileNesting.enabled": true, + "explorer.fileNesting.patterns": { + "*.sln": "*.csproj", + }, + "dotnet.defaultSolution": "Sui-Unity-SDK.sln" +} \ No newline at end of file diff --git a/Assets/Sui-Unity-SDK/Code/Sui.Seal/README.md b/Assets/Sui-Unity-SDK/Code/Sui.Seal/README.md index 519fb7a..893ccac 100644 --- a/Assets/Sui-Unity-SDK/Code/Sui.Seal/README.md +++ b/Assets/Sui-Unity-SDK/Code/Sui.Seal/README.md @@ -102,10 +102,21 @@ SealBridge.Instance.SetServerObjectIds( ### 2. Encrypt/Decrypt data Encrypt the given plaintext for a specific Sui address. -Returns a TransactionBlock ready to be signed and executed on-chain. +Returns an EncryptionResult containing encrypted bytes and nonce for transaction construction.
-var tx = await SealBridge.Instance.Encrypt("my secret text", suiAddress);
-await suiClient.SignAndExecuteTransactionBlock(tx);
+EncryptionResult result = await SealBridge.Instance.Encrypt("my secret text", suiAddress);
+TransactionBlock tx_block = new TransactionBlock();
+tx_block.AddMoveCallTx
+(
+ SuiMoveNormalizedStructType.FromStr($"{_packageId}::{_moduleName}::{_funcName}"),
+ new SerializableTypeTag[] { },
+ new TransactionArgument[]
+ {
+ tx_block.AddPure(new OpenDive.BCS.Bytes(encryptionResult.NonceBytes)),
+ tx_block.AddPure(new OpenDive.BCS.Bytes(encryptionResult.EncryptedBytes))
+ }
+);
+await suiClient.SignAndExecuteTransactionBlock(tx_block);
Decrypt the encrypted payload using a standard private key.
diff --git a/Assets/Sui-Unity-SDK/Code/Sui.Seal/Scripts/SealBridge.cs b/Assets/Sui-Unity-SDK/Code/Sui.Seal/Scripts/SealBridge.cs
index a48f4d1..7602518 100644
--- a/Assets/Sui-Unity-SDK/Code/Sui.Seal/Scripts/SealBridge.cs
+++ b/Assets/Sui-Unity-SDK/Code/Sui.Seal/Scripts/SealBridge.cs
@@ -111,8 +111,8 @@ public void SetPackageInformation(string packageId, string moduleName, string fu
///
/// The plaintext data to encrypt.
/// The Sui address in hexadecimal format.
- ///