Support bitmessage: scheme in Address.decode
This commit is contained in:
parent
68e5bae278
commit
542d31d387
|
@ -91,6 +91,8 @@ Address.decode = function(str) {
|
||||||
str = str.trim();
|
str = str.trim();
|
||||||
if (str.slice(0, 3) === "BM-") {
|
if (str.slice(0, 3) === "BM-") {
|
||||||
str = str.slice(3);
|
str = str.slice(3);
|
||||||
|
} else if (str.slice(0, 11) === "bitmessage:") {
|
||||||
|
str = str.slice(11);
|
||||||
}
|
}
|
||||||
|
|
||||||
var bytes = bs58.decode(str);
|
var bytes = bs58.decode(str);
|
||||||
|
|
5
test.js
5
test.js
|
@ -1205,6 +1205,11 @@ describe("High-level classes", function() {
|
||||||
expect(addr.ripe.toString("hex")).to.equal("003ab6655de4bd8c603eba9b00dd5970725fdd56");
|
expect(addr.ripe.toString("hex")).to.equal("003ab6655de4bd8c603eba9b00dd5970725fdd56");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should decode address for bitmessage scheme", function() {
|
||||||
|
var addr = Address.decode("bitmessage:2cTux3PGRqHTEH6wyUP2sWeT4LrsGgy63z");
|
||||||
|
expect(addr.ripe.toString("hex")).to.equal("003ab6655de4bd8c603eba9b00dd5970725fdd56");
|
||||||
|
});
|
||||||
|
|
||||||
it("should allow to create random Bitmessage address", function() {
|
it("should allow to create random Bitmessage address", function() {
|
||||||
this.timeout(60000);
|
this.timeout(60000);
|
||||||
var addr = Address.fromRandom();
|
var addr = Address.fromRandom();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user