remove realm

Signed-off-by: yenda <eric@status.im>
This commit is contained in:
yenda 2019-09-05 20:21:37 +02:00
parent 172038b70d
commit c3dd950286
No known key found for this signature in database
GPG Key ID: 0095623C0069DCE6
80 changed files with 1487 additions and 9149 deletions

View File

@ -64,10 +64,6 @@ nix-add-gcroots: export TARGET_OS := none
nix-add-gcroots: ##@nix Add Nix GC roots to avoid status-react expressions being garbage collected
scripts/add-nix-gcroots.sh
nix-update-npm: export TARGET_OS := none
nix-update-npm: ##@nix Update node2nix expressions based on current package.json
nix/desktop/realm-node/generate-nix.sh
nix-update-gradle: ##@nix Update maven nix expressions based on current gradle setup
nix/mobile/android/maven-and-npm-deps/maven/generate-nix.sh

View File

@ -265,7 +265,6 @@ dependencies {
implementation project(':react-native-splash-screen')
implementation project(':react-native-image-resizer')
implementation project(':react-native-dialogs')
implementation project(':realm')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
// Force using exact RN version instead of relying on gradle dependency resolution
@ -298,7 +297,6 @@ dependencies {
implementation project(':react-native-keychain')
compile 'com.github.status-im:function:0.0.1'
implementation fileTree(dir: "node_modules/realm/android/libs", include: ["*.jar"])
implementation 'com.facebook.fresco:animated-gif:1.10.0'
}

View File

@ -34,7 +34,6 @@ import im.status.ethereum.module.StatusPackage;
import io.invertase.firebase.RNFirebasePackage;
import io.invertase.firebase.messaging.RNFirebaseMessagingPackage;
import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage;
import io.realm.react.RealmReactPackage;
import me.alwx.HttpServer.HttpServerReactPackage;
import com.chirag.RNMail.*;
import com.clipsub.RNShake.RNShakeEventPackage;
@ -67,7 +66,6 @@ public class MainApplication extends MultiDexApplication implements ReactApplica
new SplashScreenReactPackage(),
statusPackage,
new RNStatusKeycardPackage(),
new RealmReactPackage(),
new RNLanguagesPackage(),
new RNCameraPackage(),
new RNFSPackage(),

View File

@ -27,8 +27,6 @@ include ':react-native-dialogs'
project(':react-native-dialogs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-dialogs/android')
include ':react-native-languages'
project(':react-native-languages').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-languages/android')
include ':realm'
project(':realm').projectDir = new File(rootProject.projectDir, '../node_modules/realm/android')
include ':react-native-status'
project(':react-native-status').projectDir = new File(rootProject.projectDir, '../modules/react-native-status/android')
include ':react-native-camera'

View File

@ -29,7 +29,6 @@ pipeline {
BUILD_ENV = 'prod'
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
FASTLANE_DISABLE_COLORS = 1
REALM_DISABLE_ANALYTICS = 1
/* since we are mounting it we need to specify location */
STATUS_RELEASE_STORE_FILE = '/home/jenkins/status-im.keystore'
/* We use EXECUTOR_NUMBER to avoid multiple instances clashing */

View File

@ -28,7 +28,6 @@ pipeline {
TARGET_OS = 'ios'
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
FASTLANE_DISABLE_COLORS = 1
REALM_DISABLE_ANALYTICS = 1
BUNDLE_PATH = "${HOME}/.bundle"
/* We use EXECUTOR_NUMBER to avoid multiple instances clashing */
LEIN_HOME = "/var/tmp/lein-${EXECUTOR_NUMBER}"

View File

@ -40,7 +40,7 @@ def bundle() {
'STATUS_RELEASE_KEY_PASSWORD'
],
keep: [
'REALM_DISABLE_ANALYTICS', 'NDK_ABI_FILTERS',
'NDK_ABI_FILTERS',
'STATUS_RELEASE_STORE_FILE'
],
sbox: [

View File

@ -4,10 +4,8 @@
:figwheel-bridge "./figwheel-bridge.js"
;; JS modules
:js-modules ["realm"
"react-native-languages"
:js-modules ["react-native-languages"
"i18n-js"
"realm/react-native"
"dismissKeyboard"
"react-native-splash-screen"
"react-native-status"
@ -40,7 +38,6 @@
"react-native/Libraries/vendor/emitter/EventEmitter"
"react-native-background-timer"
"react-native-fetch-polyfill"
"text-encoding"
"js-sha3"
"react-navigation"
"react-native-navigation-twopane"
@ -49,10 +46,8 @@
"react-native-shake"
"@react-native-community/netinfo"]
;; Desktop modules
:desktop-modules ["realm"
"react-native-languages"
:desktop-modules ["react-native-languages"
"i18n-js"
"realm/react-native"
"dismissKeyboard"
"react-native-splash-screen"
"react-native-status"
@ -81,7 +76,6 @@
"react-native-desktop-config"
"react-native-desktop-shortcuts"
"react-native-desktop-notification"
"text-encoding"
"js-sha3"
"web3-utils"
"react-navigation"

View File

@ -218,20 +218,6 @@ QString getDataStoragePath() {
return dataStoragePath;
}
void renameRealmDirs() {
QDir dataDir(getDataStoragePath());
if (dataDir.exists("default.realmaccounts")) {
dataDir.mkdir("default.realm");
dataDir.rename("default.realmaccounts", "default.realm/accounts");
dataDir.rename("default.realmdefault.realm", "default.realm/default.realm");
dataDir.rename("default.realmdefault.realm.lock", "default.realm/default.realm.lock");
dataDir.rename("default.realmdefault.realm.management", "default.realm/default.realm.management");
dataDir.rename("default.realmdefault.realm.note", "default.realm/default.realm.note");
}
}
int main(int argc, char **argv) {
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication app(argc, argv);
@ -251,7 +237,6 @@ int main(int argc, char **argv) {
dataStoragePath = "";
#endif
renameRealmDirs();
ExceptionGlobalHandler exceptionHandler(
appPath + QDir::separator() + CRASH_REPORT_EXECUTABLE,
exceptionPostHandledCallback, dataStoragePath);
@ -438,7 +423,6 @@ bool runNodeJsServer() {
QStringList arguments = (QStringList() << "--port" << port);
g_nodeJsServerProcess->setArguments(arguments);
}
qputenv("REALM_DISABLE_ANALYTICS", "1");
QObject::connect(g_nodeJsServerProcess, &QProcess::errorOccurred,
[=](QProcess::ProcessError) {
qCWarning(JSSERVER) << "process name: "

View File

@ -58,10 +58,10 @@
"i18n-js": "^3.1.0",
"identicon.js": "git+https://github.com/status-im/identicon.js.git#v1.2.1-status",
"js-sha3": "^0.8.0",
"qrcode": "^1.4.1",
"metro": "^0.48.1",
"metro-react-native-babel-preset": "0.45.6",
"nfc-react-native": "git+https://github.com/status-im/nfc-react-native.git#v0.3.8-status",
"qrcode": "^1.4.1",
"react": "16.6.1",
"react-dom": "16.4.2",
"react-native": "git+https://github.com/status-im/react-native-desktop.git#v0.57.8_10",
@ -82,13 +82,9 @@
"react-native-os": "1.1.0",
"react-native-securerandom": "git+https://github.com/status-im/react-native-securerandom.git#0.1.1-2",
"react-native-splash-screen": "3.0.6",
"react-native-tcp": "3.3.0",
"react-native-udp": "2.2.1",
"react-native-webview-bridge": "git+https://github.com/status-im/react-native-webview-bridge.git#0.33.16-status-rn049-desktop",
"react-navigation": "^2.12.1",
"realm": "git+https://github.com/status-im/realm-js.git#v2.20.1",
"status-conan": "git+https://github.com/status-im/status-conan.git#v1.0.0",
"text-encoding": "^0.6.4",
"url": "0.10.3",
"web3": "git+https://github.com/status-im/web3.js.git#0.20.3-status.alpha.3",
"web3-utils": "1.0.0-beta.36"

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,7 @@
# Sign in flow
TODO: this document is outdated
## tl;dr
In general, at first we try to encrypt realm database using password
and then proceed with the rest of operations. We do not wait for

View File

@ -62,7 +62,6 @@ var TopLevel = {
"contentOffset" : function () {},
"contentSize" : function () {},
"contract" : function () {},
"create" : function () {},
"createAccount" : function () {},
"createBatch" : function () {},
"createChannel" : function () {},
@ -92,10 +91,8 @@ var TopLevel = {
"decodeURI" : function () {},
"default" : function () {},
"defaultAccount" : function () {},
"defaultPath" : function () {},
"defaultSeparator" : function () {},
"delay" : function () {},
"delete" : function () {},
"DesktopNotification" : function () {},
"DeviceEventEmitter" : function () {},
"Dimensions" : function () {},
@ -129,7 +126,6 @@ var TopLevel = {
"extractGroupMembershipSignatures" : function () {},
"fallbacks" : function () {},
"fetch" : function () {},
"filtered" : function () {},
"firebase" : function () {},
"floor" : function () {},
"focus" : function () {},
@ -333,8 +329,6 @@ var TopLevel = {
"NumberFormatSymbols_zh_HK" : function () {},
"NumberFormatSymbols_zh_TW" : function () {},
"numberToHex" : function () {},
"objectForPrimaryKey" : function () {},
"objects" : function () {},
"ok" : function () {},
"onMessage" : function () {},
"onNotification" : function () {},
@ -379,7 +373,6 @@ var TopLevel = {
"ReactNative" : function () {},
"readDir" : function () {},
"readFile" : function () {},
"realm" : function () {},
"recoverAccount" : function () {},
"reduce" : function () {},
"register" : function () {},
@ -464,7 +457,6 @@ var TopLevel = {
"signMessage" : function () {},
"signTypedData" : function () {},
"slice" : function () {},
"sorted" : function () {},
"SplashScreen" : function () {},
"spring" : function () {},
"stack" : function () {},
@ -532,7 +524,6 @@ var TopLevel = {
"WebViewBridgeModule" : function () {},
"width" : function () {},
"window" : function () {},
"write" : function () {},
"writeCopyTo" : function () {},
"x" : function () {},
"y" : function () {},

View File

@ -19,9 +19,6 @@
:Text #js {}}
:DeviceEventEmitter #js {:addListener (fn [])}
:Dimensions #js {:get (fn [])}})
(def realm #js {:schemaVersion (fn [])
:defaultPath "/tmp/realm"
:close (fn [])})
(def vector-icons (fn [] #js {:default #js {}}))
(def webview-bridge (fn [] #js {:default #js {}}))
(def webview (fn [] #js {:WebView #js {}}))
@ -54,4 +51,3 @@
(def desktop-config #js {})
(def react-native-mail (fn [] #js {:mail #js {}}))
(def react-native-navigation-twopane #js {})

View File

@ -25,11 +25,9 @@
20B6B6851D92C42600CC5C6A /* RSKImageCropper.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 20B6B6831D92C42600CC5C6A /* RSKImageCropper.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20B6B6871D92C42600CC5C6A /* QBImagePicker.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 20B6B6861D92C42600CC5C6A /* QBImagePicker.framework */; };
20B6B6881D92C42600CC5C6A /* QBImagePicker.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 20B6B6861D92C42600CC5C6A /* QBImagePicker.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
22118DE1207A419FBFE7B62D /* libRealmReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CD48A32459B64E96843BB238 /* libRealmReact.a */; };
25DC9C9DC25846BD8D084888 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B9A886A2CB448B1ABA0EB62 /* libc++.tbd */; };
3870E1E692E24133A80B07DE /* Inter-SemiBold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 693A62DB37BC4CD5A30E5C96 /* Inter-SemiBold.otf */; };
393D26E3080B443A998F4A2F /* Inter-Italic.otf in Resources */ = {isa = PBXBuildFile; fileRef = B07176ACDAA1422E8F0A3D6B /* Inter-Italic.otf */; };
3E15DFEC1F6F4D7CAE088F49 /* libTcpSockets.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C2A4E93F6B154AEFA3485B45 /* libTcpSockets.a */; };
42B30EAD0EED4C72BB96D1AB /* Inter-ExtraBold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 6B145D55D500476BB45C2232 /* Inter-ExtraBold.otf */; };
475D202F20B7450D00879A77 /* libRNFirebase.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 475D1FC020B7413500879A77 /* libRNFirebase.a */; };
4C16DE0C1F89508700AA10DB /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C16DE0B1F89508700AA10DB /* JavaScriptCore.framework */; };
@ -141,13 +139,6 @@
remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192;
remoteInfo = React;
};
2010676C1D477F5E00FA83B6 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 38E1A2C8D0734EE99E2B16CE /* TcpSockets.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = TcpSockets;
};
201067C31D4789F700FA83B6 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 439B6B4B407A4E2AACAFE5BE /* RCTStatus.xcodeproj */;
@ -169,13 +160,6 @@
remoteGlobalIDString = F12AFB9B1ADAF8F800E0535D;
remoteInfo = RNFS;
};
20B7D1281D3F74CD00B70F14 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = F090E261B9854867A728CE4F /* RealmReact.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = F60690131CA2766F0003FB26;
remoteInfo = RealmReact;
};
475D1EF120B73EE000879A77 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = AF409BB755B94FB1BBA01927 /* RNSecureRandom.xcodeproj */;
@ -579,7 +563,6 @@
2BEE3436791D42248F853999 /* libRCTImageResizer.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRCTImageResizer.a; sourceTree = "<group>"; };
305F194186D848FDB07AF34C /* RNFS.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNFS.xcodeproj; path = "../node_modules/react-native-fs/RNFS.xcodeproj"; sourceTree = "<group>"; };
38A44830EC5708E89387F641 /* Pods-StatusIm.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-StatusIm.release.xcconfig"; path = "Pods/Target Support Files/Pods-StatusIm/Pods-StatusIm.release.xcconfig"; sourceTree = "<group>"; };
38E1A2C8D0734EE99E2B16CE /* TcpSockets.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = TcpSockets.xcodeproj; path = "../node_modules/react-native-tcp/ios/TcpSockets.xcodeproj"; sourceTree = "<group>"; };
3A7EB0491DD9CABC00A4FCC8 /* SplashScreen.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SplashScreen.xcodeproj; path = "../node_modules/react-native-splash-screen/ios/SplashScreen.xcodeproj"; sourceTree = "<group>"; };
439B6B4B407A4E2AACAFE5BE /* RCTStatus.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RCTStatus.xcodeproj; path = "../modules/react-native-status/ios/RCTStatus/RCTStatus.xcodeproj"; sourceTree = "<group>"; };
475D1F8D20B7413500879A77 /* RNFirebase.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNFirebase.xcodeproj; path = "../node_modules/react-native-firebase/ios/RNFirebase.xcodeproj"; sourceTree = "<group>"; };
@ -634,16 +617,13 @@
B2F2D1BB1D9D531B00B7B453 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = StatusIm/Images.xcassets; sourceTree = "<group>"; };
B321D25F4493470980039457 /* Inter-BoldItalic.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Inter-BoldItalic.otf"; path = "../resources/fonts/Inter-BoldItalic.otf"; sourceTree = "<group>"; };
B461988B2210C98F00603CF2 /* RNCWebView.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNCWebView.xcodeproj; path = "../node_modules/react-native-webview/ios/RNCWebView.xcodeproj"; sourceTree = "<group>"; };
C2A4E93F6B154AEFA3485B45 /* libTcpSockets.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libTcpSockets.a; sourceTree = "<group>"; };
C6B1215047604CD59A4C74D6 /* Inter-MediumItalic.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Inter-MediumItalic.otf"; path = "../resources/fonts/Inter-MediumItalic.otf"; sourceTree = "<group>"; };
CD48A32459B64E96843BB238 /* libRealmReact.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRealmReact.a; sourceTree = "<group>"; };
CD4A2C27D6D5473184DC1F7E /* Inter-Bold.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Inter-Bold.otf"; path = "../resources/fonts/Inter-Bold.otf"; sourceTree = "<group>"; };
CE4E31B21D8695250033ED64 /* Statusgo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Statusgo.framework; path = "../modules/react-native-status/ios/RCTStatus/Statusgo.framework"; sourceTree = "<group>"; };
D489EE8D5F52DA10AC715727 /* Pods-StatusImTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-StatusImTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-StatusImTests/Pods-StatusImTests.release.xcconfig"; sourceTree = "<group>"; };
DF1CD4C3D1254774ACCAE4E8 /* libBVLinearGradient.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libBVLinearGradient.a; sourceTree = "<group>"; };
E3CDB86E22BBD9D2009BFE27 /* RNScreens.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNScreens.xcodeproj; path = "../node_modules/react-native-screens/ios/RNScreens.xcodeproj"; sourceTree = "<group>"; };
EBCA9155761E4EBCB2EAFE9A /* Inter-ExtraLightItalic-BETA.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Inter-ExtraLightItalic-BETA.otf"; path = "../resources/fonts/Inter-ExtraLightItalic-BETA.otf"; sourceTree = "<group>"; };
F090E261B9854867A728CE4F /* RealmReact.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RealmReact.xcodeproj; path = "../node_modules/realm/react-native/ios/RealmReact.xcodeproj"; sourceTree = "<group>"; };
F9238D6B1E5F055900C047B9 /* SF-UI-Text-Semibold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Semibold.otf"; sourceTree = "<group>"; };
FC1CBCFE6C906043D6CCEEE1 /* libPods-StatusImTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-StatusImTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
@ -692,10 +672,8 @@
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
FD4F213C3873473CB703B1D2 /* libRNFS.a in Frameworks */,
22118DE1207A419FBFE7B62D /* libRealmReact.a in Frameworks */,
25DC9C9DC25846BD8D084888 /* libc++.tbd in Frameworks */,
BA68A2377A20496EA737000D /* libz.tbd in Frameworks */,
3E15DFEC1F6F4D7CAE088F49 /* libTcpSockets.a in Frameworks */,
E0AD9E8F495A4907B65104BF /* libRCTImageResizer.a in Frameworks */,
8E55E6877F950B81C8D711C5 /* libPods-StatusIm.a in Frameworks */,
9EF0836B1F3B53AB00876A8F /* libReactNativeConfig.a in Frameworks */,
@ -852,14 +830,6 @@
name = Resources;
sourceTree = "<group>";
};
201067551D477F5E00FA83B6 /* Products */ = {
isa = PBXGroup;
children = (
2010676D1D477F5E00FA83B6 /* libTcpSockets.a */,
);
name = Products;
sourceTree = "<group>";
};
201067BA1D4789F700FA83B6 /* Products */ = {
isa = PBXGroup;
children = (
@ -901,14 +871,6 @@
name = Products;
sourceTree = "<group>";
};
20B7D1251D3F74CD00B70F14 /* Products */ = {
isa = PBXGroup;
children = (
20B7D1291D3F74CD00B70F14 /* libRealmReact.a */,
);
name = Products;
sourceTree = "<group>";
};
475D1EEE20B73EE000879A77 /* Products */ = {
isa = PBXGroup;
children = (
@ -999,8 +961,6 @@
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
305F194186D848FDB07AF34C /* RNFS.xcodeproj */,
F090E261B9854867A728CE4F /* RealmReact.xcodeproj */,
38E1A2C8D0734EE99E2B16CE /* TcpSockets.xcodeproj */,
439B6B4B407A4E2AACAFE5BE /* RCTStatus.xcodeproj */,
5E5A7625B76441D984EA8C0D /* RCTImageResizer.xcodeproj */,
1E74DC52A1E449A2BA858B14 /* RNSVG.xcodeproj */,
@ -1164,8 +1124,6 @@
DF1CD4C3D1254774ACCAE4E8 /* libBVLinearGradient.a */,
5535217F57E44D77AA9CF083 /* libRCTOrientation.a */,
11632AA0A5F84F029DD91797 /* libRNVectorIcons.a */,
CD48A32459B64E96843BB238 /* libRealmReact.a */,
C2A4E93F6B154AEFA3485B45 /* libTcpSockets.a */,
2BEE3436791D42248F853999 /* libRCTImageResizer.a */,
AF2BF381BC7B4EB0887F0091 /* libRNSVG.a */,
7F752F17B1E04216B1337A72 /* libRNFIRMessaging.a */,
@ -1358,10 +1316,6 @@
ProductGroup = 9EF083391F3B538A00876A8F /* Products */;
ProjectRef = 9EF083381F3B538A00876A8F /* ReactNativeConfig.xcodeproj */;
},
{
ProductGroup = 20B7D1251D3F74CD00B70F14 /* Products */;
ProjectRef = F090E261B9854867A728CE4F /* RealmReact.xcodeproj */;
},
{
ProductGroup = B461988C2210C98F00603CF2 /* Products */;
ProjectRef = B461988B2210C98F00603CF2 /* RNCWebView.xcodeproj */;
@ -1406,10 +1360,6 @@
ProductGroup = B24FC7BB1DE718EA00D694FF /* Products */;
ProjectRef = 3A7EB0491DD9CABC00A4FCC8 /* SplashScreen.xcodeproj */;
},
{
ProductGroup = 201067551D477F5E00FA83B6 /* Products */;
ProjectRef = 38E1A2C8D0734EE99E2B16CE /* TcpSockets.xcodeproj */;
},
);
projectRoot = "";
targets = (
@ -1476,13 +1426,6 @@
remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2010676D1D477F5E00FA83B6 /* libTcpSockets.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libTcpSockets.a;
remoteRef = 2010676C1D477F5E00FA83B6 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
201067C41D4789F700FA83B6 /* libRCTStatus.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
@ -1504,13 +1447,6 @@
remoteRef = 20B7D1191D3F74CD00B70F14 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
20B7D1291D3F74CD00B70F14 /* libRealmReact.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRealmReact.a;
remoteRef = 20B7D1281D3F74CD00B70F14 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
475D1EF220B73EE000879A77 /* libRNSecureRandom.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
@ -2120,8 +2056,6 @@
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
"$(SRCROOT)/../node_modules/react-native-orientation/iOS/RCTOrientation/**",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/realm/src/**",
"$(SRCROOT)/../node_modules/react-native-tcp/ios/**",
"$(SRCROOT)/../modules/react-native-status/ios/RCTStatus/**",
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
@ -2185,8 +2119,6 @@
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
"$(SRCROOT)/../node_modules/react-native-orientation/iOS/RCTOrientation/**",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/realm/src/**",
"$(SRCROOT)/../node_modules/react-native-tcp/ios/**",
"$(SRCROOT)/../modules/react-native-status/ios/RCTStatus/**",
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
@ -2281,8 +2213,6 @@
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
"$(SRCROOT)/../node_modules/react-native-orientation/iOS/RCTOrientation/**",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/realm/src/**",
"$(SRCROOT)/../node_modules/react-native-tcp/ios/**",
"$(SRCROOT)/../modules/react-native-status/ios/RCTStatus/**",
"$(SRCROOT)/../modules/react-native-status/ios/RCTStatus/**",
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",
@ -2350,8 +2280,6 @@
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
"$(SRCROOT)/../node_modules/react-native-orientation/iOS/RCTOrientation/**",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/realm/src/**",
"$(SRCROOT)/../node_modules/react-native-tcp/ios/**",
"$(SRCROOT)/../modules/react-native-status/ios/RCTStatus/**",
"$(SRCROOT)/../modules/react-native-status/ios/RCTStatus/**",
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",

View File

@ -31,7 +31,7 @@
"react-native-fetch-polyfill": "1.1.2",
"react-native-firebase": "5.1.1",
"react-native-fs": "2.14.1",
"react-native-gesture-handler": "^1.3.0",
"react-native-gesture-handler": "1.3.0",
"react-native-http-bridge": "0.6.1",
"react-native-image-crop-picker": "0.18.1",
"react-native-image-resizer": "git+https://github.com/status-im/react-native-image-resizer.git#1.0.0-1-status",
@ -41,20 +41,16 @@
"react-native-navigation-twopane": "git+https://github.com/status-im/react-native-navigation-twopane.git#v0.0.2-status",
"react-native-randombytes": "3.5.0",
"react-native-safe-area-view": "0.9.0",
"react-native-screens": "^1.0.0-alpha.22",
"react-native-screens": "1.0.0-alpha.22",
"react-native-securerandom": "git+https://github.com/status-im/react-native-securerandom.git#0.1.1-2",
"react-native-shake": "^3.3.1",
"react-native-splash-screen": "3.1.1",
"react-native-status-keycard": "2.5.7",
"react-native-svg": "9.7.1",
"react-native-svg-transformer": "^0.12.1",
"react-native-tcp": "git+https://github.com/status-im/react-native-tcp.git#v3.3.0-1-status",
"react-native-touch-id": "^4.4.1",
"react-native-udp": "git+https://github.com/status-im/react-native-udp.git#v2.3.1-1-status",
"react-native-webview-bridge": "git+https://github.com/status-im/react-native-webview-bridge.git#fix/classnames-colision",
"react-navigation": "^3.11.0",
"realm": "2.28.1",
"text-encoding": "^0.6.4",
"react-navigation": "3.11.0",
"url": "0.10.3",
"web3": "git+https://github.com/status-im/web3.js.git#0.20.3-status.alpha.3",
"web3-utils": "1.0.0-beta.36"

File diff suppressed because it is too large Load Diff

View File

@ -15,10 +15,6 @@ let
optional platform.targetLinux linuxPlatform ++
optional platform.targetDarwin darwinPlatform ++
optional platform.targetWindows windowsPlatform;
nodeInputs = import ./realm-node {
# The remaining dependencies come from Nixpkgs
inherit pkgs nodejs;
};
in {
buildInputs = unique ([
@ -27,8 +23,7 @@ in {
file
snoreNotifySources
qtkeychainSources
] ++ catAttrs "buildInputs" selectedSources
++ (builtins.attrValues nodeInputs));
] ++ catAttrs "buildInputs" selectedSources);
shellHook = concatStrings (catAttrs "shellHook" (selectedSources ++ [ snoreNotifySources qtkeychainSources ]));
}

View File

@ -1,13 +0,0 @@
# Abstract
The purpose of this folder is to allow some tools such as `react-native` to be installed globally through Nix instead of resorting to `npm install -g` (which is not allowed in a Nix environment). We get around that by using the [node2nix tool](https://github.com/svanderburg/node2nix).
## Inputs
The inputs are listed in `node-packages.json`.
## Generating the nix expressions
``` shell
node2nix --nodejs-10 --bypass-cache -i node-packages.json
```

View File

@ -1,34 +0,0 @@
{ pkgs, nodejs }:
#
# This expression builds the realm executable that is used for debugging the desktop app (used by ubuntu-server.js)
#
let nodePackages = import ./output { inherit pkgs nodejs; };
realm-version = "5.12.1";
realm-patched-name = "realm-https://github.com/status-im/realm-js/archive/v2.20.1.tar.gz";
# We download ${realm-core-src} to ${realm-dest-dir} in order to avoid having realm try to download these files on its own (which is disallowed by Nix)
realm-core-src = pkgs.fetchurl (
if builtins.currentSystem == "x86_64-darwin" then {
url = "https://static.realm.io/downloads/core/realm-core-Release-v${realm-version}-Darwin-devel.tar.gz";
sha256 = "05ji1zyskwjj8p5i01kcg7h1cxdjj62fcsp6haf2f65qshp6r44d";
} else {
url = "https://static.realm.io/downloads/core/realm-core-Release-v${realm-version}-Linux-devel.tar.gz";
sha256 = "02pvi28qnvzdv7ghqzf79bxn8id9s7mpp3g2ambxg8jrcrkqfvr1";
}
);
realm-dest-dir = if builtins.currentSystem == "x86_64-darwin" then
"$out/lib/node_modules/realm/compiled/node-v64_darwin_x64/realm.node" else
"$out/lib/node_modules/realm/compiled/node-v64_linux_x64/realm.node";
in nodePackages // {
"${realm-patched-name}" = nodePackages."${realm-patched-name}".override(oldAttrs: {
reconstructLock = true;
preRebuild = ''
# Do not attempt to do any http calls!
substituteInPlace $out/lib/node_modules/realm/scripts/download-realm.js \
--replace "!shouldSkipAcquire(realmDir, requirements, options.force)" "false"
mkdir -p ${realm-dest-dir}
tar -xzf ${realm-core-src} -C ${realm-dest-dir}
'';
});
}

View File

@ -1,58 +0,0 @@
#!/usr/bin/env bash
if [[ -z "${IN_NIX_SHELL}" ]]; then
echo "Remember to call 'make shell'!"
exit 1
fi
#
# Run this file to regenerate the Nix files in ./output.
# Prerequisites: Node, npm, and node2nix (installed with npm i -g https://github.com/svanderburg/node2nix)
#
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
toolversion="${GIT_ROOT}/scripts/toolversion"
dir="$SCRIPTPATH"
input="${dir}/output/node-packages.json"
output_dir="${dir}/output"
supplement_input="${dir}/output/supplement.json"
rm -rf $output_dir && mkdir -p $output_dir
# Specify the package.json file containing the dependencies to install
cat << EOF > $input
[
{ "realm": "https://github.com/status-im/realm-js/archive/v2.20.1.tar.gz" }
]
EOF
# Specify the package.json file containing the build dependencies to install
cat << EOF > $supplement_input
[
"node-pre-gyp"
]
EOF
# Specify the package.json file containing the build dependencies to install
cat << EOF > $supplement_input
[
"node-pre-gyp"
]
EOF
node_required_version=$($toolversion node)
node_major_version=$(echo $node_required_version | cut -d. -f1,1)
if ! which node2nix > /dev/null; then
echo "Installing node2nix..."
nix-env -f '<nixpkgs>' -iA nodePackages.node2nix
fi
node2nix --nodejs-${node_major_version} --bypass-cache \
--input $input \
--output $output_dir/node-packages.nix \
--supplement-input $supplement_input \
--supplement-output $output_dir/supplement.nix \
--composition $output_dir/default.nix \
--node-env $output_dir/node-env.nix
rm $input $supplement_input

View File

@ -1,21 +0,0 @@
# This file has been generated by node2nix 1.7.0. Do not edit!
{pkgs ? import <nixpkgs> {
inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-10_x"}:
let
globalBuildInputs = pkgs.lib.attrValues (import ./supplement.nix {
inherit nodeEnv;
inherit (pkgs) fetchurl fetchgit;
});
nodeEnv = import ./node-env.nix {
inherit (pkgs) stdenv python2 utillinux runCommand writeTextFile;
inherit nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
};
in
import ./node-packages.nix {
inherit (pkgs) fetchurl fetchgit;
inherit nodeEnv globalBuildInputs;
}

View File

@ -1,540 +0,0 @@
# This file originates from node2nix
{stdenv, nodejs, python2, utillinux, libtool, runCommand, writeTextFile}:
let
python = if nodejs ? python then nodejs.python else python2;
# Create a tar wrapper that filters all the 'Ignoring unknown extended header keyword' noise
tarWrapper = runCommand "tarWrapper" {} ''
mkdir -p $out/bin
cat > $out/bin/tar <<EOF
#! ${stdenv.shell} -e
$(type -p tar) "\$@" --warning=no-unknown-keyword --delay-directory-restore
EOF
chmod +x $out/bin/tar
'';
# Function that generates a TGZ file from a NPM project
buildNodeSourceDist =
{ name, version, src, ... }:
stdenv.mkDerivation {
name = "node-tarball-${name}-${version}";
inherit src;
buildInputs = [ nodejs ];
buildPhase = ''
export HOME=$TMPDIR
tgzFile=$(npm pack | tail -n 1) # Hooks to the pack command will add output (https://docs.npmjs.com/misc/scripts)
'';
installPhase = ''
mkdir -p $out/tarballs
mv $tgzFile $out/tarballs
mkdir -p $out/nix-support
echo "file source-dist $out/tarballs/$tgzFile" >> $out/nix-support/hydra-build-products
'';
};
includeDependencies = {dependencies}:
stdenv.lib.optionalString (dependencies != [])
(stdenv.lib.concatMapStrings (dependency:
''
# Bundle the dependencies of the package
mkdir -p node_modules
cd node_modules
# Only include dependencies if they don't exist. They may also be bundled in the package.
if [ ! -e "${dependency.name}" ]
then
${composePackage dependency}
fi
cd ..
''
) dependencies);
# Recursively composes the dependencies of a package
composePackage = { name, packageName, src, dependencies ? [], ... }@args:
''
DIR=$(pwd)
cd $TMPDIR
unpackFile ${src}
# Make the base dir in which the target dependency resides first
mkdir -p "$(dirname "$DIR/${packageName}")"
if [ -f "${src}" ]
then
# Figure out what directory has been unpacked
packageDir="$(find . -maxdepth 1 -type d | tail -1)"
# Restore write permissions to make building work
find "$packageDir" -type d -exec chmod u+x {} \;
chmod -R u+w "$packageDir"
# Move the extracted tarball into the output folder
mv "$packageDir" "$DIR/${packageName}"
elif [ -d "${src}" ]
then
# Get a stripped name (without hash) of the source directory.
# On old nixpkgs it's already set internally.
if [ -z "$strippedName" ]
then
strippedName="$(stripHash ${src})"
fi
# Restore write permissions to make building work
chmod -R u+w "$strippedName"
# Move the extracted directory into the output folder
mv "$strippedName" "$DIR/${packageName}"
fi
# Unset the stripped name to not confuse the next unpack step
unset strippedName
# Include the dependencies of the package
cd "$DIR/${packageName}"
${includeDependencies { inherit dependencies; }}
cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
'';
pinpointDependencies = {dependencies, production}:
let
pinpointDependenciesFromPackageJSON = writeTextFile {
name = "pinpointDependencies.js";
text = ''
var fs = require('fs');
var path = require('path');
function resolveDependencyVersion(location, name) {
if(location == process.env['NIX_STORE']) {
return null;
} else {
var dependencyPackageJSON = path.join(location, "node_modules", name, "package.json");
if(fs.existsSync(dependencyPackageJSON)) {
var dependencyPackageObj = JSON.parse(fs.readFileSync(dependencyPackageJSON));
if(dependencyPackageObj.name == name) {
return dependencyPackageObj.version;
}
} else {
return resolveDependencyVersion(path.resolve(location, ".."), name);
}
}
}
function replaceDependencies(dependencies) {
if(typeof dependencies == "object" && dependencies !== null) {
for(var dependency in dependencies) {
var resolvedVersion = resolveDependencyVersion(process.cwd(), dependency);
if(resolvedVersion === null) {
process.stderr.write("WARNING: cannot pinpoint dependency: "+dependency+", context: "+process.cwd()+"\n");
} else {
dependencies[dependency] = resolvedVersion;
}
}
}
}
/* Read the package.json configuration */
var packageObj = JSON.parse(fs.readFileSync('./package.json'));
/* Pinpoint all dependencies */
replaceDependencies(packageObj.dependencies);
if(process.argv[2] == "development") {
replaceDependencies(packageObj.devDependencies);
}
replaceDependencies(packageObj.optionalDependencies);
/* Write the fixed package.json file */
fs.writeFileSync("package.json", JSON.stringify(packageObj, null, 2));
'';
};
in
''
node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"}
${stdenv.lib.optionalString (dependencies != [])
''
if [ -d node_modules ]
then
cd node_modules
${stdenv.lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies}
cd ..
fi
''}
'';
# Recursively traverses all dependencies of a package and pinpoints all
# dependencies in the package.json file to the versions that are actually
# being used.
pinpointDependenciesOfPackage = { packageName, dependencies ? [], production ? true, ... }@args:
''
if [ -d "${packageName}" ]
then
cd "${packageName}"
${pinpointDependencies { inherit dependencies production; }}
cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
fi
'';
# Extract the Node.js source code which is used to compile packages with
# native bindings
nodeSources = runCommand "node-sources" {} ''
tar --no-same-owner --no-same-permissions -xf ${nodejs.src}
mv node-* $out
'';
# Script that adds _integrity fields to all package.json files to prevent NPM from consulting the cache (that is empty)
addIntegrityFieldsScript = writeTextFile {
name = "addintegrityfields.js";
text = ''
var fs = require('fs');
var path = require('path');
function augmentDependencies(baseDir, dependencies) {
for(var dependencyName in dependencies) {
var dependency = dependencies[dependencyName];
// Open package.json and augment metadata fields
var packageJSONDir = path.join(baseDir, "node_modules", dependencyName);
var packageJSONPath = path.join(packageJSONDir, "package.json");
if(fs.existsSync(packageJSONPath)) { // Only augment packages that exist. Sometimes we may have production installs in which development dependencies can be ignored
console.log("Adding metadata fields to: "+packageJSONPath);
var packageObj = JSON.parse(fs.readFileSync(packageJSONPath));
if(dependency.integrity) {
packageObj["_integrity"] = dependency.integrity;
} else {
packageObj["_integrity"] = "sha1-000000000000000000000000000="; // When no _integrity string has been provided (e.g. by Git dependencies), add a dummy one. It does not seem to harm and it bypasses downloads.
}
if(dependency.resolved) {
packageObj["_resolved"] = dependency.resolved; // Adopt the resolved property if one has been provided
} else {
packageObj["_resolved"] = dependency.version; // Set the resolved version to the version identifier. This prevents NPM from cloning Git repositories.
}
if(dependency.from !== undefined) { // Adopt from property if one has been provided
packageObj["_from"] = dependency.from;
}
fs.writeFileSync(packageJSONPath, JSON.stringify(packageObj, null, 2));
}
// Augment transitive dependencies
if(dependency.dependencies !== undefined) {
augmentDependencies(packageJSONDir, dependency.dependencies);
}
}
}
if(fs.existsSync("./package-lock.json")) {
var packageLock = JSON.parse(fs.readFileSync("./package-lock.json"));
if(packageLock.lockfileVersion !== 1) {
process.stderr.write("Sorry, I only understand lock file version 1!\n");
process.exit(1);
}
if(packageLock.dependencies !== undefined) {
augmentDependencies(".", packageLock.dependencies);
}
}
'';
};
# Reconstructs a package-lock file from the node_modules/ folder structure and package.json files with dummy sha1 hashes
reconstructPackageLock = writeTextFile {
name = "addintegrityfields.js";
text = ''
var fs = require('fs');
var path = require('path');
var packageObj = JSON.parse(fs.readFileSync("package.json"));
var lockObj = {
name: packageObj.name,
version: packageObj.version,
lockfileVersion: 1,
requires: true,
dependencies: {}
};
function augmentPackageJSON(filePath, dependencies) {
var packageJSON = path.join(filePath, "package.json");
if(fs.existsSync(packageJSON)) {
var packageObj = JSON.parse(fs.readFileSync(packageJSON));
dependencies[packageObj.name] = {
version: packageObj.version,
integrity: "sha1-000000000000000000000000000=",
dependencies: {}
};
processDependencies(path.join(filePath, "node_modules"), dependencies[packageObj.name].dependencies);
}
}
function processDependencies(dir, dependencies) {
if(fs.existsSync(dir)) {
var files = fs.readdirSync(dir);
files.forEach(function(entry) {
var filePath = path.join(dir, entry);
var stats = fs.statSync(filePath);
if(stats.isDirectory()) {
if(entry.substr(0, 1) == "@") {
// When we encounter a namespace folder, augment all packages belonging to the scope
var pkgFiles = fs.readdirSync(filePath);
pkgFiles.forEach(function(entry) {
if(stats.isDirectory()) {
var pkgFilePath = path.join(filePath, entry);
augmentPackageJSON(pkgFilePath, dependencies);
}
});
} else {
augmentPackageJSON(filePath, dependencies);
}
}
});
}
}
processDependencies("node_modules", lockObj.dependencies);
fs.writeFileSync("package-lock.json", JSON.stringify(lockObj, null, 2));
'';
};
prepareAndInvokeNPM = {packageName, bypassCache, reconstructLock, npmFlags, production}:
let
forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com";
in
''
# Pinpoint the versions of all dependencies to the ones that are actually being used
echo "pinpointing versions of dependencies..."
source $pinpointDependenciesScriptPath
# Patch the shebangs of the bundled modules to prevent them from
# calling executables outside the Nix store as much as possible
patchShebangs .
# Deploy the Node.js package by running npm install. Since the
# dependencies have been provided already by ourselves, it should not
# attempt to install them again, which is good, because we want to make
# it Nix's responsibility. If it needs to install any dependencies
# anyway (e.g. because the dependency parameters are
# incomplete/incorrect), it fails.
#
# The other responsibilities of NPM are kept -- version checks, build
# steps, postprocessing etc.
export HOME=$TMPDIR
cd "${packageName}"
runHook preRebuild
${stdenv.lib.optionalString bypassCache ''
${stdenv.lib.optionalString reconstructLock ''
if [ -f package-lock.json ]
then
echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!"
echo "This will most likely result in version mismatches! We will remove the lock file and regenerate it!"
rm package-lock.json
else
echo "No package-lock.json file found, reconstructing..."
fi
node ${reconstructPackageLock}
''}
node ${addIntegrityFieldsScript}
''}
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild
if [ "$dontNpmInstall" != "1" ]
then
# NPM tries to download packages even when they already exist if npm-shrinkwrap is used.
rm -f npm-shrinkwrap.json
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} install
fi
'';
# Builds and composes an NPM package including all its dependencies
buildNodePackage =
{ name
, packageName
, version
, dependencies ? []
, buildInputs ? []
, production ? true
, npmFlags ? ""
, dontNpmInstall ? false
, bypassCache ? false
, reconstructLock ? false
, preRebuild ? ""
, dontStrip ? true
, unpackPhase ? "true"
, buildPhase ? "true"
, ... }@args:
let
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" ];
in
stdenv.mkDerivation ({
name = "node_${name}-${version}";
buildInputs = [ tarWrapper python nodejs ]
++ stdenv.lib.optional (stdenv.isLinux) utillinux
++ stdenv.lib.optional (stdenv.isDarwin) libtool
++ buildInputs;
inherit dontStrip; # Stripping may fail a build for some package deployments
inherit dontNpmInstall preRebuild unpackPhase buildPhase;
compositionScript = composePackage args;
pinpointDependenciesScript = pinpointDependenciesOfPackage args;
passAsFile = [ "compositionScript" "pinpointDependenciesScript" ];
installPhase = ''
# Create and enter a root node_modules/ folder
mkdir -p $out/lib/node_modules
cd $out/lib/node_modules
# Compose the package and all its dependencies
source $compositionScriptPath
${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }}
# Create symlink to the deployed executable folder, if applicable
if [ -d "$out/lib/node_modules/.bin" ]
then
ln -s $out/lib/node_modules/.bin $out/bin
fi
# Create symlinks to the deployed manual page folders, if applicable
if [ -d "$out/lib/node_modules/${packageName}/man" ]
then
mkdir -p $out/share
for dir in "$out/lib/node_modules/${packageName}/man/"*
do
mkdir -p $out/share/man/$(basename "$dir")
for page in "$dir"/*
do
ln -s $page $out/share/man/$(basename "$dir")
done
done
fi
# Run post install hook, if provided
runHook postInstall
'';
} // extraArgs);
# Builds a development shell
buildNodeShell =
{ name
, packageName
, version
, src
, dependencies ? []
, buildInputs ? []
, production ? true
, npmFlags ? ""
, dontNpmInstall ? false
, bypassCache ? false
, reconstructLock ? false
, dontStrip ? true
, unpackPhase ? "true"
, buildPhase ? "true"
, ... }@args:
let
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ];
nodeDependencies = stdenv.mkDerivation ({
name = "node-dependencies-${name}-${version}";
buildInputs = [ tarWrapper python nodejs ]
++ stdenv.lib.optional (stdenv.isLinux) utillinux
++ stdenv.lib.optional (stdenv.isDarwin) libtool
++ buildInputs;
inherit dontStrip; # Stripping may fail a build for some package deployments
inherit dontNpmInstall unpackPhase buildPhase;
includeScript = includeDependencies { inherit dependencies; };
pinpointDependenciesScript = pinpointDependenciesOfPackage args;
passAsFile = [ "includeScript" "pinpointDependenciesScript" ];
installPhase = ''
mkdir -p $out/${packageName}
cd $out/${packageName}
source $includeScriptPath
# Create fake package.json to make the npm commands work properly
cp ${src}/package.json .
chmod 644 package.json
${stdenv.lib.optionalString bypassCache ''
if [ -f ${src}/package-lock.json ]
then
cp ${src}/package-lock.json .
fi
''}
# Go to the parent folder to make sure that all packages are pinpointed
cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }}
# Expose the executables that were installed
cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
mv ${packageName} lib
ln -s $out/lib/node_modules/.bin $out/bin
'';
} // extraArgs);
in
stdenv.mkDerivation {
name = "node-shell-${name}-${version}";
buildInputs = [ python nodejs ] ++ stdenv.lib.optional (stdenv.isLinux) utillinux ++ buildInputs;
buildCommand = ''
mkdir -p $out/bin
cat > $out/bin/shell <<EOF
#! ${stdenv.shell} -e
$shellHook
exec ${stdenv.shell}
EOF
chmod +x $out/bin/shell
'';
# Provide the dependencies in a development shell through the NODE_PATH environment variable
inherit nodeDependencies;
shellHook = stdenv.lib.optionalString (dependencies != []) ''
export NODE_PATH=$nodeDependencies/lib/node_modules
export PATH="$nodeDependencies/bin:$PATH"
'';
};
in
{
buildNodeSourceDist = stdenv.lib.makeOverridable buildNodeSourceDist;
buildNodePackage = stdenv.lib.makeOverridable buildNodePackage;
buildNodeShell = stdenv.lib.makeOverridable buildNodeShell;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,683 +0,0 @@
# This file has been generated by node2nix 1.7.0. Do not edit!
{nodeEnv, fetchurl, fetchgit, globalBuildInputs ? []}:
let
sources = {
"abbrev-1.1.1" = {
name = "abbrev";
packageName = "abbrev";
version = "1.1.1";
src = fetchurl {
url = "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz";
sha512 = "nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==";
};
};
"ansi-regex-2.1.1" = {
name = "ansi-regex";
packageName = "ansi-regex";
version = "2.1.1";
src = fetchurl {
url = "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz";
sha1 = "c3b33ab5ee360d86e0e628f0468ae7ef27d654df";
};
};
"aproba-1.2.0" = {
name = "aproba";
packageName = "aproba";
version = "1.2.0";
src = fetchurl {
url = "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz";
sha512 = "Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==";
};
};
"are-we-there-yet-1.1.5" = {
name = "are-we-there-yet";
packageName = "are-we-there-yet";
version = "1.1.5";
src = fetchurl {
url = "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz";
sha512 = "5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==";
};
};
"balanced-match-1.0.0" = {
name = "balanced-match";
packageName = "balanced-match";
version = "1.0.0";
src = fetchurl {
url = "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz";
sha1 = "89b4d199ab2bee49de164ea02b89ce462d71b767";
};
};
"brace-expansion-1.1.11" = {
name = "brace-expansion";
packageName = "brace-expansion";
version = "1.1.11";
src = fetchurl {
url = "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz";
sha512 = "iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==";
};
};
"chownr-1.1.2" = {
name = "chownr";
packageName = "chownr";
version = "1.1.2";
src = fetchurl {
url = "https://registry.npmjs.org/chownr/-/chownr-1.1.2.tgz";
sha512 = "GkfeAQh+QNy3wquu9oIZr6SS5x7wGdSgNQvD10X3r+AZr1Oys22HW8kAmDMvNg2+Dm0TeGaEuO8gFwdBXxwO8A==";
};
};
"code-point-at-1.1.0" = {
name = "code-point-at";
packageName = "code-point-at";
version = "1.1.0";
src = fetchurl {
url = "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz";
sha1 = "0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77";
};
};
"concat-map-0.0.1" = {
name = "concat-map";
packageName = "concat-map";
version = "0.0.1";
src = fetchurl {
url = "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz";
sha1 = "d8a96bd77fd68df7793a73036a3ba0d5405d477b";
};
};
"console-control-strings-1.1.0" = {
name = "console-control-strings";
packageName = "console-control-strings";
version = "1.1.0";
src = fetchurl {
url = "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz";
sha1 = "3d7cf4464db6446ea644bf4b39507f9851008e8e";
};
};
"core-util-is-1.0.2" = {
name = "core-util-is";
packageName = "core-util-is";
version = "1.0.2";
src = fetchurl {
url = "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz";
sha1 = "b5fd54220aa2bc5ab57aab7140c940754503c1a7";
};
};
"debug-3.2.6" = {
name = "debug";
packageName = "debug";
version = "3.2.6";
src = fetchurl {
url = "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz";
sha512 = "mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==";
};
};
"deep-extend-0.6.0" = {
name = "deep-extend";
packageName = "deep-extend";
version = "0.6.0";
src = fetchurl {
url = "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz";
sha512 = "LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==";
};
};
"delegates-1.0.0" = {
name = "delegates";
packageName = "delegates";
version = "1.0.0";
src = fetchurl {
url = "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz";
sha1 = "84c6e159b81904fdca59a0ef44cd870d31250f9a";
};
};
"detect-libc-1.0.3" = {
name = "detect-libc";
packageName = "detect-libc";
version = "1.0.3";
src = fetchurl {
url = "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz";
sha1 = "fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b";
};
};
"fs-minipass-1.2.6" = {
name = "fs-minipass";
packageName = "fs-minipass";
version = "1.2.6";
src = fetchurl {
url = "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.6.tgz";
sha512 = "crhvyXcMejjv3Z5d2Fa9sf5xLYVCF5O1c71QxbVnbLsmYMBEvDAftewesN/HhY03YRoA7zOMxjNGrF5svGaaeQ==";
};
};
"fs.realpath-1.0.0" = {
name = "fs.realpath";
packageName = "fs.realpath";
version = "1.0.0";
src = fetchurl {
url = "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz";
sha1 = "1504ad2523158caa40db4a2787cb01411994ea4f";
};
};
"gauge-2.7.4" = {
name = "gauge";
packageName = "gauge";
version = "2.7.4";
src = fetchurl {
url = "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz";
sha1 = "2c03405c7538c39d7eb37b317022e325fb018bf7";
};
};
"glob-7.1.4" = {
name = "glob";
packageName = "glob";
version = "7.1.4";
src = fetchurl {
url = "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz";
sha512 = "hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==";
};
};
"has-unicode-2.0.1" = {
name = "has-unicode";
packageName = "has-unicode";
version = "2.0.1";
src = fetchurl {
url = "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz";
sha1 = "e0e6fe6a28cf51138855e086d1691e771de2a8b9";
};
};
"iconv-lite-0.4.24" = {
name = "iconv-lite";
packageName = "iconv-lite";
version = "0.4.24";
src = fetchurl {
url = "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz";
sha512 = "v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==";
};
};
"ignore-walk-3.0.1" = {
name = "ignore-walk";
packageName = "ignore-walk";
version = "3.0.1";
src = fetchurl {
url = "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz";
sha512 = "DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==";
};
};
"inflight-1.0.6" = {
name = "inflight";
packageName = "inflight";
version = "1.0.6";
src = fetchurl {
url = "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz";
sha1 = "49bd6331d7d02d0c09bc910a1075ba8165b56df9";
};
};
"inherits-2.0.4" = {
name = "inherits";
packageName = "inherits";
version = "2.0.4";
src = fetchurl {
url = "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz";
sha512 = "k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==";
};
};
"ini-1.3.5" = {
name = "ini";
packageName = "ini";
version = "1.3.5";
src = fetchurl {
url = "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz";
sha512 = "RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==";
};
};
"is-fullwidth-code-point-1.0.0" = {
name = "is-fullwidth-code-point";
packageName = "is-fullwidth-code-point";
version = "1.0.0";
src = fetchurl {
url = "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz";
sha1 = "ef9e31386f031a7f0d643af82fde50c457ef00cb";
};
};
"isarray-1.0.0" = {
name = "isarray";
packageName = "isarray";
version = "1.0.0";
src = fetchurl {
url = "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz";
sha1 = "bb935d48582cba168c06834957a54a3e07124f11";
};
};
"minimatch-3.0.4" = {
name = "minimatch";
packageName = "minimatch";
version = "3.0.4";
src = fetchurl {
url = "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz";
sha512 = "yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==";
};
};
"minimist-0.0.8" = {
name = "minimist";
packageName = "minimist";
version = "0.0.8";
src = fetchurl {
url = "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz";
sha1 = "857fcabfc3397d2625b8228262e86aa7a011b05d";
};
};
"minimist-1.2.0" = {
name = "minimist";
packageName = "minimist";
version = "1.2.0";
src = fetchurl {
url = "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz";
sha1 = "a35008b20f41383eec1fb914f4cd5df79a264284";
};
};
"minipass-2.5.0" = {
name = "minipass";
packageName = "minipass";
version = "2.5.0";
src = fetchurl {
url = "https://registry.npmjs.org/minipass/-/minipass-2.5.0.tgz";
sha512 = "9FwMVYhn6ERvMR8XFdOavRz4QK/VJV8elU1x50vYexf9lslDcWe/f4HBRxCPd185ekRSjU6CfYyJCECa/CQy7Q==";
};
};
"minizlib-1.2.1" = {
name = "minizlib";
packageName = "minizlib";
version = "1.2.1";
src = fetchurl {
url = "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz";
sha512 = "7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==";
};
};
"mkdirp-0.5.1" = {
name = "mkdirp";
packageName = "mkdirp";
version = "0.5.1";
src = fetchurl {
url = "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz";
sha1 = "30057438eac6cf7f8c4767f38648d6697d75c903";
};
};
"ms-2.1.2" = {
name = "ms";
packageName = "ms";
version = "2.1.2";
src = fetchurl {
url = "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz";
sha512 = "sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==";
};
};
"needle-2.4.0" = {
name = "needle";
packageName = "needle";
version = "2.4.0";
src = fetchurl {
url = "https://registry.npmjs.org/needle/-/needle-2.4.0.tgz";
sha512 = "4Hnwzr3mi5L97hMYeNl8wRW/Onhy4nUKR/lVemJ8gJedxxUyBLm9kkrDColJvoSfwi0jCNhD+xCdOtiGDQiRZg==";
};
};
"nopt-4.0.1" = {
name = "nopt";
packageName = "nopt";
version = "4.0.1";
src = fetchurl {
url = "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz";
sha1 = "d0d4685afd5415193c8c7505602d0d17cd64474d";
};
};
"npm-bundled-1.0.6" = {
name = "npm-bundled";
packageName = "npm-bundled";
version = "1.0.6";
src = fetchurl {
url = "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.6.tgz";
sha512 = "8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g==";
};
};
"npm-packlist-1.4.4" = {
name = "npm-packlist";
packageName = "npm-packlist";
version = "1.4.4";
src = fetchurl {
url = "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.4.tgz";
sha512 = "zTLo8UcVYtDU3gdeaFu2Xu0n0EvelfHDGuqtNIn5RO7yQj4H1TqNdBc/yZjxnWA0PVB8D3Woyp0i5B43JwQ6Vw==";
};
};
"npmlog-4.1.2" = {
name = "npmlog";
packageName = "npmlog";
version = "4.1.2";
src = fetchurl {
url = "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz";
sha512 = "2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==";
};
};
"number-is-nan-1.0.1" = {
name = "number-is-nan";
packageName = "number-is-nan";
version = "1.0.1";
src = fetchurl {
url = "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz";
sha1 = "097b602b53422a522c1afb8790318336941a011d";
};
};
"object-assign-4.1.1" = {
name = "object-assign";
packageName = "object-assign";
version = "4.1.1";
src = fetchurl {
url = "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz";
sha1 = "2109adc7965887cfc05cbbd442cac8bfbb360863";
};
};
"once-1.4.0" = {
name = "once";
packageName = "once";
version = "1.4.0";
src = fetchurl {
url = "https://registry.npmjs.org/once/-/once-1.4.0.tgz";
sha1 = "583b1aa775961d4b113ac17d9c50baef9dd76bd1";
};
};
"os-homedir-1.0.2" = {
name = "os-homedir";
packageName = "os-homedir";
version = "1.0.2";
src = fetchurl {
url = "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz";
sha1 = "ffbc4988336e0e833de0c168c7ef152121aa7fb3";
};
};
"os-tmpdir-1.0.2" = {
name = "os-tmpdir";
packageName = "os-tmpdir";
version = "1.0.2";
src = fetchurl {
url = "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz";
sha1 = "bbe67406c79aa85c5cfec766fe5734555dfa1274";
};
};
"osenv-0.1.5" = {
name = "osenv";
packageName = "osenv";
version = "0.1.5";
src = fetchurl {
url = "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz";
sha512 = "0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==";
};
};
"path-is-absolute-1.0.1" = {
name = "path-is-absolute";
packageName = "path-is-absolute";
version = "1.0.1";
src = fetchurl {
url = "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz";
sha1 = "174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f";
};
};
"process-nextick-args-2.0.1" = {
name = "process-nextick-args";
packageName = "process-nextick-args";
version = "2.0.1";
src = fetchurl {
url = "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz";
sha512 = "3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==";
};
};
"rc-1.2.8" = {
name = "rc";
packageName = "rc";
version = "1.2.8";
src = fetchurl {
url = "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz";
sha512 = "y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==";
};
};
"readable-stream-2.3.6" = {
name = "readable-stream";
packageName = "readable-stream";
version = "2.3.6";
src = fetchurl {
url = "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz";
sha512 = "tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==";
};
};
"rimraf-2.7.1" = {
name = "rimraf";
packageName = "rimraf";
version = "2.7.1";
src = fetchurl {
url = "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz";
sha512 = "uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==";
};
};
"safe-buffer-5.1.2" = {
name = "safe-buffer";
packageName = "safe-buffer";
version = "5.1.2";
src = fetchurl {
url = "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz";
sha512 = "Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==";
};
};
"safer-buffer-2.1.2" = {
name = "safer-buffer";
packageName = "safer-buffer";
version = "2.1.2";
src = fetchurl {
url = "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz";
sha512 = "YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==";
};
};
"sax-1.2.4" = {
name = "sax";
packageName = "sax";
version = "1.2.4";
src = fetchurl {
url = "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz";
sha512 = "NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==";
};
};
"semver-5.7.1" = {
name = "semver";
packageName = "semver";
version = "5.7.1";
src = fetchurl {
url = "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz";
sha512 = "sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==";
};
};
"set-blocking-2.0.0" = {
name = "set-blocking";
packageName = "set-blocking";
version = "2.0.0";
src = fetchurl {
url = "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz";
sha1 = "045f9782d011ae9a6803ddd382b24392b3d890f7";
};
};
"signal-exit-3.0.2" = {
name = "signal-exit";
packageName = "signal-exit";
version = "3.0.2";
src = fetchurl {
url = "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz";
sha1 = "b5fdc08f1287ea1178628e415e25132b73646c6d";
};
};
"string-width-1.0.2" = {
name = "string-width";
packageName = "string-width";
version = "1.0.2";
src = fetchurl {
url = "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz";
sha1 = "118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3";
};
};
"string_decoder-1.1.1" = {
name = "string_decoder";
packageName = "string_decoder";
version = "1.1.1";
src = fetchurl {
url = "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz";
sha512 = "n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==";
};
};
"strip-ansi-3.0.1" = {
name = "strip-ansi";
packageName = "strip-ansi";
version = "3.0.1";
src = fetchurl {
url = "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz";
sha1 = "6a385fb8853d952d5ff05d0e8aaf94278dc63dcf";
};
};
"strip-json-comments-2.0.1" = {
name = "strip-json-comments";
packageName = "strip-json-comments";
version = "2.0.1";
src = fetchurl {
url = "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz";
sha1 = "3c531942e908c2697c0ec344858c286c7ca0a60a";
};
};
"tar-4.4.10" = {
name = "tar";
packageName = "tar";
version = "4.4.10";
src = fetchurl {
url = "https://registry.npmjs.org/tar/-/tar-4.4.10.tgz";
sha512 = "g2SVs5QIxvo6OLp0GudTqEf05maawKUxXru104iaayWA09551tFCTI8f1Asb4lPfkBr91k07iL4c11XO3/b0tA==";
};
};
"util-deprecate-1.0.2" = {
name = "util-deprecate";
packageName = "util-deprecate";
version = "1.0.2";
src = fetchurl {
url = "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz";
sha1 = "450d4dc9fa70de732762fbd2d4a28981419a0ccf";
};
};
"wide-align-1.1.3" = {
name = "wide-align";
packageName = "wide-align";
version = "1.1.3";
src = fetchurl {
url = "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz";
sha512 = "QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==";
};
};
"wrappy-1.0.2" = {
name = "wrappy";
packageName = "wrappy";
version = "1.0.2";
src = fetchurl {
url = "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz";
sha1 = "b5243d8f3ec1aa35f1364605bc0d1036e30ab69f";
};
};
"yallist-3.0.3" = {
name = "yallist";
packageName = "yallist";
version = "3.0.3";
src = fetchurl {
url = "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz";
sha512 = "S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==";
};
};
};
in
{
node-pre-gyp = nodeEnv.buildNodePackage {
name = "node-pre-gyp";
packageName = "node-pre-gyp";
version = "0.13.0";
src = fetchurl {
url = "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.13.0.tgz";
sha512 = "Md1D3xnEne8b/HGVQkZZwV27WUi1ZRuZBij24TNaZwUPU3ZAFtvT6xxJGaUVillfmMKnn5oD1HoGsp2Ftik7SQ==";
};
dependencies = [
sources."abbrev-1.1.1"
sources."ansi-regex-2.1.1"
sources."aproba-1.2.0"
sources."are-we-there-yet-1.1.5"
sources."balanced-match-1.0.0"
sources."brace-expansion-1.1.11"
sources."chownr-1.1.2"
sources."code-point-at-1.1.0"
sources."concat-map-0.0.1"
sources."console-control-strings-1.1.0"
sources."core-util-is-1.0.2"
sources."debug-3.2.6"
sources."deep-extend-0.6.0"
sources."delegates-1.0.0"
sources."detect-libc-1.0.3"
sources."fs-minipass-1.2.6"
sources."fs.realpath-1.0.0"
sources."gauge-2.7.4"
sources."glob-7.1.4"
sources."has-unicode-2.0.1"
sources."iconv-lite-0.4.24"
sources."ignore-walk-3.0.1"
sources."inflight-1.0.6"
sources."inherits-2.0.4"
sources."ini-1.3.5"
sources."is-fullwidth-code-point-1.0.0"
sources."isarray-1.0.0"
sources."minimatch-3.0.4"
sources."minimist-0.0.8"
sources."minipass-2.5.0"
sources."minizlib-1.2.1"
sources."mkdirp-0.5.1"
sources."ms-2.1.2"
sources."needle-2.4.0"
sources."nopt-4.0.1"
sources."npm-bundled-1.0.6"
sources."npm-packlist-1.4.4"
sources."npmlog-4.1.2"
sources."number-is-nan-1.0.1"
sources."object-assign-4.1.1"
sources."once-1.4.0"
sources."os-homedir-1.0.2"
sources."os-tmpdir-1.0.2"
sources."osenv-0.1.5"
sources."path-is-absolute-1.0.1"
sources."process-nextick-args-2.0.1"
(sources."rc-1.2.8" // {
dependencies = [
sources."minimist-1.2.0"
];
})
sources."readable-stream-2.3.6"
sources."rimraf-2.7.1"
sources."safe-buffer-5.1.2"
sources."safer-buffer-2.1.2"
sources."sax-1.2.4"
sources."semver-5.7.1"
sources."set-blocking-2.0.0"
sources."signal-exit-3.0.2"
sources."string-width-1.0.2"
sources."string_decoder-1.1.1"
sources."strip-ansi-3.0.1"
sources."strip-json-comments-2.0.1"
sources."tar-4.4.10"
sources."util-deprecate-1.0.2"
sources."wide-align-1.1.3"
sources."wrappy-1.0.2"
sources."yallist-3.0.3"
];
buildInputs = globalBuildInputs;
meta = {
description = "Node.js native addon binary install tool";
homepage = "https://github.com/mapbox/node-pre-gyp#readme";
license = "BSD-3-Clause";
};
production = true;
bypassCache = true;
reconstructLock = true;
};
}

View File

@ -71,7 +71,6 @@ in stdenv.mkDerivation {
for d in `find $sourceRoot/node_modules -type f -name build.gradle | xargs dirname`; do
chmod -R u+w $d
done
chmod u+w $sourceRoot/node_modules/realm/android
'';
patchPhase = ''
prevSet=$-
@ -83,8 +82,6 @@ in stdenv.mkDerivation {
"exec gradle -Dmaven.repo.local='${localMavenRepo}' --offline ${gradle-opts}"
# OPTIONAL: There's no need to forward debug ports for a release build, just disable it
substituteInPlace node_modules/realm/android/build.gradle \
--replace 'compileTask.dependsOn forwardDebugPort' 'compileTask'
set $prevSet
'';

View File

@ -36,7 +36,6 @@ if [ -d "$nodeModulesDir" ]; then
-not \( -path "$nodeModulesDir/react-native/third-party/*" -prune \
-o -path "$nodeModulesDir/react-native/ReactAndroid/build/*" -prune \
-o -path "$nodeModulesDir/*/android/build/*" -prune \
-o -path "$nodeModulesDir/realm/src/*" -prune \
-o -path './resources/icons/*' -prune \) -print) )
if [ ${#modifiedFiles[@]} -eq 0 ]; then
needCopyModules=0

View File

@ -6,7 +6,6 @@
(def keychain (js/require "react-native-keychain"))
(def qr-code (js/require "qrcode"))
(def react-native (js/require "react-native"))
(def realm (js/require "realm"))
(def webview-bridge (js/require "react-native-webview-bridge"))
(def webview #js {:WebView #js {}})
(def EventEmmiter #js {})

View File

@ -7,7 +7,6 @@
(def qr-code (js/require "qrcode"))
(def react-native (js/require "react-native"))
(def status-keycard (js/require "react-native-status-keycard"))
(def realm (js/require "realm"))
(def webview-bridge (js/require "react-native-webview-bridge"))
(def touchid-class (js/require "react-native-touch-id"))
(def touchid (.-default touchid-class))

View File

@ -5,7 +5,6 @@
status-im.ui.screens.db
status-im.ui.screens.events
status-im.subs
status-im.data-store.core
[status-im.ui.screens.views :as views]
[status-im.ui.components.react :as react]
[status-im.native-module.core :as status]

View File

@ -106,7 +106,7 @@
(chats-store/save-chat chat))))
(fx/defn add-public-chat
"Adds new public group chat to db & realm"
"Adds new public group chat to db"
[cofx topic]
(if config/use-status-go-protocol?
{::json-rpc/call [{:method "status_joinPublicChat"

View File

@ -1,222 +0,0 @@
(ns status-im.data-store.core
(:require [cljs.core.async :as async]
[re-frame.core :as re-frame]
[status-im.data-store.realm.core :as realm]
[status-im.ethereum.core :as ethereum]
[status-im.i18n :as i18n]
[status-im.multiaccounts.model :as multiaccounts.model]
[status-im.native-module.core :as status]
[status-im.protocol.core :as protocol]
[status-im.utils.fx :as fx]
[status-im.utils.handlers :as handlers]
[status-im.utils.keychain.core :as keychain]
[status-im.utils.security :as security]
[status-im.utils.types :as types]
[taoensso.timbre :as log]))
(fx/defn multiaccount-db-removed
{:events [::multiaccount-db-removed]}
[{:keys [db]}]
{:db (assoc-in db [:multiaccounts/login :processing] false)})
(defn change-multiaccount
[address password encryption-key create-database-if-not-exist?]
(log/debug "changing multiaccount to: " address)
(..
(js/Promise.
(fn [on-success on-error]
(try
(realm/close-account-realm)
(on-success)
(catch :default e
(on-error {:message (str e)
:error :closing-account-failed})))))
(then
(if create-database-if-not-exist?
#(js/Promise. (fn [on-success] (on-success)))
#(realm/db-exists? address)))
(then
#(realm/check-db-encryption address password encryption-key))
(then
#(realm/open-account address password encryption-key))))
(defn merge-events-of-type [success-events event-type]
;; merges data value of events of specified type together
;; keeps the other events intact
;; [[:e1 [:d1]] [:e1 [:d2]]] => [[:e1 [:d1 :d2]]]
(let [event-to-merge? (fn [event]
(and (vector? event)
(= (first event) event-type)
(vector? (second event))))
unmergeable-events (filter (complement event-to-merge?) success-events)
mergeable-events (filter event-to-merge? success-events)]
(into []
(into unmergeable-events
(when-not (empty? mergeable-events)
(let [merged-values (reduce into
(map second mergeable-events))]
[(into [event-type]
(when merged-values
[merged-values]))]))))))
(defn- merge-persistence-events [success-events]
(merge-events-of-type success-events :message/messages-persisted))
(defn- perform-transactions [raw-transactions realm]
(let [success-events (keep :success-event raw-transactions)
transactions (map (fn [{:keys [transaction] :as f}]
(or transaction f)) raw-transactions)]
(realm/write realm #(doseq [transaction transactions]
(transaction realm)))
(let [optimized-events (merge-persistence-events success-events)]
(doseq [event optimized-events]
(re-frame/dispatch event)))))
(re-frame/reg-fx
:data-store/tx
(fn [transactions]
(async/go (async/>! realm/realm-queue
(partial perform-transactions
transactions
@realm/account-realm)))))
(re-frame/reg-fx
::init-store
(fn []
(realm/ensure-directories)))
(handlers/register-handler-fx
::multiaccount-data-reset-accepted
(fn [_ [_ address]]
{::reset-multiaccount-data address}))
(re-frame/reg-fx
::reset-multiaccount-data
(fn [address]
(let [callback #(re-frame/dispatch [::multiaccount-db-removed])]
(.. (realm/delete-multiaccount-realm address)
(then callback)
(catch callback)))))
(fx/defn show-migration-error-dialog
[{:keys [db]} realm-error]
(let [{:keys [message]} realm-error
address (get-in db [:multiaccounts/login :address])
erase-button (i18n/label :migrations-erase-multiaccounts-data-button)]
{:ui/show-confirmation
{:title (i18n/label :invalid-key-title)
:content (i18n/label
:invalid-key-content
{:message message
:erase-multiaccounts-data-button-text erase-button})
:confirm-button-text (i18n/label :invalid-key-confirm)
:on-accept #(re-frame/dispatch
[::multiaccount-data-reset-accepted address])}}))
(fx/defn verify-callback
{:events [::verify-success]}
[{:keys [db] :as cofx} verify-result realm-error]
(let [data (types/json->clj verify-result)
error (:error data)
success (empty? error)]
(if success
(case (:error realm-error)
:decryption-failed
(show-migration-error-dialog cofx realm-error)
:database-does-not-exist
(let [{:keys [address password]} (multiaccounts.model/credentials cofx)]
{::change-multiaccount [address password]}))
{:db (update db :multiaccounts/login assoc
:error error
:processing false)})))
(fx/defn migrations-failed
[{:keys [db]} {:keys [realm-error erase-button]}]
(let [{:keys [message details]} realm-error
address (get-in db [:multiaccounts/login :address])]
{:ui/show-confirmation
{:title (i18n/label :migrations-failed-title)
:content (i18n/label
:migrations-failed-content
(merge
{:message message
:erase-multiaccounts-data-button-text erase-button}
details))
:confirm-button-text erase-button
:on-accept #(re-frame/dispatch
[::multiaccount-data-reset-accepted address])}}))
(fx/defn verify-multiaccount
[{:keys [db] :as cofx} {:keys [realm-error]}]
(let [{:keys [address password]} (multiaccounts.model/credentials cofx)]
{:db (assoc db :realm-error realm-error)
::verify [address password (:realm-error db)]}))
(fx/defn unknown-realm-error
[cofx {:keys [realm-error erase-button]}]
(let [{:keys [message]} realm-error
{:keys [address]} (multiaccounts.model/credentials cofx)]
{:ui/show-confirmation
{:title (i18n/label :unknown-realm-error)
:content (i18n/label
:unknown-realm-error-content
{:message message
:erase-multiaccounts-data-button-text erase-button})
:confirm-button-text (i18n/label :invalid-key-confirm)
:on-accept #(re-frame/dispatch
[::multiaccount-data-reset-accepted address])}}))
(fx/defn handle-change-multiaccount-error
{:events [::multiaccount-change-error]}
[{:keys [db] :as cofx} error]
(let [{:keys [error] :as realm-error}
(if (map? error)
error
{:message (str error)})
erase-button (i18n/label :migrations-erase-multiaccounts-data-button)]
(fx/merge
cofx
{:db (assoc-in db [:multiaccounts/login :save-password?] false)}
(case error
:migrations-failed
(migrations-failed {:realm-error realm-error
:erase-button erase-button})
(:database-does-not-exist :decryption-failed)
(verify-multiaccount {:realm-error realm-error})
(unknown-realm-error {:realm-error realm-error
:erase-button erase-button})))))
(re-frame/reg-fx
::verify
(fn [[address password realm-error]]
(status/verify address
(ethereum/sha3 (security/safe-unmask-data password))
#(re-frame/dispatch [::verify-success % realm-error]))))
(fx/defn handle-change-multiaccount-success
{:events [::multiaccount-change-success]}
[cofx])
(defn change-multiaccount!
[address password create-database-if-not-exist?]
;; No matter what is the keychain we use, as checks are done on decrypting base
(.. (keychain/safe-get-encryption-key)
(then #(change-multiaccount address password % create-database-if-not-exist?))
(then #(re-frame/dispatch [::multiaccount-change-success address]))
(catch (fn [error]
(log/warn "Could not change multiaccount" error)
;; If all else fails we fallback to showing initial error
(re-frame/dispatch [::multiaccount-change-error error])))))
(re-frame/reg-fx
::change-multiaccount
(fn [[address password]]
(change-multiaccount! address (security/safe-unmask-data password) false)))
(re-frame/reg-fx
::create-multiaccount
(fn [[address password]]
(change-multiaccount! address (security/safe-unmask-data password) true)))

View File

@ -1,6 +1,5 @@
(ns status-im.data-store.mailservers
(:require [re-frame.core :as re-frame]
[status-im.data-store.realm.core :as core]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.utils.fx :as fx]
[taoensso.timbre :as log]))

View File

@ -1,368 +0,0 @@
(ns status-im.data-store.realm.core
(:require [clojure.string :as string]
[cognitect.transit :as transit]
[goog.object :as object]
[re-frame.core :as re-frame]
[status-im.data-store.realm.schemas.account.core :as account]
[status-im.ethereum.core :as ethereum]
[status-im.js-dependencies :as js-dependencies]
[status-im.react-native.js-dependencies :as rn-dependencies]
[status-im.utils.async :as utils.async]
[status-im.utils.fs :as fs]
[status-im.utils.platform :as utils.platform]
[taoensso.timbre :as log]))
(defn to-buffer [key]
(when-not (nil? key)
(when key
(let [length (.-length key)
arr (js/Int8Array. length)]
(dotimes [i length]
(aset arr i (aget key i)))
arr))))
(defn encrypted-realm-version
"Returns -1 if the file does not exists, the schema version if it successfully
decrypts it, throws error otherwise."
[file-name encryption-key]
(if encryption-key
(.schemaVersion rn-dependencies/realm file-name (to-buffer encryption-key))
(.schemaVersion rn-dependencies/realm file-name)))
(defn encrypted-realm-version-promise
[file-name encryption-key]
(js/Promise.
(fn [on-success on-error]
(try
(encrypted-realm-version file-name encryption-key)
(on-success)
(catch :default e
(on-error {:message (str e)
:error :decryption-failed}))))))
(defn open-realm
[options file-name encryption-key]
(log/debug "Opening realm at " file-name "...")
(let [options-js (clj->js (assoc options :path file-name))]
(log/debug "Using encryption key...")
(when encryption-key
(set! (.-encryptionKey options-js) (to-buffer encryption-key)))
(when (exists? js/window)
(rn-dependencies/realm. options-js))))
(defn- is-account-file? [n]
(re-matches #".*/[0-9a-f]{40}$" n))
(defn- is-realm-file? [n]
(or (re-matches #".*/default\.realm(\.management|\.lock|\.note)?$" n)
(re-matches #".*/new-account(\.management|\.lock|\.note)?$" n)
(re-matches #".*/[0-9a-f]{40}(\.management|\.lock|\.note)?$" n)))
(defn- realm-management-file? [n]
(re-matches #".*(\.management|\.lock|\.note)$" n))
(defn realm-dir []
"This has to be a fn because otherwise re-frame app-db is not
initialized yet"
(if-let [path (utils.platform/no-backup-directory)]
(str path "/realm/")
(let [initial-props @(re-frame/subscribe [:initial-props])
status-data-dir (get initial-props :STATUS_DATA_DIR)]
(cond-> (if status-data-dir
(str status-data-dir "/default.realm")
(.-defaultPath rn-dependencies/realm))
utils.platform/desktop?
(str "/")))))
(defn accounts-realm-dir []
(str (realm-dir) "accounts/"))
(defn get-account-db-path
[address]
(str (accounts-realm-dir) (ethereum/sha3 address)))
(defn delete-realms []
(log/warn "realm: deleting all realms")
(fs/unlink (realm-dir)))
(defn delete-multiaccount-realm
[address]
(log/warn "realm: deleting account db " (ethereum/sha3 address))
(let [file (get-account-db-path address)]
(.. (fs/unlink file)
(then #(fs/unlink (str file ".lock")))
(then #(fs/unlink (str file ".management")))
(then #(fs/unlink (str file ".note"))))))
(defn ensure-directories []
(..
(fs/mkdir (realm-dir))
(then #(fs/mkdir (accounts-realm-dir)))))
(defn- close [realm]
(when realm
(.close realm)))
(defonce schema-migration-log (atom {}))
(defn migration-log [k v]
(swap! schema-migration-log assoc k v))
(defn- migrate-schemas
"Apply migrations in sequence and open database with the last schema"
[file-name schemas encryption-key current-version]
(reset! schema-migration-log {})
(migration-log :initial-version current-version)
(migration-log :current-version current-version)
(migration-log :last-version (:schemaVersion (last schemas)))
(log/info "migrate schemas" current-version)
(when (pos? current-version)
(doseq [schema schemas
:when (> (:schemaVersion schema) current-version)]
(migration-log :current-version (:schemaVersion schema))
(let [migrated-realm (open-realm schema file-name encryption-key)]
(close migrated-realm))))
(open-realm (last schemas) file-name encryption-key))
(defn keccak512-array [key]
(.array (.-keccak512 js-dependencies/js-sha3) key))
(defn merge-Uint8Arrays [arr1 arr2]
(let [arr1-length (.-length arr1)
arr2-length (.-length arr2)
arr (js/Uint8Array. (+ arr1-length arr2-length))]
(.set arr arr1)
(.set arr arr2 arr1-length)
arr))
(defn db-encryption-key [password encryption-key]
(let [TextEncoder (.-TextEncoder js-dependencies/text-encoding)
password-array (.encode
(new TextEncoder)
password)]
(keccak512-array (merge-Uint8Arrays encryption-key password-array))))
(defn migrate-realm
"Migrate realm if is a compatible version or reset the database"
[file-name schemas encryption-key]
(log/info "migrate-realm")
(migrate-schemas file-name schemas encryption-key (encrypted-realm-version
file-name
encryption-key)))
(defn- index-entity-schemas [all-schemas]
(into {} (map (juxt :name identity)) (-> all-schemas last :schema)))
(defonce account-realm (atom nil))
(def entity->schemas (index-entity-schemas account/schemas))
(def realm-queue (utils.async/task-queue 2000))
(defn close-account-realm []
(log/debug "closing account realm")
(close @account-realm)
(reset! account-realm nil))
(defn re-encrypt-realm
[file-name old-key new-key on-success on-error]
(let [old-file-name (str file-name "old")]
(.. (fs/move-file file-name old-file-name)
(then #(fs/unlink (str file-name ".lock")))
(then #(fs/unlink (str file-name ".management")))
(then #(fs/unlink (str file-name ".note")))
(catch (fn [e]
(let [message (str "can't move old database " (str e) " " file-name)]
(log/debug message)
(on-error {:message message
:error :removing-old-db-failed}))))
(then (fn []
(let [old-account-db (migrate-realm old-file-name
account/schemas
old-key)]
(log/info "copy old database")
(.writeCopyTo old-account-db file-name (to-buffer new-key))
(log/info "old database copied")
(close old-account-db)
(log/info "old database closed")
(on-success)
(fs/unlink old-file-name)
(log/info "old database removed"))))
(catch (fn [e]
(try (fs/move-file old-file-name file-name)
(catch :default _))
(let [message (str "something went wrong " (str e) " " file-name)]
(log/info message)
(on-error {:error :write-copy-to-failed
:message message})))))))
(defn check-db-encryption
[address password old-key]
(let [file-name (get-account-db-path address)
new-key (db-encryption-key password old-key)]
(js/Promise.
(fn [on-success on-error]
(try
(do
(log/info "try to encrypt with password")
(encrypted-realm-version file-name new-key)
(log/info "try to encrypt with password success")
(on-success))
(catch :default e
(do
(log/warn "failed checking db encryption with" e)
(log/info "try to encrypt with old key")
(.. (encrypted-realm-version-promise file-name old-key)
(then
#(re-encrypt-realm file-name old-key new-key on-success on-error))
(catch on-error)))))))))
(defn db-exists? [address]
(js/Promise.
(fn [on-success on-error]
(.. (fs/file-exists? (get-account-db-path address))
(then (fn [db-exists?]
(if db-exists?
(on-success)
(on-error {:message "Account's database doesn't exist."
:error :database-does-not-exist}))))))))
(defn open-account [address password encryption-key]
(let [path (get-account-db-path address)
account-db-key (db-encryption-key password encryption-key)]
(js/Promise.
(fn [on-success on-error]
(try
(log/info "open-account")
(reset! account-realm
(migrate-realm path account/schemas account-db-key))
(log/info "account-realm " (nil? @account-realm))
(on-success)
(catch :default e
(on-error {:message (str e)
:error :migrations-failed
:details @schema-migration-log})))))))
(declare realm-obj->clj)
;; realm functions
(defn write [realm f]
(.write realm f))
(defn create
([realm schema-name obj]
(create realm schema-name obj false))
([realm schema-name obj update?]
(let [obj-to-save (select-keys obj (keys (get-in entity->schemas
[schema-name :properties])))]
(.create realm (name schema-name) (clj->js obj-to-save) update?))))
(defn delete [realm obj]
(.delete realm obj))
(defn get-all [realm schema-name]
(.objects realm (name schema-name)))
(defn sorted [results field-name order]
(.sorted results (name field-name) (if (= order :asc)
false
true)))
(defn multi-field-sorted [results fields]
(.sorted results (clj->js fields)))
(defn page [results from to]
(js/Array.prototype.slice.call results from (or to -1)))
(defn filtered [results filter-query]
(.filtered results filter-query))
(def reader (transit/reader :json))
(def writer (transit/writer :json))
(defn serialize [o] (transit/write writer o))
(defn deserialize [o] (try (transit/read reader o) (catch :default e nil)))
(defn- realm-list->clj-coll [realm-list coll map-fn]
(when realm-list
(into coll (map map-fn) (range 0 (.-length realm-list)))))
(defn list->clj [realm-list]
(realm-list->clj-coll realm-list [] #(object/get realm-list %)))
(defn- object-list->clj [realm-object-list entity-name]
(let [primary-key (-> entity->schemas (get entity-name) :primaryKey name)]
(realm-list->clj-coll realm-object-list
{}
#(let [realm-obj (object/get realm-object-list %)]
[(object/get realm-obj primary-key) (realm-obj->clj realm-obj entity-name)]))))
(defn realm-obj->clj [realm-obj entity-name]
(when realm-obj
(let [{:keys [primaryKey properties]} (get entity->schemas entity-name)]
(into {}
(map (fn [[prop-name {:keys [type objectType]}]]
(let [prop-value (object/get realm-obj (name prop-name))]
[prop-name (case type
"string[]" (list->clj prop-value)
:list (object-list->clj prop-value objectType)
prop-value)])))
properties))))
(defn single
"Takes realm results, returns the first one"
[result]
(object/get result 0))
(defn single-clj
"Takes realm results and schema name, returns the first result converted to cljs datastructure"
[results schema-name]
(-> results single (realm-obj->clj schema-name)))
(defn all-clj
"Takes realm results and schema name, returns results as converted cljs datastructures in vector"
[results schema-name]
(realm-list->clj-coll results [] #(realm-obj->clj (object/get results %) schema-name)))
(defn- field-type [schema-name field]
(let [field-def (get-in entity->schemas [schema-name :properties field])]
(or (:type field-def) field-def)))
(defmulti to-query (fn [_ operator _ _] operator))
(defmethod to-query :eq [schema-name _ field value]
(let [field-type (field-type schema-name field)
query (str (name field) "=" (if (= "string" (name field-type))
(str "\"" value "\"")
value))]
query))
(defn get-by-field
"Selects objects from realm identified by schema-name based on value of field"
[realm schema-name field value]
(let [q (to-query schema-name :eq field value)]
(.filtered (.objects realm (name schema-name)) q)))
(defn- and-query [queries]
(string/join " and " queries))
(defn- or-query [queries]
(string/join " or " queries))
(defn get-by-fields
"Selects objects from realm identified by schema name based on field values
combined by `:and`/`:or` operator"
[realm schema-name op fields]
(let [queries (map (fn [[k v]]
(to-query schema-name :eq k v))
fields)]
(.filtered (.objects realm (name schema-name))
(case op
:and (and-query queries)
:or (or-query queries)))))
(defn in-query
"Constructs IN query"
[field-name ids]
(string/join " or " (map #(str field-name "=\"" % "\"") ids)))

View File

@ -1,25 +0,0 @@
(ns status-im.data-store.realm.schemas.account.browser)
(def v1 {:name :browser
:primaryKey :browser-id
:properties {:browser-id :string
:name :string
:timestamp :int
:dapp? {:type :bool
:default false}
:url {:type :string
:optional true}
:contact {:type :string
:optional true}}})
(def v8 {:name :browser
:primaryKey :browser-id
:properties {:browser-id :string
:name :string
:timestamp :int
:dapp? {:type :bool
:default false}
:history-index {:type :int
:optional true}
:history {:type "string[]"
:optional true}}})

View File

@ -1,259 +0,0 @@
(ns status-im.data-store.realm.schemas.account.chat
(:require [status-im.ui.components.colors :as colors]))
(def v1 {:name :chat
:primaryKey :chat-id
:properties {:chat-id :string
:name :string
:color {:type :string
:default colors/default-chat-color}
:group-chat {:type :bool
:indexed true}
:group-admin {:type :string
:optional true}
:is-active :bool
:timestamp :int
:contacts {:type "string[]"}
:removed-at {:type :int
:optional true}
:removed-from-at {:type :int
:optional true}
:added-to-at {:type :int
:optional true}
:updated-at {:type :int
:optional true}
:message-overhead {:type :int
:default 0}
:contact-info {:type :string
:optional true}
:debug? {:type :bool
:default false}
:public? {:type :bool
:default false}}})
(def v3 {:name :chat
:primaryKey :chat-id
:properties {:chat-id :string
:name :string
:color {:type :string
:default colors/default-chat-color}
:group-chat {:type :bool
:indexed true}
:group-admin {:type :string
:optional true}
:is-active :bool
:timestamp :int
:contacts {:type "string[]"}
:removed-at {:type :int
:optional true}
:removed-from-at {:type :int
:optional true}
:deleted-at-clock-value {:type :int
:optional true}
:added-to-at {:type :int
:optional true}
:updated-at {:type :int
:optional true}
:message-overhead {:type :int
:default 0}
:contact-info {:type :string
:optional true}
:debug? {:type :bool
:default false}
:public? {:type :bool
:default false}}})
(def v5 {:name :chat
:primaryKey :chat-id
:properties {:chat-id :string
:name :string
:color {:type :string
:default colors/default-chat-color}
:group-chat {:type :bool
:indexed true}
:group-admin {:type :string
:optional true}
:is-active :bool
:timestamp :int
:contacts {:type "string[]"}
:removed-at {:type :int
:optional true}
:removed-from-at {:type :int
:optional true}
:deleted-at-clock-value {:type :int
:optional true}
:added-to-at {:type :int
:optional true}
:updated-at {:type :int
:optional true}
:message-overhead {:type :int
:default 0}
:debug? {:type :bool
:default false}
:public? {:type :bool
:default false}}})
(def v6 {:name :chat
:primaryKey :chat-id
:properties {:chat-id :string
:name :string
:color {:type :string
:default colors/default-chat-color}
:group-chat {:type :bool
:indexed true}
:group-admin {:type :string
:optional true}
:is-active :bool
:timestamp :int
:contacts {:type "string[]"}
:removed-at {:type :int
:optional true}
:removed-from-at {:type :int
:optional true}
:deleted-at-clock-value {:type :int
:optional true}
:added-to-at {:type :int
:optional true}
:updated-at {:type :int
:optional true}
:message-overhead {:type :int
:default 0}
:membership-version {:type :int
:optional true}
:membership-signature {:type :string
:optional true}
:debug? {:type :bool
:default false}
:public? {:type :bool
:default false}}})
(def v7 {:name :chat
:primaryKey :chat-id
:properties {:chat-id :string
:name :string
:color {:type :string
:default colors/default-chat-color}
:group-chat {:type :bool
:indexed true}
:is-active :bool
:timestamp :int
:contacts {:type "string[]"}
:admins {:type "string[]"}
:membership-updates {:type :list
:objectType :membership-update}
:removed-at {:type :int
:optional true}
:removed-from-at {:type :int
:optional true}
:deleted-at-clock-value {:type :int
:optional true}
:added-to-at {:type :int
:optional true}
:updated-at {:type :int
:optional true}
:message-overhead {:type :int
:default 0}
:debug? {:type :bool
:default false}
:public? {:type :bool
:default false}}})
(def v8 {:name :chat
:primaryKey :chat-id
:properties {:chat-id :string
:name :string
:color {:type :string
:default colors/default-chat-color}
:group-chat {:type :bool
:indexed true}
:is-active :bool
:timestamp :int
:contacts {:type "string[]"}
:admins {:type "string[]"}
:membership-updates {:type :list
:objectType :membership-update}
:removed-at {:type :int
:optional true}
:removed-from-at {:type :int
:optional true}
:deleted-at-clock-value {:type :int
:optional true}
:added-to-at {:type :int
:optional true}
:updated-at {:type :int
:optional true}
:message-overhead {:type :int
:default 0}
:debug? {:type :bool
:default false}
:public? {:type :bool
:default false}
:tags {:type "string[]"}}})
(def v9 {:name :chat
:primaryKey :chat-id
:properties {:chat-id :string
:name :string
:color {:type :string
:default colors/default-chat-color}
:group-chat {:type :bool
:indexed true}
:is-active :bool
:timestamp :int
:contacts {:type "string[]"}
:admins {:type "string[]"}
:membership-updates {:type :list
:objectType :membership-update}
:removed-at {:type :int
:optional true}
:removed-from-at {:type :int
:optional true}
:deleted-at-clock-value {:type :int
:optional true}
:added-to-at {:type :int
:optional true}
:updated-at {:type :int
:optional true}
:message-overhead {:type :int
:default 0}
:debug? {:type :bool
:default false}
:public? {:type :bool
:default false}
:tags {:type "string[]"}
:unviewed-messages-count {:type :int
:default 0}}})
(def v10
(update v9 :properties merge
{:last-message-content {:type :string
:optional true}
:last-message-type {:type :string
:optional true}}))
(def v11
(update v10 :properties merge
{:last-clock-value {:type :int
:optional true}}))
(def v12
(-> v11
(update :properties merge
{:last-message-content-type
{:type :string
:optional true}})
(update :properties dissoc :last-message-type)))
(def v13
(update v12 :properties assoc
:members-joined {:type "string[]"}))
(def v14
(update v13 :properties assoc
:group-chat-local-version {:type :int
:optional true}))
(def v15
(update v14 :properties dissoc
:message-overhead
:removed-from-at
:added-to-at
:removed-at))

View File

@ -1,9 +0,0 @@
(ns status-im.data-store.realm.schemas.account.chat-requests-range)
(def v1 {:name :chat-requests-range
:primaryKey :chat-id
:properties {:chat-id :string
:lowest-request-from {:type :int
:optional true}
:highest-request-to {:type :int
:optional true}}})

View File

@ -1,132 +0,0 @@
(ns status-im.data-store.realm.schemas.account.contact)
(def v1 {:name :contact
:primaryKey :whisper-identity
:properties {:address {:type :string :optional true}
:whisper-identity :string
:name {:type :string :optional true}
:photo-path {:type :string :optional true}
:last-updated {:type :int :default 0}
:last-online {:type :int :default 0}
:pending? {:type :bool :default false}
:hide-contact? {:type :bool :default false}
:status {:type :string :optional true}
:fcm-token {:type :string :optional true}
:description {:type :string :optional true}
:public-key {:type :string
:optional true}
:dapp? {:type :bool
:default false}
:dapp-url {:type :string
:optional true}
:bot-url {:type :string
:optional true}
:dapp-hash {:type :int
:optional true}
:debug? {:type :bool
:default false}}})
(def v2 {:name :contact
:primaryKey :whisper-identity
:properties {:address {:type :string :optional true}
:whisper-identity :string
:name {:type :string :optional true}
:photo-path {:type :string :optional true}
:last-updated {:type :int :default 0}
:last-online {:type :int :default 0}
:pending? {:type :bool :default false}
:hide-contact? {:type :bool :default false}
:status {:type :string :optional true}
:fcm-token {:type :string :optional true}
:description {:type :string :optional true}
:public-key {:type :string
:optional true}
:dapp? {:type :bool
:default false}
:dapp-url {:type :string
:optional true}
:bot-url {:type :string
:optional true}
:dapp-hash {:type :int
:optional true}
:debug? {:type :bool
:default false}
:tags {:type "string[]"}}})
(def v3 {:name :contact
:primaryKey :public-key
:properties {:address {:type :string :optional true}
:name {:type :string :optional true}
:photo-path {:type :string :optional true}
:last-updated {:type :int :default 0}
:last-online {:type :int :default 0}
:pending? {:type :bool :default false}
:hide-contact? {:type :bool :default false}
:status {:type :string :optional true}
:fcm-token {:type :string :optional true}
:description {:type :string :optional true}
:public-key :string
:dapp? {:type :bool
:default false}
:dapp-url {:type :string
:optional true}
:bot-url {:type :string
:optional true}
:dapp-hash {:type :int
:optional true}
:debug? {:type :bool
:default false}
:tags {:type "string[]"}}})
(def v4 {:name :contact
:primaryKey :public-key
:properties {:address {:type :string :optional true}
:name {:type :string :optional true}
:photo-path {:type :string :optional true}
:last-updated {:type :int :default 0}
:last-online {:type :int :default 0}
:blocked? {:type :bool :default false}
:pending? {:type :bool :default false}
:hide-contact? {:type :bool :default false}
:status {:type :string :optional true}
:fcm-token {:type :string :optional true}
:description {:type :string :optional true}
:public-key :string
:tags {:type "string[]"}}})
(def v5 (assoc-in v4 [:properties :device-info]
{:type :list
:objectType :contact-device-info}))
(def v6 {:name :contact
:primaryKey :public-key
:properties {:address {:type :string :optional true}
:name {:type :string :optional true}
:photo-path {:type :string :optional true}
:last-updated {:type :int :default 0}
:last-online {:type :int :default 0}
:blocked? {:type :bool :default false}
:pending? {:type :bool :default false}
:status {:type :string :optional true}
:fcm-token {:type :string :optional true}
:description {:type :string :optional true}
:public-key :string
:tags {:type "string[]"}
:device-info {:type :list
:objectType :contact-device-info}}})
(def v7 {:name :contact
:primaryKey :public-key
:properties {:address {:type :string :optional true}
:name {:type :string :optional true}
:photo-path {:type :string :optional true}
:last-updated {:type :int :default 0}
:last-online {:type :int :default 0}
:fcm-token {:type :string :optional true}
:public-key :string
:tags {:type "string[]"}
:system-tags {:type "string[]"}
:device-info {:type :list
:objectType :contact-device-info}}})
(def v8 (assoc-in v7 [:properties :tribute-to-talk] {:type :string :optional true}))

View File

@ -1,7 +0,0 @@
(ns status-im.data-store.realm.schemas.account.contact-device-info)
(def v1 {:name :contact-device-info
:primaryKey :id
:properties {:id :string
:timestamp :int
:fcm-token :string}})

View File

@ -1,7 +0,0 @@
(ns status-im.data-store.realm.schemas.account.contact-recovery)
(def v1 {:name :contact-recovery
:primaryKey :id
:properties {:id :string
:timestamp {:type :int
:optional true}}})

View File

@ -1,737 +0,0 @@
(ns status-im.data-store.realm.schemas.account.core
(:require [status-im.data-store.realm.schemas.account.browser :as browser]
[status-im.data-store.realm.schemas.account.chat :as chat]
[status-im.data-store.realm.schemas.account.chat-requests-range :as chat-requests-range]
[status-im.data-store.realm.schemas.account.contact :as contact]
[status-im.data-store.realm.schemas.account.contact-device-info :as contact-device-info]
[status-im.data-store.realm.schemas.account.contact-recovery :as contact-recovery]
[status-im.data-store.realm.schemas.account.dapp-permissions :as dapp-permissions]
[status-im.data-store.realm.schemas.account.installation :as installation]
[status-im.data-store.realm.schemas.account.local-storage :as local-storage]
[status-im.data-store.realm.schemas.account.mailserver :as mailserver]
[status-im.data-store.realm.schemas.account.mailserver-requests-gap :as mailserver-requests-gap]
[status-im.data-store.realm.schemas.account.mailserver-topic :as mailserver-topic]
[status-im.data-store.realm.schemas.account.membership-update :as membership-update]
[status-im.data-store.realm.schemas.account.message :as message]
[status-im.data-store.realm.schemas.account.migrations :as migrations]
[status-im.data-store.realm.schemas.account.request :as request]
[status-im.data-store.realm.schemas.account.transport :as transport]
[status-im.data-store.realm.schemas.account.transport-inbox-topic :as transport-inbox-topic]
[status-im.data-store.realm.schemas.account.user-status :as user-status]))
(def v1 [chat/v1
transport/v1
contact/v1
message/v1
request/v1
user-status/v1
local-storage/v1
browser/v1])
(def v2 [chat/v1
transport/v1
contact/v1
message/v1
request/v1
mailserver/v2
user-status/v1
local-storage/v1
browser/v1])
(def v3 [chat/v3
transport/v1
contact/v1
message/v1
request/v1
mailserver/v2
user-status/v1
local-storage/v1
browser/v1])
(def v4 [chat/v3
transport/v4
contact/v1
message/v1
request/v1
mailserver/v2
user-status/v1
local-storage/v1
browser/v1])
(def v5 [chat/v5
transport/v4
contact/v1
message/v1
request/v1
mailserver/v2
user-status/v1
local-storage/v1
browser/v1])
(def v6 [chat/v5
transport/v6
contact/v1
message/v1
request/v1
mailserver/v2
user-status/v1
local-storage/v1
browser/v1])
(def v7 [chat/v5
transport/v6
contact/v1
message/v7
request/v1
mailserver/v2
user-status/v1
local-storage/v1
browser/v1])
(def v8 [chat/v5
transport/v6
contact/v1
message/v7
request/v1
mailserver/v2
user-status/v1
local-storage/v1
browser/v8])
(def v9 [chat/v5
transport/v6
contact/v1
message/v7
request/v1
mailserver/v2
user-status/v1
local-storage/v1
browser/v8
dapp-permissions/v9])
(def v10 [chat/v5
transport/v6
contact/v1
message/v7
mailserver/v2
user-status/v1
local-storage/v1
browser/v8
dapp-permissions/v9])
(def v11 [chat/v5
transport/v6
contact/v1
message/v7
mailserver/v11
user-status/v1
local-storage/v1
browser/v8
dapp-permissions/v9])
(def v12 [chat/v5
transport/v6
contact/v1
message/v7
mailserver/v11
user-status/v1
local-storage/v1
browser/v8
dapp-permissions/v9])
(def v13 [chat/v6
transport/v6
contact/v1
message/v7
mailserver/v11
user-status/v1
local-storage/v1
browser/v8
dapp-permissions/v9])
(def v14 v13)
(def v15 [chat/v7
transport/v6
contact/v1
message/v7
mailserver/v11
user-status/v1
membership-update/v1
local-storage/v1
browser/v8
dapp-permissions/v9])
(def v16 [chat/v7
transport/v7
transport-inbox-topic/v1
contact/v1
message/v7
mailserver/v11
user-status/v1
membership-update/v1
local-storage/v1
browser/v8
dapp-permissions/v9])
(def v17 [chat/v8
transport/v7
transport-inbox-topic/v1
contact/v2
message/v7
mailserver/v11
user-status/v1
membership-update/v1
local-storage/v1
browser/v8
dapp-permissions/v9])
(def v18 v17)
(def v19 [chat/v8
transport/v7
transport-inbox-topic/v1
contact/v2
message/v7
mailserver/v11
user-status/v1
membership-update/v1
installation/v1
local-storage/v1
browser/v8
dapp-permissions/v9])
(def v20 v19)
(def v21 [chat/v8
transport/v7
transport-inbox-topic/v1
contact/v2
message/v7
mailserver/v11
user-status/v1
membership-update/v1
installation/v2
local-storage/v1
browser/v8
dapp-permissions/v9])
(def v22 [chat/v8
transport/v7
mailserver-topic/v1
contact/v2
message/v7
mailserver/v11
user-status/v1
membership-update/v1
installation/v2
local-storage/v1
browser/v8
dapp-permissions/v9])
(def v23 [chat/v8
transport/v7
contact/v3
message/v7
mailserver/v11
mailserver-topic/v1
user-status/v2
membership-update/v1
installation/v1
local-storage/v1
browser/v8
dapp-permissions/v9])
(def v24 [chat/v8
transport/v7
contact/v3
message/v7
mailserver/v11
mailserver-topic/v1
user-status/v2
membership-update/v1
installation/v2
local-storage/v1
browser/v8
dapp-permissions/v9])
(def v25 [chat/v8
transport/v7
contact/v3
message/v7
mailserver/v11
mailserver-topic/v1
user-status/v2
membership-update/v1
installation/v2
local-storage/v1
browser/v8
dapp-permissions/v9])
(def v26 [chat/v9
transport/v7
contact/v3
message/v7
mailserver/v11
mailserver-topic/v1
user-status/v2
membership-update/v1
installation/v2
local-storage/v1
browser/v8
dapp-permissions/v9])
(def v27 [chat/v9
transport/v7
contact/v3
message/v9
mailserver/v11
mailserver-topic/v1
user-status/v2
membership-update/v1
installation/v2
local-storage/v1
browser/v8
dapp-permissions/v9])
(def v28 [chat/v10
transport/v7
contact/v3
message/v9
mailserver/v11
mailserver-topic/v1
user-status/v2
membership-update/v1
installation/v2
local-storage/v1
browser/v8
dapp-permissions/v9])
(def v29 [chat/v11
transport/v7
contact/v3
message/v9
mailserver/v11
mailserver-topic/v1
user-status/v2
membership-update/v1
installation/v2
local-storage/v1
browser/v8
dapp-permissions/v9])
(def v30 [chat/v12
transport/v7
contact/v3
message/v9
mailserver/v11
mailserver-topic/v1
user-status/v2
membership-update/v1
installation/v2
local-storage/v1
browser/v8
dapp-permissions/v9])
(def v31 [chat/v13
transport/v7
contact/v3
message/v9
mailserver/v11
mailserver-topic/v1
user-status/v2
membership-update/v1
installation/v2
local-storage/v1
browser/v8
dapp-permissions/v9])
(def v32 [chat/v13
transport/v7
contact/v3
message/v9
mailserver/v11
mailserver-topic/v1
user-status/v2
membership-update/v1
installation/v2
local-storage/v1
browser/v8
dapp-permissions/v9
contact-recovery/v1])
(def v33 [chat/v13
transport/v7
contact/v3
message/v9
mailserver/v11
mailserver-topic/v1
user-status/v2
membership-update/v1
installation/v3
local-storage/v1
browser/v8
dapp-permissions/v9
contact-recovery/v1])
(def v34 [chat/v14
transport/v7
contact/v3
message/v9
mailserver/v11
mailserver-topic/v1
user-status/v2
membership-update/v1
installation/v3
local-storage/v1
browser/v8
dapp-permissions/v9
contact-recovery/v1])
(def v35 [chat/v14
transport/v8
contact/v3
message/v9
mailserver/v11
mailserver-topic/v1
user-status/v2
membership-update/v1
installation/v3
local-storage/v1
browser/v8
dapp-permissions/v9
contact-recovery/v1])
(def v36 [chat/v14
transport/v8
contact/v4
message/v9
mailserver/v11
mailserver-topic/v1
user-status/v2
membership-update/v1
installation/v3
local-storage/v1
browser/v8
dapp-permissions/v9
contact-recovery/v1])
(def v37 [chat/v14
transport/v8
contact/v5
message/v9
mailserver/v11
mailserver-topic/v1
user-status/v2
membership-update/v1
installation/v3
local-storage/v1
browser/v8
dapp-permissions/v9
contact-device-info/v1
contact-recovery/v1])
(def v38 v37)
(def v39 [chat/v14
transport/v8
contact/v6
message/v9
mailserver/v11
mailserver-topic/v1
user-status/v2
membership-update/v1
installation/v3
local-storage/v1
browser/v8
dapp-permissions/v9
contact-device-info/v1
contact-recovery/v1])
(def v40 [chat/v14
transport/v8
contact/v7
message/v9
mailserver/v11
mailserver-topic/v1
user-status/v2
membership-update/v1
installation/v3
local-storage/v1
browser/v8
dapp-permissions/v9
contact-device-info/v1
contact-recovery/v1])
(def v41 [chat/v14
transport/v8
contact/v7
message/v10
mailserver/v11
mailserver-topic/v2
user-status/v2
membership-update/v1
installation/v3
local-storage/v1
browser/v8
dapp-permissions/v9
contact-device-info/v1
contact-recovery/v1])
(def v42 [chat/v14
chat-requests-range/v1
transport/v8
contact/v7
message/v10
mailserver/v11
mailserver-topic/v2
user-status/v2
membership-update/v1
installation/v3
local-storage/v1
browser/v8
dapp-permissions/v9
contact-device-info/v1
contact-recovery/v1
mailserver-requests-gap/v1])
(def v43 [chat/v15
chat-requests-range/v1
transport/v8
contact/v7
message/v10
mailserver/v11
mailserver-topic/v2
user-status/v2
membership-update/v1
installation/v3
local-storage/v1
browser/v8
dapp-permissions/v9
contact-device-info/v1
contact-recovery/v1
mailserver-requests-gap/v1])
(def v44 [chat/v15
chat-requests-range/v1
transport/v8
contact/v8
message/v10
mailserver/v11
mailserver-topic/v2
user-status/v2
membership-update/v1
installation/v3
local-storage/v1
browser/v8
dapp-permissions/v9
contact-device-info/v1
contact-recovery/v1
mailserver-requests-gap/v1])
(def v45 [chat/v15
chat-requests-range/v1
transport/v9
contact/v8
message/v10
mailserver/v11
mailserver-topic/v2
user-status/v2
membership-update/v1
installation/v3
browser/v8
dapp-permissions/v9
contact-device-info/v1
contact-recovery/v1
mailserver-requests-gap/v1])
(def v46 [chat/v15
chat-requests-range/v1
transport/v9
contact/v8
message/v11
mailserver/v11
mailserver-topic/v2
membership-update/v1
installation/v3
browser/v8
dapp-permissions/v9
contact-device-info/v1
contact-recovery/v1
mailserver-requests-gap/v1])
(def v47 [chat/v15
chat-requests-range/v1
transport/v10
contact/v8
message/v11
mailserver/v11
mailserver-topic/v2
membership-update/v1
installation/v3
browser/v8
dapp-permissions/v9
contact-device-info/v1
contact-recovery/v1
mailserver-requests-gap/v1])
(def v48 [chat/v15
chat-requests-range/v1
transport/v10
contact/v8
message/v12
mailserver/v11
mailserver-topic/v2
membership-update/v1
installation/v3
browser/v8
dapp-permissions/v9
contact-device-info/v1
contact-recovery/v1
mailserver-requests-gap/v1])
;; put schemas ordered by version
(def schemas [{:schema v1
:schemaVersion 1
:migration migrations/v1}
{:schema v2
:schemaVersion 2
:migration migrations/v2}
{:schema v3
:schemaVersion 3
:migration migrations/v3}
{:schema v4
:schemaVersion 4
:migration migrations/v4}
{:schema v5
:schemaVersion 5
:migration migrations/v5}
{:schema v6
:schemaVersion 6
:migration migrations/v6}
{:schema v7
:schemaVersion 7
:migration migrations/v7}
{:schema v8
:schemaVersion 8
:migration migrations/v8}
{:schema v9
:schemaVersion 9
:migration migrations/v9}
{:schema v10
:schemaVersion 10
:migration migrations/v10}
{:schema v11
:schemaVersion 11
:migration migrations/v11}
{:schema v12
:schemaVersion 12
:migration migrations/v12}
{:schema v13
:schemaVersion 13
:migration migrations/v13}
{:schema v14
:schemaVersion 14
:migration migrations/v14}
{:schema v15
:schemaVersion 15
:migration migrations/v15}
{:schema v16
:schemaVersion 16
:migration migrations/v16}
{:schema v17
:schemaVersion 17
:migration migrations/v17}
{:schema v18
:schemaVersion 18
:migration migrations/v18}
{:schema v19
:schemaVersion 19
:migration migrations/v19}
{:schema v20
:schemaVersion 20
:migration migrations/v20}
{:schema v21
:schemaVersion 21
:migration migrations/v21}
{:schema v22
:schemaVersion 22
:migration migrations/v22}
{:schema v23
:schemaVersion 23
:migration migrations/v23}
{:schema v24
:schemaVersion 24
:migration migrations/v24}
{:schema v25
:schemaVersion 25
:migration migrations/v25}
{:schema v26
:schemaVersion 26
:migration migrations/v26}
{:schema v27
:schemaVersion 27
:migration migrations/v27}
{:schema v28
:schemaVersion 28
:migration migrations/v28}
{:schema v29
:schemaVersion 29
:migration migrations/v29}
{:schema v30
:schemaVersion 30
:migration migrations/v30}
{:schema v31
:schemaVersion 31
:migration (constantly nil)}
{:schema v32
:schemaVersion 32
:migration (constantly nil)}
{:schema v33
:schemaVersion 33
:migration (constantly nil)}
{:schema v34
:schemaVersion 34
:migration migrations/v34}
{:schema v35
:schemaVersion 35
:migration migrations/v35}
{:schema v36
:schemaVersion 36
:migration (constantly nil)}
{:schema v37
:schemaVersion 37
:migration (constantly nil)}
{:schema v38
:schemaVersion 38
:migration migrations/v38}
{:schema v39
:schemaVersion 39
:migration (constantly nil)}
{:schema v40
:schemaVersion 40
:migration migrations/v40}
{:schema v41
:schemaVersion 41
:migration (constantly nil)}
{:schema v42
:schemaVersion 42
:migration migrations/v42}
{:schema v43
:schemaVersion 43
:migration (constantly nil)}
{:schema v44
:schemaVersion 44
:migration (constantly nil)}
{:schema v45
:schemaVersion 45
:migration (constantly nil)}
{:schema v46
:schemaVersion 46
:migration migrations/v46}
{:schema v47
:schemaVersion 47
:migration (constantly nil)}
{:schema v48
:schemaVersion 48
:migration (constantly nil)}])

View File

@ -1,7 +0,0 @@
(ns status-im.data-store.realm.schemas.account.dapp-permissions)
(def v9 {:name :dapp-permissions
:primaryKey :dapp
:properties {:dapp :string
:permissions {:type "string[]"
:optional true}}})

View File

@ -1,26 +0,0 @@
(ns status-im.data-store.realm.schemas.account.installation)
(def v1 {:name :installation
:primaryKey :installation-id
:properties {:installation-id :string
:confirmed? :bool}})
(def v2 {:name :installation
:primaryKey :installation-id
:properties {:installation-id :string
:device-type {:type :string
:optional true}
:last-paired {:type :int
:optional true}
:has-bundle? {:type :bool
:optional true
:default false}
:enabled? {:type :bool
:optional true
:default false}}})
(def v3 (assoc-in v2 [:properties :name] {:type :string
:optional true}))
(def v4 (assoc-in v3 [:properties :fcm-token] {:type :string
:optional true}))

View File

@ -1,7 +0,0 @@
(ns status-im.data-store.realm.schemas.account.local-storage)
(def v1 {:name :local-storage
:primaryKey :chat-id
:properties {:chat-id :string
:data {:type :string
:default "{}"}}})

View File

@ -1,19 +0,0 @@
(ns status-im.data-store.realm.schemas.account.mailserver)
(def v2 {:name :mailserver
:primaryKey :id
:properties {:id :string
:name {:type :string}
:address {:type :string}
:password {:type :string
:optional true}
:chain {:type :string}}})
(def v11 {:name :mailserver
:primaryKey :id
:properties {:id :string
:name {:type :string}
:address {:type :string}
:password {:type :string
:optional true}
:fleet {:type :string}}})

View File

@ -1,10 +0,0 @@
(ns status-im.data-store.realm.schemas.account.mailserver-requests-gap)
(def v1 {:name :mailserver-requests-gap
:primaryKey :id
:properties {:id :string
:chat-id {:type :string
:indexed true}
:from {:type :int
:indexed true}
:to :int}})

View File

@ -1,21 +0,0 @@
(ns status-im.data-store.realm.schemas.account.mailserver-topic)
(def v1 {:name :mailserver-topic
:primaryKey :topic
:properties {:topic :string
:chat-ids :string
:last-request {:type :int :default 1}}})
(def v2
(-> v1
(assoc-in
[:properties :gap-from]
{:type :int
:optional true})
(assoc-in
[:properties :gap-to]
{:type :int
:optional true})))
(def v3
(update v2 :properties dissoc :gap-to :gap-from))

View File

@ -1,15 +0,0 @@
(ns status-im.data-store.realm.schemas.account.membership-update)
(def v1 {:name :membership-update
:primaryKey :id
:properties {:id :string
:type :string
:name {:type :string
:optional true}
:clock-value :int
:signature :string
:from :string
:member {:type :string
:optional true}
:members {:type "string[]"
:optional true}}})

View File

@ -1,83 +0,0 @@
(ns status-im.data-store.realm.schemas.account.message)
(def v1 {:name :message
:primaryKey :message-id
:properties {:message-id :string
:from :string
:to {:type :string
:optional true}
:content :string ; TODO make it ArrayBuffer
:content-type :string
:username {:type :string
:optional true}
:timestamp :int
:chat-id {:type :string
:indexed true}
:outgoing :bool
:retry-count {:type :int
:default 0}
:message-type {:type :string
:optional true}
:message-status {:type :string
:optional true}
:user-statuses {:type :list
:objectType :user-status}
:clock-value {:type :int
:default 0}
:show? {:type :bool
:default true}}})
(def v7 {:name :message
:primaryKey :message-id
:properties {:message-id :string
:from :string
:to {:type :string
:optional true}
:content :string ; TODO make it ArrayBuffer
:content-type :string
:username {:type :string
:optional true}
:timestamp :int
:chat-id {:type :string
:indexed true}
:outgoing :bool
:retry-count {:type :int
:default 0}
:message-type {:type :string
:optional true}
:message-status {:type :string
:optional true}
:clock-value {:type :int
:default 0}
:show? {:type :bool
:default true}}})
(def v8
(-> v7
(assoc-in [:properties :old-message-id]
{:type :string
:indexed true})))
(def v9
(-> v8
(assoc-in [:properties :raw-payload-hash]
{:type :string})))
(def v10
(-> v9
(assoc-in [:properties :whisper-timestamp]
{:type :int
:optional true})))
(def v11
(-> v10
(update :properties dissoc :outgoing)
(assoc-in [:properties :seen]
{:type :bool
:default false})
(assoc-in [:properties :outgoing-status]
{:type :string
:optional true})))
(def v12
(update v11 :properties dissoc :old-message-id))

View File

@ -1,431 +0,0 @@
(ns status-im.data-store.realm.schemas.account.migrations
(:require [cljs.reader :as reader]
[cljs.tools.reader.edn :as edn]
[clojure.string :as string]
[cognitect.transit :as transit]
[status-im.chat.models.message-content :as message-content]
[status-im.constants :as constants]
[status-im.ethereum.core :as ethereum]
[status-im.js-dependencies :as dependencies]
[status-im.transport.utils :as transport.utils]
[status-im.utils.clocks :as utils.clocks]
[taoensso.timbre :as log]))
(defn v1 [old-realm new-realm]
(log/debug "migrating v1 account database: " old-realm new-realm))
(defn v2 [old-realm new-realm]
(log/debug "migrating v2 account database: " old-realm new-realm))
(defn v3 [old-realm new-realm]
(log/debug "migrating v3 account database: " old-realm new-realm))
(defn v4 [old-realm new-realm]
(log/debug "migrating v4 account database: " old-realm new-realm))
(defn v5 [old-realm new-realm]
(log/debug "migrating chats schema v5")
(let [chats (.objects new-realm "chat")]
(dotimes [i (.-length chats)]
(js-delete (aget chats i) "contact-info"))))
(defn v6 [old-realm new-realm]
(log/debug "migrating v6 account database: " old-realm new-realm))
(defn v7 [old-realm new-realm]
(log/debug "migrating messages schema v7")
(let [messages (.objects new-realm "message")]
(dotimes [i (.-length messages)]
(js-delete (aget messages i) "user-statuses"))))
(defn message-by-id [realm message-id]
(.objectForPrimaryKey realm "message" message-id))
(defn v8 [old-realm new-realm]
(log/debug "migrating v8 account database")
(let [browsers (.objects new-realm "browser")
old-browsers (.objects old-realm "browser")]
(dotimes [i (.-length browsers)]
(let [browser (aget browsers i)
old-browser (aget old-browsers i)
url (aget old-browser "url")]
(aset browser "history-index" 0)
(aset browser "history" (clj->js [url]))))))
(defn v9 [old-realm new-realm]
(log/debug "migrating v9 account database"))
(defn v10 [old-realm new-realm]
(log/debug "migrating v10 account database")
(some-> old-realm
(.objects "request")
(.filtered (str "status = \"answered\""))
(.map (fn [request _ _]
(let [message-id (aget request "message-id")
message (message-by-id new-realm message-id)
content (reader/read-string (aget message "content"))
new-content (assoc-in content [:params :answered?] true)]
(aset message "content" (pr-str new-content)))))))
(defn v11 [old-realm new-realm]
(log/debug "migrating v11 account database")
(let [mailservers (.objects new-realm "mailserver")]
(dotimes [i (.-length mailservers)]
(aset (aget mailservers i) "fleet" "eth.beta"))))
(defn v12 [old-realm new-realm]
(log/debug "migrating v12 account database")
(some-> new-realm
(.objects "message")
(.filtered (str "content-type = \"text/plain\""))
(.map (fn [message _ _]
(let [content (aget message "content")
new-content {:text content}]
(aset message "content" (pr-str new-content))))))
(some-> new-realm
(.objects "message")
(.filtered (str "content-type = \"emoji\""))
(.map (fn [message _ _]
(let [content (aget message "content")
new-content {:text content}]
(aset message "content" (pr-str new-content)))))))
(defn v13 [old-realm new-realm]
(log/debug "migrating v13 account database"))
(defn v14 [old-realm new-realm]
(log/debug "migrating v14 account database")
(some-> new-realm
(.objects "message")
(.filtered (str "content-type = \"command-request\""))
(.map (fn [message _ _]
(when message
(aset message "content-type" "command"))))))
(defn v15 [old-realm new-realm]
(log/debug "migrating v15 account database"))
(defn v16 [old-realm new-realm]
(log/debug "migrating v16 account database"))
(defn v17 [old-realm new-realm]
(log/debug "migrating v17 account database"))
(defn v18
"reset last request to 1 to fetch 7 past days of history"
[old-realm new-realm]
(log/debug "migrating v18 account database")
(some-> new-realm
(.objects "transport-inbox-topic")
(.map (fn [inbox-topic _ _]
(aset inbox-topic "last-request" 1)))))
(defn v19 [old-realm new-realm]
(log/debug "migrating v19 account database"))
(defn v20 [old-realm new-realm]
(log/debug "migrating v20 account database")
(some-> new-realm
(.objects "message")
(.filtered (str "content-type = \"text/plain\""))
(.map (fn [message _ _]
(let [content (reader/read-string (aget message "content"))
new-content (message-content/enrich-content content)]
(aset message "content" (pr-str new-content)))))))
(defn v21 [old-realm new-realm]
(log/debug "migrating v21 account database"))
(defn v22 [old-realm new-realm]
(log/debug "migrating v22 account database"))
(defn v23
"the primary key for contact was whisper-identity
change to public-key and remove whisper-identity field"
[old-realm new-realm]
(log/debug "migrating v20 account database")
(let [old-contacts (.objects old-realm "contact")
new-contacts (.objects new-realm "contact")]
(dotimes [i (.-length old-contacts)]
(let [old-contact (aget old-contacts i)
new-contact (aget new-contacts i)
whisper-identity (aget old-contact "whisper-identity")]
(aset new-contact "public-key" whisper-identity))))
(let [old-user-statuses (.objects old-realm "user-status")
new-user-statuses (.objects new-realm "user-status")]
(dotimes [i (.-length old-user-statuses)]
(let [old-user-status (aget old-user-statuses i)
new-user-status (aget new-user-statuses i)
whisper-identity (aget old-user-status "whisper-identity")]
(aset new-user-status "public-key" whisper-identity)))))
(defn v24 [old-realm new-realm]
(log/debug "migrating v24 account database"))
(defn v25 [old-realm new-realm])
(defn v26 [old-realm new-realm]
(let [chats (.objects new-realm "chat")]
(dotimes [i (.-length chats)]
(let [chat (aget chats i)
chat-id (aget chat "chat-id")
user-statuses-count (-> (.objects new-realm "user-status")
(.filtered (str "chat-id=\"" chat-id "\""
" and "
"status = \"received\""))
(.-length))]
(aset chat "unviewed-messages-count" user-statuses-count)))))
;; Message record's interface was
;; copied from status-im.transport.message.protocol
;; to ensure that any further changes to this record will not
;; affect migrations
(defrecord Message [content content-type message-type clock-value timestamp])
(defn replace-ns [str-message]
(string/replace-first
str-message
"status-im.data-store.realm.schemas.account.migrations"
"status-im.transport.message.protocol"))
(defn old-message-id
"Calculates the same `message-id` as was used in `0.9.31`"
[message]
(ethereum/sha3 (replace-ns (pr-str message))))
;; The code below copied from status-im.transport.message.transit
;; in order to make sure that future changes will not have any impact
;; on migrations
(defn- new->legacy-command-data [{:keys [command-path params] :as content}]
(get {["send" #{:personal-chats}] [{:command-ref ["transactor" :command 83 "send"]
:command "send"
:bot "transactor"
:command-scope-bitmask 83}
constants/content-type-command]
["request" #{:personal-chats}] [{:command-ref ["transactor" :command 83 "request"]
:request-command-ref ["transactor" :command 83 "send"]
:command "request"
:request-command "send"
:bot "transactor"
:command-scope-bitmask 83
:prefill [(get params :asset)
(get params :amount)]}
constants/content-type-command-request]}
command-path))
(deftype MessageHandler []
Object
(tag [this v] "c4")
(rep [this {:keys [content content-type message-type clock-value timestamp]}]
(condp = content-type
constants/content-type-text ;; append new content add the end, still pass content the old way at the old index
#js [(:text content) content-type message-type clock-value timestamp content]
constants/content-type-command ;; handle command compatibility issues
(let [[legacy-content legacy-content-type] (new->legacy-command-data content)]
#js [(merge content legacy-content) (or legacy-content-type content-type) message-type clock-value timestamp])
;; no need for legacy conversions for rest of the content types
#js [content content-type message-type clock-value timestamp])))
(def writer (transit/writer :json
{:handlers
{Message (MessageHandler.)}}))
(defn serialize
"Serializes a record implementing the StatusMessage protocol using the custom writers"
[o]
(transit/write writer o))
(defn raw-payload
[message]
(ethereum/utf8-to-hex (serialize message)))
(defn v27 [old-ream new-realm]
(let [messages (.objects new-realm "message")
user-statuses (.objects new-realm "user-status")
old-ids->new-ids (volatile! {})
messages-to-be-deleted (volatile! [])
statuses-to-be-deleted (volatile! [])]
(dotimes [i (.-length messages)]
(let [message (aget messages i)
prev-message-id (aget message "message-id")
content (-> (aget message "content")
edn/read-string
(dissoc :should-collapse? :metadata :render-recipe))
content-type (aget message "content-type")
message-type (keyword
(aget message "message-type"))
clock-value (aget message "clock-value")
from (aget message "from")
timestamp (aget message "timestamp")
message-record (Message. content content-type message-type
clock-value timestamp)
old-message-id (old-message-id message-record)
raw-payload (raw-payload message-record)
message-id (transport.utils/message-id from raw-payload)
raw-payload-hash (ethereum/sha3 raw-payload)]
(vswap! old-ids->new-ids assoc prev-message-id message-id)
(if (.objectForPrimaryKey
new-realm
"message"
message-id)
(vswap! messages-to-be-deleted conj message)
(do
(aset message "message-id" message-id)
(aset message "raw-payload-hash" raw-payload-hash)
(aset message "old-message-id" old-message-id)))))
(doseq [message @messages-to-be-deleted]
(.delete new-realm message))
(dotimes [i (.-length user-statuses)]
(let [user-status (aget user-statuses i)
message-id (aget user-status "message-id")
new-message-id (get @old-ids->new-ids message-id)
public-key (aget user-status "public-key")
new-status-id (str new-message-id "-" public-key)]
(if (.objectForPrimaryKey
new-realm
"user-status"
new-status-id)
(vswap! statuses-to-be-deleted conj user-status)
(when (contains? @old-ids->new-ids message-id)
(aset user-status "status-id" new-status-id)
(aset user-status "message-id" new-message-id)))))
(doseq [status @statuses-to-be-deleted]
(.delete new-realm status))))
(defn get-last-message [realm chat-id]
(->
(.objects realm "message")
(.filtered (str "chat-id=\"" chat-id "\""))
(.sorted "timestamp" true)
(aget 0)))
(defn v28 [old-realm new-realm])
(defn get-last-clock-value [realm chat-id]
(if-let [last-message
(-> (.objects realm "message")
(.filtered (str "chat-id=\"" chat-id "\""))
(.sorted "clock-value" true)
(aget 0))]
(->
last-message
(aget "clock-value")
(utils.clocks/safe-timestamp))
0))
(defn v29 [old-realm new-realm]
(let [chats (.objects new-realm "chat")]
(dotimes [i (.-length chats)]
(let [chat (aget chats i)
chat-id (aget chat "chat-id")]
(when-let [last-clock-value (get-last-clock-value new-realm chat-id)]
(aset chat "last-clock-value" last-clock-value))))))
(defn v30 [old-realm new-realm]
(let [chats (.objects new-realm "chat")]
(dotimes [i (.-length chats)]
(let [chat (aget chats i)
chat-id (aget chat "chat-id")]
(when-let [last-message (get-last-message new-realm chat-id)]
(let [content (aget last-message "content")
content-type (aget last-message "content-type")]
(aset chat "last-message-content" content)
(aset chat "last-message-content-type" content-type)))))))
(defn v34 [old-realm new-realm]
(let [chats (.objects new-realm "chat")]
(dotimes [i (.-length chats)]
(let [chat (aget chats i)
chat-id (aget chat "chat-id")]
(aset chat "group-chat-local-version" 0)))))
(defn one-to-one? [chat-id]
(re-matches #"^0x[0-9a-fA-F]+$" chat-id))
(defn v35 [old-realm new-realm]
(log/debug "migrating transport chats")
(let [old-chats (.objects old-realm "transport")
new-chats (.objects new-realm "transport")]
(dotimes [i (.-length old-chats)]
(let [old-chat (aget old-chats i)
new-chat (aget new-chats i)
chat-id (aget old-chat "chat-id")]
(when (one-to-one? chat-id)
(aset new-chat "one-to-one" true))))))
(defn v38 [old-realm new-realm]
(log/debug "migrating chats v38")
(let [chats (.objects new-realm "chat")]
(dotimes [i (.-length chats)]
(let [chat (aget chats i)
chat-id (aget chat "chat-id")]
(when-let [last-clock-value (get-last-clock-value new-realm chat-id)]
(aset chat "last-clock-value" last-clock-value))))))
(defn v40
"the pending? and blocked? boolean fields are removed and turned
into system tags equivalents in the system-tags field"
[old-realm new-realm]
(log/debug "migrating v40 account database")
(let [old-contacts (.objects old-realm "contact")
new-contacts (.objects new-realm "contact")]
(dotimes [i (.-length old-contacts)]
(let [old-contact (aget old-contacts i)
new-contact (aget new-contacts i)
blocked? (aget old-contact "blocked?")
pending? (aget old-contact "pending?")
last-updated (aget old-contact "last-updated")
system-tags (cond-> #{}
blocked? (conj ":contact/blocked")
(false? pending?) (conj ":contact/added")
(or (true? pending?)
(zero? last-updated)) (conj ":contact/request-received"))]
(aset new-contact "system-tags" (clj->js system-tags))))))
(defn private-chats-ids [chats]
(set
(keep
(fn [i]
(let [chat (aget chats i)]
(when-not (aget chat "public?")
(aget chat "chat-id"))))
(range (.-length chats)))))
(def one-day (* 24 60 60))
(def discovery-topic-hash "0xf8946aac")
(defn v42
"Add all private chats to :discovery mailserver topic"
[old-realm new-realm]
(log/debug "migrating v40 account database")
(let [mailserver-topic (-> (.objects new-realm "mailserver-topic")
(.filtered (str "topic=\"" discovery-topic-hash "\""))
(aget 0))
old-chat-ids (edn/read-string (aget mailserver-topic "chat-ids"))
new-chats-ids (private-chats-ids (.objects old-realm "chat"))
all-chat-ids (clojure.set/union old-chat-ids new-chats-ids)
chat-ids-str (pr-str all-chat-ids)]
(when mailserver-topic
(aset mailserver-topic "chat-ids" chat-ids-str))))
(defn v46
"Migrate user-statuses"
[old-realm new-realm]
(log/debug "migrating v46 account database")
(let [old-user-statuses (.objects old-realm "user-status")]
(dotimes [i (.-length old-user-statuses)]
(let [user-status (aget old-user-statuses i)
status (aget user-status "status")
message-id (aget user-status "message-id")
message (message-by-id new-realm message-id)]
(when message
(cond
(= status "seen")
(aset message "seen" true)
(#{"sent" "sending" "not-sent"} status)
(aset message "outgoing-status" status)))))))

View File

@ -1,8 +0,0 @@
(ns status-im.data-store.realm.schemas.account.request)
(def v1 {:name :request
:properties {:message-id :string
:chat-id :string
:response :string
:status {:type :string
:default "open"}}})

View File

@ -1,76 +0,0 @@
(ns status-im.data-store.realm.schemas.account.transport)
(def v1 {:name :transport
:primaryKey :chat-id
:properties {:chat-id :string
:ack :string
:seen :string
:pending-ack :string
:pending-send :string
:topic :string
:sym-key-id {:type :string
:optional true}
;;TODO (yenda) remove once go implements persistence
:sym-key {:type :string
:optional true}}})
(def v4 {:name :transport
:primaryKey :chat-id
:properties {:chat-id :string
:ack :string
:seen :string
:pending-ack :string
:pending-send :string
:topic :string
:fetch-history? {:type :bool
:default false}
:sym-key-id {:type :string
:optional true}
;;TODO (yenda) remove once go implements persistence
:sym-key {:type :string
:optional true}}})
(def v6 {:name :transport
:primaryKey :chat-id
:properties {:chat-id :string
:ack :string
:seen :string
:pending-ack :string
:pending-send :string
:topic :string
:fetch-history? {:type :bool
:default false}
:resend? {:type :string
:optional true}
:sym-key-id {:type :string
:optional true}
;;TODO (yenda) remove once go implements persistence
:sym-key {:type :string
:optional true}}})
(def v7 {:name :transport
:primaryKey :chat-id
:properties {:chat-id :string
:ack :string
:seen :string
:pending-ack :string
:pending-send :string
:topic {:type :string
:optional true}
:resend? {:type :string
:optional true}
:sym-key-id {:type :string
:optional true}
;;TODO (yenda) remove once go implements persistence
:sym-key {:type :string
:optional true}}})
(def v8 (assoc-in v7 [:properties :one-to-one]
{:type :bool
:optional true}))
(def v9 (update v8 :properties
dissoc
:ack :seen :pending-ack :pending-send))
(def v10 (update v9 :properties dissoc :one-to-one :topic :sym-key-id :sym-key))

View File

@ -1,8 +0,0 @@
; This entity is not used in the newer version of schema
(ns status-im.data-store.realm.schemas.account.transport-inbox-topic)
(def v1 {:name :transport-inbox-topic
:primaryKey :topic
:properties {:topic :string
:chat-ids :string
:last-request {:type :int :default 1}}})

View File

@ -1,23 +0,0 @@
(ns status-im.data-store.realm.schemas.account.user-status)
(def v1 {:name :user-status
:primaryKey :status-id
:properties {;; Unfortunately, realm doesn't support composite primary keys,
;; so we have to keep separate `:status-id` property, which is just
;; `:message-id`-`:whisper-identity` concatenated
:status-id :string
:message-id :string
:chat-id :string
:whisper-identity :string
:status :string}})
(def v2 {:name :user-status
:primaryKey :status-id
:properties {;; Unfortunately, realm doesn't support composite primary keys,
;; so we have to keep separate `:status-id` property, which is just
;; `:message-id`-`:public-key` concatenated
:status-id :string
:message-id :string
:chat-id :string
:public-key :string
:status :string}})

View File

@ -5,7 +5,6 @@
status-im.ui.screens.db
status-im.ui.screens.events
status-im.subs
status-im.data-store.core
[status-im.ui.screens.views :as views]
[status-im.ui.components.react :as react]
[status-im.notifications.core :as notifications]

View File

@ -1,7 +1,6 @@
(ns status-im.init.core
(:require [re-frame.core :as re-frame]
[status-im.biometric-auth.core :as biometric-auth]
[status-im.data-store.core :as data-store]
[status-im.multiaccounts.login.core :as multiaccounts.login]
[status-im.native-module.core :as status]
[status-im.network.net-info :as network]
@ -81,7 +80,6 @@
::init-keystore nil
::restore-native-settings nil
::open-multiaccounts #(re-frame/dispatch [::initialize-multiaccounts %])
::data-store/init-store nil
:ui/listen-to-window-dimensions-change nil
:notifications/init nil
::network/listen-to-network-info nil

View File

@ -5,7 +5,6 @@
status-im.ui.screens.db
status-im.ui.screens.events
status-im.subs
status-im.data-store.core
[status-im.react-native.js-dependencies :as rn-dependencies]
[status-im.ui.screens.views :as views]
[status-im.ui.components.react :as react]

View File

@ -6,7 +6,6 @@
(def identicon-js (js/require "identicon.js"))
(def Web3 (js/require "web3"))
(def web3-prototype (.-prototype Web3))
(def text-encoding (js/require "text-encoding"))
(def js-sha3 (js/require "js-sha3"))
(def web3-utils (js/require "web3-utils"))
(def hi-base32 (js/require "hi-base32"))

View File

@ -6,7 +6,6 @@
[status-im.chat.models.loading :as chat.loading]
[status-im.constants :as constants]
[status-im.contact.core :as contact]
[status-im.data-store.core :as data-store]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.ethereum.transactions.core :as transactions]
@ -160,7 +159,6 @@
(let [stored-pns (:push-notifications/stored db)]
(fx/merge cofx
{:db (assoc db :chats/loading? true)
::data-store/change-multiaccount [address password]
::json-rpc/call
[{:method "mailservers_getMailserverTopics"
:on-success #(re-frame/dispatch [::protocol/initialize-protocol {:mailserver-topics (or % {})}])}
@ -199,7 +197,6 @@
:filters/initialized 1
:network constants/default-network
:networks/networks constants/default-networks)
::data-store/create-multiaccount [address password]
:filters/load-filters []
::json-rpc/call
[{:method "settings_saveConfig"

View File

@ -8,7 +8,6 @@
status-im.ui.screens.add-new.new-chat.navigation
status-im.ui.screens.profile.events
status-im.ui.screens.wallet.navigation
status-im.utils.keychain.events
[re-frame.core :as re-frame]
[status-im.chat.models :as chat]
[status-im.hardwallet.core :as hardwallet]

View File

@ -11,13 +11,17 @@
cofx))
(def ^:private mergable-keys
#{:data-store/tx :chat-received-message/add-fx
#{:chat-received-message/add-fx
:filters/load-filters
:pairing/set-installation-metadata
:status-im.data-store.messages/save-message
:shh/send-direct-message :shh/remove-filter
:shh/generate-sym-key-from-password :transport/confirm-messages-processed
:group-chats/extract-membership-signature :utils/dispatch-later ::json-rpc/call})
:shh/send-direct-message
:shh/remove-filter
:shh/generate-sym-key-from-password
:transport/confirm-messages-processed
:group-chats/extract-membership-signature
:utils/dispatch-later
::json-rpc/call})
(defn- safe-merge [fx new-fx]
(if (:merging-fx-with-common-keys fx)

View File

@ -4,17 +4,8 @@
[status-im.react-native.js-dependencies :as rn]
[status-im.utils.platform :as platform]
[status-im.utils.security :as security]
[status-im.native-module.core :as status]))
(def key-bytes 64)
(def username "status-im.encryptionkey")
(def android-keystore-min-version 23)
(defn- bytes->js-array [b]
(.from js/Array b))
(defn- string->js-array [s]
(.parse js/JSON (.-password s)))
[status-im.native-module.core :as status]
[status-im.utils.handlers :as handlers]))
(defn- check-conditions [callback & checks]
(if (= (count checks) 0)
@ -122,85 +113,6 @@
:else (callback false)))
;; ********************************************************************************
;; Storing / Retrieving the realm encryption key to/from the Keychain
;; ********************************************************************************
;; Smoke test key to make sure is ok, we noticed some non-random keys on
;; some IOS devices. We check naively that there are no more than key-bytes/2
;; identical characters.
(defn validate
[encryption-key]
(cond
(or (not encryption-key)
(not= (.-length encryption-key) key-bytes))
(.reject js/Promise {:error :invalid-key
:key encryption-key})
(>= (/ key-bytes 2)
(count (keys (group-by identity encryption-key))))
(.reject js/Promise {:error :weak-key
:key encryption-key})
:else encryption-key))
(defn store [encryption-key]
(log/debug "storing encryption key")
(-> (.setGenericPassword
rn/keychain
username
(.stringify js/JSON encryption-key))
(.then (constantly encryption-key))))
(defn create []
(log/debug "no key exists, creating...")
(.. (rn/secure-random key-bytes)
(then bytes->js-array)))
(defn handle-not-found []
(.. (create)
(then validate)
(then store)))
(def handle-found
(comp validate
string->js-array))
(defonce generic-password (atom nil))
(defn get-encryption-key []
(log/debug "PERF" "initializing realm encryption key..." (.now js/Date))
(if @generic-password
(js/Promise.
(fn [on-success _]
(on-success (security/unmask @generic-password))))
(.. (.getGenericPassword rn/keychain)
(then
(fn [res]
(if res
(let [handled-res (handle-found res)]
(reset! generic-password
(security/->MaskedData handled-res))
handled-res)
(handle-not-found)))))))
(defn safe-get-encryption-key
"Return encryption key or empty string in case invalid/empty"
[]
(log/debug "initializing realm encryption key...")
(.. (get-encryption-key)
(catch (fn [{:keys [_ key]}]
(log/warn "key is invalid, continuing")
(or key "")))))
(defn reset []
(log/debug "resetting key...")
(.resetGenericPassword rn/keychain))
(defn set-username []
(when platform/desktop? (.setUsername rn/keychain username)))
;;;; Effects
(re-frame/reg-fx
@ -233,3 +145,10 @@
:keychain/can-save-user-password?
(fn [_]
(can-save-user-password? #(re-frame/dispatch [:keychain.callback/can-save-user-password?-success %]))))
(handlers/register-handler-fx
:keychain.callback/can-save-user-password?-success
(fn [{:keys [db]} [_ can-save-user-password?]]
{:db (assoc-in db
[:multiaccounts/login :can-save-password?]
can-save-user-password?)}))

View File

@ -1,26 +0,0 @@
(ns status-im.utils.keychain.events
(:require [re-frame.core :as re-frame]
[taoensso.timbre :as log]
[status-im.utils.keychain.core :as keychain]
[status-im.utils.platform :as platform]
[status-im.utils.handlers :as handlers]))
(defn handle-key-error [event {:keys [error key]}]
(if (= :weak-key error)
(log/warn "weak key used, database might not be encrypted properly")
(log/warn "invalid key detected"))
(re-frame/dispatch (into [] (concat event [(or key "")
(or error :invalid-key)]))))
(re-frame/reg-fx
:keychain/get-encryption-key
(fn [event]
(when platform/desktop? (keychain/set-username))
(.. (keychain/get-encryption-key)
(then #(re-frame/dispatch (conj event %)))
(catch (partial handle-key-error event)))))
(handlers/register-handler-fx
:keychain.callback/can-save-user-password?-success
(fn [{:keys [db]} [_ can-save-user-password?]]
{:db (assoc-in db [:multiaccounts/login :can-save-password?] can-save-user-password?)}))

View File

@ -21,9 +21,7 @@
:Text #js {}}
:DeviceEventEmitter #js {:addListener (fn [])}
:Dimensions #js {:get (fn [])}})
(def realm #js {:schemaVersion (fn [])
:defaultPath "/tmp/realm"
:close (fn [])})
(def vector-icons #js {:default #js {}})
(def webview-bridge #js {:default #js {}})
(def webview #js {:WebView #js {}})

View File

@ -46,7 +46,6 @@
(deftest add-public-chat
(let [topic "topic"
fx (chat/add-public-chat {:db {}} topic)
store-fx (:data-store/tx fx)
chat (get-in fx [:db :chats topic])]
(testing "it sets the name"
(is (= topic (:name chat))))

View File

@ -1,49 +0,0 @@
(ns status-im.test.data-store.core
(:require [cljs.test :refer-macros [deftest is testing use-fixtures]]
[status-im.utils.utils :as utils]
[clojure.string :as string]
[status-im.data-store.core :as core]))
(deftest merge-events-of-type
(def events-test [[:event1 [:data1]] [:event1 [:data2]]
[:event2 [:data3]] [:event2 [:data4]]
[:event3 [:data5]]
[:event4 :data6]
[:event5]])
(testing "merging-events-with-data"
(is (= (core/merge-events-of-type events-test :event1)
[[:event1 [:data1 :data2]]
[:event2 [:data3]] [:event2 [:data4]]
[:event3 [:data5]]
[:event4 :data6]
[:event5]]))
(is (= (core/merge-events-of-type events-test :event2)
[[:event2 [:data3 :data4]]
[:event1 [:data1]] [:event1 [:data2]]
[:event3 [:data5]]
[:event4 :data6]
[:event5]]))
(is (= (core/merge-events-of-type events-test :event3)
[[:event3 [:data5]]
[:event1 [:data1]] [:event1 [:data2]]
[:event2 [:data3]] [:event2 [:data4]]
[:event4 :data6]
[:event5]]))
;; we can't group non-vector event data
(is (= (core/merge-events-of-type events-test :event4)
[[:event1 [:data1]] [:event1 [:data2]]
[:event2 [:data3]] [:event2 [:data4]]
[:event3 [:data5]]
[:event4 :data6]
[:event5]]))
;; we can't group non-vector event data
(is (= (core/merge-events-of-type events-test :event5)
[[:event1 [:data1]] [:event1 [:data2]]
[:event2 [:data3]] [:event2 [:data4]]
[:event3 [:data5]]
[:event4 :data6]
[:event5]]))))

View File

@ -1,62 +0,0 @@
(ns status-im.test.data-store.realm.core
(:require [cljs.test :refer-macros [deftest is testing use-fixtures]]
[status-im.utils.utils :as utils]
[clojure.string :as string]
[status-im.data-store.realm.core :as core]))
(def migrated-realm? (atom nil))
(defn fixtures [f]
(reset! migrated-realm? nil)
(f))
(def valid-account-path
(str "/some/" (string/join (repeat 40 "a"))))
(use-fixtures :each fixtures)
(deftest migrate-realm
(with-redefs [core/open-realm #(reset! migrated-realm? true)]
(testing "the database does not exists"
(with-redefs [core/encrypted-realm-version (constantly -1)]
(core/migrate-realm "test-filename" [] "encryption-key")
(testing "it migrates the db"
(is @migrated-realm?))))
(testing "the database exists"
(with-redefs [core/encrypted-realm-version (constantly 2)]
(core/migrate-realm "test-filename" [] "encryption-key")
(testing "it migrates the db"
(is @migrated-realm?))))))
(deftest is-account-file-test
(testing "not an account file"
(is (not (core/is-account-file? "not-one")))
(is (not (core/is-account-file? "000000000000000009212102"))))
(testing "an account file"
(is (core/is-account-file? valid-account-path))))
(deftest is-realm-file-test
(testing "not a realm file"
(is (not (core/is-realm-file? "not-one")))
(is (not (core/is-realm-file? "000000000000000009212102"))))
(testing "realm files"
(is (core/is-realm-file? "/some/new-account"))
(is (core/is-realm-file? "/some/new-account.lock"))
(is (core/is-realm-file? "/some/new-account.management"))
(is (core/is-realm-file? "/some/new-account.note"))
(is (core/is-realm-file? "/some/default.realm"))
(is (core/is-realm-file? valid-account-path))))
(deftest realm-management-file-test
(testing "not a management file"
(is (not (core/realm-management-file? "new-account"))))
(testing "management file"
(is (core/realm-management-file? "anything.management"))
(is (core/realm-management-file? "anything.lock"))
(is (core/realm-management-file? "anything.note"))))
(deftest serialization
(is (nil? (core/deserialize "")))
(is (nil? (core/deserialize "giberrish")))
(is (nil? (core/deserialize nil)))
(is (nil? (core/deserialize (core/serialize nil)))))

File diff suppressed because one or more lines are too long

View File

@ -35,11 +35,6 @@
(reset! re-frame.db/app-db {:web3 web3
:multiaccount {:public-key from}})
(rf/reg-fx :data-store/save-chat (constantly nil))
(rf/reg-fx :data-store/save-message (constantly nil))
(rf/reg-fx :data-store/save-contact (constantly nil))
(rf/reg-fx :data-store/update-message (constantly nil))
(rf/dispatch [:contact.ui/send-message-pressed {:public-key contact-public-key}])
(rf-test/wait-for [::transport.contact/send-new-sym-key]
(rf/dispatch [:set-chat-input-text "test message"])

View File

@ -17,8 +17,6 @@
[status-im.test.data-store.chats]
[status-im.test.data-store.messages]
[status-im.test.data-store.contacts]
[status-im.test.data-store.core]
[status-im.test.data-store.realm.core]
[status-im.test.ethereum.abi-spec]
[status-im.test.ethereum.core]
[status-im.test.ethereum.eip55]
@ -57,7 +55,6 @@
[status-im.test.utils.fx]
[status-im.test.utils.gfycat.core]
[status-im.test.utils.http]
[status-im.test.utils.keychain.core]
[status-im.test.utils.money]
[status-im.test.utils.prices]
[status-im.test.utils.random]
@ -100,8 +97,6 @@
'status-im.test.data-store.chats
'status-im.test.data-store.messages
'status-im.test.data-store.contacts
'status-im.test.data-store.core
'status-im.test.data-store.realm.core
'status-im.test.ethereum.abi-spec
'status-im.test.ethereum.core
'status-im.test.ethereum.eip55
@ -142,7 +137,6 @@
'status-im.test.utils.fx
'status-im.test.utils.gfycat.core
'status-im.test.utils.http
'status-im.test.utils.keychain.core
'status-im.test.utils.money
'status-im.test.utils.prices
'status-im.test.utils.random

View File

@ -3,7 +3,6 @@
flow has been changed. Such changes should be reflected in both these tests
and documents which describe the whole \"sign in\" flow."
(:require [cljs.test :refer-macros [deftest is testing]]
[status-im.data-store.core :as data-store]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.multiaccounts.login.core :as login.core]
@ -36,7 +35,6 @@
(testing ":accounts/login cleared."
(is (not (contains? new-db :multiaccounts/login))))
(testing "Check the rest of effects."
(is (contains? efx ::data-store/change-multiaccount))
(is (json-rpc "web3_clientVersion"))))))
;;TODO re-enable when keycard is fixed

View File

@ -1,81 +0,0 @@
(ns status-im.test.utils.keychain.core
(:require [cljs.test :refer-macros [deftest async is testing]]
[status-im.react-native.js-dependencies :as rn]
[status-im.utils.keychain.core :as keychain]))
(def strong-key (range 0 64))
(def weak-key (concat (range 0 32) (take 32 (repeat 0))))
(defn- key->json [k]
(->> k
(keychain/bytes->js-array)
(.stringify js/JSON)))
(deftest key-does-not-exists
(async
done
(with-redefs [rn/keychain #js {:getGenericPassword (constantly (.resolve js/Promise nil))}]
(testing "it returns a valid key"
(.. (keychain/get-encryption-key)
(then (fn [k]
(is (= strong-key (js->clj k)))
(done)))
(catch (fn [err]
(is (not err))
(done))))))))
(deftest key-does-exist
(async
done
(with-redefs [rn/keychain #js {:getGenericPassword (constantly (.resolve js/Promise #js {:password (key->json (range 64 128))}))}]
(testing "it returns a valid key"
(.. (keychain/get-encryption-key)
(then (fn [k]
(is (= (range 64 128) (js->clj k)))
(done)))
(catch (fn [err]
(is (not err))
(done))))))))
(deftest key-is-weak
(async
done
(with-redefs [rn/keychain #js {:getGenericPassword (constantly (.resolve js/Promise #js {:password (key->json weak-key)}))}
keychain/generic-password (atom nil)]
(testing "it returns a valid key"
(.. (keychain/get-encryption-key)
(then (fn [_]
(is false)
(done)))
(catch (fn [{:keys [error key]}]
(is (= :weak-key error))
(is (= weak-key (js->clj key)))
(done))))))))
(deftest safe-key-is-not-valid
(async
done
(with-redefs [rn/keychain #js {:getGenericPassword (constantly (.resolve js/Promise #js {:password (key->json weak-key)}))}
keychain/generic-password (atom nil)]
(testing "it returns a valid key"
(.. (keychain/safe-get-encryption-key)
(then (fn [k]
(is (= weak-key (js->clj k)))
(done)))
(catch (fn [err]
(is (not err))
(done))))))))
(deftest safe-key-is-nil
(async
done
(with-redefs [rn/keychain #js {:getGenericPassword (constantly (.resolve js/Promise #js {:password nil}))}
keychain/generic-password (atom nil)]
(testing "it returns a valid key"
(.. (keychain/safe-get-encryption-key)
(then (fn [k]
(is (= "" (js->clj k)))
(done)))
(catch (fn [err]
(is (not err))
(done))))))))

View File

@ -572,7 +572,6 @@
"currency-display-name-ron": "Romania Leu",
"log-level-settings": "Log level settings",
"invalid-key-content": "{{message}}\n\nMultiaccount's database can't be encrypted because file is corrupted. There is no way to restore it. If you press \"Cancel\" button, nothing will happen. If you press \"{{erase-multiaccounts-data-button-text}}\" button, multiaccount's db will be removed and you will be able to unlock multiaccount. All multiaccount's data will be lost.",
"unknown-realm-error-content": "{{message}}\n\nMultiaccount's database can't be opened. Please let us know about this problem at #status public chat. If you press \"Cancel\" button, nothing will happen. If you press \"{{erase-multiaccounts-data-button-text}}\" button, multiaccount's db will be removed and you will be able to unlock multiaccount. All multiaccount's data will be lost.",
"advanced-settings": "Advanced settings",
"group-info": "Group info",
"currency-display-name-nio": "Nicaragua Cordoba",
@ -595,7 +594,6 @@
"wallet-send": "Send",
"wallet-deposit": "Deposit",
"invalid-key-title": "We detected a problem with the encryption key",
"unknown-realm-error": "Something went wrong",
"notifications": "Notifications",
"currency-display-name-czk": "Czech Koruna",
"currency-display-name-bob": "Bolivia Bolíviano",
@ -1043,8 +1041,6 @@
"migrations-failed-title": "Migration failed",
"migrations-failed-content": "{{message}}\nschema version: initial {{initial-version}}, current {{current-version}}, last {{last-version}}\n\nPlease let us know about this problem at #status public chat. If you press \"Cancel\" button, nothing will happen. If you press \"{{erase-multiaccounts-data-button-text}}\" button, multiaccount's db will be removed and you will be able to unlock multiaccount. All multiaccount's data will be lost.",
"migrations-erase-multiaccounts-data-button": "Erase multiaccount's db",
"multiaccount-and-db-password-mismatch-title": "A problem occurred!",
"multiaccount-and-db-password-mismatch-content": "Multiaccount's and realm db passwords do not match.",
"recover-multiaccount-warning": "Your wallet information will be exposed by importing this multiaccount.",
"buy-with-snt": "Buy with SNT",
"sticker-market": "Sticker market",

View File

@ -742,8 +742,6 @@
"mobile-syncing-sheet-title": "Sync utilisant des données mobiles",
"more": "plus",
"move-to-internal-failure-message": "Nous devons déplacer certains fichiers importants du stockage externe vers le stockage interne. Pour ce faire, nous avons besoin de votre permission. Nous n'utiliserons pas de stockage externe dans les prochaines versions.",
"multiaccount-and-db-password-mismatch-content": "Les mots de passe des bases de données multi-comptes et des domaines realm ne correspondent pas.",
"multiaccount-and-db-password-mismatch-title": "Un problème est survenu!",
"multiaccount-generation-message": "",
"multiaccount-not-listed": "Multicompte non répertorié",
"multiaccount-not-listed-text": "Le multicompte sur cette carte n'est pas listé sur votre téléphone. Souhaitez-vous vous connecter avec ce nouveau multicompte ?",
@ -1159,8 +1157,6 @@
"unable-to-read-this-code": "Impossible de lire ce code",
"unblock-contact": "Débloquer le contact",
"unknown-address": "Adresse inconnue",
"unknown-realm-error": "Quelque chose a mal tourné",
"unknown-realm-error-content": "{{message}} \n \n La base de données multi-compte ne peut pas être ouverte. Veuillez nous informer de ce problème sur le chat public #status. Si vous appuyez sur le bouton \"Annuler\", rien ne se passera. Si vous appuyez sur le bouton \" {{erase-multiaccounts-data-button-text}} \", la base de données multi-comptes sera supprimée et vous pourrez déverrouiller plusieurs comptes. Toutes les données multi-comptes seront perdues.",
"unknown-status-go-error": "Erreur inconnue status-go",
"unlock": "Déverrouiller",
"unpair-card": "Dissocier la carte",

View File

@ -740,8 +740,6 @@
"mobile-syncing-sheet-title": "モバイルデータを使用して同期する",
"more": "もっとみる",
"move-to-internal-failure-message": "重要なファイルを外部ストレージから内部ストレージに移動する必要があります。これを行うにはあなたの許可が必要です。今後のバージョンでは外部ストレージを使用しない予定です。",
"multiaccount-and-db-password-mismatch-content": "マルチアカウントとレルムデータベースのパスワードがマッチしません。",
"multiaccount-and-db-password-mismatch-title": "問題が発生しました!",
"multiaccount-not-listed": "マルチアカウントがリストされていません",
"multiaccount-not-listed-text": "このカードのマルチアカウントはあなたのスマートフォンにリストされていません。新しいマルチアカウントでログインしますか?",
"multiaccounts-recover-enter-phrase-text": "12、15、18、21、または24単語を入力してください。各単語はシングルスペースで区切ってください。",
@ -1162,8 +1160,6 @@
"unable-to-read-this-code": "このコードを読み込めません",
"unblock-contact": "連絡先のブロックを解除",
"unknown-address": "不明なアドレス",
"unknown-realm-error": "うまくいきませんでした",
"unknown-realm-error-content": "{{message}}\nマルチアカウントのデータベースが開けませんでした。#status パブリックチャットでこの問題を報告してください。キャンセルボタンを押せば何も起こりません。{{erase-multiaccounts-data-button-text}}を押せば、マルチアカウントデータベースは削除され、マルチアカウントをアンロックできますが、データは全て消失します。",
"unknown-status-go-error": "不明なstatus-goのエラー",
"unlock": "ロック解除",
"unpair-card": "カードのペアリングを解除",
@ -1273,4 +1269,4 @@
"your-recovery-phrase": "リカバリーフレーズ",
"your-recovery-phrase-description": "これがあなたのリカバリーフレーズです。ウォレットがあなたのものであることを証明するために使用します。一度だけしか見ることができません。紙に書くか安全な場所で保管してください。ウォレットを再インストールするときに必要になります。",
"your-wallets": "あなたのウォレット"
}
}

View File

@ -747,8 +747,6 @@
"mobile-syncing-sheet-title": "모바일 데이터로 동기화",
"more": "더보기",
"move-to-internal-failure-message": "몇몇 중요한 파일을 외부 저장소에서 내부 저장소로 옮기기 위해 권한이 필요합니다. 추후 버전에서는 외부 저장소를 사용하지 않을 것입니다.",
"multiaccount-and-db-password-mismatch-content": "계정의 영역(realm) db 암호가 일치하지 않습니다.",
"multiaccount-and-db-password-mismatch-title": "문제가 발생했습니다!",
"multiaccount-not-listed": "리스트에 없는 계정",
"multiaccount-not-listed-text": "이 카드의 계정은 스마트폰에 존재하지 않습니다. 이 새로운 계정으로 로그인 하시겠습니까?",
"multiaccounts-recover-enter-phrase-text": "12, 15, 18, 21 또는 24 단어를 입력해주세요.\n단어를 한 칸씩 띄어써서 구분해야 합니다.",
@ -1176,8 +1174,6 @@
"unable-to-read-this-code": "코드를 읽을 수 없습니다.",
"unblock-contact": "연락처 차단 해제",
"unknown-address": "알 수 없는 주소",
"unknown-realm-error": "문제가 발생했습니다",
"unknown-realm-error-content": "{{message}}\n\n계정의 데이터베이스를 열람할 수 없습니다. 이 문제를 #status 오픈 채팅에 공유해주세요. '취소' 버튼을 누르면 이전으로 돌아갑니다. {{erase-multiaccounts-data-button-text}} 버튼을 누르면 계정의 데이터베이스가 삭제하고 계정을 열람할 수 있습니다. 이전 데이터는 모두 지워집니다.",
"unknown-status-go-error": "알 수 없는 status-go 오류",
"unlock": "잠금 해제",
"unpair-card": "카드 페어링 해제",
@ -1287,4 +1283,4 @@
"your-recovery-phrase": "시드 구문",
"your-recovery-phrase-description": "위 12단어가 사용자의 시드 구문입니다. 이 구문은 사용자의 지갑을 증명하기 위해 반드시 필요하며, 이번 한번만 확인할 수 있습니다. 지갑을 분실하거나 재설치하는 경우 반드시 필요하므로 안전한 장소에 보관하세요.",
"your-wallets": "내 지갑"
}
}

View File

@ -779,8 +779,6 @@
"mobile-syncing-sheet-title": "Синхронизация с использованием мобильной сети",
"more": "больше",
"move-to-internal-failure-message": "Нам нужно переместить некоторые важные файлы из внешнего хранилища во внутреннее. Для этого нам нужно ваше разрешение. В следующих версиях мы не будем использовать внешние хранилища.",
"multiaccount-and-db-password-mismatch-content": "Пароли баз данных мультиаккаунта и realm не совпадают.",
"multiaccount-and-db-password-mismatch-title": "Возникла проблема!",
"multiaccount-not-listed": "Мультиаккаунта нет в списке",
"multiaccount-not-listed-text": "Мультиаккаунта на этой карте нет в списке на вашем телефоне. Хотите войти используя этот новый мультиаккаунт?",
"multiaccounts-recover-enter-phrase-text": "Введите 12, 15, 18, 21 или 24 слова. \n Ожидается, что слова будет разделять один пробел.",
@ -1208,8 +1206,6 @@
"unable-to-read-this-code": "Не удалось прочитать этот код",
"unblock-contact": "Разблокировать контакт",
"unknown-address": "Неизвестный адрес",
"unknown-realm-error": "Что-то пошло не так",
"unknown-realm-error-content": "{{message}} \n \nБаза данных мультиаккаунта не может быть открыта. Пожалуйста, сообщите нам об этой проблеме в #status публичном чате. Если вы нажмете кнопку «Отмена», ничего не произойдет. Если вы нажмете кнопку «{{erase-multiaccounts-data-button-text}}», база данных мультиаккаунта будет удалена, и вы сможете разблокировать мультиаккаунт. Все данные мультиаккаунта будут потеряны.",
"unknown-status-go-error": "Неизвестная status-go ошибка",
"unlock": "Разблокировать",
"unpair-card": "Отменить привязку карты",
@ -1323,4 +1319,4 @@
"your-recovery-phrase": "Ваша фраза восстановления",
"your-recovery-phrase-description": "Это ваша фраза восстановления. Используйте её, чтобы доказать, что это ваш кошелёк. Вы увидите её только один раз. Запишите все слова на бумаге и держите в надежном месте. Они вам понадобятся, если вы потеряете или переустановите свой кошелёк.",
"your-wallets": "Ваши кошельки"
}
}

View File

@ -755,8 +755,6 @@
"mobile-syncing-sheet-title": "使用移动数据同步",
"more": "更多",
"move-to-internal-failure-message": "我们需要将一些重要的文件从外部存储移动到内部存储。为此,我们需要你的许可。在之后的版本中,我们将不会使用外部存储。",
"multiaccount-and-db-password-mismatch-content": "帐户和域数据库密码不匹配。",
"multiaccount-and-db-password-mismatch-title": "出现问题!",
"multiaccount-not-listed": "帐户不在列表中",
"multiaccount-not-listed-text": "此卡上的帐户未在手机列表中。您想使用这个新帐户登录吗?",
"multiaccounts-recover-enter-phrase-text": "输入12,15,18,21或24个单词。 \n用单个空格分隔单词。",
@ -1184,8 +1182,6 @@
"unable-to-read-this-code": "无法读取此代码",
"unblock-contact": "取消屏蔽联系人",
"unknown-address": "未知地址",
"unknown-realm-error": "出错",
"unknown-realm-error-content": "{{message}} \n \n帐户的数据库无法打开。请在#status公共聊天中告诉我们此问题。如果按“取消”按钮则不会发生任何事情。如果按“ {{erase-multiaccounts-data-button-text}} ”按钮,帐户的数据库将被删除,您将能够解锁帐户。所有帐户的数据都将丢失。",
"unknown-status-go-error": "未知的 status-go 错误",
"unlock": "解锁",
"unpair-card": "未配对卡片",
@ -1296,4 +1292,4 @@
"your-recovery-phrase": "您的助记词",
"your-recovery-phrase-description": "这是你的助记词。已此来证明这是你的钱包。你只能查看一次!请将其写在纸上并保存在安全的地方。如果丢失或重新安装钱包,您将需要用到这些助记词。",
"your-wallets": "你的钱包"
}
}

View File

@ -5,8 +5,6 @@
"about-names-content": "",
"about-names-title": "",
"access-key": "",
"multiaccount-and-db-password-mismatch-content": "帐户和域数据库密码不匹配。",
"multiaccount-and-db-password-mismatch-title": "出现问题!",
"multiaccount-generation-message": "给我一点时间,我得疯狂地计算一下,才能生成你的帐户!",
"multiaccount-not-listed": "帐户不在列表中",
"multiaccount-not-listed-text": "此卡上的帐户未在手机列表中。您想使用这个新帐户登录吗?",
@ -1115,8 +1113,6 @@
"unable-to-read-this-code": "无法读取此代码",
"unblock-contact": "取消屏蔽联系人",
"unknown-address": "未知地址",
"unknown-realm-error": "出错",
"unknown-realm-error-content": "{{message}} \n \n帐户的数据库无法打开。请在#status公共聊天中告诉我们此问题。如果按“取消”按钮则不会发生任何事情。如果按“ {{erase-accounts-data-button-text}} ”按钮,帐户的数据库将被删除,您将能够解锁帐户。所有帐户的数据都将丢失。",
"unknown-status-go-error": "未知的 status-go 错误",
"unlock": "",
"unpair-card": "未配对卡片",

View File

@ -18,14 +18,12 @@ var repl = require('repl');
var vm = require('vm');
var util = require('util');
var Buffer = require('buffer').Buffer;
var realmConstructor = require("./node_modules/realm/lib/index.js");
console.log("Loaded realmConstructor: " + realmConstructor);
var DEBUG = 1;
function rnUbuntuServer(readable, writable) {
console.reportErrorsAsExceptions = false; // XXX:
var sandbox = { console: console, util: util, outerRealmConstructor: realmConstructor };
var sandbox = { console: console, util: util };
vm.createContext(sandbox);
var state = 'start';