Fork of github.com/did-method-plc/did-method-plc
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add max op size (#14)

authored by

Daniel Holmgren and committed by
GitHub
c699ef5c 1abf995a

+5 -1
+5 -1
packages/server/src/routes.ts
··· 1 1 import express from 'express' 2 - import { check } from '@atproto/common' 2 + import { cborEncode, check } from '@atproto/common' 3 3 import * as plc from '@did-plc/lib' 4 4 import { ServerError } from './error' 5 5 import { AppContext } from './context' ··· 109 109 router.post('/:did', async function (req, res) { 110 110 const { did } = req.params 111 111 const op = req.body 112 + const byteLength = cborEncode(op).byteLength 113 + if (byteLength > 7500) { 114 + throw new ServerError(400, 'Operation too large') 115 + } 112 116 if (!check.is(op, plc.def.compatibleOpOrTombstone)) { 113 117 throw new ServerError(400, `Not a valid operation: ${JSON.stringify(op)}`) 114 118 }