This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // to load private keys created with sdk v4, you can use the `KeyStorage` class from sdk v5 - https://github.com/VirgilSecurity/virgil-sdk-javascript/blob/master/src/Storage/KeyStorage.ts | |
| // (ignore the deprecation warning) | |
| // note, if you used the default key storage name with sdk v4 (i.e. didn't provide `keyStorageName` option to the `API` function), | |
| // then you will have to provide a `name` config parameter equal to "VirgilSecurityKeys" into the `KeyStorage` constructor - `new KeyStorage({ name: "VirgilSecurityKeys" })` | |
| // otherwise, provide the same value as you did for the `keyStorageName` option | |
| // One caveat is that the `KeyStorage` from v5 sdk only uses IndexedDB as a storage backend, whereas in v4 we used the localforage (https://github.com/localForage/localForage) | |
| // library, which aslo uses IndexedDB, but falls back to using WebSQL or localStorage if IndexedDB is not available. | |
| // So if you can verify that all of your users have devices that support IndexedDB (https://caniuse.com/#search=Indexe |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const axios = require("axios"); | |
| const { JwtGenerator } = require("virgil-sdk"); | |
| const { VirgilCrypto, VirgilAccessTokenSigner } = require("virgil-crypto"); | |
| const crypto = new VirgilCrypto(); | |
| const APP_ID = "YOUR_VIRGIL_APP_ID"; | |
| const API_KEY = "YOUR_VIRGIL_API_KEY"; | |
| const API_KEY_ID = "YOUR_VIRGIL_APP_ID"; | |
| const PARSE_APP_ID = "YOUR_PARSE_APP_ID"; | |
| const PARSE_REST_API_KEY = "YOUR_PARSE_REST_API_KEY"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function createChannel(twilioChat, uniqueName, friendlyName) { | |
| return await twilioChat.createChannel({ | |
| uniqueName, | |
| friendlyName | |
| }); | |
| } | |
| async function joinChannel(twilioChat, name) { | |
| const paginator = await twilioChat.getPublicChannelDescriptors(); | |
| for (i = 0; i < paginator.items.length; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Single Device | |
| // User sign up | |
| async function onUserSignUp(user) { | |
| const getToken = () => fetchToken(user.token); | |
| // Initialize e3kit - see full sample in EThree.initialize page | |
| const eThree = await EThree.initialize(getToken); | |
| // Bootstrap user (i.e.create private key if user with this identity doesn't exists yet) | |
| eThree.bootstrap(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| console.log(new String('hello world').toString()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var fs = require('fs'); | |
| var watch = fs.watch('./', (event, filename) => { | |
| console.log(`event is: ${event}`); | |
| if (filename) { | |
| console.log(`filename provided: ${filename}`); | |
| } else { | |
| console.log('filename not provided'); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| hello |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var props = Ti.App.Properties.listProperties(); | |
| for (var i=0, ilen=props.length; i<ilen; i++){ | |
| var value = Ti.App.Properties.removeProperty(props[i]); | |
| Ti.API.info(props[i] + 'cleared'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function imageOnLoad($q) { | |
| return { | |
| restrict: 'A', | |
| link: function(scope, element, attrs) { | |
| var dfd = $q.defered(); | |
| element.bind('load', function(e) { | |
| dfd.resolve(); | |
| }); | |
| return dfd; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var $posterService = require('../../service/posters'); | |
| router.get('/posters/:id', function(req, res, next) { | |
| var id = new Number(req.params.id).toString(); | |
| if (id != "NaN") | |
| res.render('sliders',{ | |
| posters: $posterService.pull(id) | |
| }); | |
NewerOlder