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.

tiny tweaks (#29)

* lib: trivial variable re-name to make assureValidSig clearer

* lib: add an eslint ignore for unused 'sig' var

authored by

bnewbold and committed by
GitHub
55187178 8c6a8f90

+5 -4
+5 -4
packages/lib/src/operations.ts
··· 77 77 ): Promise<t.Operation> => { 78 78 const prev = await cidForCbor(lastOp) 79 79 // omit sig so it doesn't accidentally make its way into the next operation 80 + // eslint-disable-next-line @typescript-eslint/no-unused-vars 80 81 const { sig, ...normalized } = normalizeOp(lastOp) 81 82 const unsigned = await fn(normalized) 82 83 return addSignature( ··· 289 290 } 290 291 291 292 export const assureValidSig = async ( 292 - allowedDids: string[], 293 + allowedDidKeys: string[], 293 294 op: t.CompatibleOpOrTombstone, 294 295 ): Promise<string> => { 295 296 const { sig, ...opData } = op 296 297 const sigBytes = uint8arrays.fromString(sig, 'base64url') 297 298 const dataBytes = new Uint8Array(cbor.encode(opData)) 298 - for (const did of allowedDids) { 299 - const isValid = await verifySignature(did, dataBytes, sigBytes) 299 + for (const didKey of allowedDidKeys) { 300 + const isValid = await verifySignature(didKey, dataBytes, sigBytes) 300 301 if (isValid) { 301 - return did 302 + return didKey 302 303 } 303 304 } 304 305 throw new InvalidSignatureError(op)