Skip to content

Instantly share code, notes, and snippets.

View lholmquist's full-sized avatar

Lucas Holmquist lholmquist

View GitHub Profile
test( "Encrypt/Decrypt raw bytes providing password", function() {
var agCrypto = AeroGear.Crypto(), //Need to create a "Crypto" object to re-use
rawPassword = agCrypto.deriveKey( PASSWORD ),
utf8String = sjcl.codec.utf8String,
hex = sjcl.codec.hex,
cipherText,
options = {
AAD: hex.toBits( BOB_AAD ),
key: rawPassword,
AeroGear.Crypto = function() {
...
// Local Variables
var privateKey, publicKey, IV;
...
// Method to provide symmetric encryption with GCM by default
/**
Encrypts in GCM mode
@status Experimental
// this
AeroGear.crypto.getRandomValue = function() {
var random = new Uint32Array( 1 );
crypto.getRandomValues( random );
return random[ 0 ];
};
// can now be
//this is using promises.
dm.stores.demo.open().then( function( value ) {
var data = [
{
"id": 1,
"name": "Lea",
"type": "Skywalker"
}
];
var pouchdb = require('pouchdb');
var db = PouchDB('coolcool');
PouchDB.destroy( 'coolcool', function( error, response ) {
console.log( "error", error );
console.log( "response", response );
});
var pipeline = AeroGear.Pipeline();
var pipey = pipeline.add( {
name: "pipey",
settings: {
baseURL: "your base URL",
endpoint: "/{pushAppid}/android/{variantId}/"
}
}).pipes.pipey;
send( params, function( err ) {
if( err ) {
throw something;
}
do other cool stuff
});
//No criteria, just a normal send( what use to be broadcast )
{
message: {
alert: "...",
sound: "...",
badge: "...",
"simple-push": "version=123"
}
}
@lholmquist
lholmquist / gist:6585576
Created September 16, 2013 19:44
holy verboseness
~/develop/projects/aerogear-simplepush-server(branch:master) » mvn -X clean install lholmquist@lincolnhawk
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 08:51:28-0500)
Maven home: /usr/share/maven
Java version: 1.6.0_51, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.8.4", arch: "x86_64", family: "mac"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /usr/share/maven/conf/settings.xml
[DEBUG] Reading user settings from /Users/lholmquist/.m2/settings.xml
running this:
~/develop/projects/aerogear-simplepush-server(branch:master) » mvn install -DskipTests=true
gives me this:
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 32 source files to /Users/lholmquist/develop/projects/aerogear-simplepush-server/netty-codec-sockjs/target/test-classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :