···4242 // Get data for a DID document
4343 router.get('/:did', async function (req, res) {
4444 const { did } = req.params
4545- const log = await ctx.db.opsForDid(did)
4646- if (log.length === 0) {
4545+ const last = await ctx.db.lastOpForDid(did)
4646+ if (!last) {
4747 throw new ServerError(404, `DID not registered: ${did}`)
4848 }
4949- const data = await plc.validateOperationLog(did, log)
4949+ const data = plc.opToData(did, last)
5050 if (data === null) {
5151 throw new ServerError(404, `DID not available: ${did}`)
5252 }
···5858 // Get data for a DID document
5959 router.get('/:did/data', async function (req, res) {
6060 const { did } = req.params
6161- const log = await ctx.db.opsForDid(did)
6262- if (log.length === 0) {
6161+ const last = await ctx.db.lastOpForDid(did)
6262+ if (!last) {
6363 throw new ServerError(404, `DID not registered: ${did}`)
6464 }
6565- const data = await plc.validateOperationLog(did, log)
6565+ const data = plc.opToData(did, last)
6666 if (data === null) {
6767 throw new ServerError(404, `DID not available: ${did}`)
6868 }