Skip to content

Instantly share code, notes, and snippets.

@dansitu
Forked from austintaylor/readme.md
Created August 23, 2012 18:46
Show Gist options
  • Select an option

  • Save dansitu/3440202 to your computer and use it in GitHub Desktop.

Select an option

Save dansitu/3440202 to your computer and use it in GitHub Desktop.

Revisions

  1. @austintaylor austintaylor revised this gist Jul 6, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    Cryptojs is hosted on [Google Code](http://code.google.com/p/crypto-js/). There is an [npm](http://search.npmjs.org/#/cryptojs) with source on [Github](https://github.com/gwjjeff/cryptojs/).
    Cryptojs is hosted on [Google Code](http://code.google.com/p/crypto-js/). There is an [npm module](http://search.npmjs.org/#/cryptojs) with source on [Github](https://github.com/gwjjeff/cryptojs/).
  2. @austintaylor austintaylor revised this gist Jul 6, 2012. 2 changed files with 1 addition and 1 deletion.
    1 change: 0 additions & 1 deletion _readme.md
    Original file line number Diff line number Diff line change
    @@ -1 +0,0 @@
    test
    1 change: 1 addition & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    Cryptojs is hosted on [Google Code](http://code.google.com/p/crypto-js/). There is an [npm](http://search.npmjs.org/#/cryptojs) with source on [Github](https://github.com/gwjjeff/cryptojs/).
  3. @austintaylor austintaylor revised this gist Jul 5, 2012. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions _readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    test
  4. @austintaylor austintaylor revised this gist Jul 5, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions uv_sso.js
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,9 @@
    var Crypto = require('cryptojs').Crypto,
    UserVoiceAccountKey = "YOUR_ACCOUNT_KEY",
    UserVocieAPIKey = "YOUR_API_KEY";
    UserVoiceAPIKey = "YOUR_API_KEY";

    function createUserVoiceSSOToken(data) {
    var key = Crypto.SHA1(UserVocieAPIKey+UserVoiceAccountKey, {asBytes: true}).slice(0, 16),
    var key = Crypto.SHA1(UserVoiceAPIKey+UserVoiceAccountKey, {asBytes: true}).slice(0, 16),
    json = JSON.stringify(data),
    encrypted = Crypto.AES.encrypt(json, key, {mode:new Crypto.mode.CBC(Crypto.pad.pkcs7), iv:'OpenSSL for Ruby', asBytes:true}),
    base64 = Crypto.util.bytesToBase64(encrypted),
  5. @austintaylor austintaylor created this gist Jul 5, 2012.
    12 changes: 12 additions & 0 deletions uv_sso.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    var Crypto = require('cryptojs').Crypto,
    UserVoiceAccountKey = "YOUR_ACCOUNT_KEY",
    UserVocieAPIKey = "YOUR_API_KEY";

    function createUserVoiceSSOToken(data) {
    var key = Crypto.SHA1(UserVocieAPIKey+UserVoiceAccountKey, {asBytes: true}).slice(0, 16),
    json = JSON.stringify(data),
    encrypted = Crypto.AES.encrypt(json, key, {mode:new Crypto.mode.CBC(Crypto.pad.pkcs7), iv:'OpenSSL for Ruby', asBytes:true}),
    base64 = Crypto.util.bytesToBase64(encrypted),
    uriEncoded = encodeURIComponent(base64);
    return uriEncoded;
    }