Skip to content

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 ​

bash
npm install @xo-cash/crypto

Usage ​

typescript
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 ​

mermaid
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]

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 MemberValueDescriptionDefined in
DataSigning0Keys for data signing (e.g. invitations and commits).source/defaults.ts:42
Encryption1Keys 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 MemberValueDescriptionDefined in
SigningAndSpending0Keys 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 ​

ts
new AccountHashHexFormatInvalidError(receivedValue): AccountHashHexFormatInvalidError;

Defined in: index.d.mts:256

Parameters ​
ParameterType
receivedValuestring
Returns ​

AccountHashHexFormatInvalidError

Overrides ​
ts
Error.constructor

Properties ​

PropertyModifierTypeDescriptionDefined in
receivedValuereadonlystringAccount 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 ​

ts
new AccountHashHexLengthInvalidError(receivedLength): AccountHashHexLengthInvalidError;

Defined in: index.d.mts:246

Parameters ​
ParameterType
receivedLengthnumber
Returns ​

AccountHashHexLengthInvalidError

Overrides ​
ts
Error.constructor

Properties ​

PropertyModifierTypeDescriptionDefined in
receivedLengthreadonlynumberCharacter 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 ​

ts
new AccountHashInputTypeInvalidError(receivedType): AccountHashInputTypeInvalidError;

Defined in: index.d.mts:236

Parameters ​
ParameterType
receivedTypestring
Returns ​

AccountHashInputTypeInvalidError

Overrides ​
ts
Error.constructor

Properties ​

PropertyModifierTypeDescriptionDefined in
receivedTypereadonlystringType 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 ​

ts
new CommitSigningHdNodePrivateKeyInvalidError(commitRelativePath): CommitSigningHdNodePrivateKeyInvalidError;

Defined in: index.d.mts:190

Parameters ​
ParameterType
commitRelativePathstring
Returns ​

CommitSigningHdNodePrivateKeyInvalidError

Overrides ​
ts
Error.constructor

Properties ​

PropertyModifierTypeDescriptionDefined in
commitRelativePathreadonlystringHD 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 ​

ts
new Crypto(seedBytes, options?): Crypto;

Defined in: index.d.mts:425

Creates a new Crypto instance from seed bytes.

Parameters ​
ParameterTypeDescription
seedBytesUint8ArraySeed bytes
options?CryptoConstructionOptionsConstruction options
Returns ​

Crypto

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() ​

ts
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 ​
ParameterTypeDescription
parametersScriptCompilationParametersCompiler 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() ​

ts
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' vs m/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 ​
ParameterTypeDescription
params{ rootCommitIdentifier: string; templateIdentifier: string; }Parameters for deriving the entity identifier
params.rootCommitIdentifierstringCommit identifier of the first commit this entity made to the invitation
params.templateIdentifierstringTemplate 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() ​

ts
derivePublicKey(keyReference): Uint8Array;

Defined in: source/crypto.ts:452

Derives the compressed public key using the template identifier and derivation index.

Parameters ​
ParameterTypeDescription
keyReferenceKeyReferenceTemplate 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() ​

ts
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() ​

ts
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() ​

ts
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 ​
ParameterTypeDescription
params{ actionIdentifier: string; invitationCommit: Omit<XOInvitationCommit, "signature" | "entityIdentifier">; invitationIdentifier: string; rootCommitIdentifier: string; templateIdentifier: string; }Options for signing the invitation commit
params.actionIdentifierstringAction identifier
params.invitationCommitOmit<XOInvitationCommit, "signature" | "entityIdentifier">Invitation commit without signature and entityIdentifier
params.invitationIdentifierstringInvitation identifier (included in signing payload)
params.rootCommitIdentifierstringCommit identifier of the first commit this entity made to the invitation
params.templateIdentifierstringTemplate identifier
Returns ​

XOInvitationCommit

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() ​

ts
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 ​
ParameterTypeDescription
params{ createdAtTimestamp: number; invitationIdentifier: string; rootCommitIdentifier: string; templateIdentifier: string; value: XOInvitationVariableValue; }Signing parameters for the data result
params.createdAtTimestampnumberTime the data value was created
params.invitationIdentifierstringInvitation the result belongs to
params.rootCommitIdentifierstringCommit identifier of the first commit this entity made to the invitation
params.templateIdentifierstringTemplate identifier
params.valueXOInvitationVariableValueResolved 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() ​

ts
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 ​
ParameterTypeDescription
params{ broadcastedAtTimestamp: number; invitationIdentifier: string; rootCommitIdentifier: string; templateIdentifier: string; transactionResult: Omit<XOInvitationTransactionResult, | "broadcastedAtTimestamp" | "broadcastedByEntityIdentifier" | "broadcastedBySignature">; }Signing parameters for the broadcast result fields
params.broadcastedAtTimestampnumberTime the transaction was broadcast to the network
params.invitationIdentifierstringInvitation the result belongs to
params.rootCommitIdentifierstringCommit identifier of the first commit this entity made to the invitation
params.templateIdentifierstringTemplate identifier
params.transactionResultOmit<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() ​

ts
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 ​
ParameterTypeDescription
params{ createdAtTimestamp: number; invitationIdentifier: string; rootCommitIdentifier: string; templateIdentifier: string; transactionHash: string; }Signing parameters for the created transaction result
params.createdAtTimestampnumberTime the transaction was created, before broadcasting
params.invitationIdentifierstringInvitation the result belongs to
params.rootCommitIdentifierstringCommit identifier of the first commit this entity made to the invitation
params.templateIdentifierstringTemplate identifier
params.transactionHashstringHash 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 ​

ts
new HashBytesLengthInvalidError(receivedLength): HashBytesLengthInvalidError;

Defined in: index.d.mts:87

Parameters ​
ParameterType
receivedLengthnumber
Returns ​

HashBytesLengthInvalidError

Overrides ​
ts
Error.constructor

Properties ​

PropertyModifierTypeDescriptionDefined in
receivedLengthreadonlynumberByte 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 ​

ts
new InvitationHdNodePrivateKeyInvalidError(invitationFullPath): InvitationHdNodePrivateKeyInvalidError;

Defined in: index.d.mts:177

Parameters ​
ParameterType
invitationFullPathstring
Returns ​

InvitationHdNodePrivateKeyInvalidError

Overrides ​
ts
Error.constructor

Properties ​

PropertyModifierTypeDescriptionDefined in
invitationFullPathreadonlystringFull 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 ​

ts
new InvitationPublicNodeDecodingFailedError(reason): InvitationPublicNodeDecodingFailedError;

Defined in: index.d.mts:218

Parameters ​
ParameterType
reasonstring
Returns ​

InvitationPublicNodeDecodingFailedError

Overrides ​
ts
Error.constructor

Properties ​

PropertyModifierTypeDescriptionDefined in
reasonreadonlystringReason 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 ​

ts
new InvitationPublicNodeDerivationFailedError(reason): InvitationPublicNodeDerivationFailedError;

Defined in: index.d.mts:226

Parameters ​
ParameterType
reasonstring
Returns ​

InvitationPublicNodeDerivationFailedError

Overrides ​
ts
Error.constructor

Properties ​

PropertyModifierTypeDescriptionDefined in
reasonreadonlystringReason 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 ​

ts
new MasterNodeDerivationFailedError(reason?): MasterNodeDerivationFailedError;

Defined in: index.d.mts:95

Parameters ​
ParameterType
reason?string
Returns ​

MasterNodeDerivationFailedError

Overrides ​
ts
Error.constructor

Properties ​

PropertyModifierTypeDescriptionDefined in
reason?readonlystringReason 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 ​

ts
new MnemonicInputTypeInvalidError(receivedType): MnemonicInputTypeInvalidError;

Defined in: index.d.mts:105

Parameters ​
ParameterType
receivedTypestring
Returns ​

MnemonicInputTypeInvalidError

Overrides ​
ts
Error.constructor

Properties ​

PropertyModifierTypeDescriptionDefined in
receivedTypereadonlystringType 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 ​

ts
new MnemonicNotProvidedError(): MnemonicNotProvidedError;

Defined in: source/errors.ts:54

Returns ​

MnemonicNotProvidedError

Overrides ​
ts
Error.constructor

PathIndexOutOfRangeError ​

Defined in: source/errors.ts:63

Thrown when path index is out of range.

Extends ​

  • Error

Constructors ​

Constructor ​

ts
new PathIndexOutOfRangeError(pathIndex): PathIndexOutOfRangeError;

Defined in: index.d.mts:117

Parameters ​
ParameterType
pathIndexnumber
Returns ​

PathIndexOutOfRangeError

Overrides ​
ts
Error.constructor

Properties ​

PropertyModifierTypeDescriptionDefined in
pathIndexreadonlynumberPath 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 ​

ts
new PublicKeyDerivationFailedError(reason): PublicKeyDerivationFailedError;

Defined in: index.d.mts:266

Parameters ​
ParameterType
reasonstring
Returns ​

PublicKeyDerivationFailedError

Overrides ​
ts
Error.constructor

Properties ​

PropertyModifierTypeDescriptionDefined in
reasonreadonlystringReason 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 ​

ts
new PurposeHDNodeDestroyedError(): PurposeHDNodeDestroyedError;

Defined in: source/errors.ts:78

Returns ​

PurposeHDNodeDestroyedError

Overrides ​
ts
Error.constructor

PurposeHdNodePrivateKeyInvalidError ​

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 ​

ts
new PurposeHdNodePrivateKeyInvalidError(purposePath): PurposeHdNodePrivateKeyInvalidError;

Defined in: index.d.mts:151

Parameters ​
ParameterType
purposePathstring
Returns ​

PurposeHdNodePrivateKeyInvalidError

Overrides ​
ts
Error.constructor

Properties ​

PropertyModifierTypeDescriptionDefined in
purposePathreadonlystringHD 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 ​

ts
new PurposeNodeDerivationFailedError(path, reason?): PurposeNodeDerivationFailedError;

Defined in: index.d.mts:138

Parameters ​
ParameterType
pathstring
reason?string
Returns ​

PurposeNodeDerivationFailedError

Overrides ​
ts
Error.constructor

Properties ​

PropertyModifierTypeDescriptionDefined in
pathreadonlystringHD derivation path that failed.source/errors.ts:96
reason?readonlystringReason 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 ​

ts
new SchnorrSignatureGenerationFailedError(subjectIdentifier, reason?): SchnorrSignatureGenerationFailedError;

Defined in: index.d.mts:210

Parameters ​
ParameterType
subjectIdentifierstring
reason?string
Returns ​

SchnorrSignatureGenerationFailedError

Overrides ​
ts
Error.constructor

Properties ​

PropertyModifierTypeDescriptionDefined in
reason?readonlystringReason reported by the secp256k1 implementation, when one is given.source/errors.ts:218
subjectIdentifierreadonlystringIdentifier 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 ​

ts
new SeedDerivationFromMnemonicFailedError(reason): SeedDerivationFromMnemonicFailedError;

Defined in: index.d.mts:198

Parameters ​
ParameterType
reasonstring
Returns ​

SeedDerivationFromMnemonicFailedError

Overrides ​
ts
Error.constructor

Properties ​

PropertyModifierTypeDescriptionDefined in
reasonreadonlystringReason 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 ​

ts
new UseCaseHdNodePrivateKeyInvalidError(fullPath): UseCaseHdNodePrivateKeyInvalidError;

Defined in: index.d.mts:164

Parameters ​
ParameterType
fullPathstring
Returns ​

UseCaseHdNodePrivateKeyInvalidError

Overrides ​
ts
Error.constructor

Properties ​

PropertyModifierTypeDescriptionDefined in
fullPathreadonlystringFull HD derivation path of the use case child node.source/errors.ts:143

CryptoConstructionOptions ​

ts
type CryptoConstructionOptions = object;

Defined in: source/types.ts:23

Options for constructing the Crypto class (see crypto.ts).

Properties ​

network? ​

ts
optional network?: HdKeyNetwork;

Defined in: source/types.ts:28

Only supports mainnet and testnet. Defaults to mainnet.


IncompleteScriptCompilation ​

ts
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 ​

ts
compilationErrors: ScriptCompilationErrorDetail[];

Defined in: source/types.ts:157

Compiler errors with their source position, missing identifier, and owning entity.

compilationStage ​

ts
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 ​

ts
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 ​

ts
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 ​

ts
scriptId: string;

Defined in: source/types.ts:146

Script that was compiled.


InvitationCommitParams ​

ts
type InvitationCommitParams = object;

Defined in: source/types.ts:34

Parameters for constructing a commit message.

Properties ​

actionIdentifier ​

ts
actionIdentifier: XOTemplateActionIdentifier;

Defined in: source/types.ts:50

The action identifier used in the invitation

commitIdentifier ​

ts
commitIdentifier: XOInvitationCommitIdentifier;

Defined in: source/types.ts:60

The commit identifier of the invitation commit

data ​

ts
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 ​

ts
invitationIdentifier: XOInvitationIdentifier;

Defined in: source/types.ts:55

The invitation identifier of the invitation

previousCommitIdentifier? ​

ts
optional previousCommitIdentifier?: XOInvitationCommitIdentifier;

Defined in: source/types.ts:65

The previous commit identifier in the invitation

templateIdentifier ​

ts
templateIdentifier: XOTemplateIdentifier;

Defined in: source/types.ts:45

The template identifier used in the invitation


InvitationDataResultSignedFields ​

ts
type InvitationDataResultSignedFields = Pick<XOInvitationDataResult, "value" | "createdAtTimestamp" | "createdByEntityIdentifier">;

Defined in: source/types.ts:190

Fields of invitation's data result.


InvitationTransactionBroadcastedResultSignedFields ​

ts
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 ​

ts
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 ​

ts
type KeyReference = object;

Defined in: source/types.ts:71

Key reference used to derive private key material.

Properties ​

derivationIndex ​

ts
derivationIndex: number;

Defined in: source/types.ts:81

Derivation index of the key.

templateIdentifier ​

ts
templateIdentifier: XOTemplateIdentifier;

Defined in: source/types.ts:76

Template the key was generated under.


ScriptCompilationErrorDetail ​

ts
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 ​

ts
message: string;

Defined in: source/types.ts:119

Compiler error message.

missingIdentifier? ​

ts
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? ​

ts
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 ​

ts
range: Range;

Defined in: source/types.ts:124

Position in the script source the error traces to.


ScriptCompilationParameters ​

ts
type ScriptCompilationParameters = object;

Defined in: source/types.ts:87

What Crypto#compileScript compiles.

Properties ​

compilerConfiguration ​

ts
compilerConfiguration: CompilerConfiguration<CompilationContextBch>;

Defined in: source/types.ts:92

Libauth compiler configuration with the scripts, variables, and locking types to compile with.

data ​

ts
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 ​

ts
keyReferences: Record<string, KeyReference>;

Defined in: source/types.ts:107

Key reference for each key variable the script may use.

scriptId ​

ts
scriptId: string;

Defined in: source/types.ts:97

Script to compile.


ACCOUNT_HASH_HEX_LENGTH ​

ts
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 ​

ts
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 ​

ts
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 ​

ts
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 ​

ts
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 ​

ParameterTypeDescription
paramsInvitationCommitParamsInvitation commit options

Returns ​

string

Message string to be hashed and signed


buildInvitationDataResultSigningMessage ​

ts
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 ​

ParameterTypeDescription
invitationIdentifierXOInvitationIdentifierInvitation the result belongs to.
dataResultFieldsInvitationDataResultSignedFieldsThe fields the signature covers.

Returns ​

string

Deterministic message string.


buildInvitationTransactionBroadcastedResultSigningMessage ​

ts
const buildInvitationTransactionBroadcastedResultSigningMessage: (invitationIdentifier, broadcastResultFields) => string;

Defined in: source/utils.ts:95

Builds the signed message for a transaction result broadcast signature.

Parameters ​

ParameterTypeDescription
invitationIdentifierXOInvitationIdentifierInvitation the result belongs to.
broadcastResultFieldsInvitationTransactionBroadcastedResultSignedFieldsThe created and broadcast fields the signature covers.

Returns ​

string

Deterministic message string.


buildInvitationTransactionCreatedResultSigningMessage ​

ts
const buildInvitationTransactionCreatedResultSigningMessage: (invitationIdentifier, createdResultFields) => string;

Defined in: source/utils.ts:77

Builds the signed message for a transaction result created signature.

Parameters ​

ParameterTypeDescription
invitationIdentifierXOInvitationIdentifierInvitation the result belongs to.
createdResultFieldsInvitationTransactionCreatedResultSignedFieldsThe created fields the signature covers.

Returns ​

string

Deterministic message string.


computeAccountHash ​

ts
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 ​

ParameterTypeDescription
mnemonicstringNormalized 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 ​

ts
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 ​

ParameterTypeDescription
mnemonicstringBIP39 mnemonic phrase (12+ words)
passphrase?stringBIP39 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 ​

ts
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 ​

ParameterTypeDescription
hashBytesUint8ArrayA 32-byte SHA256 hash

Returns ​

number

Path index (31-bit unsigned integer, 0 to 2,147,483,647)


DEFAULT_NETWORK ​

ts
const DEFAULT_NETWORK: HdKeyNetwork;

Defined in: source/defaults.ts:80

Only supports mainnet and testnet. Defaults to mainnet.


generateSchnorrSignedInvitationDataResult ​

ts
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 ​

ParameterTypeDescription
params{ createdAtTimestamp: XOInvitationTimestamp; invitationIdentifier: XOInvitationIdentifier; network: HdKeyNetwork; purposeHDNode: HdPrivateNodeValid; rootCommitIdentifier: XOInvitationCommitIdentifier; templateIdentifier: XOTemplateIdentifier; value: XOInvitationVariableValue; }Parameters for generating the signed data result
params.createdAtTimestampXOInvitationTimestampTimestamp when the data result was created
params.invitationIdentifierXOInvitationIdentifierInvitation identifier
params.networkHdKeyNetworkUsed for encoding entity identifiers (xpub for mainnet, tpub for testnet)
params.purposeHDNodeHdPrivateNodeValidXO purpose HD node
params.rootCommitIdentifierXOInvitationCommitIdentifierRoot commit identifier
params.templateIdentifierXOTemplateIdentifierTemplate identifier
params.valueXOInvitationVariableValueResolved 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 ​

ts
const generateSchnorrSignedInvitationTransactionBroadcastedResult: (params) => XOInvitationTransactionBroadcastDetails;

Defined in: source/signing.ts:480

Generates Schnorr-signed broadcast metadata for an existing invitation transaction created result.

Parameters ​

ParameterTypeDescription
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.broadcastedAtTimestampXOInvitationTimestampTimestamp when the transaction was broadcast
params.invitationIdentifierXOInvitationIdentifierInvitation identifier
params.networkHdKeyNetworkUsed for encoding entity identifiers (xpub for mainnet, tpub for testnet)
params.purposeHDNodeHdPrivateNodeValidXO purpose HD node
params.rootCommitIdentifierXOInvitationCommitIdentifierRoot commit identifier
params.templateIdentifierXOTemplateIdentifierTemplate identifier
params.transactionResultOmit<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 ​

ts
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 ​

ParameterTypeDescription
params{ createdAtTimestamp: XOInvitationTimestamp; invitationIdentifier: XOInvitationIdentifier; network: HdKeyNetwork; purposeHDNode: HdPrivateNodeValid; rootCommitIdentifier: XOInvitationCommitIdentifier; templateIdentifier: XOTemplateIdentifier; transactionHash: XOInvitationTransactionHash; }Parameters for generating the signed transaction created result
params.createdAtTimestampXOInvitationTimestampTimestamp when the transaction was created
params.invitationIdentifierXOInvitationIdentifierInvitation identifier
params.networkHdKeyNetworkUsed for encoding entity identifiers (xpub for mainnet, tpub for testnet)
params.purposeHDNodeHdPrivateNodeValidXO purpose HD node
params.rootCommitIdentifierXOInvitationCommitIdentifierRoot commit identifier
params.templateIdentifierXOTemplateIdentifierTemplate identifier
params.transactionHashXOInvitationTransactionHashOn 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 ​

ts
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 ​

ParameterTypeDescription
networkHdKeyNetworkTarget network (mainnet or testnet)

Returns ​

string

Purpose path string


NON_HARDENED_INDEX_MAX ​

ts
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 ​

ts
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 ​

ParameterTypeDescription
mnemonicstringRaw 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 ​

ts
const SHA256_HASH_LENGTH: 32 = 32;

Defined in: source/defaults.ts:75

Length of a SHA256 hash in bytes.


SIGNING_PAYLOAD_FIELD_DELIMITER ​

ts
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 ​

ts
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 ​

ParameterTypeDescription
accountHashstringThe 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 ​

ts
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 ​

ParameterTypeDescription
pathIndexnumberA 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 ​

ts
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 ​

ParameterTypeDescription
params{ commitIdentifier: XOInvitationCommitIdentifier; entityIdentifier: XOInvitationEntityIdentifier; message: string; signature: XOInvitationSignature; }Verification parameters
params.commitIdentifierXOInvitationCommitIdentifierCommit identifier
params.entityIdentifierXOInvitationEntityIdentifierInvitation entity identifier
params.messagestringMessage that was signed
params.signatureXOInvitationSignatureSchnorr 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 ​

ts
const verifyInvitationDataResultSignature: (params) => boolean;

Defined in: source/signing.ts:652

Verifies a Schnorr signature for an invitation data result.

Parameters ​

ParameterTypeDescription
params{ dataResult: XOInvitationDataResult; invitationIdentifier: XOInvitationIdentifier; }Verification parameters.
params.dataResultXOInvitationDataResultData result row.
params.invitationIdentifierXOInvitationIdentifierInvitation identifier.

Returns ​

boolean

True if the signature is valid, false otherwise.

Throws ​

InvitationPublicNodeDecodingFailedError When createdByEntityIdentifier is invalid.

Throws ​

InvitationPublicNodeDerivationFailedError When child derivation fails.


verifyInvitationTransactionBroadcastedResultSignature ​

ts
const verifyInvitationTransactionBroadcastedResultSignature: (params) => boolean;

Defined in: source/signing.ts:627

Verifies a Schnorr signature for an invitation transaction broadcasted result.

Parameters ​

ParameterTypeDescription
params{ invitationIdentifier: XOInvitationIdentifier; transactionResult: XOInvitationTransactionResult & XOInvitationTransactionBroadcastDetails; }Verification parameters.
params.invitationIdentifierXOInvitationIdentifierInvitation identifier.
params.transactionResultXOInvitationTransactionResult & XOInvitationTransactionBroadcastDetailsTransaction 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 ​

ts
const verifyInvitationTransactionCreatedResultSignature: (params) => boolean;

Defined in: source/signing.ts:602

Verifies a Schnorr signature for an invitation transaction created result.

Parameters ​

ParameterTypeDescription
params{ invitationIdentifier: XOInvitationIdentifier; transactionResult: Omit<XOInvitationTransactionResult, | "broadcastedAtTimestamp" | "broadcastedByEntityIdentifier" | "broadcastedBySignature">; }Verification parameters.
params.invitationIdentifierXOInvitationIdentifierInvitation identifier.
params.transactionResultOmit<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 ​

ts
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.