PrivacyBackendRegistry
SIP Protocol API Reference v0.7.4
SIP Protocol API Reference / PrivacyBackendRegistry
Class: PrivacyBackendRegistry
Section titled “Class: PrivacyBackendRegistry”Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20266
Registry for managing privacy backends
Provides a centralized way to register, discover, and manage different privacy backend implementations. Optionally integrates with BackendHealthTracker for circuit breaker support.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new PrivacyBackendRegistry(
config?):PrivacyBackendRegistry
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20275
Create a new registry
Parameters
Section titled “Parameters”config?
Section titled “config?”PrivacyBackendRegistryConfig
Registry configuration
Returns
Section titled “Returns”PrivacyBackendRegistry
Methods
Section titled “Methods”getHealthTracker()
Section titled “getHealthTracker()”getHealthTracker():
BackendHealthTracker|null
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20281
Get the health tracker instance
Returns
Section titled “Returns”BackendHealthTracker | null
Health tracker or null if not enabled
setHealthTracker()
Section titled “setHealthTracker()”setHealthTracker(
tracker):void
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20290
Attach an external health tracker
Useful for sharing a health tracker between multiple registries or for testing.
Parameters
Section titled “Parameters”tracker
Section titled “tracker”Health tracker to attach
BackendHealthTracker | null
Returns
Section titled “Returns”void
getRateLimiter()
Section titled “getRateLimiter()”getRateLimiter():
RateLimiter|null
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20296
Get the rate limiter instance
Returns
Section titled “Returns”RateLimiter | null
Rate limiter or null if not enabled
setRateLimiter()
Section titled “setRateLimiter()”setRateLimiter(
limiter):void
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20305
Attach an external rate limiter
Useful for sharing a rate limiter between multiple registries or for testing.
Parameters
Section titled “Parameters”limiter
Section titled “limiter”Rate limiter to attach
RateLimiter | null
Returns
Section titled “Returns”void
register()
Section titled “register()”register(
backend,options?):void
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20319
Register a privacy backend
Parameters
Section titled “Parameters”backend
Section titled “backend”Backend instance to register
options?
Section titled “options?”Registration options
Returns
Section titled “Returns”void
Throws
Section titled “Throws”Error if backend with same name exists and override is false
Example
Section titled “Example”registry.register(new SIPNativeBackend())registry.register(new PrivacyCashBackend(), { priority: 100 })unregister()
Section titled “unregister()”unregister(
name):boolean
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20326
Unregister a backend by name
Parameters
Section titled “Parameters”string
Backend name to unregister
Returns
Section titled “Returns”boolean
true if backend was removed, false if not found
get(
name):PrivacyBackend|undefined
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20333
Get a backend by name
Parameters
Section titled “Parameters”string
Backend name
Returns
Section titled “Returns”PrivacyBackend | undefined
Backend instance or undefined if not found
has(
name):boolean
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20340
Check if a backend is registered
Parameters
Section titled “Parameters”string
Backend name
Returns
Section titled “Returns”boolean
true if registered (regardless of enabled state)
getAll()
Section titled “getAll()”getAll():
PrivacyBackend[]
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20346
Get all enabled backends sorted by priority
Returns
Section titled “Returns”Array of backends (highest priority first)
getAllEntries()
Section titled “getAllEntries()”getAllEntries():
RegisteredBackend[]
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20352
Get all registered entries (including disabled)
Returns
Section titled “Returns”Array of registered backend entries
getByChain()
Section titled “getByChain()”getByChain(
chain):PrivacyBackend[]
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20359
Get backends supporting a specific chain
Parameters
Section titled “Parameters”string
Chain type to filter by
Returns
Section titled “Returns”Array of backends supporting the chain
getByType()
Section titled “getByType()”getByType(
type):PrivacyBackend[]
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20366
Get backends of a specific type
Parameters
Section titled “Parameters”Backend type to filter by
Returns
Section titled “Returns”Array of backends of the specified type
getCompliant()
Section titled “getCompliant()”getCompliant():
PrivacyBackend[]
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20372
Get backends that support compliance (viewing keys)
Returns
Section titled “Returns”Array of compliance-supporting backends
findAvailable()
Section titled “findAvailable()”findAvailable(
params):Promise<object[]>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20379
Find available backends for a transfer
Parameters
Section titled “Parameters”params
Section titled “params”Transfer parameters
Returns
Section titled “Returns”Promise<object[]>
Array of available backends with availability info
enable()
Section titled “enable()”enable(
name):boolean
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20389
Enable a backend
Parameters
Section titled “Parameters”string
Backend name
Returns
Section titled “Returns”boolean
true if backend was enabled, false if not found
disable()
Section titled “disable()”disable(
name):boolean
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20396
Disable a backend
Parameters
Section titled “Parameters”string
Backend name
Returns
Section titled “Returns”boolean
true if backend was disabled, false if not found
setPriority()
Section titled “setPriority()”setPriority(
name,priority):boolean
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20404
Set backend priority
Parameters
Section titled “Parameters”string
Backend name
priority
Section titled “priority”number
New priority value
Returns
Section titled “Returns”boolean
true if priority was set, false if not found
count()
Section titled “count()”count(
enabledOnly?):number
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20411
Get count of registered backends
Parameters
Section titled “Parameters”enabledOnly?
Section titled “enabledOnly?”boolean
If true, only count enabled backends
Returns
Section titled “Returns”number
Number of backends
clear()
Section titled “clear()”clear():
void
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20415
Clear all registered backends
Returns
Section titled “Returns”void
getNames()
Section titled “getNames()”getNames(
enabledOnly?):string[]
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20422
Get backend names
Parameters
Section titled “Parameters”enabledOnly?
Section titled “enabledOnly?”boolean
If true, only return enabled backend names
Returns
Section titled “Returns”string[]
Array of backend names
getHealthy()
Section titled “getHealthy()”getHealthy():
PrivacyBackend[]
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20431
Get all healthy backends (circuit not open)
Filters out backends where the circuit breaker is open. Falls back to getAll() if health tracking is disabled.
Returns
Section titled “Returns”Array of healthy backends
getHealthyByChain()
Section titled “getHealthyByChain()”getHealthyByChain(
chain):PrivacyBackend[]
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20438
Get healthy backends supporting a specific chain
Parameters
Section titled “Parameters”string
Chain type to filter by
Returns
Section titled “Returns”Array of healthy backends supporting the chain
getHealthState()
Section titled “getHealthState()”getHealthState(
name):BackendHealthState|undefined
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20445
Get health state for a backend
Parameters
Section titled “Parameters”string
Backend name
Returns
Section titled “Returns”BackendHealthState | undefined
Health state or undefined if not tracked
getMetrics()
Section titled “getMetrics()”getMetrics(
name):BackendMetrics|undefined
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20452
Get metrics for a backend
Parameters
Section titled “Parameters”string
Backend name
Returns
Section titled “Returns”BackendMetrics | undefined
Metrics or undefined if not tracked
getHealthSummary()
Section titled “getHealthSummary()”getHealthSummary():
Record<string, {healthy:boolean;state:string;failures:number;lastError?:string; }>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20458
Get summary of all backend health
Returns
Section titled “Returns”Record<string, { healthy: boolean; state: string; failures: number; lastError?: string; }>
Object with backend names as keys and health info as values
isHealthy()
Section titled “isHealthy()”isHealthy(
name):boolean
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20470
Check if a backend is healthy
Parameters
Section titled “Parameters”string
Backend name
Returns
Section titled “Returns”boolean
true if healthy or health tracking is disabled
openCircuit()
Section titled “openCircuit()”openCircuit(
name):boolean
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20479
Manually open circuit for a backend
Useful for maintenance or known issues.
Parameters
Section titled “Parameters”string
Backend name
Returns
Section titled “Returns”boolean
true if circuit was opened, false if not found or tracking disabled
closeCircuit()
Section titled “closeCircuit()”closeCircuit(
name):boolean
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20488
Manually close circuit for a backend
Use with caution - may route requests to failing backend.
Parameters
Section titled “Parameters”string
Backend name
Returns
Section titled “Returns”boolean
true if circuit was closed, false if not found or tracking disabled
resetHealth()
Section titled “resetHealth()”resetHealth(
name):boolean
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20497
Reset health state for a backend
Clears failure count and closes circuit.
Parameters
Section titled “Parameters”string
Backend name
Returns
Section titled “Returns”boolean
true if reset, false if not found or tracking disabled
recordSuccess()
Section titled “recordSuccess()”recordSuccess(
name,latencyMs):void
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20504
Record a successful execution for a backend
Parameters
Section titled “Parameters”string
Backend name
latencyMs
Section titled “latencyMs”number
Request latency in milliseconds
Returns
Section titled “Returns”void
recordFailure()
Section titled “recordFailure()”recordFailure(
name,reason):void
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20511
Record a failed execution for a backend
Parameters
Section titled “Parameters”string
Backend name
reason
Section titled “reason”string
Failure reason
Returns
Section titled “Returns”void
tryAcquire()
Section titled “tryAcquire()”tryAcquire(
name,tokens?):boolean
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20519
Try to acquire rate limit tokens for a backend (non-blocking)
Parameters
Section titled “Parameters”string
Backend name
tokens?
Section titled “tokens?”number
Number of tokens to acquire (default: 1)
Returns
Section titled “Returns”boolean
true if tokens were acquired, false if rate limited or limiter disabled
acquire()
Section titled “acquire()”acquire(
name,options?):Promise<void>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20528
Acquire rate limit tokens for a backend (async with queueing)
Parameters
Section titled “Parameters”string
Backend name
options?
Section titled “options?”AcquireOptions
Acquire options (tokens, timeout)
Returns
Section titled “Returns”Promise<void>
Promise resolving when tokens are acquired
Throws
Section titled “Throws”RateLimitExceededError, QueueFullError, or AcquireTimeoutError
canAcquire()
Section titled “canAcquire()”canAcquire(
name,tokens?):boolean
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20536
Check if tokens can be acquired without consuming them
Parameters
Section titled “Parameters”string
Backend name
tokens?
Section titled “tokens?”number
Number of tokens to check (default: 1)
Returns
Section titled “Returns”boolean
true if tokens are available
getRateLimitStats()
Section titled “getRateLimitStats()”getRateLimitStats(
name):RateLimitStats|undefined
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20543
Get rate limit statistics for a backend
Parameters
Section titled “Parameters”string
Backend name
Returns
Section titled “Returns”RateLimitStats | undefined
Rate limit stats or undefined if limiter disabled
isRateLimited()
Section titled “isRateLimited()”isRateLimited(
name):boolean
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20550
Check if a backend is rate limited (no tokens available)
Parameters
Section titled “Parameters”string
Backend name
Returns
Section titled “Returns”boolean
true if rate limited, false if available or limiter disabled
getAvailable()
Section titled “getAvailable()”getAvailable():
PrivacyBackend[]
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20556
Get all backends that are NOT rate limited
Returns
Section titled “Returns”Array of backends with available rate limit tokens
getAvailableByChain()
Section titled “getAvailableByChain()”getAvailableByChain(
chain):PrivacyBackend[]
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20565
Get available backends for a specific chain
Filters by both chain support and rate limit availability.
Parameters
Section titled “Parameters”string
Chain type to filter by
Returns
Section titled “Returns”Array of available backends supporting the chain
getReady()
Section titled “getReady()”getReady():
PrivacyBackend[]
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20571
Get backends that are both healthy AND not rate limited
Returns
Section titled “Returns”Array of backends ready for use
getReadyByChain()
Section titled “getReadyByChain()”getReadyByChain(
chain):PrivacyBackend[]
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20578
Get ready backends for a specific chain
Parameters
Section titled “Parameters”string
Chain type to filter by
Returns
Section titled “Returns”Array of ready backends supporting the chain
resetRateLimit()
Section titled “resetRateLimit()”resetRateLimit(
name):void
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20586
Reset rate limit state for a backend
Refills bucket to max tokens and clears stats.
Parameters
Section titled “Parameters”string
Backend name
Returns
Section titled “Returns”void
disposeRateLimiter()
Section titled “disposeRateLimiter()”disposeRateLimiter():
void
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:20592
Dispose rate limiter resources
Call when shutting down to clean up queue processing intervals.
Returns
Section titled “Returns”void