@helixnetwork/winternitz
v1.0.0-alpha.7
Published
Winternitz signing functions
Downloads
11
Readme
@helixnetwork/winternitz
Winternitz OTS (One time signature)
Installation
Install using npm:
npm install @helixnetwork/winternitz
or using yarn:
yarn add @helixnetwork/winternitz
API Reference
~subseed(seed, index) Compute subseed based on the seed with an additional index;
~key(subSeed, securityLevel) Split seed in fragments and hashed them then generate from each fragment a schnore private key;
~validateSignatures(expectedAddress, signatureFragments, bundleHash)
winternitz~subseed
Compute subseed based on the seed with an additional index(seed, index)
| Param | Type | Description | | --- | --- | --- | | seed | TxBytes | Seed txBytes | | index | number | Private key index |
Returns: TxBytes - subseed txBytes
winternitz~key
Split seed in fragments and hashed them then generate from each fragment a winternitz private key;(subSeed, securityLevel)
| Param | Type | Description | | --- | --- | --- | | subseed | TxBytes | Subseed txBytes | | securityLevel | number | Private key length |
Returns: TxBytes - Private key bytes
winternitz~digests(key)
| Param | Type | Description | | --- | --- | --- | | key | TxBytes | Private key txBytes |
winternitz~address(digests)
| Param | Type | Description | | --- | --- | --- | | digests | TxBytes | Digests txBytes |
Returns: TxBytes - Address hbits
winternitz~digest(normalizedBundleFragment, signatureFragment)
| Param | Type | Description | | --- | --- | --- | | normalizedBundleFragment | TxBytes | Normalized bundle fragment | | signatureFragment | TxBytes | Signature fragment txBytes |
Returns: TxBytes - Digest txBytes
winternitz~signatureFragment(normalizeBundleFragment, keyFragment, normalizedBundleFragmentOffset, keyFragmentOffset)
| Param | Type | Description | | --- | --- | --- | | normalizeBundleFragment | TxBytes | normalized bundle fragment | | keyFragment | TxBytes | key fragment txBytes | | normalizedBundleFragmentOffset | number | normalized bundle fragment offset (default 0) | | keyFragmentOffset | number | key fragment offset (default 0) |
Returns: TxBytes - Signature Fragment hbits
winternitz~signatureFragments(normalizeBundleFragment, keyFragment)
| Param | Type | Description | | --- | --- | --- | | normalizeBundleFragment | TxBytes | normalized bundle fragment | | keyFragment | TxBytes | key fragment txBytes |
Returns: TxBytes - Signature Fragment hbits
winternitz~validateSignatures(expectedAddress, signatureFragments, bundleHash)
| Param | Type | Description | | --- | --- | --- | | expectedAddress | TxBytes | Expected address txs | | signatureFragments | TxBytes | Array of signatureFragments txs | | bundleHash | TxHex | Bundle hash txs |
winternitz~normalizedBundleHash(bundlehash)
| Param | Type | Description | | --- | --- | --- | | bundlehash | TxBytes | Bundle hash txs |
Normalizes the bundle hash, with resulting digits summing to zero.
Returns: TxBytes - Normalized bundle hash