How to use the protobufjs.loadProtoFile function in protobufjs

To help you get started, we’ve selected a few protobufjs 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 named-data / ndn-js / examples / node / test-list-channels.js View on Github external
function printChannelStatuses(encodedMessage)
{
  var builder = ProtoBuf.loadProtoFile("../browser/channel-status.proto");
  var descriptor = builder.lookup("ndn_message.ChannelStatusMessage");
  var ChannelStatusMessage = descriptor.build();

  var channelStatusMessage = new ChannelStatusMessage();
  ProtobufTlv.decode(channelStatusMessage, descriptor, encodedMessage);

  console.log("Channels:");
  for (var iEntry = 0; iEntry < channelStatusMessage.channel_status.length; ++iEntry) {
    var channelStatus = channelStatusMessage.channel_status[iEntry];

    // Format to look the same as "nfd-status -c".
    console.log("  " + channelStatus.local_uri);
  }
}
github chemdemo / wts-monit / test / client.js View on Github external
/*
* @Author: dm.yang
* @Date:   2015-04-05 15:55:27
* @Last Modified by:   chemdemo
* @Last Modified time: 2015-04-09 12:17:10
*/

'use strict';

var net = require('net');
var fs = require('fs');
var pty = require('pty.js');
var ProtoBuf = require('protobufjs');

var builder = ProtoBuf.loadProtoFile('../conf/socket.proto');
var Proto = builder.build('Socket');
var Input = Proto.Input;
var Output = Proto.Output;

var monitHost = '0.0.0.0';
var monitPort = 3977;

var client = new net.Socket();
var stream;
var terms = {};

connect();

function connect() {
    client.connect(monitPort, monitHost);
    // client.setEncoding('utf8');
github Multibit-Legacy / read-multibit-wallet-file / poc / hd.js View on Github external
var aesjs = require('aes-js');
var fs = require('fs');
var scrypt = require('scrypt-hash');
var Protobuf = require('protobufjs');
var pkcs7 = require('pkcs7');
var _ = require('lodash');



var builder = Protobuf.loadProtoFile("wallet.proto");
var BitcoinjWallet = builder.build('wallet');
var Wallet = BitcoinjWallet.Wallet;

const PASSWORD = "foo";
var bytes = [];

for (var i = 0; i < PASSWORD.length; ++i) {
  var charCode = PASSWORD.charCodeAt(i);
  bytes.push((charCode & 0xFF00) >> 8);
  bytes.push(charCode & 0xFF);
}
const PASSWORD_UINT16 = new Buffer(Uint16Array.from(bytes));

// Is this a magic number?
const SCRYPT_SALT = new Buffer([
  0x35, 0x51, 0x03, 0x80, 0x75, 0xa3, 0xb0, 0xc5
github joshuaferrara / node-csgo / helpers / protos.js View on Github external
var Protobuf = require('protobufjs');

Protobuf.convertFieldsToCamelCase = false;

var builder = Protobuf.newBuilder();

Protobuf.loadProtoFile(__dirname + "/../protos/base_gcmessages.proto", builder);
Protobuf.loadProtoFile(__dirname + "/../protos/gcsdk_gcmessages.proto", builder);
Protobuf.loadProtoFile(__dirname + "/../protos/cstrike15_gcmessages.proto", builder);
Protobuf.loadProtoFile(__dirname + "/../protos/custom.proto", builder);
module.exports = builder.build();

var builder_steam = Protobuf.newBuilder();
Protobuf.loadProtoFile(__dirname + "/../protos/steammessages_clientserver.proto", builder_steam);
Protobuf.loadProtoFile(__dirname + "/../protos/steammessages_clientserver_2.proto", builder_steam);
module.exports.schema = builder_steam.build();
github getyoti / yoti-node-sdk / src / proto-root / init.js View on Github external
const encryptedData = serverConfig.CORE_ENCRYPTED_DATA_PROTO_BUFF_PATH;
  const signedTimeStampStructure = serverConfig.CORE_SIGNED_TIMESTAMP_PROTO__BUFF_PATH;

  const extraDataStructure = serverConfig.CORE_EXTRA_DATA_PROTO_BUFF_PATH;
  const dataEntryStructure = serverConfig.CORE_DATA_ENTRY_PROTO_BUFF_PATH;
  const issuingAttributesStructure = serverConfig.CORE_ISSUING_ATTRIBUTES_PROTO_BUFF_PATH;
  const thirdPartyAttributeStructure = serverConfig.CORE_THIRD_PARTY_ATTRIBUTE_PROTO_BUFF_PATH;

  ProtoBuf.loadProtoFile(attributeListPath, builder);
  ProtoBuf.loadProtoFile(encryptedData, builder);
  ProtoBuf.loadProtoFile(signedTimeStampStructure, builder);

  ProtoBuf.loadProtoFile(extraDataStructure, builder);
  ProtoBuf.loadProtoFile(dataEntryStructure, builder);
  ProtoBuf.loadProtoFile(thirdPartyAttributeStructure, builder);
  ProtoBuf.loadProtoFile(issuingAttributesStructure, builder);

  return {
    builder: builder.build(),
  };
}
github getyoti / yoti-node-sdk / src / proto-root / init.js View on Github external
function initProtoBufBuilder() {
  const builder = ProtoBuf.newBuilder({ convertFieldsToCamelCase: true });
  const attributeListPath = serverConfig.CORE_ATTRIBUTE_LIST_PROTO_BUFF_PATH;
  const encryptedData = serverConfig.CORE_ENCRYPTED_DATA_PROTO_BUFF_PATH;
  const signedTimeStampStructure = serverConfig.CORE_SIGNED_TIMESTAMP_PROTO__BUFF_PATH;

  const extraDataStructure = serverConfig.CORE_EXTRA_DATA_PROTO_BUFF_PATH;
  const dataEntryStructure = serverConfig.CORE_DATA_ENTRY_PROTO_BUFF_PATH;
  const issuingAttributesStructure = serverConfig.CORE_ISSUING_ATTRIBUTES_PROTO_BUFF_PATH;
  const thirdPartyAttributeStructure = serverConfig.CORE_THIRD_PARTY_ATTRIBUTE_PROTO_BUFF_PATH;

  ProtoBuf.loadProtoFile(attributeListPath, builder);
  ProtoBuf.loadProtoFile(encryptedData, builder);
  ProtoBuf.loadProtoFile(signedTimeStampStructure, builder);

  ProtoBuf.loadProtoFile(extraDataStructure, builder);
  ProtoBuf.loadProtoFile(dataEntryStructure, builder);
  ProtoBuf.loadProtoFile(thirdPartyAttributeStructure, builder);
  ProtoBuf.loadProtoFile(issuingAttributesStructure, builder);

  return {
    builder: builder.build(),
  };
}
github getyoti / yoti-node-sdk / src / proto-root / init.js View on Github external
const attributeListPath = serverConfig.CORE_ATTRIBUTE_LIST_PROTO_BUFF_PATH;
  const encryptedData = serverConfig.CORE_ENCRYPTED_DATA_PROTO_BUFF_PATH;
  const signedTimeStampStructure = serverConfig.CORE_SIGNED_TIMESTAMP_PROTO__BUFF_PATH;

  const extraDataStructure = serverConfig.CORE_EXTRA_DATA_PROTO_BUFF_PATH;
  const dataEntryStructure = serverConfig.CORE_DATA_ENTRY_PROTO_BUFF_PATH;
  const issuingAttributesStructure = serverConfig.CORE_ISSUING_ATTRIBUTES_PROTO_BUFF_PATH;
  const thirdPartyAttributeStructure = serverConfig.CORE_THIRD_PARTY_ATTRIBUTE_PROTO_BUFF_PATH;

  ProtoBuf.loadProtoFile(attributeListPath, builder);
  ProtoBuf.loadProtoFile(encryptedData, builder);
  ProtoBuf.loadProtoFile(signedTimeStampStructure, builder);

  ProtoBuf.loadProtoFile(extraDataStructure, builder);
  ProtoBuf.loadProtoFile(dataEntryStructure, builder);
  ProtoBuf.loadProtoFile(thirdPartyAttributeStructure, builder);
  ProtoBuf.loadProtoFile(issuingAttributesStructure, builder);

  return {
    builder: builder.build(),
  };
}