Comparing version 1.3.0 to 1.3.1
18
index.js
@@ -22,6 +22,3 @@ 'use strict' | ||
// Decode a base58-check encoded string to a buffer, no result if checksum is wrong | ||
function decodeUnsafe (string) { | ||
var buffer = new Buffer(base58.decode(string)) | ||
function decodeRaw (buffer) { | ||
var payload = buffer.slice(0, -4) | ||
@@ -39,4 +36,15 @@ var checksum = buffer.slice(-4) | ||
// Decode a base58-check encoded string to a buffer, no result if checksum is wrong | ||
function decodeUnsafe (string) { | ||
var array = base58.decodeUnsafe(string) | ||
if (!array) return | ||
var buffer = new Buffer(array) | ||
return decodeRaw(buffer) | ||
} | ||
function decode (string) { | ||
var payload = decodeUnsafe(string) | ||
var array = base58.decode(string) | ||
var buffer = new Buffer(array) | ||
var payload = decodeRaw(buffer) | ||
if (!payload) throw new Error('Invalid checksum') | ||
@@ -43,0 +51,0 @@ return payload |
{ | ||
"name": "bs58check", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "A straightforward implementation of base58-check encoding", | ||
@@ -41,3 +41,3 @@ "keywords": [ | ||
"dependencies": { | ||
"bs58": "^2.0.1", | ||
"bs58": "^3.1.0", | ||
"create-hash": "^1.1.0" | ||
@@ -44,0 +44,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4636
47
+ Addedbase-x@1.1.0(transitive)
+ Addedbs58@3.1.0(transitive)
- Removedbs58@2.0.1(transitive)
Updatedbs58@^3.1.0