Skip to content

Commit

Permalink
DID.parse() regex tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
kremalicious committed Sep 22, 2020
1 parent ebfe0c4 commit 1f9cdfb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ocean/DID.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default class DID {
didString = didString.getDid()
}
let did: DID
const didMatch = didString.match(/^did:op:([a-f0-9]{42})$/i)
const didMatch = didString.match(/^did:op:0x([a-f0-9]{40})$/i)

if (didMatch) {
did = new DID(didMatch[1])
Expand Down
2 changes: 1 addition & 1 deletion test/unit/ocean/DID.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('DID', () => {
const did: DID = DID.generate(dataTokenMock)

assert(did)
assert(did.getDid().startsWith('did:op:'))
assert(did.getDid() === `did:op:${dataTokenMock}`)
})
})
})

0 comments on commit 1f9cdfb

Please sign in to comment.