mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-10-07 22:57:07 +00:00
Merge branch 'master' into update-peer-exchanged
This commit is contained in:
@@ -82,7 +82,7 @@ class OrbitDB {
|
||||
options.offline = false
|
||||
}
|
||||
|
||||
if (options.offline && !options.id ) {
|
||||
if (options.offline && !options.id) {
|
||||
throw new Error('Offline mode requires passing an `id` in the options')
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,18 @@ class OrbitDBAddress {
|
||||
|
||||
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 {
|
||||
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()
|
||||
: null
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user