cabal-core
Advanced tools
Comparing version 11.1.0 to 11.1.1
17
index.js
@@ -62,3 +62,3 @@ var kappa = require('kappa-core') | ||
const uri = new URL(key) | ||
this.key = sanitizeKey(uri.host) | ||
this.key = sanitizeKey(key) | ||
this.modKeys = uri.searchParams.getAll('mod') | ||
@@ -259,3 +259,3 @@ this.adminKeys = uri.searchParams.getAll('admin') | ||
function isHypercoreKey (key) { | ||
if (typeof key === 'string') return /^[0-9a-f]{64}$/.test(key) | ||
if (typeof key === 'string') return /^[0-9A-Fa-f]{64}$/.test(key) | ||
else if (Buffer.isBuffer(key)) return key.length === 32 | ||
@@ -266,14 +266,7 @@ } | ||
function sanitizeKey (key) { | ||
// force to hex string | ||
if (Buffer.isBuffer(key)) { | ||
key = key.toString('hex') | ||
} | ||
// remove any protocol uri prefix | ||
if (typeof key === 'string') key = key.replace(/^.*:\/\//, '') | ||
else key = undefined | ||
return key | ||
const match = key.match(/^cabal:\/\/([0-9A-Fa-f]{64})/) | ||
if (match === null) return undefined | ||
return match[1] | ||
} | ||
function noop () {} |
{ | ||
"name": "cabal-core", | ||
"version": "11.1.0", | ||
"version": "11.1.1", | ||
"description": " p2p db functions for chat ", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
76067
1026