Skip to content
This repository was archived by the owner on Apr 2, 2025. It is now read-only.

Commit 865b82b

Browse files
Added docs on secure storage for Android and updated editor docs as well as they were out of date (#480)
1 parent 34899c1 commit 865b82b

File tree

1 file changed

+64
-1
lines changed

1 file changed

+64
-1
lines changed

docs/pages/sdk/unity/recovering-sessions.mdx

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,69 @@ On Windows PCs, we leverage the [Crypto: Next Generation - Data Protection API (
2929

3030
On Web builds, we leverage [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) via [PlayerPrefs](https://docs.unity3d.com/ScriptReference/PlayerPrefs.html).
3131

32+
## Android
33+
34+
On Android builds, we leverage the [Android Keystore](https://developer.android.com/privacy-and-security/keystore).
35+
36+
Our Keystore plugin for Unity (included in the SDK) requires a Custom Main Gradle Template. Please navigate to your Project Settings, then under `Player > Publishing Settings` enable `Custom Main Gradle Template`. This will create a file `Assets/Plugins/Android/mainTemplate.gradle` (or similar, the editor will show you the path) if you don't have one already. Here is an example `mainTemplate.gradle` file; please copy/paste this (or incorporate into your existing file).
37+
38+
```
39+
apply plugin: 'com.android.library'
40+
**APPLY_PLUGINS**
41+
42+
dependencies {
43+
implementation fileTree(dir: 'libs', include: ['*.jar'])
44+
implementation 'androidx.security:security-crypto:1.1.0-alpha03'
45+
46+
**DEPS**}
47+
48+
android {
49+
compileSdkVersion **APIVERSION**
50+
buildToolsVersion '**BUILDTOOLS**'
51+
52+
compileOptions {
53+
sourceCompatibility JavaVersion.VERSION_1_8
54+
targetCompatibility JavaVersion.VERSION_1_8
55+
}
56+
57+
defaultConfig {
58+
minSdkVersion **MINSDKVERSION**
59+
targetSdkVersion **TARGETSDKVERSION**
60+
ndk {
61+
abiFilters **ABIFILTERS**
62+
}
63+
versionCode **VERSIONCODE**
64+
versionName '**VERSIONNAME**'
65+
consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD**
66+
}
67+
68+
lintOptions {
69+
abortOnError false
70+
}
71+
72+
aaptOptions {
73+
noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ')
74+
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
75+
}**PACKAGING_OPTIONS**
76+
}**REPOSITORIES**
77+
**IL_CPP_BUILD_SETUP**
78+
**SOURCE_BUILD_SETUP**
79+
**EXTERNAL_SOURCES**
80+
```
81+
82+
Our Keystore plugin also requires a Custom Gradle Properties Template. Again, navigate to your Project Settings, then under `Player > Publishing Settings` enable `Custom Gradle Properties Template`. This will create a file `Assets/Plugins/Android/gradleTemplate.properties` (or similar, the editor will show you the path) if you don't have one already. Here is an example `gradleTemplate.properties` file; please copy/paste this (or incorporate into your existing file).
83+
84+
```
85+
org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M
86+
org.gradle.parallel=true
87+
android.enableJetifier=true
88+
android.useAndroidX=true
89+
unityStreamingAssets=**STREAMING_ASSETS**
90+
**ADDITIONAL_PROPERTIES**
91+
92+
android.enableR8=**MINIFY_WITH_R_EIGHT**
93+
```
94+
3295
## Editor
3396

34-
In the editor, we leverage the MacOS and PC secure storage solutions depending on which version of the editor you are using. You will also need to enable 'EditorStoreSessionPrivateKeyInSecureStorage' in SequenceConfig in order to use secure storage and recover sessions from within the editor. This separate flag makes it easier for you to test both flows without modifying the behaviour of your builds.
97+
In the editor, we use PlayerPrefs for private key storage. You will also need to enable 'EditorStoreSessionPrivateKeyInSecureStorage' in SequenceConfig in order to use secure storage and recover sessions from within the editor. This separate flag makes it easier for you to test both flows without modifying the behaviour of your builds. Secure storage in the editor is for development purposes only and should not be considered secure for long-term storage.

0 commit comments

Comments
 (0)