Welshman Docs / @welshman/app / Wraps
Class: Wraps
Defined in: plugins/wraps.ts:37
Per-app wrap (NIP-59) state: the unwrap queue plus attempt/dedup tracking. Scoped to app.user, so an app only ever unwraps its own user's messages into its own repository — which is what keeps DM history from being merged across identities. The repository subscription that feeds it lives in appPolicyWraps.
A wrap whose unwrap throws or times out goes back on the queue after a backoff until it has been tried MAX_UNWRAP_ATTEMPTS times, since a signer that is busy or disconnected fails the same way a wrap this user cannot read does.
Unwrapping a stored backlog is work behind whatever the user is doing, so each decryption asks for the back of the signer's queue and the signer bounds it by SIGNER_TIMEOUT. The queue waits out a slow signer rather than abandoning a decryption that is still running, which is what used to leave orphaned requests in front of every later wrap.
Constructors
Constructor
new Wraps(
app):Wraps
Defined in: plugins/wraps.ts:42
Parameters
app
Returns
Wraps
Properties
app
readonlyapp:IApp
Defined in: plugins/wraps.ts:42
queue
queue:
TaskQueue<TrustedEvent>
Defined in: plugins/wraps.ts:40
retryTimers
retryTimers:
Set<Timeout>
Defined in: plugins/wraps.ts:39
unwrapAttempts
unwrapAttempts:
Map<string,number>
Defined in: plugins/wraps.ts:38
Methods
enqueue()
enqueue(
wrap):void
Defined in: plugins/wraps.ts:96
Parameters
wrap
Returns
void
publish()
publish(
__namedParameters):Promise<PublicationGroup>
Defined in: plugins/wraps.ts:105
Parameters
__namedParameters
Returns
Promise<PublicationGroup>
retry()
retry(
wrap,delay):void
Defined in: plugins/wraps.ts:87
Parameters
wrap
delay
number
Returns
void