Skip to content

Commit 1c1b2eb

Browse files
Add signature to orbit address
1 parent 9b070fb commit 1c1b2eb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/orbit-db-address.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ const path = require('path')
44
const multihash = require('multihashes')
55

66
class OrbitDBAddress {
7-
constructor (root, path) {
7+
constructor (root, path, signature) {
88
this.root = root
99
this.path = path
10+
this.signature = signature
1011
}
1112

1213
toString () {
13-
return path.join('/orbitdb', this.root, this.path)
14+
return path.join('/orbitdb', this.root, this.path, this.signature)
1415
}
1516

1617
static isValid (address) {
@@ -30,7 +31,7 @@ class OrbitDBAddress {
3031
}
3132

3233
static parse (address) {
33-
if (!address)
34+
if (!address)
3435
throw new Error(`Not a valid OrbitDB address: ${address}`)
3536

3637
if (!OrbitDBAddress.isValid(address))
@@ -41,7 +42,7 @@ class OrbitDBAddress {
4142
.filter((e, i) => !((i === 0 || i === 1) && address.toString().indexOf('/orbit') === 0 && e === 'orbitdb'))
4243
.filter(e => e !== '' && e !== ' ')
4344

44-
return new OrbitDBAddress(parts[0], parts.slice(1, parts.length).join('/'))
45+
return new OrbitDBAddress(parts[0], parts.slice(1, parts.length - 1).join('/'), parts.slice(2, parts.length).join())
4546
}
4647
}
4748

0 commit comments

Comments
 (0)