dev vouch dev on at. thats about it atvouch.dev

use did as rkey

+3 -27
+2 -26
frontend/src/api.ts
··· 58 58 }); 59 59 const subjectDid = (resolveResp.data as unknown as { did: string }).did; 60 60 61 - // Check if already vouched 62 - const existing = await listMyVouches(agent); 63 - if (existing.includes(subjectDid)) { 64 - throw new Error(`You have already vouched for ${handle}`); 65 - } 66 - 67 - // Generate TID (timestamp-based ID) 68 - const tid = generateTID(); 69 - 70 - // Create vouch record 61 + // Create vouch record (rkey is the subject DID, so duplicates are impossible) 71 62 const createResp = await rpc.call("com.atproto.repo.createRecord", { 72 63 data: { 73 64 repo: agent.sub, 74 65 collection: "dev.atvouch.graph.vouch", 75 - rkey: tid, 66 + rkey: subjectDid, 76 67 record: { 77 68 $type: "dev.atvouch.graph.vouch", 78 69 subject: subjectDid, ··· 265 256 return { targetDID, directVouch: false, paths, handleMap }; 266 257 } 267 258 268 - // Generate a TID (Timestamp ID) matching AT Protocol spec 269 - function generateTID(): string { 270 - const now = BigInt(Date.now()) * 1000n; 271 - const clockId = BigInt(Math.floor(Math.random() * 1024)); 272 - const tid = (now << 10n) | clockId; 273 - 274 - const chars = "234567abcdefghijklmnopqrstuvwxyz"; 275 - let result = ""; 276 - let val = tid; 277 - for (let i = 0; i < 13; i++) { 278 - result = chars[Number(val & 31n)] + result; 279 - val >>= 5n; 280 - } 281 - return result; 282 - }
+1 -1
lexicons/dev/atvouch/graph/vouch.json
··· 5 5 "main": { 6 6 "type": "record", 7 7 "description": "a vouch", 8 - "key": "tid", 8 + "key": "any", 9 9 "record": { 10 10 "type": "object", 11 11 "required": ["subject", "createdAt"],