How to use the utility.base64encode function in utility

To help you get started, we’ve selected a few utility examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-modules / qn / lib / up.js View on Github external
exports.uploadToken = function uploadToken(options) {
  options = options || {};
  options.scope = options.scope || this.options.bucket;
  options.deadline = options.deadline || (utility.timestamp() + 3600);
  var flags = options;
  // 步骤2:将 Flags 进行安全编码
  var encodedFlags = utility.base64encode(JSON.stringify(flags), true);

  // 步骤3:将编码后的元数据混入私钥进行签名
  // 步骤4:将签名摘要值进行安全编码
  var encodedSign = this.signData(encodedFlags);

  // 步骤5:连接各字符串,生成上传授权凭证
  return this.options.accessKey + ':' + encodedSign + ':' + encodedFlags;
};
github node-modules / qn / lib / rs.js View on Github external
exports.fetch = function (url, key, callback) {
  var encodedURL = utility.base64encode(url);
  var pathname = '/fetch/' + encodedURL + '/to/' + this.encodeEntryURI(key);
  this._rsAction(pathname, callback, 'http://iovip.qbox.me');
};
github node-modules / qn / lib / rs.js View on Github external
exports.encodeEntryURI = function (key) {
  key = this.resourceKey(key);
  return utility.base64encode(this.options.bucket + ':' + key, true);
};
github cnpm / mirrors / lib / utils.js View on Github external
exports.getGithubBasicAuth = function (argument) {
  return config.githubToken
    ? 'Basic ' + utility.base64encode(util.format('%s:x-oauth-basic', config.githubToken))
    : '';
};
github linzhixian / quick-vue-admin / src / server / utils / Rc4Encrypt.js View on Github external
function rc4Encrypt(data) {
    return encodeHex(rc4(utility.base64encode(data), KEY));
}
github node-modules / urllib-sync / index.js View on Github external
exports.request = function request(url, args) {
  assert(url, 'url required');
  args = args || {};

  var input = utility.base64encode(JSON.stringify({
    url: url,
    args: args
  }));
  var requestPath = path.join(__dirname, './request.js');

  var cmd = process.execPath;
  var _args = [requestPath, input];
  var res = cp.spawnSync(cmd, _args, {
    timeout: (args.timeout || 3000) + 1000
  });

  if (res.error) {
    res.error.url = url;
    res.error.args = args;
    throw res.error;
  }