Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
gallery-2012.01.11-21-03 solmsted gallery-yql-crypto
  • Loading branch information
YUI Builder committed Jan 11, 2012
1 parent 3537068 commit 6b32856
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/gallery-yql-crypto/build.properties
Expand Up @@ -17,7 +17,7 @@ component=gallery-yql-crypto
component.jsfiles=yql-crypto.js

# The list of modules this component. requires. Used to set up the Y.add module call for YUI 3.
component.requires=gallery-base64, yql
component.requires=gallery-base64, gallery-yql-execute

# The list of modules this component. supersedes. Used to set up the Y.add module call for YUI 3.
component.supersedes=
Expand Down
14 changes: 2 additions & 12 deletions src/gallery-yql-crypto/js/yql-crypto.js
Expand Up @@ -7,23 +7,13 @@
'use strict';

var _base64Decode = Y.Base64.decode,
_execute,
_getResult,
_execute = Y.YQL.execute,
_getResult = _execute.getResult,
_hash,
_hmac,
_bind = Y.bind,
_toHex;

_execute = function (code, callbackFunction, params, opts) {
Y.YQL("SELECT * FROM execute WHERE code = '" + code.replace(/'/g, '\\\'') + "'", callbackFunction, params, opts);
};

_getResult = function (result) {
result = result && result.query;
result = result && result.results;
return result && result.result;
};

_hash = function (hash, string, callbackFunction, params, opts) {
_execute('response.object = y.crypto.encode' + hash + '("' + String(string || '').replace(/"/g, '\\"') + '");', function (result) {
callbackFunction(_toHex(_base64Decode(_getResult(result))));
Expand Down

0 comments on commit 6b32856

Please sign in to comment.