API — Methods
Constructor
new UldaSign(cfg?: UldaSignConfig)
Creates an instance, merges your cfg with defaults, and registers any external hashers declared in the config.
Malformed descriptors throw synchronously (e.g., unknown output format).
New(idx = 0n)
Returns a self-contained Origin package for generation idx.
- Work: O(N) random bytes, no hashing.
- Output format (bytes/hex/base64) follows
fmt.export.
stepUp(originPkg)
Returns the next Origin package derived from originPkg:
- Drops the oldest block, appends a new random block, increments generation.
- Keeps size stable and does not mutate the old package.
sign(originPkg)
Produces a Signature package for the given Origin:
- Internals: import → ladder engine (S or X) → export.
- Complexity: ~
N(N−1)/2hash ops for both S and X (different structure).
verify(sigA, sigB)
Checks if sigB directly follows sigA.
-
S-mode: accepts gaps
1…N−1(extra diagonal hashing). -
X-mode: accepts only
gap = 1. - Returns strict boolean; never throws on mismatch.
UldaSign.loadScriptOnce(url)
Loads a <script src="…"> exactly once (race-safe).
Useful for lazy-loading custom hash functions before calling sign().