Class InMemoryWebAuthnStore
java.lang.Object
com.revetsec.webauthn.InMemoryWebAuthnStore
- All Implemented Interfaces:
WebAuthnStore
@ThreadSafe
@CheckReturnValue
public final class InMemoryWebAuthnStore
extends Object
implements WebAuthnStore
Explicit bounded, volatile, single-process WebAuthn store. Restart loses ceremonies,
credentials, ownership tombstones, account fences and every recovery/time fence. Use durable
shared authoritative storage for established accounts or deployments with several nodes.
No ordinary read, predicate barrier or refusal reclaims records. A successful mutating commit
atomically reclaims expired ceremonies outside its predicate set using the same fresh admitted
store time. Permanent records are never evicted to make room.
The first operational call establishes this store's own volatile UTC/elapsed projection and admission metadata. The relying party's worker Clock is never its time source. Each operation checks the projection against fresh host UTC. A discontinuity starts a new clock generation, fencing old work; after a backward step the store waits for the last published time before it resumes. Construction performs no I/O, random acquisition or time sampling. This demonstration does not qualify external UTC, restore, device durability, suspend/rate continuity or a shared deployment.
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptioncompareAndCommit(@NonNull WebAuthnStoreWrite write, @NonNull Duration remainingBudget) Compares all snapshot versions and absences at one linearization point and applies all changes or none.static @NonNull InMemoryWebAuthnStorefromLimits(@NonNull Integer maximumEntries, @NonNull Long maximumSealedBytes) Creates empty volatile storage with explicit count and aggregate sealed-byte capacity.Reads every requested key at one authoritative snapshot point.toString()Redacts stored records and admission metadata.
-
Method Details
-
fromLimits
public static @NonNull InMemoryWebAuthnStore fromLimits(@NonNull Integer maximumEntries, @NonNull Long maximumSealedBytes) Creates empty volatile storage with explicit count and aggregate sealed-byte capacity. Expired ceremonies may be reclaimed by a later successful mutating commit; permanent records are never evicted. One record may be up to 262144 bytes.- Parameters:
maximumEntries- capacity from 1 to 65536maximumSealedBytes- aggregate capacity from 1 to 268435456 bytes- Returns:
- a new empty process-local store
- Since:
- 1.0.0
-
read
public @NonNull WebAuthnStoreReadResult read(@NonNull Set<@NonNull WebAuthnStoreKey> keys, @NonNull Duration remainingBudget) Description copied from interface:WebAuthnStoreReads every requested key at one authoritative snapshot point. A missing key is represented by an explicitWebAuthnStoreEntry.Absententry. Admission retirement is Fenced; a provider failure is Unavailable, never fabricated absence.- Specified by:
readin interfaceWebAuthnStore- Parameters:
keys- the complete bounded read setremainingBudget- the remaining positive operation budget- Returns:
- a coherent complete snapshot, fenced result or unavailable result
-
compareAndCommit
public @NonNull WebAuthnStoreCommitReceipt compareAndCommit(@NonNull WebAuthnStoreWrite write, @NonNull Duration remainingBudget) Description copied from interface:WebAuthnStoreCompares all snapshot versions and absences at one linearization point and applies all changes or none. Fresh healthy authority time must satisfy the original inclusive floor and exclusive expiry after all waits and before mutations. An empty mutation set is a timed predicate barrier. A known late commit stays COMMITTED with timing; an uncertain mutation is never safe to retry.- Specified by:
compareAndCommitin interfaceWebAuthnStore- Parameters:
write- the complete predicate and mutation setremainingBudget- the remaining positive operation budget- Returns:
- the actual commit outcome
-
toString
-