
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Semafy provides synchronization and concurrency management across execution agents (main thread, web workers). It contains a robust set of tools modeled after C++ synchronization primitives, offering control and flexibility for managing shared resources and states.
lock
, tryLock
, lockGuard
, and callOnce
.SharedArrayBuffer
.NPM:
npm install semafy
Yarn:
yarn add semafy
JSR:
jsr add @rojas/semafy
[Sync]BasicLockable: A base interface that provides exclusive blocking for agents.
[Sync]Lockable: Extends BasicLockable
to include attempted locking.
SharedLockable: Provides shared blocking semantics for agents.
SharedResource: Represents a shared resource that is backed by a SharedArrayBuffer
.
SharedTimedLockable: Extends SharedLockable
to include timed blocking.
[Sync]TimedLockable: Extends Lockable
to include timed blocking.
Mutex: Provides essential mutex operations including lock
, unlock
, and tryLock
.
TimedMutex: A timed variant that supports timed operations including tryLockFor
and tryLockUntil
.
RecursiveMutex: Allows multiple locks from the same agent.
RecursiveTimedMutex: A timed variant that supports timed operations.
SharedMutex: Allows multiple readers or exclusive writer access, facilitating reader-writer scenarios.
SharedTimedMutex: A timed variant that supports timed operations.
lock(): Sequentially acquires the given locks. If any lock fails, the process is stopped, and any acquired locks are released in reverse order.
lockGuard[Sync](): Locks a mutex before calling a callback function, ensuring the mutex is unlocked afterwards.
MultiLock: Wraps multiple BasicLockable
objects to create a multi-lock. Calls to lock
, unlock
, etc will acquire / release locks on all of the wrapped objects.
SharedLock: Wraps a SharedLockable
object (e.g. SharedMutex
) to create a shared lock. Calls to lock
, unlock
, etc will acquire / release a shared lock instead of an exclusive lock.
tryLock(): Tries to sequentially acquire the given locks. If any lock fails, the process is stopped, and any acquired locks are released in reverse order.
UniqueLock: Wraps a BasicLockable
object to create a unique lock. Calls to lock
, unlock
, etc will acquire / release a lock on the wrapped object.
callOnce(): Executes a callback function at most once, based on the state of a provided OnceFlag
.
OnceFlag: Represents a flag that can be set exactly once, shared across different execution agents.
LockError: A generic error related to errors in lock acquisition, release and management.
MultiLockError: Occurs when attempting to acquire multiple locks simultaneously.
MultiUnlockError: Occurs when attempting multiple unlocks simultaneously.
OwnershipError: Occurs when attempting to unlock an unacquired mutex.
RelockError: Occurs when attempting to lock an already acquired mutex. Prevents deadlocks from occurring.
TimeoutError: Occurs when an operation exceeds a set time, such as when using tryLockFor
or tryLockUntil
.
Browser security requirements for using shared memory must be met. Please see SharedArrayBuffer > Security Requirements for details.
The use of synchronous methods (e.g. lockSync
) may not be allowed on the main thread. If not, their async versions (e.g. lock
) are available.
Contributions are welcome!
Bug Reports: Please use the GitHub issue tracker to report any bugs. Include a detailed description and any relevant code snippets or logs.
Feature Requests: Please submit feature requests as issues, clearly describing the feature and its potential benefits.
Pull Requests: Please ensure your code adheres to the existing style of the project and include any necessary tests and documentation.
For more information, check out the contributor's guide.
FAQs
A robust cross-agent synchronization library.
The npm package semafy receives a total of 11 weekly downloads. As such, semafy popularity was classified as not popular.
We found that semafy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.