@orbinum/sdk 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +42 -2
- package/dist/index.d.ts +42 -2
- package/dist/index.js +76 -15
- package/dist/index.mjs +81 -22
- package/package.json +2 -1
package/dist/index.d.mts
CHANGED
|
@@ -664,6 +664,13 @@ type NoteInput = {
|
|
|
664
664
|
counterpartyPk?: bigint;
|
|
665
665
|
/** Circuit version to stamp on the note. Defaults to `CURRENT_CIRCUIT_VERSION`. */
|
|
666
666
|
circuitVersion?: number;
|
|
667
|
+
/**
|
|
668
|
+
* 32-byte ephemeral secret for the memo ECDH. Self-notes pass a
|
|
669
|
+
* deterministic one (deriveSelfEphSk) so a cold restore recognizes them by
|
|
670
|
+
* ephPk equality with no trial ECDH. Ignored on the stealth path (it
|
|
671
|
+
* generates its own coordinated ephSk). Default: random.
|
|
672
|
+
*/
|
|
673
|
+
ephSkOverride?: Uint8Array;
|
|
667
674
|
};
|
|
668
675
|
/**
|
|
669
676
|
* Circuit version notes are created under today. A note carries its version
|
|
@@ -1920,7 +1927,8 @@ declare class NoteBuilder {
|
|
|
1920
1927
|
/**
|
|
1921
1928
|
* EncryptedMemo — TypeScript implementation of Orbinum's encrypted note memo.
|
|
1922
1929
|
*
|
|
1923
|
-
*
|
|
1930
|
+
* Native TypeScript implementation — no WASM required. This file IS the
|
|
1931
|
+
* normative memo format: the chain treats memos as opaque 180-byte blobs.
|
|
1924
1932
|
*
|
|
1925
1933
|
* Layout (180 bytes, ECDH):
|
|
1926
1934
|
* nonce(12) || ciphertext+MAC(136) || ephPk_packed(32) = 180
|
|
@@ -2048,6 +2056,31 @@ declare const EncryptedMemo: {
|
|
|
2048
2056
|
*/
|
|
2049
2057
|
declare function deriveViewTag(sharedSecret: Uint8Array): number;
|
|
2050
2058
|
|
|
2059
|
+
/**
|
|
2060
|
+
* Derive the deterministic 32-byte ephemeral secret for self-note `index`.
|
|
2061
|
+
* Feed it to EncryptedMemo.encrypt / NoteBuilder.build as `ephSkOverride`.
|
|
2062
|
+
*/
|
|
2063
|
+
declare function deriveSelfEphSk(spendingKey: bigint, index: number): Uint8Array;
|
|
2064
|
+
/** One precomputed self-note window entry. */
|
|
2065
|
+
interface SelfEphWindowEntry {
|
|
2066
|
+
index: number;
|
|
2067
|
+
/** 0x-prefixed LE-packed ephPk — byte-identical to the memo's last 32 bytes. */
|
|
2068
|
+
ephPkHex: string;
|
|
2069
|
+
/** ECDH shared secret vs the wallet's own ivk — feeds decryptWithSharedSecret. */
|
|
2070
|
+
sharedSecret: Uint8Array;
|
|
2071
|
+
}
|
|
2072
|
+
/**
|
|
2073
|
+
* Precompute the self-note discovery window [from, from+count): for each
|
|
2074
|
+
* index, the ephPk the wallet would have published and the shared secret
|
|
2075
|
+
* needed to decrypt the memo. One EC pass up front; scanning then matches
|
|
2076
|
+
* hints by ephPk hex equality with no per-hint EC work.
|
|
2077
|
+
*
|
|
2078
|
+
* @param spendingKey Wallet spending key (the seed of the derivation).
|
|
2079
|
+
* @param ivkPacked The wallet's OWN 32-byte LE packed viewing public key —
|
|
2080
|
+
* self memos are encrypted to it.
|
|
2081
|
+
*/
|
|
2082
|
+
declare function selfEphWindow(spendingKey: bigint, ivkPacked: Uint8Array, from: number, count: number): SelfEphWindowEntry[];
|
|
2083
|
+
|
|
2051
2084
|
/**
|
|
2052
2085
|
* NoteDecryptor
|
|
2053
2086
|
*
|
|
@@ -2081,6 +2114,13 @@ interface TryDecryptOptions {
|
|
|
2081
2114
|
* legacy memos carry a random byte there and would be silently dropped.
|
|
2082
2115
|
*/
|
|
2083
2116
|
viewTag?: boolean;
|
|
2117
|
+
/**
|
|
2118
|
+
* Precomputed ECDH shared secret (self-note discovery: the caller matched
|
|
2119
|
+
* the hint's ephPk against a selfEphWindow and already holds the secret).
|
|
2120
|
+
* Skips the ECDH and the view-tag gate entirely; the decrypt + commitment
|
|
2121
|
+
* check still validate the note as usual.
|
|
2122
|
+
*/
|
|
2123
|
+
sharedSecret?: Uint8Array;
|
|
2084
2124
|
}
|
|
2085
2125
|
/**
|
|
2086
2126
|
* Attempt to decrypt an on-chain commitment using the recipient's viewing secret key.
|
|
@@ -4221,4 +4261,4 @@ interface ExtrinsicFailedData {
|
|
|
4221
4261
|
dispatch_info: DispatchInfo;
|
|
4222
4262
|
}
|
|
4223
4263
|
|
|
4224
|
-
export { type AccountListing, type AccountMappedData, type AccountMappedEvent, type AccountMappingCall, type AccountMappingEvent, AccountMappingModule, AccountMappingPrecompile, type AccountMetadata, type AccountUnmappedEvent, type ActiveVersionSetEvent, type AddChainLinkArgs, type AddChainLinkParams, type AddSupportedChainArgs, type AliasFullIdentity, type AliasInfo, type AliasListedForSaleEvent, type AliasOnSaleData, type AliasRegisteredData, type AliasRegisteredEvent, type AliasReleasedEvent, type AliasSaleCancelledEvent, type AliasSoldData, type AliasSoldEvent, type AliasTransferredData, type AliasTransferredEvent, type AssetRegisteredEvent, type AssetUnverifiedEvent, type AssetVerifiedEvent, BABYJUB_SUBORDER, BN254_R, type BatchRegisterVerificationKeysArgs, type BatchVerificationKeysRegisteredEvent, type BlockInfo, type BuyAliasArgs, type Bytes32, CURRENT_CIRCUIT_VERSION, type ChainInfo, type ChainLink, type ChainLinkAddedEvent, type ChainLinkRemovedEvent, CircuitId, CircuitId as CircuitIdType, CircuitVersionResolver, type ClaimShieldedFeesParams, type ClientProviderConfig, type CommitmentsInsertedEvent, type CommitmentsInsertedEventData, type ConnectionStatus, CryptoPrecompiles, type DecodedAddChainLinkArgs, type DecodedBatchArgs, type DecodedDispatchAsPrivateLinkArgs, type DecodedEthereumTransactArgs, type DecodedEvmCallArgs, type DecodedPrecompile, type DecodedPrivateTransferArgs, type DecodedPutAliasForSaleArgs, type DecodedRegisterAliasArgs, type DecodedRemarkArgs, type DecodedRevealPrivateLinkArgs, type DecodedSetAccountMetadataArgs, type DecodedShieldArgs, type DecodedShieldBatchArgs, type DecodedShieldBatchOperation, type DecodedSudoArgs, type DecodedTransferAllArgs, type DecodedTransferArgs, type DecodedTransferKeepAliveArgs, type DecodedUnshieldArgs, type DecryptedMemo, type DispatchAsLinkedAccountArgs, type DispatchAsLinkedParams, type DispatchAsPrivateLinkArgs, type DispatchError, type DispatchInfo, type DynamicBuilder, ENCRYPTED_MEMO_SIZE, EncryptedMemo, type EncryptedNoteRecord, type EndowedEventData, type EthereumExecutedData, type EventData, type EventPhase, type EventRecord, type EvmAddressInfo, type EvmBlock, EvmClient, type EvmExecutedData, type EvmExitReason, EvmExplorer, type EvmLog, type EvmSigner, type EvmTransaction, type EvmTxRequest, type EvmTxSummary, type ExtrinsicDecoder, type ExtrinsicFailedData, type ExtrinsicSuccessData, type FeeClaimProofInputs, type FormatOptions, KNOWN_PRECOMPILES, type KnownPrecompileInfo, type ListingInfo, type MerkleRootUpdatedData, type MerkleRootUpdatedEvent, type MerkleTreeInfo, type MetadataUpdatedEvent, NoteBuilder, type NoteDisclosure, type NoteInput, type NoteStatusUpdate, type NullifiersSpentEvent, type NullifiersSpentEventData, OrbinumClient, type OrbinumClientConfig, OrbinumClientProvider, PRECOMPILE_ADDR, PrivacyKeyManager, type PrivacyMerkleProof, PrivacyModule, type PrivateChainLinkAddedEvent, type PrivateChainLinkRemovedEvent, type PrivateChainLinkRevealedEvent, type PrivateLink, type PrivateLinkDispatchExecutedEvent, type PrivateTransferArgs, type PrivateTransferInput, type PrivateTransferOutput, type PrivateTransferParams, type PrivateTransferProofInputs, type ProofVerificationFailedEvent, type ProofVerifiedEvent, type ProxyCallExecutedEvent, type PutAliasOnSaleArgs, type PutOnSaleParams, type RawBlock, type RawBlockHeader, type RawTransferInput, type RawTransferOutput, type RegisterAliasArgs, type RegisterAssetArgs, type RegisterPrivateLinkArgs, type RegisterVerificationKeyArgs, type RelayerInfo, RelayerStatusModule, type RemoveChainLinkArgs, type RemovePrivateLinkArgs, type RemoveSupportedChainArgs, type RemoveVerificationKeyArgs, type ReservedEventData, type ResolvedAlias, type ResolvedSpendVersion, type RevealPrivateLinkArgs, type RpcV2MerkleProof, type RpcV2NullifierStatus, type RpcV2PoolAssetBalance, type RpcV2PoolStats, SLIP0044_NAMESPACE, type ScanCommitment, type SetAccountMetadataArgs, type SetActiveVersionArgs, type SetMetadataParams, type ShieldArgs, type ShieldBatchArgs, type ShieldBatchItem, type ShieldBatchParams, type ShieldOperation, type ShieldParams, type ShieldedEvent, type ShieldedEventData, type ShieldedPoolCall, type ShieldedPoolEvent, ShieldedPoolModule, ShieldedPoolPrecompile, SignatureScheme, type StatusChangeEvent, type StatusListener, SubstrateClient, type SupportedChain, type SupportedChainAddedEvent, type SupportedChainRemovedEvent, type SystemHealth, type TokenInfo, type TokenTransfer, type TransferAliasArgs, type TransferEventData, type TransferInputNote, type TransferOutputNote, type TryDecryptOptions, type TxResult, type UnsafeTxOptions, type UnshieldArgs, type UnshieldParams, type UnshieldProofInputs, type UnshieldedEvent, type UnshieldedEventData, type UnverifyAssetArgs, VaultLockedError, type VerificationKeyRegisteredEvent, type VerificationKeyRemovedEvent, type VerifyAssetArgs, type VerifyProofArgs, type VkEntry, type ZkNote, type ZkVerifierCall, type ZkVerifierCircuitVersionInfo, type ZkVerifierEvent, type ZkVerifierHistoricalVersion, ZkVerifierModule, type ZkVerifierVersionStats, type ZkVerifierVkHash, accountIdHexToSs58, addressToAccountIdHex, applyNoteStatus, bigintTo32Be, bigintTo32Le, bigintTo32LeArr, blindTag, buildDummyTransferInput, bytesToBigintLE, computeNullifier, computePathIndices, createNoteDisclosureKey, decodeNoteDisclosureKey, decodePrecompileCalldata, decryptJson, decryptNoteRecord, deriveMasterKeyBytes, deriveOwnerPk, deriveSpendingKeyFromSignature, deriveSpendingKeyMessage, deriveStealthOwnerPk, deriveStealthSk, deriveVaultBlindKey, deriveVaultKey, deriveViewTag, deriveViewingPublicKey, deriveViewingSecretKey, encryptJson, encryptNote, ensureHexPrefix, evmAddressToAccountId, evmToImplicitSubstrate, evmToMappedAccountHex, evmToSubstrate, formatBalance, formatORB, fromBase64, fromHex, generateFeeClaimProof, generateTransferProof, generateUnshieldProof, getPrecompileLabel, hexToBigint, hexToNumber, implicitSubstrateToEvm, isEvmAddress, isImplicitEvmAccount, isSs58, isSubstrateAddress, isUnifiedAddress, leHexToBigint, mapExtrinsicArgs, mapZkEventData, normalizeEvmAddress, noteBlindTag, randomBlinding, recoverOwnerPkPoint, selectNotes, shortHash, substrateSs58ToAccountIdHex, substrateToEvm, toBase64, toHex, toTxResult, truncateMiddle, tryDecryptNote, tryDecryptNoteVerbose, vaultReplacer, vaultReviver };
|
|
4264
|
+
export { type AccountListing, type AccountMappedData, type AccountMappedEvent, type AccountMappingCall, type AccountMappingEvent, AccountMappingModule, AccountMappingPrecompile, type AccountMetadata, type AccountUnmappedEvent, type ActiveVersionSetEvent, type AddChainLinkArgs, type AddChainLinkParams, type AddSupportedChainArgs, type AliasFullIdentity, type AliasInfo, type AliasListedForSaleEvent, type AliasOnSaleData, type AliasRegisteredData, type AliasRegisteredEvent, type AliasReleasedEvent, type AliasSaleCancelledEvent, type AliasSoldData, type AliasSoldEvent, type AliasTransferredData, type AliasTransferredEvent, type AssetRegisteredEvent, type AssetUnverifiedEvent, type AssetVerifiedEvent, BABYJUB_SUBORDER, BN254_R, type BatchRegisterVerificationKeysArgs, type BatchVerificationKeysRegisteredEvent, type BlockInfo, type BuyAliasArgs, type Bytes32, CURRENT_CIRCUIT_VERSION, type ChainInfo, type ChainLink, type ChainLinkAddedEvent, type ChainLinkRemovedEvent, CircuitId, CircuitId as CircuitIdType, CircuitVersionResolver, type ClaimShieldedFeesParams, type ClientProviderConfig, type CommitmentsInsertedEvent, type CommitmentsInsertedEventData, type ConnectionStatus, CryptoPrecompiles, type DecodedAddChainLinkArgs, type DecodedBatchArgs, type DecodedDispatchAsPrivateLinkArgs, type DecodedEthereumTransactArgs, type DecodedEvmCallArgs, type DecodedPrecompile, type DecodedPrivateTransferArgs, type DecodedPutAliasForSaleArgs, type DecodedRegisterAliasArgs, type DecodedRemarkArgs, type DecodedRevealPrivateLinkArgs, type DecodedSetAccountMetadataArgs, type DecodedShieldArgs, type DecodedShieldBatchArgs, type DecodedShieldBatchOperation, type DecodedSudoArgs, type DecodedTransferAllArgs, type DecodedTransferArgs, type DecodedTransferKeepAliveArgs, type DecodedUnshieldArgs, type DecryptedMemo, type DispatchAsLinkedAccountArgs, type DispatchAsLinkedParams, type DispatchAsPrivateLinkArgs, type DispatchError, type DispatchInfo, type DynamicBuilder, ENCRYPTED_MEMO_SIZE, EncryptedMemo, type EncryptedNoteRecord, type EndowedEventData, type EthereumExecutedData, type EventData, type EventPhase, type EventRecord, type EvmAddressInfo, type EvmBlock, EvmClient, type EvmExecutedData, type EvmExitReason, EvmExplorer, type EvmLog, type EvmSigner, type EvmTransaction, type EvmTxRequest, type EvmTxSummary, type ExtrinsicDecoder, type ExtrinsicFailedData, type ExtrinsicSuccessData, type FeeClaimProofInputs, type FormatOptions, KNOWN_PRECOMPILES, type KnownPrecompileInfo, type ListingInfo, type MerkleRootUpdatedData, type MerkleRootUpdatedEvent, type MerkleTreeInfo, type MetadataUpdatedEvent, NoteBuilder, type NoteDisclosure, type NoteInput, type NoteStatusUpdate, type NullifiersSpentEvent, type NullifiersSpentEventData, OrbinumClient, type OrbinumClientConfig, OrbinumClientProvider, PRECOMPILE_ADDR, PrivacyKeyManager, type PrivacyMerkleProof, PrivacyModule, type PrivateChainLinkAddedEvent, type PrivateChainLinkRemovedEvent, type PrivateChainLinkRevealedEvent, type PrivateLink, type PrivateLinkDispatchExecutedEvent, type PrivateTransferArgs, type PrivateTransferInput, type PrivateTransferOutput, type PrivateTransferParams, type PrivateTransferProofInputs, type ProofVerificationFailedEvent, type ProofVerifiedEvent, type ProxyCallExecutedEvent, type PutAliasOnSaleArgs, type PutOnSaleParams, type RawBlock, type RawBlockHeader, type RawTransferInput, type RawTransferOutput, type RegisterAliasArgs, type RegisterAssetArgs, type RegisterPrivateLinkArgs, type RegisterVerificationKeyArgs, type RelayerInfo, RelayerStatusModule, type RemoveChainLinkArgs, type RemovePrivateLinkArgs, type RemoveSupportedChainArgs, type RemoveVerificationKeyArgs, type ReservedEventData, type ResolvedAlias, type ResolvedSpendVersion, type RevealPrivateLinkArgs, type RpcV2MerkleProof, type RpcV2NullifierStatus, type RpcV2PoolAssetBalance, type RpcV2PoolStats, SLIP0044_NAMESPACE, type ScanCommitment, type SelfEphWindowEntry, type SetAccountMetadataArgs, type SetActiveVersionArgs, type SetMetadataParams, type ShieldArgs, type ShieldBatchArgs, type ShieldBatchItem, type ShieldBatchParams, type ShieldOperation, type ShieldParams, type ShieldedEvent, type ShieldedEventData, type ShieldedPoolCall, type ShieldedPoolEvent, ShieldedPoolModule, ShieldedPoolPrecompile, SignatureScheme, type StatusChangeEvent, type StatusListener, SubstrateClient, type SupportedChain, type SupportedChainAddedEvent, type SupportedChainRemovedEvent, type SystemHealth, type TokenInfo, type TokenTransfer, type TransferAliasArgs, type TransferEventData, type TransferInputNote, type TransferOutputNote, type TryDecryptOptions, type TxResult, type UnsafeTxOptions, type UnshieldArgs, type UnshieldParams, type UnshieldProofInputs, type UnshieldedEvent, type UnshieldedEventData, type UnverifyAssetArgs, VaultLockedError, type VerificationKeyRegisteredEvent, type VerificationKeyRemovedEvent, type VerifyAssetArgs, type VerifyProofArgs, type VkEntry, type ZkNote, type ZkVerifierCall, type ZkVerifierCircuitVersionInfo, type ZkVerifierEvent, type ZkVerifierHistoricalVersion, ZkVerifierModule, type ZkVerifierVersionStats, type ZkVerifierVkHash, accountIdHexToSs58, addressToAccountIdHex, applyNoteStatus, bigintTo32Be, bigintTo32Le, bigintTo32LeArr, blindTag, buildDummyTransferInput, bytesToBigintLE, computeNullifier, computePathIndices, createNoteDisclosureKey, decodeNoteDisclosureKey, decodePrecompileCalldata, decryptJson, decryptNoteRecord, deriveMasterKeyBytes, deriveOwnerPk, deriveSelfEphSk, deriveSpendingKeyFromSignature, deriveSpendingKeyMessage, deriveStealthOwnerPk, deriveStealthSk, deriveVaultBlindKey, deriveVaultKey, deriveViewTag, deriveViewingPublicKey, deriveViewingSecretKey, encryptJson, encryptNote, ensureHexPrefix, evmAddressToAccountId, evmToImplicitSubstrate, evmToMappedAccountHex, evmToSubstrate, formatBalance, formatORB, fromBase64, fromHex, generateFeeClaimProof, generateTransferProof, generateUnshieldProof, getPrecompileLabel, hexToBigint, hexToNumber, implicitSubstrateToEvm, isEvmAddress, isImplicitEvmAccount, isSs58, isSubstrateAddress, isUnifiedAddress, leHexToBigint, mapExtrinsicArgs, mapZkEventData, normalizeEvmAddress, noteBlindTag, randomBlinding, recoverOwnerPkPoint, selectNotes, selfEphWindow, shortHash, substrateSs58ToAccountIdHex, substrateToEvm, toBase64, toHex, toTxResult, truncateMiddle, tryDecryptNote, tryDecryptNoteVerbose, vaultReplacer, vaultReviver };
|
package/dist/index.d.ts
CHANGED
|
@@ -664,6 +664,13 @@ type NoteInput = {
|
|
|
664
664
|
counterpartyPk?: bigint;
|
|
665
665
|
/** Circuit version to stamp on the note. Defaults to `CURRENT_CIRCUIT_VERSION`. */
|
|
666
666
|
circuitVersion?: number;
|
|
667
|
+
/**
|
|
668
|
+
* 32-byte ephemeral secret for the memo ECDH. Self-notes pass a
|
|
669
|
+
* deterministic one (deriveSelfEphSk) so a cold restore recognizes them by
|
|
670
|
+
* ephPk equality with no trial ECDH. Ignored on the stealth path (it
|
|
671
|
+
* generates its own coordinated ephSk). Default: random.
|
|
672
|
+
*/
|
|
673
|
+
ephSkOverride?: Uint8Array;
|
|
667
674
|
};
|
|
668
675
|
/**
|
|
669
676
|
* Circuit version notes are created under today. A note carries its version
|
|
@@ -1920,7 +1927,8 @@ declare class NoteBuilder {
|
|
|
1920
1927
|
/**
|
|
1921
1928
|
* EncryptedMemo — TypeScript implementation of Orbinum's encrypted note memo.
|
|
1922
1929
|
*
|
|
1923
|
-
*
|
|
1930
|
+
* Native TypeScript implementation — no WASM required. This file IS the
|
|
1931
|
+
* normative memo format: the chain treats memos as opaque 180-byte blobs.
|
|
1924
1932
|
*
|
|
1925
1933
|
* Layout (180 bytes, ECDH):
|
|
1926
1934
|
* nonce(12) || ciphertext+MAC(136) || ephPk_packed(32) = 180
|
|
@@ -2048,6 +2056,31 @@ declare const EncryptedMemo: {
|
|
|
2048
2056
|
*/
|
|
2049
2057
|
declare function deriveViewTag(sharedSecret: Uint8Array): number;
|
|
2050
2058
|
|
|
2059
|
+
/**
|
|
2060
|
+
* Derive the deterministic 32-byte ephemeral secret for self-note `index`.
|
|
2061
|
+
* Feed it to EncryptedMemo.encrypt / NoteBuilder.build as `ephSkOverride`.
|
|
2062
|
+
*/
|
|
2063
|
+
declare function deriveSelfEphSk(spendingKey: bigint, index: number): Uint8Array;
|
|
2064
|
+
/** One precomputed self-note window entry. */
|
|
2065
|
+
interface SelfEphWindowEntry {
|
|
2066
|
+
index: number;
|
|
2067
|
+
/** 0x-prefixed LE-packed ephPk — byte-identical to the memo's last 32 bytes. */
|
|
2068
|
+
ephPkHex: string;
|
|
2069
|
+
/** ECDH shared secret vs the wallet's own ivk — feeds decryptWithSharedSecret. */
|
|
2070
|
+
sharedSecret: Uint8Array;
|
|
2071
|
+
}
|
|
2072
|
+
/**
|
|
2073
|
+
* Precompute the self-note discovery window [from, from+count): for each
|
|
2074
|
+
* index, the ephPk the wallet would have published and the shared secret
|
|
2075
|
+
* needed to decrypt the memo. One EC pass up front; scanning then matches
|
|
2076
|
+
* hints by ephPk hex equality with no per-hint EC work.
|
|
2077
|
+
*
|
|
2078
|
+
* @param spendingKey Wallet spending key (the seed of the derivation).
|
|
2079
|
+
* @param ivkPacked The wallet's OWN 32-byte LE packed viewing public key —
|
|
2080
|
+
* self memos are encrypted to it.
|
|
2081
|
+
*/
|
|
2082
|
+
declare function selfEphWindow(spendingKey: bigint, ivkPacked: Uint8Array, from: number, count: number): SelfEphWindowEntry[];
|
|
2083
|
+
|
|
2051
2084
|
/**
|
|
2052
2085
|
* NoteDecryptor
|
|
2053
2086
|
*
|
|
@@ -2081,6 +2114,13 @@ interface TryDecryptOptions {
|
|
|
2081
2114
|
* legacy memos carry a random byte there and would be silently dropped.
|
|
2082
2115
|
*/
|
|
2083
2116
|
viewTag?: boolean;
|
|
2117
|
+
/**
|
|
2118
|
+
* Precomputed ECDH shared secret (self-note discovery: the caller matched
|
|
2119
|
+
* the hint's ephPk against a selfEphWindow and already holds the secret).
|
|
2120
|
+
* Skips the ECDH and the view-tag gate entirely; the decrypt + commitment
|
|
2121
|
+
* check still validate the note as usual.
|
|
2122
|
+
*/
|
|
2123
|
+
sharedSecret?: Uint8Array;
|
|
2084
2124
|
}
|
|
2085
2125
|
/**
|
|
2086
2126
|
* Attempt to decrypt an on-chain commitment using the recipient's viewing secret key.
|
|
@@ -4221,4 +4261,4 @@ interface ExtrinsicFailedData {
|
|
|
4221
4261
|
dispatch_info: DispatchInfo;
|
|
4222
4262
|
}
|
|
4223
4263
|
|
|
4224
|
-
export { type AccountListing, type AccountMappedData, type AccountMappedEvent, type AccountMappingCall, type AccountMappingEvent, AccountMappingModule, AccountMappingPrecompile, type AccountMetadata, type AccountUnmappedEvent, type ActiveVersionSetEvent, type AddChainLinkArgs, type AddChainLinkParams, type AddSupportedChainArgs, type AliasFullIdentity, type AliasInfo, type AliasListedForSaleEvent, type AliasOnSaleData, type AliasRegisteredData, type AliasRegisteredEvent, type AliasReleasedEvent, type AliasSaleCancelledEvent, type AliasSoldData, type AliasSoldEvent, type AliasTransferredData, type AliasTransferredEvent, type AssetRegisteredEvent, type AssetUnverifiedEvent, type AssetVerifiedEvent, BABYJUB_SUBORDER, BN254_R, type BatchRegisterVerificationKeysArgs, type BatchVerificationKeysRegisteredEvent, type BlockInfo, type BuyAliasArgs, type Bytes32, CURRENT_CIRCUIT_VERSION, type ChainInfo, type ChainLink, type ChainLinkAddedEvent, type ChainLinkRemovedEvent, CircuitId, CircuitId as CircuitIdType, CircuitVersionResolver, type ClaimShieldedFeesParams, type ClientProviderConfig, type CommitmentsInsertedEvent, type CommitmentsInsertedEventData, type ConnectionStatus, CryptoPrecompiles, type DecodedAddChainLinkArgs, type DecodedBatchArgs, type DecodedDispatchAsPrivateLinkArgs, type DecodedEthereumTransactArgs, type DecodedEvmCallArgs, type DecodedPrecompile, type DecodedPrivateTransferArgs, type DecodedPutAliasForSaleArgs, type DecodedRegisterAliasArgs, type DecodedRemarkArgs, type DecodedRevealPrivateLinkArgs, type DecodedSetAccountMetadataArgs, type DecodedShieldArgs, type DecodedShieldBatchArgs, type DecodedShieldBatchOperation, type DecodedSudoArgs, type DecodedTransferAllArgs, type DecodedTransferArgs, type DecodedTransferKeepAliveArgs, type DecodedUnshieldArgs, type DecryptedMemo, type DispatchAsLinkedAccountArgs, type DispatchAsLinkedParams, type DispatchAsPrivateLinkArgs, type DispatchError, type DispatchInfo, type DynamicBuilder, ENCRYPTED_MEMO_SIZE, EncryptedMemo, type EncryptedNoteRecord, type EndowedEventData, type EthereumExecutedData, type EventData, type EventPhase, type EventRecord, type EvmAddressInfo, type EvmBlock, EvmClient, type EvmExecutedData, type EvmExitReason, EvmExplorer, type EvmLog, type EvmSigner, type EvmTransaction, type EvmTxRequest, type EvmTxSummary, type ExtrinsicDecoder, type ExtrinsicFailedData, type ExtrinsicSuccessData, type FeeClaimProofInputs, type FormatOptions, KNOWN_PRECOMPILES, type KnownPrecompileInfo, type ListingInfo, type MerkleRootUpdatedData, type MerkleRootUpdatedEvent, type MerkleTreeInfo, type MetadataUpdatedEvent, NoteBuilder, type NoteDisclosure, type NoteInput, type NoteStatusUpdate, type NullifiersSpentEvent, type NullifiersSpentEventData, OrbinumClient, type OrbinumClientConfig, OrbinumClientProvider, PRECOMPILE_ADDR, PrivacyKeyManager, type PrivacyMerkleProof, PrivacyModule, type PrivateChainLinkAddedEvent, type PrivateChainLinkRemovedEvent, type PrivateChainLinkRevealedEvent, type PrivateLink, type PrivateLinkDispatchExecutedEvent, type PrivateTransferArgs, type PrivateTransferInput, type PrivateTransferOutput, type PrivateTransferParams, type PrivateTransferProofInputs, type ProofVerificationFailedEvent, type ProofVerifiedEvent, type ProxyCallExecutedEvent, type PutAliasOnSaleArgs, type PutOnSaleParams, type RawBlock, type RawBlockHeader, type RawTransferInput, type RawTransferOutput, type RegisterAliasArgs, type RegisterAssetArgs, type RegisterPrivateLinkArgs, type RegisterVerificationKeyArgs, type RelayerInfo, RelayerStatusModule, type RemoveChainLinkArgs, type RemovePrivateLinkArgs, type RemoveSupportedChainArgs, type RemoveVerificationKeyArgs, type ReservedEventData, type ResolvedAlias, type ResolvedSpendVersion, type RevealPrivateLinkArgs, type RpcV2MerkleProof, type RpcV2NullifierStatus, type RpcV2PoolAssetBalance, type RpcV2PoolStats, SLIP0044_NAMESPACE, type ScanCommitment, type SetAccountMetadataArgs, type SetActiveVersionArgs, type SetMetadataParams, type ShieldArgs, type ShieldBatchArgs, type ShieldBatchItem, type ShieldBatchParams, type ShieldOperation, type ShieldParams, type ShieldedEvent, type ShieldedEventData, type ShieldedPoolCall, type ShieldedPoolEvent, ShieldedPoolModule, ShieldedPoolPrecompile, SignatureScheme, type StatusChangeEvent, type StatusListener, SubstrateClient, type SupportedChain, type SupportedChainAddedEvent, type SupportedChainRemovedEvent, type SystemHealth, type TokenInfo, type TokenTransfer, type TransferAliasArgs, type TransferEventData, type TransferInputNote, type TransferOutputNote, type TryDecryptOptions, type TxResult, type UnsafeTxOptions, type UnshieldArgs, type UnshieldParams, type UnshieldProofInputs, type UnshieldedEvent, type UnshieldedEventData, type UnverifyAssetArgs, VaultLockedError, type VerificationKeyRegisteredEvent, type VerificationKeyRemovedEvent, type VerifyAssetArgs, type VerifyProofArgs, type VkEntry, type ZkNote, type ZkVerifierCall, type ZkVerifierCircuitVersionInfo, type ZkVerifierEvent, type ZkVerifierHistoricalVersion, ZkVerifierModule, type ZkVerifierVersionStats, type ZkVerifierVkHash, accountIdHexToSs58, addressToAccountIdHex, applyNoteStatus, bigintTo32Be, bigintTo32Le, bigintTo32LeArr, blindTag, buildDummyTransferInput, bytesToBigintLE, computeNullifier, computePathIndices, createNoteDisclosureKey, decodeNoteDisclosureKey, decodePrecompileCalldata, decryptJson, decryptNoteRecord, deriveMasterKeyBytes, deriveOwnerPk, deriveSpendingKeyFromSignature, deriveSpendingKeyMessage, deriveStealthOwnerPk, deriveStealthSk, deriveVaultBlindKey, deriveVaultKey, deriveViewTag, deriveViewingPublicKey, deriveViewingSecretKey, encryptJson, encryptNote, ensureHexPrefix, evmAddressToAccountId, evmToImplicitSubstrate, evmToMappedAccountHex, evmToSubstrate, formatBalance, formatORB, fromBase64, fromHex, generateFeeClaimProof, generateTransferProof, generateUnshieldProof, getPrecompileLabel, hexToBigint, hexToNumber, implicitSubstrateToEvm, isEvmAddress, isImplicitEvmAccount, isSs58, isSubstrateAddress, isUnifiedAddress, leHexToBigint, mapExtrinsicArgs, mapZkEventData, normalizeEvmAddress, noteBlindTag, randomBlinding, recoverOwnerPkPoint, selectNotes, shortHash, substrateSs58ToAccountIdHex, substrateToEvm, toBase64, toHex, toTxResult, truncateMiddle, tryDecryptNote, tryDecryptNoteVerbose, vaultReplacer, vaultReviver };
|
|
4264
|
+
export { type AccountListing, type AccountMappedData, type AccountMappedEvent, type AccountMappingCall, type AccountMappingEvent, AccountMappingModule, AccountMappingPrecompile, type AccountMetadata, type AccountUnmappedEvent, type ActiveVersionSetEvent, type AddChainLinkArgs, type AddChainLinkParams, type AddSupportedChainArgs, type AliasFullIdentity, type AliasInfo, type AliasListedForSaleEvent, type AliasOnSaleData, type AliasRegisteredData, type AliasRegisteredEvent, type AliasReleasedEvent, type AliasSaleCancelledEvent, type AliasSoldData, type AliasSoldEvent, type AliasTransferredData, type AliasTransferredEvent, type AssetRegisteredEvent, type AssetUnverifiedEvent, type AssetVerifiedEvent, BABYJUB_SUBORDER, BN254_R, type BatchRegisterVerificationKeysArgs, type BatchVerificationKeysRegisteredEvent, type BlockInfo, type BuyAliasArgs, type Bytes32, CURRENT_CIRCUIT_VERSION, type ChainInfo, type ChainLink, type ChainLinkAddedEvent, type ChainLinkRemovedEvent, CircuitId, CircuitId as CircuitIdType, CircuitVersionResolver, type ClaimShieldedFeesParams, type ClientProviderConfig, type CommitmentsInsertedEvent, type CommitmentsInsertedEventData, type ConnectionStatus, CryptoPrecompiles, type DecodedAddChainLinkArgs, type DecodedBatchArgs, type DecodedDispatchAsPrivateLinkArgs, type DecodedEthereumTransactArgs, type DecodedEvmCallArgs, type DecodedPrecompile, type DecodedPrivateTransferArgs, type DecodedPutAliasForSaleArgs, type DecodedRegisterAliasArgs, type DecodedRemarkArgs, type DecodedRevealPrivateLinkArgs, type DecodedSetAccountMetadataArgs, type DecodedShieldArgs, type DecodedShieldBatchArgs, type DecodedShieldBatchOperation, type DecodedSudoArgs, type DecodedTransferAllArgs, type DecodedTransferArgs, type DecodedTransferKeepAliveArgs, type DecodedUnshieldArgs, type DecryptedMemo, type DispatchAsLinkedAccountArgs, type DispatchAsLinkedParams, type DispatchAsPrivateLinkArgs, type DispatchError, type DispatchInfo, type DynamicBuilder, ENCRYPTED_MEMO_SIZE, EncryptedMemo, type EncryptedNoteRecord, type EndowedEventData, type EthereumExecutedData, type EventData, type EventPhase, type EventRecord, type EvmAddressInfo, type EvmBlock, EvmClient, type EvmExecutedData, type EvmExitReason, EvmExplorer, type EvmLog, type EvmSigner, type EvmTransaction, type EvmTxRequest, type EvmTxSummary, type ExtrinsicDecoder, type ExtrinsicFailedData, type ExtrinsicSuccessData, type FeeClaimProofInputs, type FormatOptions, KNOWN_PRECOMPILES, type KnownPrecompileInfo, type ListingInfo, type MerkleRootUpdatedData, type MerkleRootUpdatedEvent, type MerkleTreeInfo, type MetadataUpdatedEvent, NoteBuilder, type NoteDisclosure, type NoteInput, type NoteStatusUpdate, type NullifiersSpentEvent, type NullifiersSpentEventData, OrbinumClient, type OrbinumClientConfig, OrbinumClientProvider, PRECOMPILE_ADDR, PrivacyKeyManager, type PrivacyMerkleProof, PrivacyModule, type PrivateChainLinkAddedEvent, type PrivateChainLinkRemovedEvent, type PrivateChainLinkRevealedEvent, type PrivateLink, type PrivateLinkDispatchExecutedEvent, type PrivateTransferArgs, type PrivateTransferInput, type PrivateTransferOutput, type PrivateTransferParams, type PrivateTransferProofInputs, type ProofVerificationFailedEvent, type ProofVerifiedEvent, type ProxyCallExecutedEvent, type PutAliasOnSaleArgs, type PutOnSaleParams, type RawBlock, type RawBlockHeader, type RawTransferInput, type RawTransferOutput, type RegisterAliasArgs, type RegisterAssetArgs, type RegisterPrivateLinkArgs, type RegisterVerificationKeyArgs, type RelayerInfo, RelayerStatusModule, type RemoveChainLinkArgs, type RemovePrivateLinkArgs, type RemoveSupportedChainArgs, type RemoveVerificationKeyArgs, type ReservedEventData, type ResolvedAlias, type ResolvedSpendVersion, type RevealPrivateLinkArgs, type RpcV2MerkleProof, type RpcV2NullifierStatus, type RpcV2PoolAssetBalance, type RpcV2PoolStats, SLIP0044_NAMESPACE, type ScanCommitment, type SelfEphWindowEntry, type SetAccountMetadataArgs, type SetActiveVersionArgs, type SetMetadataParams, type ShieldArgs, type ShieldBatchArgs, type ShieldBatchItem, type ShieldBatchParams, type ShieldOperation, type ShieldParams, type ShieldedEvent, type ShieldedEventData, type ShieldedPoolCall, type ShieldedPoolEvent, ShieldedPoolModule, ShieldedPoolPrecompile, SignatureScheme, type StatusChangeEvent, type StatusListener, SubstrateClient, type SupportedChain, type SupportedChainAddedEvent, type SupportedChainRemovedEvent, type SystemHealth, type TokenInfo, type TokenTransfer, type TransferAliasArgs, type TransferEventData, type TransferInputNote, type TransferOutputNote, type TryDecryptOptions, type TxResult, type UnsafeTxOptions, type UnshieldArgs, type UnshieldParams, type UnshieldProofInputs, type UnshieldedEvent, type UnshieldedEventData, type UnverifyAssetArgs, VaultLockedError, type VerificationKeyRegisteredEvent, type VerificationKeyRemovedEvent, type VerifyAssetArgs, type VerifyProofArgs, type VkEntry, type ZkNote, type ZkVerifierCall, type ZkVerifierCircuitVersionInfo, type ZkVerifierEvent, type ZkVerifierHistoricalVersion, ZkVerifierModule, type ZkVerifierVersionStats, type ZkVerifierVkHash, accountIdHexToSs58, addressToAccountIdHex, applyNoteStatus, bigintTo32Be, bigintTo32Le, bigintTo32LeArr, blindTag, buildDummyTransferInput, bytesToBigintLE, computeNullifier, computePathIndices, createNoteDisclosureKey, decodeNoteDisclosureKey, decodePrecompileCalldata, decryptJson, decryptNoteRecord, deriveMasterKeyBytes, deriveOwnerPk, deriveSelfEphSk, deriveSpendingKeyFromSignature, deriveSpendingKeyMessage, deriveStealthOwnerPk, deriveStealthSk, deriveVaultBlindKey, deriveVaultKey, deriveViewTag, deriveViewingPublicKey, deriveViewingSecretKey, encryptJson, encryptNote, ensureHexPrefix, evmAddressToAccountId, evmToImplicitSubstrate, evmToMappedAccountHex, evmToSubstrate, formatBalance, formatORB, fromBase64, fromHex, generateFeeClaimProof, generateTransferProof, generateUnshieldProof, getPrecompileLabel, hexToBigint, hexToNumber, implicitSubstrateToEvm, isEvmAddress, isImplicitEvmAccount, isSs58, isSubstrateAddress, isUnifiedAddress, leHexToBigint, mapExtrinsicArgs, mapZkEventData, normalizeEvmAddress, noteBlindTag, randomBlinding, recoverOwnerPkPoint, selectNotes, selfEphWindow, shortHash, substrateSs58ToAccountIdHex, substrateToEvm, toBase64, toHex, toTxResult, truncateMiddle, tryDecryptNote, tryDecryptNoteVerbose, vaultReplacer, vaultReviver };
|
package/dist/index.js
CHANGED
|
@@ -73,6 +73,7 @@ __export(index_exports, {
|
|
|
73
73
|
decryptNoteRecord: () => decryptNoteRecord,
|
|
74
74
|
deriveMasterKeyBytes: () => deriveMasterKeyBytes,
|
|
75
75
|
deriveOwnerPk: () => deriveOwnerPk,
|
|
76
|
+
deriveSelfEphSk: () => deriveSelfEphSk,
|
|
76
77
|
deriveSpendingKeyFromSignature: () => deriveSpendingKeyFromSignature,
|
|
77
78
|
deriveSpendingKeyMessage: () => deriveSpendingKeyMessage,
|
|
78
79
|
deriveStealthOwnerPk: () => deriveStealthOwnerPk,
|
|
@@ -117,6 +118,7 @@ __export(index_exports, {
|
|
|
117
118
|
randomBlinding: () => randomBlinding,
|
|
118
119
|
recoverOwnerPkPoint: () => recoverOwnerPkPoint,
|
|
119
120
|
selectNotes: () => selectNotes,
|
|
121
|
+
selfEphWindow: () => selfEphWindow,
|
|
120
122
|
shortHash: () => shortHash,
|
|
121
123
|
substrateSs58ToAccountIdHex: () => substrateSs58ToAccountIdHex,
|
|
122
124
|
substrateToEvm: () => substrateToEvm,
|
|
@@ -1208,6 +1210,32 @@ var import_chacha = require("@noble/ciphers/chacha.js");
|
|
|
1208
1210
|
var import_utils = require("@noble/ciphers/utils.js");
|
|
1209
1211
|
var import_baby_jubjub = require("@zk-kit/baby-jubjub");
|
|
1210
1212
|
|
|
1213
|
+
// src/utils/bjj-fast.ts
|
|
1214
|
+
var import_edwards = require("@noble/curves/abstract/edwards.js");
|
|
1215
|
+
var P = 21888242871839275222246405745257275088548364400416034343698204186575808495617n;
|
|
1216
|
+
var N = 2736030358979909402780800718157159386076813972158567259200215660948447373041n;
|
|
1217
|
+
var BjjPoint = (0, import_edwards.edwards)({
|
|
1218
|
+
p: P,
|
|
1219
|
+
n: N,
|
|
1220
|
+
h: 8n,
|
|
1221
|
+
a: 168700n,
|
|
1222
|
+
d: 168696n,
|
|
1223
|
+
Gx: 5299619240641551281634865583518297030282874472190772894086521144482721001553n,
|
|
1224
|
+
Gy: 16950150798460657717958625567821834550301663161624707787222815936182638968203n
|
|
1225
|
+
});
|
|
1226
|
+
function fastMulBase(scalar) {
|
|
1227
|
+
const s = scalar % N;
|
|
1228
|
+
if (s === 0n) return [0n, 1n];
|
|
1229
|
+
const { x, y } = BjjPoint.BASE.multiply(s).toAffine();
|
|
1230
|
+
return [x, y];
|
|
1231
|
+
}
|
|
1232
|
+
function fastMulPoint(point, scalar) {
|
|
1233
|
+
const s = scalar % N;
|
|
1234
|
+
if (s === 0n) return [0n, 1n];
|
|
1235
|
+
const { x, y } = BjjPoint.fromAffine({ x: point[0], y: point[1] }).multiplyUnsafe(s).toAffine();
|
|
1236
|
+
return [x, y];
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1211
1239
|
// src/utils/bytes.ts
|
|
1212
1240
|
function bigintTo32Le(n) {
|
|
1213
1241
|
const buf = new Uint8Array(32);
|
|
@@ -1357,13 +1385,13 @@ var EncryptedMemo = {
|
|
|
1357
1385
|
if (ephSkBytes.length !== 32)
|
|
1358
1386
|
throw new Error("EncryptedMemo.encrypt: ephSkOverride must be 32 bytes");
|
|
1359
1387
|
const ephSkScalar = bytesToBjjScalar(ephSkBytes);
|
|
1360
|
-
const ephPkPoint = (
|
|
1388
|
+
const ephPkPoint = fastMulBase(ephSkScalar);
|
|
1361
1389
|
ephPkPackedBytes = bigintTo32Le((0, import_baby_jubjub.packPoint)(ephPkPoint));
|
|
1362
1390
|
const ivkPackedBigint = bytesToBigintLE(recipientIvkPacked);
|
|
1363
1391
|
const ivkPoint = (0, import_baby_jubjub.unpackPoint)(ivkPackedBigint);
|
|
1364
1392
|
if (!ivkPoint)
|
|
1365
1393
|
throw new Error("EncryptedMemo.encrypt: invalid recipient viewing public key");
|
|
1366
|
-
const sharedPoint = (
|
|
1394
|
+
const sharedPoint = fastMulPoint(ivkPoint, ephSkScalar);
|
|
1367
1395
|
sharedSecret = bigintTo32Le(sharedPoint[0]);
|
|
1368
1396
|
}
|
|
1369
1397
|
nonce[0] = deriveViewTag(sharedSecret);
|
|
@@ -1453,7 +1481,7 @@ var EncryptedMemo = {
|
|
|
1453
1481
|
const ephPkPoint = (0, import_baby_jubjub.unpackPoint)(ephPkPackedBigint);
|
|
1454
1482
|
if (!ephPkPoint) return null;
|
|
1455
1483
|
const ivskScalar = bytesToBjjScalar(viewingSecretKey);
|
|
1456
|
-
const sharedPoint = (
|
|
1484
|
+
const sharedPoint = fastMulPoint(ephPkPoint, ivskScalar);
|
|
1457
1485
|
return bigintTo32Le(sharedPoint[0]);
|
|
1458
1486
|
},
|
|
1459
1487
|
/**
|
|
@@ -3834,7 +3862,8 @@ var NoteBuilder = class {
|
|
|
3834
3862
|
commitmentBytes,
|
|
3835
3863
|
input.viewingPublicKey,
|
|
3836
3864
|
bigintTo32Le(counterpartyPk),
|
|
3837
|
-
circuitVersion
|
|
3865
|
+
circuitVersion,
|
|
3866
|
+
input.ephSkOverride
|
|
3838
3867
|
)
|
|
3839
3868
|
) : Array.from(EncryptedMemo.dummy());
|
|
3840
3869
|
if (memo.length !== ENCRYPTED_MEMO_SIZE)
|
|
@@ -3884,6 +3913,36 @@ var NoteBuilder = class {
|
|
|
3884
3913
|
}
|
|
3885
3914
|
};
|
|
3886
3915
|
|
|
3916
|
+
// src/shielded-pool/protocol/selfEph.ts
|
|
3917
|
+
var import_sha23 = require("@noble/hashes/sha2.js");
|
|
3918
|
+
var import_baby_jubjub5 = require("@zk-kit/baby-jubjub");
|
|
3919
|
+
var SELF_EPH_DOMAIN = new TextEncoder().encode("orbinum-self-eph-v1");
|
|
3920
|
+
function deriveSelfEphSk(spendingKey, index) {
|
|
3921
|
+
const h = import_sha23.sha256.create();
|
|
3922
|
+
h.update(SELF_EPH_DOMAIN);
|
|
3923
|
+
h.update(bigintTo32Le(spendingKey));
|
|
3924
|
+
const idx = new Uint8Array(4);
|
|
3925
|
+
new DataView(idx.buffer).setUint32(0, index >>> 0, true);
|
|
3926
|
+
h.update(idx);
|
|
3927
|
+
return h.digest();
|
|
3928
|
+
}
|
|
3929
|
+
function selfEphWindow(spendingKey, ivkPacked, from, count) {
|
|
3930
|
+
const ivkPoint = (0, import_baby_jubjub5.unpackPoint)(bytesToBigintLE(ivkPacked));
|
|
3931
|
+
if (!ivkPoint) throw new Error("selfEphWindow: invalid viewing public key");
|
|
3932
|
+
const entries = [];
|
|
3933
|
+
for (let i = from; i < from + count; i++) {
|
|
3934
|
+
const scalar = bytesToBjjScalar(deriveSelfEphSk(spendingKey, i));
|
|
3935
|
+
const ephPk = fastMulBase(scalar);
|
|
3936
|
+
const sharedPoint = fastMulPoint(ivkPoint, scalar);
|
|
3937
|
+
entries.push({
|
|
3938
|
+
index: i,
|
|
3939
|
+
ephPkHex: toHex(bigintTo32Le((0, import_baby_jubjub5.packPoint)(ephPk))),
|
|
3940
|
+
sharedSecret: bigintTo32Le(sharedPoint[0])
|
|
3941
|
+
});
|
|
3942
|
+
}
|
|
3943
|
+
return entries;
|
|
3944
|
+
}
|
|
3945
|
+
|
|
3887
3946
|
// src/shielded-pool/protocol/NoteDecryptor.ts
|
|
3888
3947
|
var import_poseidon_lite2 = require("poseidon-lite");
|
|
3889
3948
|
function computeNullifier(commitment, spendingKey) {
|
|
@@ -3908,8 +3967,8 @@ function tryDecryptNoteVerbose(commitment, viewingSecretKey, spendingKey, ownOwn
|
|
|
3908
3967
|
reason: `memo_size_mismatch:got_${memoBytes.length}_expected_${ENCRYPTED_MEMO_SIZE}`
|
|
3909
3968
|
};
|
|
3910
3969
|
}
|
|
3911
|
-
let sharedSecret = null;
|
|
3912
|
-
if (opts?.viewTag) {
|
|
3970
|
+
let sharedSecret = opts?.sharedSecret ?? null;
|
|
3971
|
+
if (!sharedSecret && opts?.viewTag) {
|
|
3913
3972
|
sharedSecret = EncryptedMemo.extractSharedSecret(memoBytes, viewingSecretKey);
|
|
3914
3973
|
if (!sharedSecret) return { note: null, reason: "stealth_shared_secret_failed" };
|
|
3915
3974
|
if (!EncryptedMemo.checkViewTag(memoBytes, sharedSecret)) {
|
|
@@ -4058,8 +4117,8 @@ function randomBlinding() {
|
|
|
4058
4117
|
|
|
4059
4118
|
// src/privacy-keys/PrivacyKeys.ts
|
|
4060
4119
|
var import_hkdf2 = require("@noble/hashes/hkdf.js");
|
|
4061
|
-
var
|
|
4062
|
-
var
|
|
4120
|
+
var import_sha24 = require("@noble/hashes/sha2.js");
|
|
4121
|
+
var import_baby_jubjub6 = require("@zk-kit/baby-jubjub");
|
|
4063
4122
|
var IVK_DOMAIN = new TextEncoder().encode("orbinum-ivk-v1");
|
|
4064
4123
|
function deriveSpendingKeyMessage(chainId, address) {
|
|
4065
4124
|
return `orbinum-spending-key-v1
|
|
@@ -4069,7 +4128,7 @@ ${address.toLowerCase()}`;
|
|
|
4069
4128
|
async function deriveMasterKeyBytes(signatureHex, chainId, address) {
|
|
4070
4129
|
const sigBytes = fromHex(signatureHex);
|
|
4071
4130
|
const info = new TextEncoder().encode(`orbinum-sk-v1:${chainId}:${address.toLowerCase()}`);
|
|
4072
|
-
return (0, import_hkdf2.hkdf)(
|
|
4131
|
+
return (0, import_hkdf2.hkdf)(import_sha24.sha256, sigBytes, new Uint8Array(0), info, 32);
|
|
4073
4132
|
}
|
|
4074
4133
|
async function deriveSpendingKeyFromSignature(signatureHex, chainId, address) {
|
|
4075
4134
|
const masterBytes = await deriveMasterKeyBytes(signatureHex, chainId, address);
|
|
@@ -4078,17 +4137,17 @@ async function deriveSpendingKeyFromSignature(signatureHex, chainId, address) {
|
|
|
4078
4137
|
}
|
|
4079
4138
|
function deriveViewingSecretKey(spendingKey) {
|
|
4080
4139
|
const ikm = bigintTo32Le(spendingKey);
|
|
4081
|
-
return (0, import_hkdf2.hkdf)(
|
|
4140
|
+
return (0, import_hkdf2.hkdf)(import_sha24.sha256, ikm, void 0, IVK_DOMAIN, 32);
|
|
4082
4141
|
}
|
|
4083
4142
|
function deriveViewingPublicKey(ivsk) {
|
|
4084
4143
|
const ivskScalar = BigInt(toHex(ivsk)) % BABYJUB_SUBORDER || 1n;
|
|
4085
|
-
const ivkPoint = (0,
|
|
4086
|
-
const packed = (0,
|
|
4144
|
+
const ivkPoint = (0, import_baby_jubjub6.mulPointEscalar)(import_baby_jubjub6.Base8, ivskScalar);
|
|
4145
|
+
const packed = (0, import_baby_jubjub6.packPoint)(ivkPoint);
|
|
4087
4146
|
return bigintTo32Le(packed);
|
|
4088
4147
|
}
|
|
4089
4148
|
function deriveOwnerPk(spendingKey) {
|
|
4090
4149
|
try {
|
|
4091
|
-
const pubPoint = (0,
|
|
4150
|
+
const pubPoint = (0, import_baby_jubjub6.mulPointEscalar)(import_baby_jubjub6.Base8, spendingKey);
|
|
4092
4151
|
return pubPoint[0];
|
|
4093
4152
|
} catch {
|
|
4094
4153
|
return 0n;
|
|
@@ -4397,7 +4456,7 @@ async function noteBlindTag(blindKey, hex) {
|
|
|
4397
4456
|
// src/proof-generator/unshield.ts
|
|
4398
4457
|
var import_proof_generator2 = require("@orbinum/proof-generator");
|
|
4399
4458
|
var import_utils3 = require("@noble/ciphers/utils.js");
|
|
4400
|
-
var
|
|
4459
|
+
var import_baby_jubjub7 = require("@zk-kit/baby-jubjub");
|
|
4401
4460
|
var import_poseidon_lite4 = require("poseidon-lite");
|
|
4402
4461
|
|
|
4403
4462
|
// src/proof-generator/merkle.ts
|
|
@@ -4420,7 +4479,7 @@ async function generateUnshieldProof(inputs, options = {}) {
|
|
|
4420
4479
|
if (changeValue < 0n) {
|
|
4421
4480
|
throw new Error("changeValue must be >= 0.");
|
|
4422
4481
|
}
|
|
4423
|
-
const changeOwnerPubkey = inputs.changeOwnerPubkey ?? (0,
|
|
4482
|
+
const changeOwnerPubkey = inputs.changeOwnerPubkey ?? (0, import_baby_jubjub7.mulPointEscalar)(import_baby_jubjub7.Base8, inputs.spendingKey)[0];
|
|
4424
4483
|
const changeBlinding = inputs.changeBlinding ?? (changeValue > 0n ? bytesToBigintLE((0, import_utils3.randomBytes)(32)) : 0n);
|
|
4425
4484
|
const changeCommitment = changeValue > 0n ? (0, import_poseidon_lite4.poseidon4)([changeValue, inputs.assetId, changeOwnerPubkey, changeBlinding]) : 0n;
|
|
4426
4485
|
const circuitInputs = {
|
|
@@ -5325,6 +5384,7 @@ var import_polkadot_api4 = require("polkadot-api");
|
|
|
5325
5384
|
decryptNoteRecord,
|
|
5326
5385
|
deriveMasterKeyBytes,
|
|
5327
5386
|
deriveOwnerPk,
|
|
5387
|
+
deriveSelfEphSk,
|
|
5328
5388
|
deriveSpendingKeyFromSignature,
|
|
5329
5389
|
deriveSpendingKeyMessage,
|
|
5330
5390
|
deriveStealthOwnerPk,
|
|
@@ -5369,6 +5429,7 @@ var import_polkadot_api4 = require("polkadot-api");
|
|
|
5369
5429
|
randomBlinding,
|
|
5370
5430
|
recoverOwnerPkPoint,
|
|
5371
5431
|
selectNotes,
|
|
5432
|
+
selfEphWindow,
|
|
5372
5433
|
shortHash,
|
|
5373
5434
|
substrateSs58ToAccountIdHex,
|
|
5374
5435
|
substrateToEvm,
|
package/dist/index.mjs
CHANGED
|
@@ -1074,7 +1074,33 @@ function resolveTx(unsafe, pallet, call) {
|
|
|
1074
1074
|
// src/shielded-pool/protocol/EncryptedMemo.ts
|
|
1075
1075
|
import { chacha20poly1305 } from "@noble/ciphers/chacha.js";
|
|
1076
1076
|
import { randomBytes } from "@noble/ciphers/utils.js";
|
|
1077
|
-
import {
|
|
1077
|
+
import { packPoint, unpackPoint } from "@zk-kit/baby-jubjub";
|
|
1078
|
+
|
|
1079
|
+
// src/utils/bjj-fast.ts
|
|
1080
|
+
import { edwards } from "@noble/curves/abstract/edwards.js";
|
|
1081
|
+
var P = 21888242871839275222246405745257275088548364400416034343698204186575808495617n;
|
|
1082
|
+
var N = 2736030358979909402780800718157159386076813972158567259200215660948447373041n;
|
|
1083
|
+
var BjjPoint = edwards({
|
|
1084
|
+
p: P,
|
|
1085
|
+
n: N,
|
|
1086
|
+
h: 8n,
|
|
1087
|
+
a: 168700n,
|
|
1088
|
+
d: 168696n,
|
|
1089
|
+
Gx: 5299619240641551281634865583518297030282874472190772894086521144482721001553n,
|
|
1090
|
+
Gy: 16950150798460657717958625567821834550301663161624707787222815936182638968203n
|
|
1091
|
+
});
|
|
1092
|
+
function fastMulBase(scalar) {
|
|
1093
|
+
const s = scalar % N;
|
|
1094
|
+
if (s === 0n) return [0n, 1n];
|
|
1095
|
+
const { x, y } = BjjPoint.BASE.multiply(s).toAffine();
|
|
1096
|
+
return [x, y];
|
|
1097
|
+
}
|
|
1098
|
+
function fastMulPoint(point, scalar) {
|
|
1099
|
+
const s = scalar % N;
|
|
1100
|
+
if (s === 0n) return [0n, 1n];
|
|
1101
|
+
const { x, y } = BjjPoint.fromAffine({ x: point[0], y: point[1] }).multiplyUnsafe(s).toAffine();
|
|
1102
|
+
return [x, y];
|
|
1103
|
+
}
|
|
1078
1104
|
|
|
1079
1105
|
// src/utils/bytes.ts
|
|
1080
1106
|
function bigintTo32Le(n) {
|
|
@@ -1225,13 +1251,13 @@ var EncryptedMemo = {
|
|
|
1225
1251
|
if (ephSkBytes.length !== 32)
|
|
1226
1252
|
throw new Error("EncryptedMemo.encrypt: ephSkOverride must be 32 bytes");
|
|
1227
1253
|
const ephSkScalar = bytesToBjjScalar(ephSkBytes);
|
|
1228
|
-
const ephPkPoint =
|
|
1254
|
+
const ephPkPoint = fastMulBase(ephSkScalar);
|
|
1229
1255
|
ephPkPackedBytes = bigintTo32Le(packPoint(ephPkPoint));
|
|
1230
1256
|
const ivkPackedBigint = bytesToBigintLE(recipientIvkPacked);
|
|
1231
1257
|
const ivkPoint = unpackPoint(ivkPackedBigint);
|
|
1232
1258
|
if (!ivkPoint)
|
|
1233
1259
|
throw new Error("EncryptedMemo.encrypt: invalid recipient viewing public key");
|
|
1234
|
-
const sharedPoint =
|
|
1260
|
+
const sharedPoint = fastMulPoint(ivkPoint, ephSkScalar);
|
|
1235
1261
|
sharedSecret = bigintTo32Le(sharedPoint[0]);
|
|
1236
1262
|
}
|
|
1237
1263
|
nonce[0] = deriveViewTag(sharedSecret);
|
|
@@ -1321,7 +1347,7 @@ var EncryptedMemo = {
|
|
|
1321
1347
|
const ephPkPoint = unpackPoint(ephPkPackedBigint);
|
|
1322
1348
|
if (!ephPkPoint) return null;
|
|
1323
1349
|
const ivskScalar = bytesToBjjScalar(viewingSecretKey);
|
|
1324
|
-
const sharedPoint =
|
|
1350
|
+
const sharedPoint = fastMulPoint(ephPkPoint, ivskScalar);
|
|
1325
1351
|
return bigintTo32Le(sharedPoint[0]);
|
|
1326
1352
|
},
|
|
1327
1353
|
/**
|
|
@@ -3523,7 +3549,7 @@ var CURRENT_CIRCUIT_VERSION = 1;
|
|
|
3523
3549
|
// src/utils/stealth.ts
|
|
3524
3550
|
import { sha256 as sha2562 } from "@noble/hashes/sha2.js";
|
|
3525
3551
|
import { hkdf } from "@noble/hashes/hkdf.js";
|
|
3526
|
-
import { mulPointEscalar
|
|
3552
|
+
import { mulPointEscalar, Base8, addPoint } from "@zk-kit/baby-jubjub";
|
|
3527
3553
|
var STEALTH_INFO = new TextEncoder().encode("orbinum-stealth-v1");
|
|
3528
3554
|
function deriveStealthScalar(sharedSecret, ownerPkBigint) {
|
|
3529
3555
|
const salt = bigintTo32Le(ownerPkBigint);
|
|
@@ -3532,7 +3558,7 @@ function deriveStealthScalar(sharedSecret, ownerPkBigint) {
|
|
|
3532
3558
|
}
|
|
3533
3559
|
function deriveStealthOwnerPk(sharedSecret, ownerPkBigint, ownerPkPoint) {
|
|
3534
3560
|
const stealthScalar = deriveStealthScalar(sharedSecret, ownerPkBigint);
|
|
3535
|
-
const stealthPt = addPoint(
|
|
3561
|
+
const stealthPt = addPoint(mulPointEscalar(Base8, stealthScalar), ownerPkPoint);
|
|
3536
3562
|
return stealthPt[0];
|
|
3537
3563
|
}
|
|
3538
3564
|
function deriveStealthSk(sharedSecret, ownerPkBigint, spendingKey) {
|
|
@@ -3541,7 +3567,7 @@ function deriveStealthSk(sharedSecret, ownerPkBigint, spendingKey) {
|
|
|
3541
3567
|
}
|
|
3542
3568
|
|
|
3543
3569
|
// src/utils/bjj.ts
|
|
3544
|
-
import { mulPointEscalar as
|
|
3570
|
+
import { mulPointEscalar as mulPointEscalar2 } from "@zk-kit/baby-jubjub";
|
|
3545
3571
|
var BJJ_A = 168700n;
|
|
3546
3572
|
var BJJ_D = 168696n;
|
|
3547
3573
|
function _modpow(base, exp, mod) {
|
|
@@ -3596,7 +3622,7 @@ function recoverOwnerPkPoint(ax) {
|
|
|
3596
3622
|
if (y === null) return null;
|
|
3597
3623
|
const yAlt = BN254_R - y;
|
|
3598
3624
|
try {
|
|
3599
|
-
const check =
|
|
3625
|
+
const check = mulPointEscalar2([ax, y], BABYJUB_SUBORDER);
|
|
3600
3626
|
return check[0] === 0n && check[1] === 1n ? [ax, y] : [ax, yAlt];
|
|
3601
3627
|
} catch {
|
|
3602
3628
|
return [ax, yAlt];
|
|
@@ -3604,7 +3630,7 @@ function recoverOwnerPkPoint(ax) {
|
|
|
3604
3630
|
}
|
|
3605
3631
|
|
|
3606
3632
|
// src/shielded-pool/protocol/NoteBuilder.ts
|
|
3607
|
-
import { mulPointEscalar as
|
|
3633
|
+
import { mulPointEscalar as mulPointEscalar3, unpackPoint as unpackPoint2 } from "@zk-kit/baby-jubjub";
|
|
3608
3634
|
import { randomBytes as randomBytes2 } from "@noble/ciphers/utils.js";
|
|
3609
3635
|
import { poseidon2, poseidon4 } from "poseidon-lite";
|
|
3610
3636
|
var NoteBuilder = class {
|
|
@@ -3640,7 +3666,7 @@ var NoteBuilder = class {
|
|
|
3640
3666
|
if (!ivkPoint)
|
|
3641
3667
|
throw new Error("NoteBuilder.build: invalid recipient viewing public key");
|
|
3642
3668
|
const ephSkScalar = BigInt(toHex(ephSk)) % BABYJUB_SUBORDER || 1n;
|
|
3643
|
-
const sharedPoint =
|
|
3669
|
+
const sharedPoint = mulPointEscalar3(ivkPoint, ephSkScalar);
|
|
3644
3670
|
const sharedSecret = bigintTo32Le(sharedPoint[0]);
|
|
3645
3671
|
const recipientPkPoint = recoverOwnerPkPoint(recipientOwnerPk);
|
|
3646
3672
|
if (!recipientPkPoint)
|
|
@@ -3705,7 +3731,8 @@ var NoteBuilder = class {
|
|
|
3705
3731
|
commitmentBytes,
|
|
3706
3732
|
input.viewingPublicKey,
|
|
3707
3733
|
bigintTo32Le(counterpartyPk),
|
|
3708
|
-
circuitVersion
|
|
3734
|
+
circuitVersion,
|
|
3735
|
+
input.ephSkOverride
|
|
3709
3736
|
)
|
|
3710
3737
|
) : Array.from(EncryptedMemo.dummy());
|
|
3711
3738
|
if (memo.length !== ENCRYPTED_MEMO_SIZE)
|
|
@@ -3755,6 +3782,36 @@ var NoteBuilder = class {
|
|
|
3755
3782
|
}
|
|
3756
3783
|
};
|
|
3757
3784
|
|
|
3785
|
+
// src/shielded-pool/protocol/selfEph.ts
|
|
3786
|
+
import { sha256 as sha2563 } from "@noble/hashes/sha2.js";
|
|
3787
|
+
import { packPoint as packPoint2, unpackPoint as unpackPoint3 } from "@zk-kit/baby-jubjub";
|
|
3788
|
+
var SELF_EPH_DOMAIN = new TextEncoder().encode("orbinum-self-eph-v1");
|
|
3789
|
+
function deriveSelfEphSk(spendingKey, index) {
|
|
3790
|
+
const h = sha2563.create();
|
|
3791
|
+
h.update(SELF_EPH_DOMAIN);
|
|
3792
|
+
h.update(bigintTo32Le(spendingKey));
|
|
3793
|
+
const idx = new Uint8Array(4);
|
|
3794
|
+
new DataView(idx.buffer).setUint32(0, index >>> 0, true);
|
|
3795
|
+
h.update(idx);
|
|
3796
|
+
return h.digest();
|
|
3797
|
+
}
|
|
3798
|
+
function selfEphWindow(spendingKey, ivkPacked, from, count) {
|
|
3799
|
+
const ivkPoint = unpackPoint3(bytesToBigintLE(ivkPacked));
|
|
3800
|
+
if (!ivkPoint) throw new Error("selfEphWindow: invalid viewing public key");
|
|
3801
|
+
const entries = [];
|
|
3802
|
+
for (let i = from; i < from + count; i++) {
|
|
3803
|
+
const scalar = bytesToBjjScalar(deriveSelfEphSk(spendingKey, i));
|
|
3804
|
+
const ephPk = fastMulBase(scalar);
|
|
3805
|
+
const sharedPoint = fastMulPoint(ivkPoint, scalar);
|
|
3806
|
+
entries.push({
|
|
3807
|
+
index: i,
|
|
3808
|
+
ephPkHex: toHex(bigintTo32Le(packPoint2(ephPk))),
|
|
3809
|
+
sharedSecret: bigintTo32Le(sharedPoint[0])
|
|
3810
|
+
});
|
|
3811
|
+
}
|
|
3812
|
+
return entries;
|
|
3813
|
+
}
|
|
3814
|
+
|
|
3758
3815
|
// src/shielded-pool/protocol/NoteDecryptor.ts
|
|
3759
3816
|
import { poseidon2 as poseidon22, poseidon4 as poseidon42 } from "poseidon-lite";
|
|
3760
3817
|
function computeNullifier(commitment, spendingKey) {
|
|
@@ -3779,8 +3836,8 @@ function tryDecryptNoteVerbose(commitment, viewingSecretKey, spendingKey, ownOwn
|
|
|
3779
3836
|
reason: `memo_size_mismatch:got_${memoBytes.length}_expected_${ENCRYPTED_MEMO_SIZE}`
|
|
3780
3837
|
};
|
|
3781
3838
|
}
|
|
3782
|
-
let sharedSecret = null;
|
|
3783
|
-
if (opts?.viewTag) {
|
|
3839
|
+
let sharedSecret = opts?.sharedSecret ?? null;
|
|
3840
|
+
if (!sharedSecret && opts?.viewTag) {
|
|
3784
3841
|
sharedSecret = EncryptedMemo.extractSharedSecret(memoBytes, viewingSecretKey);
|
|
3785
3842
|
if (!sharedSecret) return { note: null, reason: "stealth_shared_secret_failed" };
|
|
3786
3843
|
if (!EncryptedMemo.checkViewTag(memoBytes, sharedSecret)) {
|
|
@@ -3929,8 +3986,8 @@ function randomBlinding() {
|
|
|
3929
3986
|
|
|
3930
3987
|
// src/privacy-keys/PrivacyKeys.ts
|
|
3931
3988
|
import { hkdf as hkdf2 } from "@noble/hashes/hkdf.js";
|
|
3932
|
-
import { sha256 as
|
|
3933
|
-
import { mulPointEscalar as
|
|
3989
|
+
import { sha256 as sha2564 } from "@noble/hashes/sha2.js";
|
|
3990
|
+
import { mulPointEscalar as mulPointEscalar4, Base8 as Base82, packPoint as packPoint3 } from "@zk-kit/baby-jubjub";
|
|
3934
3991
|
var IVK_DOMAIN = new TextEncoder().encode("orbinum-ivk-v1");
|
|
3935
3992
|
function deriveSpendingKeyMessage(chainId, address) {
|
|
3936
3993
|
return `orbinum-spending-key-v1
|
|
@@ -3940,7 +3997,7 @@ ${address.toLowerCase()}`;
|
|
|
3940
3997
|
async function deriveMasterKeyBytes(signatureHex, chainId, address) {
|
|
3941
3998
|
const sigBytes = fromHex(signatureHex);
|
|
3942
3999
|
const info = new TextEncoder().encode(`orbinum-sk-v1:${chainId}:${address.toLowerCase()}`);
|
|
3943
|
-
return hkdf2(
|
|
4000
|
+
return hkdf2(sha2564, sigBytes, new Uint8Array(0), info, 32);
|
|
3944
4001
|
}
|
|
3945
4002
|
async function deriveSpendingKeyFromSignature(signatureHex, chainId, address) {
|
|
3946
4003
|
const masterBytes = await deriveMasterKeyBytes(signatureHex, chainId, address);
|
|
@@ -3949,17 +4006,17 @@ async function deriveSpendingKeyFromSignature(signatureHex, chainId, address) {
|
|
|
3949
4006
|
}
|
|
3950
4007
|
function deriveViewingSecretKey(spendingKey) {
|
|
3951
4008
|
const ikm = bigintTo32Le(spendingKey);
|
|
3952
|
-
return hkdf2(
|
|
4009
|
+
return hkdf2(sha2564, ikm, void 0, IVK_DOMAIN, 32);
|
|
3953
4010
|
}
|
|
3954
4011
|
function deriveViewingPublicKey(ivsk) {
|
|
3955
4012
|
const ivskScalar = BigInt(toHex(ivsk)) % BABYJUB_SUBORDER || 1n;
|
|
3956
|
-
const ivkPoint =
|
|
3957
|
-
const packed =
|
|
4013
|
+
const ivkPoint = mulPointEscalar4(Base82, ivskScalar);
|
|
4014
|
+
const packed = packPoint3(ivkPoint);
|
|
3958
4015
|
return bigintTo32Le(packed);
|
|
3959
4016
|
}
|
|
3960
4017
|
function deriveOwnerPk(spendingKey) {
|
|
3961
4018
|
try {
|
|
3962
|
-
const pubPoint =
|
|
4019
|
+
const pubPoint = mulPointEscalar4(Base82, spendingKey);
|
|
3963
4020
|
return pubPoint[0];
|
|
3964
4021
|
} catch {
|
|
3965
4022
|
return 0n;
|
|
@@ -4272,7 +4329,7 @@ import {
|
|
|
4272
4329
|
WebArtifactProvider as WebArtifactProvider2
|
|
4273
4330
|
} from "@orbinum/proof-generator";
|
|
4274
4331
|
import { randomBytes as randomBytes3 } from "@noble/ciphers/utils.js";
|
|
4275
|
-
import { mulPointEscalar as
|
|
4332
|
+
import { mulPointEscalar as mulPointEscalar5, Base8 as Base83 } from "@zk-kit/baby-jubjub";
|
|
4276
4333
|
import { poseidon4 as poseidon44 } from "poseidon-lite";
|
|
4277
4334
|
|
|
4278
4335
|
// src/proof-generator/merkle.ts
|
|
@@ -4295,7 +4352,7 @@ async function generateUnshieldProof(inputs, options = {}) {
|
|
|
4295
4352
|
if (changeValue < 0n) {
|
|
4296
4353
|
throw new Error("changeValue must be >= 0.");
|
|
4297
4354
|
}
|
|
4298
|
-
const changeOwnerPubkey = inputs.changeOwnerPubkey ??
|
|
4355
|
+
const changeOwnerPubkey = inputs.changeOwnerPubkey ?? mulPointEscalar5(Base83, inputs.spendingKey)[0];
|
|
4299
4356
|
const changeBlinding = inputs.changeBlinding ?? (changeValue > 0n ? bytesToBigintLE(randomBytes3(32)) : 0n);
|
|
4300
4357
|
const changeCommitment = changeValue > 0n ? poseidon44([changeValue, inputs.assetId, changeOwnerPubkey, changeBlinding]) : 0n;
|
|
4301
4358
|
const circuitInputs = {
|
|
@@ -5218,6 +5275,7 @@ export {
|
|
|
5218
5275
|
decryptNoteRecord,
|
|
5219
5276
|
deriveMasterKeyBytes,
|
|
5220
5277
|
deriveOwnerPk,
|
|
5278
|
+
deriveSelfEphSk,
|
|
5221
5279
|
deriveSpendingKeyFromSignature,
|
|
5222
5280
|
deriveSpendingKeyMessage,
|
|
5223
5281
|
deriveStealthOwnerPk,
|
|
@@ -5262,6 +5320,7 @@ export {
|
|
|
5262
5320
|
randomBlinding,
|
|
5263
5321
|
recoverOwnerPkPoint,
|
|
5264
5322
|
selectNotes,
|
|
5323
|
+
selfEphWindow,
|
|
5265
5324
|
shortHash,
|
|
5266
5325
|
substrateSs58ToAccountIdHex,
|
|
5267
5326
|
substrateToEvm,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orbinum/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Official TypeScript SDK for Orbinum.",
|
|
5
5
|
"author": "Orbinum",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@noble/ciphers": "2.2.0",
|
|
49
|
+
"@noble/curves": "^2.2.0",
|
|
49
50
|
"@noble/hashes": "2.2.0",
|
|
50
51
|
"@orbinum/proof-generator": "4.0.0",
|
|
51
52
|
"@polkadot-api/metadata-builders": "0.14.2",
|