Documentation / @xo-cash/crypto
@xo-cash/crypto
XO crypto package, deals with private keys, public keys, generation of bytecode.
⚠️ This project is in early development phase. Use it only if you understand what you are doing and accept the risks. Do not use funds you are not willing to lose. Minor version bumps may introduce breaking changes
Installation
npm install @xo-cash/cryptoUsage
import { Crypto } from '@xo-cash/crypto';
const crypto = new Crypto(seed);
const signedCommit = crypto.signInvitationCommitWithSchnorr({
invitationCommit: unsignedCommit,
invitationIdentifier,
rootCommitIdentifier,
templateIdentifier,
actionIdentifier,
});
// `rootCommitIdentifier` is the commit identifier where this entity first joined the invitation.Documentation
High-level flow
flowchart TD
mnemonic[Mnemonic] --> convertSeed[convertMnemonicToSeedBytes]
convertSeed --> seedBytes[SeedBytes]
seedBytes --> cryptoCtor[Crypto.constructor]
cryptoCtor --> purposeNode[Purpose HD node m/2415']
purposeNode --> invitationSigning[Invitation signing]
purposeNode --> templateLocking[Template locking]
invitationSigning -->|HD input templateId and rootCommitId| genSigned[generateSchnorrSignedInvitationCommit]
genSigned -->|signing payload includes invitationId| signedCommit[SignedInvitationCommit]
templateLocking -->|deriveUseCaseChildNode| compilerKeys[compileScript]
templateLocking -->|deriveUseCaseChildNode| templatePublicKey[derivePublicKey]Links
License
MIT - See LICENSE for details.
AccountKeyUseCase
Defined in: source/defaults.ts:39
Key use case for account derivation (m/2415'/{ACCOUNT_USE_CASE_INDEX}'/{AccountKeyUseCase.x}'/...). Account keys: data signing (e.g. invites, commits) or encryption.
Enumeration Members
| Enumeration Member | Value | Description | Defined in |
|---|---|---|---|
DataSigning | 0 | Keys for data signing (e.g. invitations and commits). | source/defaults.ts:42 |
Encryption | 1 | Keys for encryption. (not implemented yet) | source/defaults.ts:45 |
TemplateKeyUseCase
Defined in: source/defaults.ts:56
BIP43CompatibleTemplateIndex = first4Bytes(hash(templateIdentifier)) Note: BIP43CompatibleTemplateIndex is for ACCOUNT_OR_TEMPLATE > 0
Key use case for template derivation (m/2415'/{BIP43CompatibleTemplateIndex}'/{TemplateKeyUseCase.x}'/...). Template keys: signing and spending (e.g. Schnorr signatures, P2PKH). More template key uses may be added later.
Enumeration Members
| Enumeration Member | Value | Description | Defined in |
|---|---|---|---|
SigningAndSpending | 0 | Keys for signing (e.g. Schnorr) and spending for this template. | source/defaults.ts:59 |
AccountHashHexFormatInvalidError
Defined in: source/errors.ts:297
Error thrown when the account hash contains non-hex characters.
Extends
Error
Constructors
Constructor
new AccountHashHexFormatInvalidError(receivedValue): AccountHashHexFormatInvalidError;Defined in: index.d.mts:256
Parameters
| Parameter | Type |
|---|---|
receivedValue | string |
Returns
AccountHashHexFormatInvalidError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
receivedValue | readonly | string | Account hash value that was received. | source/errors.ts:301 |
AccountHashHexLengthInvalidError
Defined in: source/errors.ts:280
Error thrown when the account hash does not have the expected character count.
Extends
Error
Constructors
Constructor
new AccountHashHexLengthInvalidError(receivedLength): AccountHashHexLengthInvalidError;Defined in: index.d.mts:246
Parameters
| Parameter | Type |
|---|---|
receivedLength | number |
Returns
AccountHashHexLengthInvalidError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
receivedLength | readonly | number | Character count of the account hash that was received. | source/errors.ts:284 |
AccountHashInputTypeInvalidError
Defined in: source/errors.ts:263
Error thrown when the account hash input is not a string.
Extends
Error
Constructors
Constructor
new AccountHashInputTypeInvalidError(receivedType): AccountHashInputTypeInvalidError;Defined in: index.d.mts:236
Parameters
| Parameter | Type |
|---|---|
receivedType | string |
Returns
AccountHashInputTypeInvalidError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
receivedType | readonly | string | Type of the value that was received. | source/errors.ts:267 |
CommitSigningHdNodePrivateKeyInvalidError
Defined in: source/errors.ts:179
Thrown when the per-commit signing HD node's private key fails secp256k1 validation after derivation.
Remarks
The message includes the HD derivation path, which exposes internal tree structure in error output. This is intentional to aid debugging.
Extends
Error
Constructors
Constructor
new CommitSigningHdNodePrivateKeyInvalidError(commitRelativePath): CommitSigningHdNodePrivateKeyInvalidError;Defined in: index.d.mts:190
Parameters
| Parameter | Type |
|---|---|
commitRelativePath | string |
Returns
CommitSigningHdNodePrivateKeyInvalidError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
commitRelativePath | readonly | string | HD derivation path of the commit signing node, relative to the invitation node. | source/errors.ts:183 |
Crypto
Defined in: source/crypto.ts:55
Manages cryptographic operations for XO including HD key derivation, invitation entity and commit signing, and template key derivation.
Constructors
Constructor
new Crypto(seedBytes, options?): Crypto;Defined in: index.d.mts:425
Creates a new Crypto instance from seed bytes.
Parameters
| Parameter | Type | Description |
|---|---|---|
seedBytes | Uint8Array | Seed bytes |
options? | CryptoConstructionOptions | Construction options |
Returns
Throws
MasterNodeDerivationFailedError If master node derivation fails
Throws
PurposeNodeDerivationFailedError If path derivation fails
Throws
PurposeHdNodePrivateKeyInvalidError If the purpose node private key fails secp256k1 validation
See
convertMnemonicToSeedBytes - to convert a mnemonic phrase into seed bytes.
Methods
compileScript()
compileScript(parameters):
| Uint8Array<ArrayBufferLike>
| IncompleteScriptCompilation;Defined in: source/crypto.ts:349
Compiles a script using the compiler configuration and returns the bytecode, if the compilation does not complete, this function returns an IncompleteScriptCompilation with what the compiler reported. The unresolved identifiers can then be used later on to provide more missing information to the compiler.
Parameters
| Parameter | Type | Description |
|---|---|---|
parameters | ScriptCompilationParameters | Compiler configuration, script, compilation data without keys, and key references. |
Returns
| Uint8Array<ArrayBufferLike> | IncompleteScriptCompilation
- The compiled bytecode, or what the compiler reported when it stopped before producing bytecode.
Throws
PurposeHDNodeDestroyedError If instance has been destroyed
Throws
PathIndexOutOfRangeError If a key derivation index is out of range
Throws
UseCaseHdNodePrivateKeyInvalidError If a template signing node private key fails secp256k1 validation
Throws
TemplateIdentifierHexLengthInvalidError from @xo-cash/primitives if a template identifier is not the expected hex length
Throws
TemplateIdentifierHexFormatInvalidError from @xo-cash/primitives if a template identifier contains non-hex characters
Throws
TemplateIdentifierAllZeroesError from @xo-cash/primitives if a template identifier is all zeroes
Throws
TemplateIdentifierMaximumError from @xo-cash/primitives if a template identifier is all 0xFF bytes
deriveInvitationEntityIdentifier()
deriveInvitationEntityIdentifier(params): string;Defined in: source/crypto.ts:124
Derives the identifier for a participant in an invitation. The identifier is an extended public key (xpub/tpub).
How the identifier is derived? The template and root commit identifiers are concatenated and hashed (sha256). The first four bytes of the hash are read as a little-endian uint32 and masked to 31 bits to fit within the valid BIP32 child index range (0 to 2,147,483,647). That value is then used as a hardened child index, deriveHdPathRelative from libauth applies the hardened index offset (0x80000000) when it encounters the ' suffix in the path, placing the index in the hardened range. The resulting xpub at that node is the identifier.
All derivations are dependent on first-party data, the template identifier stays the same for a given template and the root commit identifier is generated by the participant themselves. No external party can influence which key gets derived.
When the identifier is different?
- Different seed means a different participant.
- Different network: mainnet and testnet derive from entirely different BIP43 purpose indices (
m/2415'vsm/42415'), producing unrelated key material. - Different template has a different identifier and therefore would lead to a different derived index.
- Different rootCommitIdentifier would lead to a different derived index.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { rootCommitIdentifier: string; templateIdentifier: string; } | Parameters for deriving the entity identifier |
params.rootCommitIdentifier | string | Commit identifier of the first commit this entity made to the invitation |
params.templateIdentifier | string | Template identifier |
Returns
string
Invitation entity identifier (extended public key)
Throws
PurposeHDNodeDestroyedError If instance has been destroyed
Throws
PurposeNodeDerivationFailedError If any derivation step fails
Throws
InvitationHdNodePrivateKeyInvalidError If the invitation node private key fails secp256k1 validation
derivePublicKey()
derivePublicKey(keyReference): Uint8Array;Defined in: source/crypto.ts:452
Derives the compressed public key using the template identifier and derivation index.
Parameters
| Parameter | Type | Description |
|---|---|---|
keyReference | KeyReference | Template identifier and derivation index the key was generated at. |
Returns
Uint8Array
- The compressed public key.
Throws
PurposeHDNodeDestroyedError If instance has been destroyed
Throws
PathIndexOutOfRangeError If the key derivation index is out of range
Throws
UseCaseHdNodePrivateKeyInvalidError If the template signing node private key fails secp256k1 validation
Throws
PublicKeyDerivationFailedError If the public key cannot be derived from the private key
Throws
TemplateIdentifierHexLengthInvalidError from @xo-cash/primitives if the template identifier is not the expected hex length
Throws
TemplateIdentifierHexFormatInvalidError from @xo-cash/primitives if the template identifier contains non-hex characters
Throws
TemplateIdentifierAllZeroesError from @xo-cash/primitives if the template identifier is all zeroes
Throws
TemplateIdentifierMaximumError from @xo-cash/primitives if the template identifier is all 0xFF bytes
destroy()
destroy(): void;Defined in: source/crypto.ts:486
Destroys the crypto instance by zeroing the purpose HD node private key. After calling this method, all operations will throw PurposeHDNodeDestroyedError.
Returns
void
isDestroyed()
isDestroyed(): boolean;Defined in: source/crypto.ts:478
Checks if the purpose HD node has been destroyed.
Returns
boolean
True if the purpose HD node has been destroyed, false otherwise
signInvitationCommitWithSchnorr()
signInvitationCommitWithSchnorr(params): XOInvitationCommit;Defined in: source/crypto.ts:182
Signs an invitation commit with a Schnorr signature and returns a new commit with signature and entityIdentifier populated.
How the signature is derived: For each commit, a separate non-hardened child signing key is derived from the commit identifier, The commit identifier is hashed (sha256), the first four bytes are read as a little-endian uint32 and masked to 31 bits to fit within the valid BIP32 child index range (0 to 2,147,483,647), the the result is used directly as a non-hardened child index under the invitation entity identity node (derived using deriveInvitationEntityIdentifier).
Path: {purposePath}/0'/0'/{invitationIndex}'/{commitIndex}
All derivations are dependent on first party data, the commit identifier is chosen by the participant. No external party can influence which child key is selected.
With xPUB as the entity identifier, each commit's public key can be derived by other participants to verify the signature without any private key material.
Signing is delegated to generateSchnorrSignedInvitationCommit in signing.ts.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { actionIdentifier: string; invitationCommit: Omit<XOInvitationCommit, "signature" | "entityIdentifier">; invitationIdentifier: string; rootCommitIdentifier: string; templateIdentifier: string; } | Options for signing the invitation commit |
params.actionIdentifier | string | Action identifier |
params.invitationCommit | Omit<XOInvitationCommit, "signature" | "entityIdentifier"> | Invitation commit without signature and entityIdentifier |
params.invitationIdentifier | string | Invitation identifier (included in signing payload) |
params.rootCommitIdentifier | string | Commit identifier of the first commit this entity made to the invitation |
params.templateIdentifier | string | Template identifier |
Returns
Signed invitation commit with signature and entityIdentifier
Throws
PurposeHDNodeDestroyedError If instance has been destroyed
Throws
InvitationHdNodePrivateKeyInvalidError If the invitation node private key fails secp256k1 validation
Throws
CommitSigningHdNodePrivateKeyInvalidError If the commit signing node private key fails secp256k1 validation
Throws
SchnorrSignatureGenerationFailedError If Schnorr signature generation fails
Throws
CommitIdentifierHexLengthInvalidError from @xo-cash/primitives if commit identifier is not the expected hex length
Throws
CommitIdentifierHexFormatInvalidError from @xo-cash/primitives if commit identifier contains non-hex characters
Throws
CommitIdentifierAllZeroesError from @xo-cash/primitives if commit identifier is all zeroes
Throws
CommitIdentifierMaximumError from @xo-cash/primitives if commit identifier is all 0xFF bytes
Throws
PurposeNodeDerivationFailedError If invitation HD derivation fails
signInvitationDataResult()
signInvitationDataResult(params): Pick<XOInvitationDataResult,
| "createdAtTimestamp"
| "createdByEntityIdentifier"
| "createdBySignature"
| "value">;Defined in: source/crypto.ts:312
Signs the data result created from the invitation process, this signature is produced when the invitation process resolves to a data value.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { createdAtTimestamp: number; invitationIdentifier: string; rootCommitIdentifier: string; templateIdentifier: string; value: XOInvitationVariableValue; } | Signing parameters for the data result |
params.createdAtTimestamp | number | Time the data value was created |
params.invitationIdentifier | string | Invitation the result belongs to |
params.rootCommitIdentifier | string | Commit identifier of the first commit this entity made to the invitation |
params.templateIdentifier | string | Template identifier |
params.value | XOInvitationVariableValue | Resolved data value |
Returns
Pick<XOInvitationDataResult, | "createdAtTimestamp" | "createdByEntityIdentifier" | "createdBySignature" | "value">
Signed data result fields including entity identifier and signature
Throws
PurposeHDNodeDestroyedError If instance has been destroyed
Throws
PurposeNodeDerivationFailedError When invitation HD derivation fails
Throws
InvitationHdNodePrivateKeyInvalidError When the invitation node private key is invalid
Throws
CommitSigningHdNodePrivateKeyInvalidError When the result signing key is invalid
Throws
SchnorrSignatureGenerationFailedError When Schnorr signing fails
Throws
from @xo-cash/primitives when any identifier or the timestamp is malformed or out of range
signInvitationTransactionBroadcastedResult()
signInvitationTransactionBroadcastedResult(params): XOInvitationTransactionBroadcastDetails;Defined in: source/crypto.ts:265
Signs the broadcast metadata for an invitation transaction result. Call this after Crypto.signInvitationTransactionCreatedResult once the transaction has been submitted to the network. This is used to sign the information about the transaction being broadcasted and the entity that broadcasted it.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { broadcastedAtTimestamp: number; invitationIdentifier: string; rootCommitIdentifier: string; templateIdentifier: string; transactionResult: Omit<XOInvitationTransactionResult, | "broadcastedAtTimestamp" | "broadcastedByEntityIdentifier" | "broadcastedBySignature">; } | Signing parameters for the broadcast result fields |
params.broadcastedAtTimestamp | number | Time the transaction was broadcast to the network |
params.invitationIdentifier | string | Invitation the result belongs to |
params.rootCommitIdentifier | string | Commit identifier of the first commit this entity made to the invitation |
params.templateIdentifier | string | Template identifier |
params.transactionResult | Omit<XOInvitationTransactionResult, | "broadcastedAtTimestamp" | "broadcastedByEntityIdentifier" | "broadcastedBySignature"> | The created result as returned by signInvitationTransactionCreatedResult, before any broadcast fields |
Returns
XOInvitationTransactionBroadcastDetails
Signed broadcast metadata including entity identifier and signature
Throws
PurposeHDNodeDestroyedError If instance has been destroyed
Throws
PurposeNodeDerivationFailedError When invitation HD derivation fails
Throws
InvitationHdNodePrivateKeyInvalidError When the invitation node private key is invalid
Throws
CommitSigningHdNodePrivateKeyInvalidError When the result signing key is invalid
Throws
SchnorrSignatureGenerationFailedError When Schnorr signing fails
Throws
from @xo-cash/primitives when any identifier, hash, timestamp, entity identifier, or signature in the inputs is malformed, out of range, or encoded for a different network
signInvitationTransactionCreatedResult()
signInvitationTransactionCreatedResult(params): Pick<XOInvitationTransactionResult,
| "createdAtTimestamp"
| "createdByEntityIdentifier"
| "createdBySignature"
| "transactionHash">;Defined in: source/crypto.ts:224
Signs a transaction result created from the invitation process, this signature is produced when an entity has created a transaction but not yet broadcasted.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { createdAtTimestamp: number; invitationIdentifier: string; rootCommitIdentifier: string; templateIdentifier: string; transactionHash: string; } | Signing parameters for the created transaction result |
params.createdAtTimestamp | number | Time the transaction was created, before broadcasting |
params.invitationIdentifier | string | Invitation the result belongs to |
params.rootCommitIdentifier | string | Commit identifier of the first commit this entity made to the invitation |
params.templateIdentifier | string | Template identifier |
params.transactionHash | string | Hash of the created transaction |
Returns
Pick<XOInvitationTransactionResult, | "createdAtTimestamp" | "createdByEntityIdentifier" | "createdBySignature" | "transactionHash">
Signed created result fields including entity identifier and signature
Throws
PurposeHDNodeDestroyedError If instance has been destroyed
Throws
PurposeNodeDerivationFailedError When invitation HD derivation fails
Throws
InvitationHdNodePrivateKeyInvalidError When the invitation node private key is invalid
Throws
CommitSigningHdNodePrivateKeyInvalidError When the result signing key is invalid
Throws
SchnorrSignatureGenerationFailedError When Schnorr signing fails
Throws
from @xo-cash/primitives when any identifier, hash, or timestamp is malformed or out of range
HashBytesLengthInvalidError
Defined in: source/errors.ts:6
Thrown when SHA256 hash bytes length is invalid.
Extends
Error
Constructors
Constructor
new HashBytesLengthInvalidError(receivedLength): HashBytesLengthInvalidError;Defined in: index.d.mts:87
Parameters
| Parameter | Type |
|---|---|
receivedLength | number |
Returns
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
receivedLength | readonly | number | Byte length of the hash that was received. | source/errors.ts:10 |
InvitationHdNodePrivateKeyInvalidError
Defined in: source/errors.ts:159
Thrown when the invitation HD private node's key fails secp256k1 validation after derivation.
Remarks
The message includes the HD derivation path, which exposes internal tree structure in error output. This is intentional to aid debugging.
Extends
Error
Constructors
Constructor
new InvitationHdNodePrivateKeyInvalidError(invitationFullPath): InvitationHdNodePrivateKeyInvalidError;Defined in: index.d.mts:177
Parameters
| Parameter | Type |
|---|---|
invitationFullPath | string |
Returns
InvitationHdNodePrivateKeyInvalidError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
invitationFullPath | readonly | string | Full HD derivation path of the invitation node. | source/errors.ts:163 |
InvitationPublicNodeDecodingFailedError
Defined in: source/errors.ts:231
Thrown when an invitation entity identifier cannot be decoded as a valid HD public key.
Extends
Error
Constructors
Constructor
new InvitationPublicNodeDecodingFailedError(reason): InvitationPublicNodeDecodingFailedError;Defined in: index.d.mts:218
Parameters
| Parameter | Type |
|---|---|
reason | string |
Returns
InvitationPublicNodeDecodingFailedError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
reason | readonly | string | Reason reported by the HD public key decoding. | source/errors.ts:235 |
InvitationPublicNodeDerivationFailedError
Defined in: source/errors.ts:246
Thrown when an invitation public node cannot be derived.
Extends
Error
Constructors
Constructor
new InvitationPublicNodeDerivationFailedError(reason): InvitationPublicNodeDerivationFailedError;Defined in: index.d.mts:226
Parameters
| Parameter | Type |
|---|---|
reason | string |
Returns
InvitationPublicNodeDerivationFailedError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
reason | readonly | string | Reason reported by the HD public derivation. | source/errors.ts:250 |
MasterNodeDerivationFailedError
Defined in: source/errors.ts:21
Thrown when BIP32 master node derivation fails.
Extends
Error
Constructors
Constructor
new MasterNodeDerivationFailedError(reason?): MasterNodeDerivationFailedError;Defined in: index.d.mts:95
Parameters
| Parameter | Type |
|---|---|
reason? | string |
Returns
MasterNodeDerivationFailedError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
reason? | readonly | string | Reason reported by the HD derivation, when one is given. | source/errors.ts:25 |
MnemonicInputTypeInvalidError
Defined in: source/errors.ts:39
Error thrown when the mnemonic input is not a string.
Extends
Error
Constructors
Constructor
new MnemonicInputTypeInvalidError(receivedType): MnemonicInputTypeInvalidError;Defined in: index.d.mts:105
Parameters
| Parameter | Type |
|---|---|
receivedType | string |
Returns
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
receivedType | readonly | string | Type of the value that was received. | source/errors.ts:43 |
MnemonicNotProvidedError
Defined in: source/errors.ts:54
Thrown when mnemonic is not provided.
Extends
Error
Constructors
Constructor
new MnemonicNotProvidedError(): MnemonicNotProvidedError;Defined in: source/errors.ts:54
Returns
Overrides
Error.constructorPathIndexOutOfRangeError
Defined in: source/errors.ts:63
Thrown when path index is out of range.
Extends
Error
Constructors
Constructor
new PathIndexOutOfRangeError(pathIndex): PathIndexOutOfRangeError;Defined in: index.d.mts:117
Parameters
| Parameter | Type |
|---|---|
pathIndex | number |
Returns
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
pathIndex | readonly | number | Path index that was received. | source/errors.ts:67 |
PublicKeyDerivationFailedError
Defined in: source/errors.ts:314
Thrown when a public key cannot be derived from its private key.
Extends
Error
Constructors
Constructor
new PublicKeyDerivationFailedError(reason): PublicKeyDerivationFailedError;Defined in: index.d.mts:266
Parameters
| Parameter | Type |
|---|---|
reason | string |
Returns
PublicKeyDerivationFailedError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
reason | readonly | string | Reason reported by the secp256k1 implementation. | source/errors.ts:318 |
PurposeHDNodeDestroyedError
Defined in: source/errors.ts:78
Thrown when the purpose HD node has been destroyed and operations cannot proceed.
Extends
Error
Constructors
Constructor
new PurposeHDNodeDestroyedError(): PurposeHDNodeDestroyedError;Defined in: source/errors.ts:78
Returns
Overrides
Error.constructorPurposeHdNodePrivateKeyInvalidError
Defined in: source/errors.ts:119
Thrown when the XO purpose HD node's private key fails secp256k1 validation after derivation.
Remarks
The message includes the HD derivation path, which exposes internal tree structure in error output. This is intentional to aid debugging.
Extends
Error
Constructors
Constructor
new PurposeHdNodePrivateKeyInvalidError(purposePath): PurposeHdNodePrivateKeyInvalidError;Defined in: index.d.mts:151
Parameters
| Parameter | Type |
|---|---|
purposePath | string |
Returns
PurposeHdNodePrivateKeyInvalidError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
purposePath | readonly | string | HD derivation path of the purpose node. | source/errors.ts:123 |
PurposeNodeDerivationFailedError
Defined in: source/errors.ts:92
Thrown when HD node path derivation fails.
Remarks
The message includes the HD derivation path, which exposes internal tree structure in error output. This is intentional to aid debugging.
Extends
Error
Constructors
Constructor
new PurposeNodeDerivationFailedError(path, reason?): PurposeNodeDerivationFailedError;Defined in: index.d.mts:138
Parameters
| Parameter | Type |
|---|---|
path | string |
reason? | string |
Returns
PurposeNodeDerivationFailedError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
path | readonly | string | HD derivation path that failed. | source/errors.ts:96 |
reason? | readonly | string | Reason reported by the HD derivation, when one is given. | source/errors.ts:101 |
SchnorrSignatureGenerationFailedError
Defined in: source/errors.ts:209
Thrown when Schnorr signature generation fails for a signed subject such as a commit, transaction, or data value.
Extends
Error
Constructors
Constructor
new SchnorrSignatureGenerationFailedError(subjectIdentifier, reason?): SchnorrSignatureGenerationFailedError;Defined in: index.d.mts:210
Parameters
| Parameter | Type |
|---|---|
subjectIdentifier | string |
reason? | string |
Returns
SchnorrSignatureGenerationFailedError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
reason? | readonly | string | Reason reported by the secp256k1 implementation, when one is given. | source/errors.ts:218 |
subjectIdentifier | readonly | string | Identifier of the subject that was being signed. | source/errors.ts:213 |
SeedDerivationFromMnemonicFailedError
Defined in: source/errors.ts:194
Thrown when seed derivation from mnemonic fails.
Extends
Error
Constructors
Constructor
new SeedDerivationFromMnemonicFailedError(reason): SeedDerivationFromMnemonicFailedError;Defined in: index.d.mts:198
Parameters
| Parameter | Type |
|---|---|
reason | string |
Returns
SeedDerivationFromMnemonicFailedError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
reason | readonly | string | Reason reported by the BIP39 seed derivation. | source/errors.ts:198 |
UseCaseHdNodePrivateKeyInvalidError
Defined in: source/errors.ts:139
Thrown when a use case child HD node's private key fails secp256k1 validation after derivation.
Remarks
The message includes the HD derivation path, which exposes internal tree structure in error output. This is intentional to aid debugging.
Extends
Error
Constructors
Constructor
new UseCaseHdNodePrivateKeyInvalidError(fullPath): UseCaseHdNodePrivateKeyInvalidError;Defined in: index.d.mts:164
Parameters
| Parameter | Type |
|---|---|
fullPath | string |
Returns
UseCaseHdNodePrivateKeyInvalidError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
fullPath | readonly | string | Full HD derivation path of the use case child node. | source/errors.ts:143 |
CryptoConstructionOptions
type CryptoConstructionOptions = object;Defined in: source/types.ts:23
Options for constructing the Crypto class (see crypto.ts).
Properties
network?
optional network?: HdKeyNetwork;Defined in: source/types.ts:28
Only supports mainnet and testnet. Defaults to mainnet.
IncompleteScriptCompilation
type IncompleteScriptCompilation = object;Defined in: source/types.ts:141
What the compiler reported for a script it stopped compiling before producing bytecode. When every compiler error names a missing identifier, more compilation data can complete the script.
Properties
compilationErrors
compilationErrors: ScriptCompilationErrorDetail[];Defined in: source/types.ts:157
Compiler errors with their source position, missing identifier, and owning entity.
compilationStage
compilationStage: CompilationResultErrorBase["errorType"];Defined in: source/types.ts:152
Compiler stage that stopped. Parsing reads the script source, resolution looks up every identifier in the compilation data, and reduction evaluates the resolved script into bytecode.
missingIdentifiers
missingIdentifiers: string[];Defined in: source/types.ts:162
Identifiers the compiler reports as missing from the compilation data, such as an operation on a key another entity holds.
resolvedKeyOperations
resolvedKeyOperations: Record<string, Uint8Array>;Defined in: source/types.ts:167
Operations on the given keys the compiler resolved before it stopped, keyed by their full identifier.
scriptId
scriptId: string;Defined in: source/types.ts:146
Script that was compiled.
InvitationCommitParams
type InvitationCommitParams = object;Defined in: source/types.ts:34
Parameters for constructing a commit message.
Properties
actionIdentifier
actionIdentifier: XOTemplateActionIdentifier;Defined in: source/types.ts:50
The action identifier used in the invitation
commitIdentifier
commitIdentifier: XOInvitationCommitIdentifier;Defined in: source/types.ts:60
The commit identifier of the invitation commit
data
data: XOInvitationCommit["data"];Defined in: source/types.ts:40
The data of the invitation commit. e.g variables, inputs, outputs, transaction version, transaction locktime, etc.
invitationIdentifier
invitationIdentifier: XOInvitationIdentifier;Defined in: source/types.ts:55
The invitation identifier of the invitation
previousCommitIdentifier?
optional previousCommitIdentifier?: XOInvitationCommitIdentifier;Defined in: source/types.ts:65
The previous commit identifier in the invitation
templateIdentifier
templateIdentifier: XOTemplateIdentifier;Defined in: source/types.ts:45
The template identifier used in the invitation
InvitationDataResultSignedFields
type InvitationDataResultSignedFields = Pick<XOInvitationDataResult, "value" | "createdAtTimestamp" | "createdByEntityIdentifier">;Defined in: source/types.ts:190
Fields of invitation's data result.
InvitationTransactionBroadcastedResultSignedFields
type InvitationTransactionBroadcastedResultSignedFields = Pick<XOInvitationTransactionResult & XOInvitationTransactionBroadcastDetails,
| "transactionHash"
| "createdAtTimestamp"
| "createdByEntityIdentifier"
| "broadcastedAtTimestamp"
| "broadcastedByEntityIdentifier">;Defined in: source/types.ts:182
Fields of invitation's transaction broadcasted result. The created fields are included so the signature also binds the entity that created the transaction.
InvitationTransactionCreatedResultSignedFields
type InvitationTransactionCreatedResultSignedFields = Pick<XOInvitationTransactionResult, "transactionHash" | "createdAtTimestamp" | "createdByEntityIdentifier">;Defined in: source/types.ts:173
Fields of invitation's transaction created result. The signing message is derived from exactly these fields.
KeyReference
type KeyReference = object;Defined in: source/types.ts:71
Key reference used to derive private key material.
Properties
derivationIndex
derivationIndex: number;Defined in: source/types.ts:81
Derivation index of the key.
templateIdentifier
templateIdentifier: XOTemplateIdentifier;Defined in: source/types.ts:76
Template the key was generated under.
ScriptCompilationErrorDetail
type ScriptCompilationErrorDetail = object;Defined in: source/types.ts:114
One error the compiler reported for a script, with the source position it traces to and, when more compilation data could resolve it, the missing identifier and the entity that owns it.
Properties
message
message: string;Defined in: source/types.ts:119
Compiler error message.
missingIdentifier?
optional missingIdentifier?: string;Defined in: source/types.ts:129
Full identifier that more compilation data could resolve, such as someKey.public_key. Present only when the error is recoverable.
owningEntity?
optional owningEntity?: string;Defined in: source/types.ts:134
Entity that owns the variable of the missing identifier. Present only when the compiler configuration maps that variable to an entity.
range
range: Range;Defined in: source/types.ts:124
Position in the script source the error traces to.
ScriptCompilationParameters
type ScriptCompilationParameters = object;Defined in: source/types.ts:87
What Crypto#compileScript compiles.
Properties
compilerConfiguration
compilerConfiguration: CompilerConfiguration<CompilationContextBch>;Defined in: source/types.ts:92
Libauth compiler configuration with the scripts, variables, and locking types to compile with.
data
data: Omit<CompilationData<CompilationContextBch>, "keys">;Defined in: source/types.ts:102
Compilation data without keys, such as WalletData bytecode and the compilation context used for signatures.
keyReferences
keyReferences: Record<string, KeyReference>;Defined in: source/types.ts:107
Key reference for each key variable the script may use.
scriptId
scriptId: string;Defined in: source/types.ts:97
Script to compile.
ACCOUNT_HASH_HEX_LENGTH
const ACCOUNT_HASH_HEX_LENGTH: 64 = 64;Defined in: source/defaults.ts:85
A 64 character hex identifier for the account.
ACCOUNT_USE_CASE_INDEX
const ACCOUNT_USE_CASE_INDEX: 0 = 0;Defined in: source/defaults.ts:33
Account or template use case index used in the derivation path.
Account = 0 Template > 0
m/2415'/${ACCOUNT_USE_CASE_INDEX}'
BIP43_PURPOSE_XO_MAINNET
const BIP43_PURPOSE_XO_MAINNET: "2415" = "2415";Defined in: source/defaults.ts:8
BIP43 purpose index for XO on mainnet.
XO => X=25 and O=15
BIP43_PURPOSE_XO_TESTNET
const BIP43_PURPOSE_XO_TESTNET: "42415" = "42415";Defined in: source/defaults.ts:15
BIP43 purpose index for XO on testnet.
DXO => D=4, X=24, O=15 (Development XO)
buildInvitationCommitSigningPayload
const buildInvitationCommitSigningPayload: (params) => string;Defined in: source/utils.ts:54
Constructs the message string for invitation commit signing and verification by concatenating the stringified invitation commit data with all identifier fields in a deterministic order.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | InvitationCommitParams | Invitation commit options |
Returns
string
Message string to be hashed and signed
buildInvitationDataResultSigningMessage
const buildInvitationDataResultSigningMessage: (invitationIdentifier, dataResultFields) => string;Defined in: source/utils.ts:125
Builds the signed message for a data result signature.
The value is always converted to a string before it is signed. That way other languages can verify the signature without matching JavaScript types. Values that resolve to the same string (such as 5n and 5, or true and "true") share the same signature.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | XOInvitationIdentifier | Invitation the result belongs to. |
dataResultFields | InvitationDataResultSignedFields | The fields the signature covers. |
Returns
string
Deterministic message string.
buildInvitationTransactionBroadcastedResultSigningMessage
const buildInvitationTransactionBroadcastedResultSigningMessage: (invitationIdentifier, broadcastResultFields) => string;Defined in: source/utils.ts:95
Builds the signed message for a transaction result broadcast signature.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | XOInvitationIdentifier | Invitation the result belongs to. |
broadcastResultFields | InvitationTransactionBroadcastedResultSignedFields | The created and broadcast fields the signature covers. |
Returns
string
Deterministic message string.
buildInvitationTransactionCreatedResultSigningMessage
const buildInvitationTransactionCreatedResultSigningMessage: (invitationIdentifier, createdResultFields) => string;Defined in: source/utils.ts:77
Builds the signed message for a transaction result created signature.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | XOInvitationIdentifier | Invitation the result belongs to. |
createdResultFields | InvitationTransactionCreatedResultSignedFields | The created fields the signature covers. |
Returns
string
Deterministic message string.
computeAccountHash
const computeAccountHash: (mnemonic) => string;Defined in: source/utils.ts:225
Derives the stable account identifier by doing a SHA-256 hash of the UTF-8 encoding of the normalized BIP39 mnemonic phrase.
Parameters
| Parameter | Type | Description |
|---|---|---|
mnemonic | string | Normalized BIP39 mnemonic phrase |
Returns
string
hexadecimal account hash
Throws
MnemonicNotProvidedError If the mnemonic is not provided
Throws
SeedDerivationFromMnemonicFailedError If the mnemonic fails BIP39 validation
convertMnemonicToSeedBytes
const convertMnemonicToSeedBytes: (mnemonic, passphrase?) => Uint8Array;Defined in: source/utils.ts:268
Converts a BIP39 mnemonic to seed bytes. Recommended to use this to prepare the seed before creating a new instance of the Crypto class.
Performs full BIP39 validation using prepareMnemonic before deriving the seed:
- Enforces the minimum word count
- Validates that all words are in the BIP39 word list
- Validates the checksum for the mnemonic
Parameters
| Parameter | Type | Description |
|---|---|---|
mnemonic | string | BIP39 mnemonic phrase (12+ words) |
passphrase? | string | BIP39 passphrase for the mnemonic, supported by the deriveSeedFromBip39Mnemonic function.. |
Returns
Uint8Array
Seed bytes
Throws
MnemonicNotProvidedError If mnemonic is not provided
Throws
SeedDerivationFromMnemonicFailedError If mnemonic is invalid or seed derivation fails
createPathIndexFromHash
const createPathIndexFromHash: (hashBytes) => number;Defined in: source/utils.ts:149
Creates a 31-bit BIP32 non-hardened child index from a SHA256 hash. Reads the first 4 bytes of the hash, interprets them as a little-endian uint32, then masks to 31 bits to guarantee a valid non-hardened index (0 to 2,147,483,647).
Note: Since only the first 4 bytes of the hash are consumed, two different hashes sharing the same first 4 bytes will derive the same child index and therefore the same signing key. This is an accepted property of this construction.
Parameters
| Parameter | Type | Description |
|---|---|---|
hashBytes | Uint8Array | A 32-byte SHA256 hash |
Returns
number
Path index (31-bit unsigned integer, 0 to 2,147,483,647)
DEFAULT_NETWORK
const DEFAULT_NETWORK: HdKeyNetwork;Defined in: source/defaults.ts:80
Only supports mainnet and testnet. Defaults to mainnet.
generateSchnorrSignedInvitationDataResult
const generateSchnorrSignedInvitationDataResult: (params) => Pick<XOInvitationDataResult,
| "createdAtTimestamp"
| "createdByEntityIdentifier"
| "createdBySignature"
| "value">;Defined in: source/signing.ts:546
Generates a Schnorr-signed invitation data result. The signing key is derived as a non-hardened child of the invitation node using the UTF-8 encoding of the data result signing message.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { createdAtTimestamp: XOInvitationTimestamp; invitationIdentifier: XOInvitationIdentifier; network: HdKeyNetwork; purposeHDNode: HdPrivateNodeValid; rootCommitIdentifier: XOInvitationCommitIdentifier; templateIdentifier: XOTemplateIdentifier; value: XOInvitationVariableValue; } | Parameters for generating the signed data result |
params.createdAtTimestamp | XOInvitationTimestamp | Timestamp when the data result was created |
params.invitationIdentifier | XOInvitationIdentifier | Invitation identifier |
params.network | HdKeyNetwork | Used for encoding entity identifiers (xpub for mainnet, tpub for testnet) |
params.purposeHDNode | HdPrivateNodeValid | XO purpose HD node |
params.rootCommitIdentifier | XOInvitationCommitIdentifier | Root commit identifier |
params.templateIdentifier | XOTemplateIdentifier | Template identifier |
params.value | XOInvitationVariableValue | Resolved data value |
Returns
Pick<XOInvitationDataResult, | "createdAtTimestamp" | "createdByEntityIdentifier" | "createdBySignature" | "value">
Signed data result fields
Throws
PurposeNodeDerivationFailedError If invitation HD derivation fails
Throws
InvitationHdNodePrivateKeyInvalidError If the invitation node private key fails secp256k1 validation
Throws
CommitSigningHdNodePrivateKeyInvalidError If the result signing node private key fails secp256k1 validation
Throws
SchnorrSignatureGenerationFailedError If Schnorr signature generation fails
generateSchnorrSignedInvitationTransactionBroadcastedResult
const generateSchnorrSignedInvitationTransactionBroadcastedResult: (params) => XOInvitationTransactionBroadcastDetails;Defined in: source/signing.ts:480
Generates Schnorr-signed broadcast metadata for an existing invitation transaction created result.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { broadcastedAtTimestamp: XOInvitationTimestamp; invitationIdentifier: XOInvitationIdentifier; network: HdKeyNetwork; purposeHDNode: HdPrivateNodeValid; rootCommitIdentifier: XOInvitationCommitIdentifier; templateIdentifier: XOTemplateIdentifier; transactionResult: Omit<XOInvitationTransactionResult, | "broadcastedAtTimestamp" | "broadcastedByEntityIdentifier" | "broadcastedBySignature">; } | Parameters for generating the signed broadcast result fields |
params.broadcastedAtTimestamp | XOInvitationTimestamp | Timestamp when the transaction was broadcast |
params.invitationIdentifier | XOInvitationIdentifier | Invitation identifier |
params.network | HdKeyNetwork | Used for encoding entity identifiers (xpub for mainnet, tpub for testnet) |
params.purposeHDNode | HdPrivateNodeValid | XO purpose HD node |
params.rootCommitIdentifier | XOInvitationCommitIdentifier | Root commit identifier |
params.templateIdentifier | XOTemplateIdentifier | Template identifier |
params.transactionResult | Omit<XOInvitationTransactionResult, | "broadcastedAtTimestamp" | "broadcastedByEntityIdentifier" | "broadcastedBySignature"> | Existing created transaction result fields |
Returns
XOInvitationTransactionBroadcastDetails
Signed broadcast metadata fields
Throws
PurposeNodeDerivationFailedError If invitation HD derivation fails
Throws
InvitationHdNodePrivateKeyInvalidError If the invitation node private key fails secp256k1 validation
Throws
CommitSigningHdNodePrivateKeyInvalidError If the result signing node private key fails secp256k1 validation
Throws
SchnorrSignatureGenerationFailedError If Schnorr signature generation fails
generateSchnorrSignedInvitationTransactionCreatedResult
const generateSchnorrSignedInvitationTransactionCreatedResult: (params) => Pick<XOInvitationTransactionResult,
| "createdAtTimestamp"
| "createdByEntityIdentifier"
| "createdBySignature"
| "transactionHash">;Defined in: source/signing.ts:417
Generates a Schnorr-signed invitation transaction created result. The signing key is derived as a non-hardened child of the invitation node using the UTF-8 encoding of the result signing message.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { createdAtTimestamp: XOInvitationTimestamp; invitationIdentifier: XOInvitationIdentifier; network: HdKeyNetwork; purposeHDNode: HdPrivateNodeValid; rootCommitIdentifier: XOInvitationCommitIdentifier; templateIdentifier: XOTemplateIdentifier; transactionHash: XOInvitationTransactionHash; } | Parameters for generating the signed transaction created result |
params.createdAtTimestamp | XOInvitationTimestamp | Timestamp when the transaction was created |
params.invitationIdentifier | XOInvitationIdentifier | Invitation identifier |
params.network | HdKeyNetwork | Used for encoding entity identifiers (xpub for mainnet, tpub for testnet) |
params.purposeHDNode | HdPrivateNodeValid | XO purpose HD node |
params.rootCommitIdentifier | XOInvitationCommitIdentifier | Root commit identifier |
params.templateIdentifier | XOTemplateIdentifier | Template identifier |
params.transactionHash | XOInvitationTransactionHash | On chain transaction hash |
Returns
Pick<XOInvitationTransactionResult, | "createdAtTimestamp" | "createdByEntityIdentifier" | "createdBySignature" | "transactionHash">
Signed transaction created result fields
Throws
PurposeNodeDerivationFailedError If invitation HD derivation fails
Throws
InvitationHdNodePrivateKeyInvalidError If the invitation node private key fails secp256k1 validation
Throws
CommitSigningHdNodePrivateKeyInvalidError If the result signing node private key fails secp256k1 validation
Throws
SchnorrSignatureGenerationFailedError If Schnorr signature generation fails
getPurposePath
const getPurposePath: (network) => string;Defined in: source/utils.ts:37
Returns the XO BIP43 purpose derivation path for the given network. Mainnet uses purpose index 2415 (m/2415') and testnet uses 42415 (m/42415'), ensuring complete key separation at the derivation level.
Parameters
| Parameter | Type | Description |
|---|---|---|
network | HdKeyNetwork | Target network (mainnet or testnet) |
Returns
string
Purpose path string
NON_HARDENED_INDEX_MAX
const NON_HARDENED_INDEX_MAX: 2147483647 = 2147483647;Defined in: source/defaults.ts:70
Bitmask for extracting a valid 31-bit BIP32 child index. BIP32 child indices are 32-bit unsigned integers where 0 to 2^31-1 is for normal derivation and 2^31 to 2^32-1 is for hardened derivation. This mask ensures derived indices stay in the valid range (0 to 2,147,483,647).
https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
prepareMnemonic
const prepareMnemonic: (mnemonic) => string;Defined in: source/utils.ts:192
Trims, normalizes and validates the BIP39 mnemonic phrase. The returned string is used for seed derivation and deriving the account hash.
Parameters
| Parameter | Type | Description |
|---|---|---|
mnemonic | string | Raw BIP39 mnemonic phrase as entered by a user |
Returns
string
Normalized BIP39 mnemonic phrase
Throws
MnemonicInputTypeInvalidError If the phrase is not a string.
Throws
MnemonicNotProvidedError If the phrase is empty or only whitespace.
Throws
SeedDerivationFromMnemonicFailedError If decoding fails (invalid words or checksum).
SHA256_HASH_LENGTH
const SHA256_HASH_LENGTH: 32 = 32;Defined in: source/defaults.ts:75
Length of a SHA256 hash in bytes.
SIGNING_PAYLOAD_FIELD_DELIMITER
const SIGNING_PAYLOAD_FIELD_DELIMITER: "\u0000" = "\0";Defined in: source/defaults.ts:92
Separator used between fields in signing payloads to prevent two different sets of field values from producing the same payload. The null byte cannot appear in hex strings, xpub keys, or JSON output, making it safe to use as a separator here.
validateAccountHash
const validateAccountHash: (accountHash) => void;Defined in: source/utils.ts:239
Validates that the given account hash is a valid hex string of the expected length.
Parameters
| Parameter | Type | Description |
|---|---|---|
accountHash | string | The account hash to validate. |
Returns
void
Throws
AccountHashInputTypeInvalidError If the hash is not a string.
Throws
AccountHashHexLengthInvalidError If the hash does not have the expected character count.
Throws
AccountHashHexFormatInvalidError If the hash contains non-hex characters.
validatePathIndex
const validatePathIndex: (pathIndex) => number;Defined in: source/utils.ts:174
Validates that a given integer is a valid 31-bit BIP32 non-hardened child index (0 to 2,147,483,647) and returns it unchanged. Use this when deriving child keys incrementally rather than from data.
Parameters
| Parameter | Type | Description |
|---|---|---|
pathIndex | number | A non-negative integer within the non-hardened index range (0 to 2,147,483,647) |
Returns
number
The validated path index unchanged
Throws
PathIndexOutOfRangeError If index is negative, non-integer, or exceeds 2,147,483,647
verifyInvitationCommitSignature
const verifyInvitationCommitSignature: (params) => boolean;Defined in: source/signing.ts:388
Verifies a Schnorr signature for an invitation commit. Re-derives the commit public key from the entity identifier and the commit identifier and verifies the signature against the provided message.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { commitIdentifier: XOInvitationCommitIdentifier; entityIdentifier: XOInvitationEntityIdentifier; message: string; signature: XOInvitationSignature; } | Verification parameters |
params.commitIdentifier | XOInvitationCommitIdentifier | Commit identifier |
params.entityIdentifier | XOInvitationEntityIdentifier | Invitation entity identifier |
params.message | string | Message that was signed |
params.signature | XOInvitationSignature | Schnorr signature |
Returns
boolean
True if the signature is valid, false otherwise
Throws
InvitationPublicNodeDecodingFailedError If the invitation entity identifier is not a valid HD public key string
Throws
InvitationPublicNodeDerivationFailedError If child derivation fails
verifyInvitationDataResultSignature
const verifyInvitationDataResultSignature: (params) => boolean;Defined in: source/signing.ts:652
Verifies a Schnorr signature for an invitation data result.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { dataResult: XOInvitationDataResult; invitationIdentifier: XOInvitationIdentifier; } | Verification parameters. |
params.dataResult | XOInvitationDataResult | Data result row. |
params.invitationIdentifier | XOInvitationIdentifier | Invitation identifier. |
Returns
boolean
True if the signature is valid, false otherwise.
Throws
InvitationPublicNodeDecodingFailedError When createdByEntityIdentifier is invalid.
Throws
InvitationPublicNodeDerivationFailedError When child derivation fails.
verifyInvitationTransactionBroadcastedResultSignature
const verifyInvitationTransactionBroadcastedResultSignature: (params) => boolean;Defined in: source/signing.ts:627
Verifies a Schnorr signature for an invitation transaction broadcasted result.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { invitationIdentifier: XOInvitationIdentifier; transactionResult: XOInvitationTransactionResult & XOInvitationTransactionBroadcastDetails; } | Verification parameters. |
params.invitationIdentifier | XOInvitationIdentifier | Invitation identifier. |
params.transactionResult | XOInvitationTransactionResult & XOInvitationTransactionBroadcastDetails | Transaction result row. |
Returns
boolean
True if the signature is valid, false otherwise.
Throws
InvitationPublicNodeDecodingFailedError When broadcastedByEntityIdentifier is invalid.
Throws
InvitationPublicNodeDerivationFailedError When child derivation fails.
verifyInvitationTransactionCreatedResultSignature
const verifyInvitationTransactionCreatedResultSignature: (params) => boolean;Defined in: source/signing.ts:602
Verifies a Schnorr signature for an invitation transaction created result.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { invitationIdentifier: XOInvitationIdentifier; transactionResult: Omit<XOInvitationTransactionResult, | "broadcastedAtTimestamp" | "broadcastedByEntityIdentifier" | "broadcastedBySignature">; } | Verification parameters. |
params.invitationIdentifier | XOInvitationIdentifier | Invitation identifier. |
params.transactionResult | Omit<XOInvitationTransactionResult, | "broadcastedAtTimestamp" | "broadcastedByEntityIdentifier" | "broadcastedBySignature"> | Transaction result row. |
Returns
boolean
True if the signature is valid, false otherwise.
Throws
InvitationPublicNodeDecodingFailedError When createdByEntityIdentifier is invalid.
Throws
InvitationPublicNodeDerivationFailedError When child derivation fails.
XO_PURPOSE_PATH_BY_NETWORK
const XO_PURPOSE_PATH_BY_NETWORK: Record<HdKeyNetwork, string>;Defined in: source/defaults.ts:20
Maps each supported network to its XO BIP43 base derivation path.