TEMP commit

This commit is contained in:
Morten Krogh 2017-09-13 16:53:44 +02:00
parent 4d4606c905
commit c554c0127d
3 changed files with 209 additions and 0 deletions

View File

@ -0,0 +1,106 @@
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 4 (0x4)
Signature Algorithm: sha1WithRSAEncryption
Issuer: DC=io, DC=realm, O=Realm, OU=Realm Test Signing CA, CN=Realm Test Signing CA
Validity
Not Before: Sep 7 13:42:46 2016 GMT
Not After : Sep 7 13:42:46 2018 GMT
Subject: DC=localhost, O=company, OU=section, CN=localhost
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
Modulus:
00:a5:54:87:8c:71:a6:f4:8b:42:96:5e:4c:38:10:
d3:2c:63:e1:2c:42:d2:14:30:91:68:f3:78:58:51:
fa:f9:a7:fc:d2:4c:eb:df:44:ea:52:00:f2:27:27:
bc:0f:d8:d2:4c:18:d1:92:6c:0d:e2:b3:6d:61:ec:
18:77:1c:37:ca:9f:8b:45:c0:9c:cb:82:cc:83:5b:
41:e1:65:62:9d:ca:e5:fe:20:8f:c1:26:8d:ae:a1:
f6:6b:d3:a7:bd:f9:b8:63:48:e3:25:1c:f9:08:16:
fe:41:ac:74:77:8d:01:8d:67:0c:e4:8b:77:0b:65:
91:8b:1e:ac:96:24:12:0a:3c:71:84:6d:b9:61:58:
da:3c:cb:65:6c:9d:8b:25:ce:0c:e9:5d:a3:a7:91:
be:d5:70:8a:d7:ce:9a:d2:21:9f:de:cf:6c:a3:7d:
db:41:7e:e1:6e:36:cb:56:52:4f:28:1a:b1:fd:39:
4b:08:10:38:f1:80:fe:da:3e:60:28:bd:86:ae:02:
23:26:0e:65:e3:73:5b:23:fb:e7:58:37:84:11:e2:
51:80:ee:fb:f9:3a:08:7e:e8:1f:5f:b2:c9:3b:5f:
d6:e4:bb:80:f6:38:3a:66:15:bd:6c:60:77:ac:18:
6b:c9:e1:5d:9e:8d:2a:25:8d:9f:a0:34:b1:bd:58:
1a:63
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Key Usage: critical
Digital Signature, Key Encipherment
X509v3 Basic Constraints:
CA:FALSE
X509v3 Extended Key Usage:
TLS Web Server Authentication, TLS Web Client Authentication
X509v3 Subject Key Identifier:
90:53:76:CA:D0:6D:14:0F:CB:44:B4:B9:F2:00:CC:55:84:25:70:89
X509v3 Authority Key Identifier:
keyid:27:79:E1:DA:F1:15:D0:E9:E5:86:30:87:E7:1F:5F:CF:27:3A:70:B4
X509v3 Subject Alternative Name:
DNS:localhost
Signature Algorithm: sha1WithRSAEncryption
14:36:f6:b5:8a:a2:5b:ce:02:f8:71:6a:2a:7a:b1:29:7d:7b:
1c:2b:35:fa:cf:45:a0:80:fa:1c:8a:29:b3:96:27:b6:77:3c:
a2:24:9d:49:36:ea:aa:95:06:7d:e8:5f:57:63:ea:d8:a7:83:
b7:22:fd:43:89:61:59:9e:09:15:16:78:07:c3:74:b8:89:c2:
be:98:51:bd:95:3e:8f:9b:a3:79:17:d1:95:7b:ae:aa:e7:95:
17:3f:85:fa:09:82:de:39:3f:4b:fe:77:9b:b8:12:3d:3d:53:
42:44:78:1a:d9:17:46:dc:55:07:fe:b4:ba:60:c2:fd:b9:73:
1d:8a:41:2b:37:e9:b9:85:6d:4c:97:e1:c3:bd:62:be:c2:f7:
a1:73:b4:26:7f:89:01:5f:09:e2:36:36:f5:9a:a4:60:11:bd:
12:43:55:56:bb:2e:5c:76:58:b8:20:7b:34:dc:73:f2:ad:69:
8f:ff:be:30:df:53:a0:c3:f0:7c:4f:77:8e:19:59:be:c5:ce:
c7:d6:50:bd:87:6f:9c:ad:ab:fe:c1:2b:d4:5c:0e:f4:00:47:
92:8d:ce:c2:65:3a:7e:4b:d5:ee:cb:b3:b9:74:80:38:70:83:
2d:a0:f3:3d:7f:9b:20:b0:09:cc:95:4a:6a:3f:ce:84:e6:f4:
c1:a7:cb:b6:eb:2e:b2:56:7b:aa:3f:82:47:1b:09:b5:32:48:
91:15:e2:6c:07:df:60:61:b4:a1:a5:0e:29:48:36:c5:f6:1f:
b9:7f:9c:1f:10:24:71:4c:bd:1c:cf:6b:53:2f:d7:93:de:45:
fa:79:6f:8c:19:24:ec:54:e6:06:a2:4b:f0:58:af:bb:26:2b:
e4:cf:39:1d:0b:5d:fc:f5:05:9c:71:3e:ed:69:93:34:1b:a8:
51:f9:92:f7:bb:5b:00:03:c7:41:26:e2:32:c5:d1:d9:a2:d5:
c3:44:94:63:ed:0d:4f:57:ad:2c:f3:bc:c8:9d:30:97:5f:2b:
57:da:fb:b0:c4:6f:fb:a1:9a:f7:b2:a6:26:e6:a0:8e:3a:fe:
d4:37:fd:e6:d1:6a:ac:95:7e:08:ac:94:3f:19:16:1f:21:b5:
8a:df:c0:fa:3a:96:a7:a5:46:60:e1:ef:6d:41:b9:d8:a9:ab:
81:f1:13:7e:44:ee:28:4e:24:15:bd:13:85:ff:22:62:01:f8:
cb:fe:4b:29:c4:1f:6f:95:ff:c0:ff:41:bf:39:02:33:4a:71:
4b:5d:ee:76:61:17:ef:d4:d8:a0:ba:c4:89:ea:97:ea:3f:a1:
80:fa:9b:4a:38:92:0e:81:6a:bd:3e:54:47:33:b1:9d:c8:d2:
db:17:c6:93:5a:15:4c:f3
-----BEGIN CERTIFICATE-----
MIIE3TCCAsWgAwIBAgIBBDANBgkqhkiG9w0BAQUFADB7MRIwEAYKCZImiZPyLGQB
GRYCaW8xFTATBgoJkiaJk/IsZAEZFgVyZWFsbTEOMAwGA1UECgwFUmVhbG0xHjAc
BgNVBAsMFVJlYWxtIFRlc3QgU2lnbmluZyBDQTEeMBwGA1UEAwwVUmVhbG0gVGVz
dCBTaWduaW5nIENBMB4XDTE2MDkwNzEzNDI0NloXDTE4MDkwNzEzNDI0NlowUzEZ
MBcGCgmSJomT8ixkARkWCWxvY2FsaG9zdDEQMA4GA1UECgwHY29tcGFueTEQMA4G
A1UECwwHc2VjdGlvbjESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0B
AQEFA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9xNYWqk1Iw7KnCSYTg7hdsOE5KxK0Qf9uwXofnwQjM7
CI15FRtdd4yL8GW2+IhGrczHG09DcuhPDwDP300KqPQe0o58vb7BIT3R85GeJYCT
kzygAZ7O5waudnY+JRqmMnRnVwKBgQDB2bfDQURmB0wO0JCXHkwYwb9AuGzaAIgH
YAkf2xxFU/Zy10dX/ELA0WDrKPF5VfbPC0AiaDFbEkhLrsJe88uEn+suyJshnYa9
hRNVMsuVq4AzUdQNBlHxzcfquHSYanJE5ghr3jhKCp11MK+5u4YMx+c++p/o1592
M+XRhcp51QKBgDzF6BscJTxIrm8J7C5ysAsDMr/jq0xOGVqOZliRFgcr8IVE7Guj
moYELaTT02+Nny1Vf7buAjVpzqpDowLxlH95ko5nsmVZWtadQ0F5KyDYxy1dFLC8
2lsCKu2mrZzOuv6ZyjjzycNg6s18Xte1ChD3on6w67kwHCWcKljMfn4tAoGABPIR
BiI8JH47KoWXqsNTHa6Tuor5+/XXgpioou9sITirKPLlFxGQgmrVFirNPlM7IL0g
vb/6wmANCCFFRDbkElYiIedsTcc/EMa8X4gUOZVOiACmcE6g+JJPb2WVU+4jTC6y
OE5LEViD++FqGkr2eI0BEVJDkiUuJE3epyHKsKECgYEAhy7dNEHOw1Djn99AgQC8
MD9iBppZNNC+yz6lwU2/m5cSxK3V575TX281iwMw4+b9v+AT/U+P52qB8lKC0Ayo
gFEmAqvhwdzQ7c8Q8hkm2LauZcyDW2fgbmEuAvM22ssZYLBL/XgmHI5xrpwvoCij
wBDm53ML3/q4fkC+Zczw3GA=
-----END PRIVATE KEY-----

75
morten.js Normal file
View File

@ -0,0 +1,75 @@
"use strict";
const Realm = require('realm');
const CarSchema = {
name: 'Car',
properties: {
make: 'string',
model: 'string',
miles: {type: 'int', default: 0},
}
};
const schema = [CarSchema];
console.log(schema);
Realm.Sync.setLogLevel('trace');
function uuid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
var realm;
const server = 'http://127.0.0.1:9080';
const username = "Morten_" + uuid();
const password = "morten-password";
function error_handler(sender, error) {
console.log(error);
}
// SSLVerifyCallback = bool(const std::string& server_address, port_type server_port, const char* pem_data, size_t pem_size, int preverify_ok, int depth);
function ssl_verify_callback(server_address, server_port, pem_data, pem_size, preverify_ok, depth) {
console.log(server_address);
console.log(server_port);
console.log(pem_data);
console.log(pem_size);
console.log(preverify_ok);
console.log(depth);
}
Realm.Sync.User.register(server, username, password, (error, user) => {
if (error) {
console.log("Erro:", error);
} else {
const config = {
schema: schema,
sync: {
user,
url: 'realms://localhost:9443/~/myrealm',
error: error_handler,
validate_ssl: true,
ssl_verify_callback: ssl_verify_callback
}
};
realm = new Realm(config);
const session = realm.syncSession;
setInterval(() => {
console.log('NOW');
realm.write(() => {
realm.create('Car', { make: 'Honda', model: uuid(), miles: 123});
});
}, 1000);
};
})