
Security News
The Next Open Source Security Race: Triage at Machine Speed
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.
@loro-dev/peer-lease
Advanced tools
TypeScript library for safely reusing CRDT peer IDs without collisions.
@loro-dev/peer-lease is a TypeScript library for safely reusing CRDT peer IDs without collisions.
pnpm add @loro-dev/peer-lease
# or
npm install @loro-dev/peer-lease
import { LoroDoc } from "loro-crdt";
import { acquirePeerId } from "@loro-dev/peer-lease";
const doc = new LoroDoc();
// ... Import local data into doc first
const lease = await acquirePeerId(
() => new LoroDoc().peerIdStr,
JSON.stringify(doc.frontiers()),
(a, b) => {
const fA = JSON.parse(a);
const fB = JSON.parse(b);
return doc.cmpFrontiers(fA, fB);
},
);
try {
console.log("Using peer", lease.value);
doc.setPeerId(lease.value);
// use doc here...
} finally {
await lease.release(JSON.stringify(doc.frontiers()));
// Or use FinalizeRegistry to release the lease
// Note: release can be invoked exactly once; a second call throws.
}
acquirePeerId first tries to coordinate through the Web Locks API. When that API is unavailable it falls back to a localStorage-backed mutex with a TTL, heartbeat refresh, and release notifications. A released ID is cached together with the document version that produced it and is only handed out when the caller proves their version has advanced, preventing stale edits from reusing a peer ID.
navigator.locks.request in supporting browsers so the lease state is mutated under an exclusive Web Lock. Fallback tabs use a fencing localStorage record with TTL heartbeats, and wake waiters via storage events plus a BroadcastChannel.pnpm install – install dependenciespnpm build – produce ESM/CJS/d.ts bundles via tsdownpnpm dev – run tsdown in watch modepnpm test – run Vitestpnpm lint – run oxlintpnpm typecheck – run the TypeScript compiler without emitting filespnpm check – type check, lint, update snapshots, and testmain; Release Please opens or updates a release PR with the changelog and semver bump..github/workflows/publish-on-tag.yml, which publishes to npm using NODE_AUTH_TOKEN derived from the NPM_TOKEN secret..npmrc and publishConfig.provenance.The CI workflow installs dependencies, lints, type-checks, runs Vitest in run mode, and builds the library on pushes and pull requests.
FAQs
TypeScript library for safely reusing CRDT peer IDs without collisions.
The npm package @loro-dev/peer-lease receives a total of 78 weekly downloads. As such, @loro-dev/peer-lease popularity was classified as not popular.
We found that @loro-dev/peer-lease demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.

Research
/Security News
Malicious dYdX client packages were published to npm and PyPI after a maintainer compromise, enabling wallet credential theft and remote code execution.

Security News
gem.coop is testing registry-level dependency cooldowns to limit exposure during the brief window when malicious gems are most likely to spread.