Remove useless messageEncodings struct
This commit is contained in:
parent
3e9f3a62a6
commit
9208e95e20
|
@ -34,7 +34,6 @@ API documentation is available [here](https://bitchan.github.io/bitmessage/docs/
|
||||||
- [x] net_addr
|
- [x] net_addr
|
||||||
- [x] inv_vect
|
- [x] inv_vect
|
||||||
- [x] encrypted
|
- [x] encrypted
|
||||||
- [x] message encodings
|
|
||||||
- [x] service features
|
- [x] service features
|
||||||
- [x] pubkey features
|
- [x] pubkey features
|
||||||
- [x] Message types
|
- [x] Message types
|
||||||
|
|
|
@ -496,29 +496,6 @@ exports.encrypted = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Message encodings. Extends {@link var_int} by adding known encoding type
|
|
||||||
* constants.
|
|
||||||
* @see {@link https://bitmessage.org/wiki/Protocol_specification#Message_Encodings}
|
|
||||||
* @namespace
|
|
||||||
*/
|
|
||||||
exports.messageEncodings = objectAssign(Object.create(var_int), {
|
|
||||||
/**
|
|
||||||
* Any data with this number may be ignored. The sending node might
|
|
||||||
* simply be sharing its public key with you.
|
|
||||||
*/
|
|
||||||
IGNORE: 0,
|
|
||||||
/**
|
|
||||||
* UTF-8. No 'Subject' or 'Body' sections. Useful for simple strings
|
|
||||||
* of data, like URIs or magnet links.
|
|
||||||
*/
|
|
||||||
TRIVIAL: 1,
|
|
||||||
/**
|
|
||||||
* UTF-8. Uses 'Subject' and 'Body' sections. No MIME is used.
|
|
||||||
*/
|
|
||||||
SIMPLE: 2,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Creates bitfield class of the specified size.
|
// Creates bitfield class of the specified size.
|
||||||
var bitfield = function(size) {
|
var bitfield = function(size) {
|
||||||
var bytesize = size / 8;
|
var bytesize = size / 8;
|
||||||
|
|
11
test.js
11
test.js
|
@ -14,7 +14,6 @@ var var_int_list = structs.var_int_list;
|
||||||
var net_addr = structs.net_addr;
|
var net_addr = structs.net_addr;
|
||||||
var inv_vect = structs.inv_vect;
|
var inv_vect = structs.inv_vect;
|
||||||
var encrypted = structs.encrypted;
|
var encrypted = structs.encrypted;
|
||||||
var messageEncodings = structs.messageEncodings;
|
|
||||||
var serviceFeatures = structs.serviceFeatures;
|
var serviceFeatures = structs.serviceFeatures;
|
||||||
var pubkeyFeatures = structs.pubkeyFeatures;
|
var pubkeyFeatures = structs.pubkeyFeatures;
|
||||||
var messages = bitmessage.messages;
|
var messages = bitmessage.messages;
|
||||||
|
@ -263,16 +262,6 @@ describe("Common structures", function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("message encodings", function() {
|
|
||||||
it("should decode", function() {
|
|
||||||
expect(messageEncodings.decode(Buffer([2])).value).to.equal(messageEncodings.SIMPLE);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should encode", function() {
|
|
||||||
expect(messageEncodings.encode(messageEncodings.SIMPLE).toString("hex")).to.equal("02");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("service features", function() {
|
describe("service features", function() {
|
||||||
it("should decode", function() {
|
it("should decode", function() {
|
||||||
expect(serviceFeatures.decode(Buffer("0000000000000001", "hex"))).to.have.members([serviceFeatures.NODE_NETWORK]);
|
expect(serviceFeatures.decode(Buffer("0000000000000001", "hex"))).to.have.members([serviceFeatures.NODE_NETWORK]);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user