mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-03-30 15:08:28 +00:00
Merge pull request #804 from orbitdb/phillmac-patch-1
Suport new base36 format, Improve unwieldy logic
This commit is contained in:
commit
32cc9a9b00
@ -26,8 +26,18 @@ class OrbitDBAddress {
|
|||||||
|
|
||||||
let accessControllerHash
|
let accessControllerHash
|
||||||
|
|
||||||
|
const validateHash = (hash) => {
|
||||||
|
const prefixes = ['zd', 'Qm', 'ba', 'k5']
|
||||||
|
for (const p of prefixes) {
|
||||||
|
if (hash.indexOf(p) > -1) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
accessControllerHash = (parts[0].indexOf('zd') > -1 || parts[0].indexOf('Qm') > -1 || parts[0].indexOf('ba') > -1)
|
accessControllerHash = validateHash(parts[0])
|
||||||
? new CID(parts[0]).toBaseEncodedString()
|
? new CID(parts[0]).toBaseEncodedString()
|
||||||
: null
|
: null
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user