dat-encoding
Advanced tools
Comparing version 4.0.2 to 5.0.0
@@ -15,4 +15,4 @@ 'use strict' | ||
if (typeof str !== 'string') throw new Error('Not a string') | ||
var match = /\/?([^/]{64})/.exec(str) | ||
if (!match) throw new Error('Invalid key') | ||
var match = /\/?([^/]{64,65})/.exec(str) | ||
if (!match || match[1].length !== 64) throw new Error('Invalid key') | ||
return Buffer.from(match[1], 'hex') | ||
@@ -19,0 +19,0 @@ } |
{ | ||
"name": "dat-encoding", | ||
"version": "4.0.2", | ||
"version": "5.0.0", | ||
"license": "MIT", | ||
@@ -11,3 +11,3 @@ "repository": "juliangruber/dat-encoding", | ||
"devDependencies": { | ||
"standard": "^8.2.0", | ||
"standard": "^9.0.0", | ||
"tape": "^4.5.1" | ||
@@ -14,0 +14,0 @@ }, |
@@ -12,2 +12,10 @@ var test = require('tape') | ||
{type: 'valid', key: 'host.com/whatever/6161616161616161616161616161616161616161616161616161616161616161'}, | ||
{type: 'invalid', key: 'z6161616161616161616161616161616161616161616161616161616161616161'}, | ||
{type: 'invalid', key: '6161616161616161616161616161z616161616161616161616161616161616161'}, | ||
{type: 'invalid', key: '6161616161616161616161616161616161616161616161616161616161616161z'}, | ||
{type: 'invalid', key: '616161616161616161616161616161616161616161616161616161616161616'}, | ||
{type: 'invalid', key: '61616161616161616161616161616161616161616161616161616161616161601'}, | ||
{type: 'invalid', key: '616161616161616161616161616161616161616161616161616161616161616012'}, | ||
{type: 'invalid', key: '6161616161616161616161616161616161616161616161616161616161616160123'}, | ||
{type: 'invalid', key: '61616161616161616161616161616161616161616161616161616161616161601234'}, | ||
{type: 'invalid', key: new Buffer('key-me-maybe', 'hex')}, | ||
@@ -14,0 +22,0 @@ {type: 'invalid', key: 'key-me-maybe'}, |
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
6149
113
6