@orbinum/sdk 0.8.0 → 0.9.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 CHANGED
@@ -844,18 +844,35 @@ declare class IndexerClient {
844
844
  * For the current Orbinum testnet/mainnet scale this is the recommended approach.
845
845
  */
846
846
  getAllSpentNullifiers(): Promise<Set<string>>;
847
+ /** Server-enforced max items per by-nullifiers / by-commitments request. */
848
+ private static readonly TRANSFER_LOOKUP_CHUNK;
849
+ /**
850
+ * Chunked fetch for the transfer timestamp lookups. The reader silently
851
+ * truncates each request to 50 items, so larger inputs MUST be split or
852
+ * results are silently lost. Responses are merged per extrinsic
853
+ * (`blockNumber:extrinsicIndex`), concatenating the matched arrays, and
854
+ * sorted by block descending.
855
+ *
856
+ * Privacy note: these lookups send the wallet's own note identifiers to
857
+ * the indexer — a bounded, documented linkage tradeoff for timestamp
858
+ * recovery. They are NEVER used for spent-STATUS checks (PIR-A: status
859
+ * comes from the anonymous full-set `/shielded/nullifiers/all` download).
860
+ */
861
+ private fetchTransfersChunked;
847
862
  /**
848
863
  * Returns temporal metadata for private transfers that spent any of the given nullifiers.
849
864
  * Only blockNumber, extrinsicIndex, timestampMs, and hash are returned — no cross-link
850
865
  * between inputs and outputs to prevent graph reconstruction.
851
- * Accepts up to 50 nullifiers (0x-prefixed hex).
866
+ * Inputs of any size are transparently chunked into requests of 50 (the server cap)
867
+ * and merged per extrinsic.
852
868
  */
853
869
  getTransfersByNullifiers(nullifiers: string[]): Promise<PrivateTransferTimestamp[]>;
854
870
  /**
855
871
  * Returns temporal metadata for private transfers that produced any of the given commitments.
856
872
  * Only blockNumber, extrinsicIndex, timestampMs, and hash are returned — no cross-link
857
873
  * between outputs and inputs to prevent graph reconstruction.
858
- * Accepts up to 50 commitments (0x-prefixed hex).
874
+ * Inputs of any size are transparently chunked into requests of 50 (the server cap)
875
+ * and merged per extrinsic.
859
876
  */
860
877
  getTransfersByCommitments(commitments: string[]): Promise<PrivateTransferTimestamp[]>;
861
878
  /** Returns a paginated list of unshield events. */
@@ -2803,6 +2820,25 @@ declare function vaultReviver(_key: string, value: unknown): unknown;
2803
2820
  * @param masterBytes 32-byte pre-modulus key material from deriveMasterKeyBytes().
2804
2821
  */
2805
2822
  declare function deriveVaultKey(masterBytes: Uint8Array): Promise<CryptoKey>;
2823
+ /**
2824
+ * Derives an HMAC-SHA-256 key ("blind key") from the same master key bytes,
2825
+ * for deterministically tagging note identifiers (commitment/nullifier) in the
2826
+ * vault WITHOUT storing them in plaintext.
2827
+ *
2828
+ * The tag `HMAC(blindKey, hex)` is stable, so equality lookups still work
2829
+ * (find a note by commitment/nullifier), but a raw storage dump reveals no
2830
+ * on-chain identifiers — an attacker with disk access can't link the vault to
2831
+ * chain activity. Derived from masterBytes, so it's device-independent and
2832
+ * survives reload (unlike a random per-session salt).
2833
+ *
2834
+ * @param masterBytes 32-byte pre-modulus key material from deriveMasterKeyBytes().
2835
+ */
2836
+ declare function deriveVaultBlindKey(masterBytes: Uint8Array): Promise<CryptoKey>;
2837
+ /**
2838
+ * Deterministic tag for a note identifier hex, as `0x`-prefixed HMAC-SHA-256.
2839
+ * Used as the blinded storage key for commitment / nullifier / assetId.
2840
+ */
2841
+ declare function blindTag(blindKey: CryptoKey, value: string): Promise<string>;
2806
2842
  /**
2807
2843
  * Serialises `payload` to JSON (bigint-safe) and encrypts it with AES-GCM.
2808
2844
  * Returns base64-encoded `iv` and `ciphertext`.
@@ -2824,18 +2860,26 @@ declare function decryptJson(key: CryptoKey, iv: string, ciphertext: string): Pr
2824
2860
  * Any backend (IndexedDB, SQLite, remote…) must produce/consume this shape
2825
2861
  * so that encryptNote / decryptNoteRecord work without modification.
2826
2862
  */
2827
- /** A single encrypted note record as stored in the vault backend. */
2863
+ /**
2864
+ * A single encrypted note record as stored in the vault backend.
2865
+ *
2866
+ * Note identifiers are BLINDED — stored as HMAC tags derived from the vault
2867
+ * blind key, not the raw on-chain hex. A storage dump reveals no
2868
+ * commitment/nullifier/asset that could be linked to chain activity, yet
2869
+ * equality lookups (find-my-note) still work by comparing tags. `spent` /
2870
+ * `spentAt` stay plaintext: they're local flags with no on-chain linkage.
2871
+ */
2828
2872
  interface EncryptedNoteRecord {
2829
- /** Primary key — note commitmentHex */
2830
- commitmentHex: string;
2873
+ /** Primary key — blinded commitment tag: HMAC(blindKey, commitmentHex). */
2874
+ commitmentTag: string;
2831
2875
  /** AES-GCM IV for this record — base64 */
2832
2876
  iv: string;
2833
2877
  /** AES-GCM ciphertext of the full ZkNote JSON — base64 */
2834
2878
  ciphertext: string;
2835
- /** Unencrypted nullifierHex for quick spent-check without unlocking */
2836
- nullifierHex: string;
2837
- /** Unencrypted assetId (string form of bigint) for filtering */
2838
- assetId: string;
2879
+ /** Blinded nullifier tag: HMAC(blindKey, nullifierHex). Quick spent-check. */
2880
+ nullifierTag: string;
2881
+ /** Blinded asset tag: HMAC(blindKey, assetId). Filter by asset without unlock. */
2882
+ assetTag: string;
2839
2883
  /** Whether the note has already been spent/nullified on-chain. */
2840
2884
  spent?: boolean;
2841
2885
  /** When the app marked the note as spent locally, if known. */
@@ -2869,17 +2913,25 @@ declare class VaultLockedError extends Error {
2869
2913
  */
2870
2914
  declare function applyNoteStatus(note: ZkNote, status?: NoteStatusUpdate): ZkNote;
2871
2915
  /**
2872
- * Encrypts a ZkNote into an EncryptedNoteRecord using AES-GCM.
2873
- * The commitmentHex, nullifierHex, and assetId are stored in plaintext
2874
- * for efficient filtering without requiring vault unlock.
2916
+ * Encrypts a ZkNote into a v2 EncryptedNoteRecord.
2917
+ *
2918
+ * The full note (values, secrets) is AES-GCM encrypted under `key`; the note
2919
+ * identifiers (commitment, nullifier, asset) are stored as BLIND TAGS under
2920
+ * `blindKey` instead of plaintext — a storage dump reveals nothing linkable to
2921
+ * chain activity, while equality lookups still work (compare tags).
2875
2922
  */
2876
- declare function encryptNote(key: CryptoKey, note: ZkNote): Promise<EncryptedNoteRecord>;
2923
+ declare function encryptNote(key: CryptoKey, blindKey: CryptoKey, note: ZkNote): Promise<EncryptedNoteRecord>;
2877
2924
  /**
2878
- * Decrypts an EncryptedNoteRecord back into a ZkNote using AES-GCM.
2925
+ * Decrypts a note record back into a ZkNote.
2879
2926
  * Applies the record's spent/spentAt metadata onto the decrypted note.
2880
2927
  * Throws DOMException on authentication failure (wrong key or corrupted data).
2881
2928
  */
2882
2929
  declare function decryptNoteRecord(key: CryptoKey, rec: EncryptedNoteRecord): Promise<ZkNote>;
2930
+ /**
2931
+ * Blind tag for a note identifier hex — use to build the storage key or to
2932
+ * look a record up by commitment/nullifier without exposing the raw hex.
2933
+ */
2934
+ declare function noteBlindTag(blindKey: CryptoKey, hex: string): Promise<string>;
2883
2935
 
2884
2936
  /**
2885
2937
  * Inputs required to generate an Unshield proof.
@@ -4474,4 +4526,4 @@ interface ExtrinsicFailedData {
4474
4526
  dispatch_info: DispatchInfo;
4475
4527
  }
4476
4528
 
4477
- export { type AccountListing, type AccountMappedData, type AccountMappedEvent, type AccountMappingCall, type AccountMappingEvent, AccountMappingModule, AccountMappingPrecompile, type AccountMetadata, type AccountUnmappedEvent, type ActiveVersionSetEvent, type ActivityBucket, 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, type ChainInfo, type ChainLink, type ChainLinkAddedEvent, type ChainLinkRemovedEvent, CircuitId, CircuitId as CircuitIdType, 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, type IndexedBlock, type IndexedEvmTx, type IndexedExtrinsic, type IndexedSession, type IndexedValidator, type IndexerActivity, IndexerClient, type IndexerClientConfig, type IndexerStats, KNOWN_PRECOMPILES, type KnownPrecompileInfo, type ListingInfo, type MerkleRoot, type MerkleRootUpdatedData, type MerkleRootUpdatedEvent, type MerkleTreeInfo, type MetadataUpdatedEvent, NoteBuilder, type NoteDisclosure, type NoteInput, type NoteStatusUpdate, type NullifierStatusResult, type NullifiersSpentEvent, type NullifiersSpentEventData, OrbinumClient, type OrbinumClientConfig, OrbinumClientProvider, PRECOMPILE_ADDR, type PaginatedResult, 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 PrivateTransferTimestamp, 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 RegisteredAsset, type RelayFeeEvent, type RelayFeeSummaryEntry, type Relayer, type RelayerInfo, RelayerStatusModule, type RemoveChainLinkArgs, type RemovePrivateLinkArgs, type RemoveSupportedChainArgs, type RemoveVerificationKeyArgs, type ReservedEventData, type ResolvedAlias, 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 ShieldedAddressEvent, type ShieldedCommitment, type ShieldedEvent, type ShieldedEventData, type ShieldedPoolCall, type ShieldedPoolEvent, ShieldedPoolModule, ShieldedPoolPrecompile, SignatureScheme, type SpentNullifier, type StatusChangeEvent, type StatusListener, type StealthScanHint, SubstrateClient, type SupportedChain, type SupportedChainAddedEvent, type SupportedChainRemovedEvent, type SystemHealth, type TokenInfo, type TokenTransfer, type TransferAliasArgs, type TransferEventData, type TransferInputNote, type TransferOutputNote, type TxResult, type UnsafeTxOptions, type Unshield, 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, buildDummyTransferInput, bytesToBigintLE, computeNullifier, computePathIndices, createNoteDisclosureKey, decodeNoteDisclosureKey, decodePrecompileCalldata, decryptJson, decryptNoteRecord, deriveMasterKeyBytes, deriveOwnerPk, deriveSpendingKeyFromSignature, deriveSpendingKeyMessage, deriveStealthOwnerPk, deriveStealthSk, deriveVaultKey, 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, randomBlinding, recoverOwnerPkPoint, selectNotes, shortHash, substrateSs58ToAccountIdHex, substrateToEvm, toBase64, toHex, toTxResult, truncateMiddle, tryDecryptNote, tryDecryptNoteVerbose, vaultReplacer, vaultReviver };
4529
+ export { type AccountListing, type AccountMappedData, type AccountMappedEvent, type AccountMappingCall, type AccountMappingEvent, AccountMappingModule, AccountMappingPrecompile, type AccountMetadata, type AccountUnmappedEvent, type ActiveVersionSetEvent, type ActivityBucket, 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, type ChainInfo, type ChainLink, type ChainLinkAddedEvent, type ChainLinkRemovedEvent, CircuitId, CircuitId as CircuitIdType, 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, type IndexedBlock, type IndexedEvmTx, type IndexedExtrinsic, type IndexedSession, type IndexedValidator, type IndexerActivity, IndexerClient, type IndexerClientConfig, type IndexerStats, KNOWN_PRECOMPILES, type KnownPrecompileInfo, type ListingInfo, type MerkleRoot, type MerkleRootUpdatedData, type MerkleRootUpdatedEvent, type MerkleTreeInfo, type MetadataUpdatedEvent, NoteBuilder, type NoteDisclosure, type NoteInput, type NoteStatusUpdate, type NullifierStatusResult, type NullifiersSpentEvent, type NullifiersSpentEventData, OrbinumClient, type OrbinumClientConfig, OrbinumClientProvider, PRECOMPILE_ADDR, type PaginatedResult, 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 PrivateTransferTimestamp, 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 RegisteredAsset, type RelayFeeEvent, type RelayFeeSummaryEntry, type Relayer, type RelayerInfo, RelayerStatusModule, type RemoveChainLinkArgs, type RemovePrivateLinkArgs, type RemoveSupportedChainArgs, type RemoveVerificationKeyArgs, type ReservedEventData, type ResolvedAlias, 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 ShieldedAddressEvent, type ShieldedCommitment, type ShieldedEvent, type ShieldedEventData, type ShieldedPoolCall, type ShieldedPoolEvent, ShieldedPoolModule, ShieldedPoolPrecompile, SignatureScheme, type SpentNullifier, type StatusChangeEvent, type StatusListener, type StealthScanHint, SubstrateClient, type SupportedChain, type SupportedChainAddedEvent, type SupportedChainRemovedEvent, type SystemHealth, type TokenInfo, type TokenTransfer, type TransferAliasArgs, type TransferEventData, type TransferInputNote, type TransferOutputNote, type TxResult, type UnsafeTxOptions, type Unshield, 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, 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 };
package/dist/index.d.ts CHANGED
@@ -844,18 +844,35 @@ declare class IndexerClient {
844
844
  * For the current Orbinum testnet/mainnet scale this is the recommended approach.
845
845
  */
846
846
  getAllSpentNullifiers(): Promise<Set<string>>;
847
+ /** Server-enforced max items per by-nullifiers / by-commitments request. */
848
+ private static readonly TRANSFER_LOOKUP_CHUNK;
849
+ /**
850
+ * Chunked fetch for the transfer timestamp lookups. The reader silently
851
+ * truncates each request to 50 items, so larger inputs MUST be split or
852
+ * results are silently lost. Responses are merged per extrinsic
853
+ * (`blockNumber:extrinsicIndex`), concatenating the matched arrays, and
854
+ * sorted by block descending.
855
+ *
856
+ * Privacy note: these lookups send the wallet's own note identifiers to
857
+ * the indexer — a bounded, documented linkage tradeoff for timestamp
858
+ * recovery. They are NEVER used for spent-STATUS checks (PIR-A: status
859
+ * comes from the anonymous full-set `/shielded/nullifiers/all` download).
860
+ */
861
+ private fetchTransfersChunked;
847
862
  /**
848
863
  * Returns temporal metadata for private transfers that spent any of the given nullifiers.
849
864
  * Only blockNumber, extrinsicIndex, timestampMs, and hash are returned — no cross-link
850
865
  * between inputs and outputs to prevent graph reconstruction.
851
- * Accepts up to 50 nullifiers (0x-prefixed hex).
866
+ * Inputs of any size are transparently chunked into requests of 50 (the server cap)
867
+ * and merged per extrinsic.
852
868
  */
853
869
  getTransfersByNullifiers(nullifiers: string[]): Promise<PrivateTransferTimestamp[]>;
854
870
  /**
855
871
  * Returns temporal metadata for private transfers that produced any of the given commitments.
856
872
  * Only blockNumber, extrinsicIndex, timestampMs, and hash are returned — no cross-link
857
873
  * between outputs and inputs to prevent graph reconstruction.
858
- * Accepts up to 50 commitments (0x-prefixed hex).
874
+ * Inputs of any size are transparently chunked into requests of 50 (the server cap)
875
+ * and merged per extrinsic.
859
876
  */
860
877
  getTransfersByCommitments(commitments: string[]): Promise<PrivateTransferTimestamp[]>;
861
878
  /** Returns a paginated list of unshield events. */
@@ -2803,6 +2820,25 @@ declare function vaultReviver(_key: string, value: unknown): unknown;
2803
2820
  * @param masterBytes 32-byte pre-modulus key material from deriveMasterKeyBytes().
2804
2821
  */
2805
2822
  declare function deriveVaultKey(masterBytes: Uint8Array): Promise<CryptoKey>;
2823
+ /**
2824
+ * Derives an HMAC-SHA-256 key ("blind key") from the same master key bytes,
2825
+ * for deterministically tagging note identifiers (commitment/nullifier) in the
2826
+ * vault WITHOUT storing them in plaintext.
2827
+ *
2828
+ * The tag `HMAC(blindKey, hex)` is stable, so equality lookups still work
2829
+ * (find a note by commitment/nullifier), but a raw storage dump reveals no
2830
+ * on-chain identifiers — an attacker with disk access can't link the vault to
2831
+ * chain activity. Derived from masterBytes, so it's device-independent and
2832
+ * survives reload (unlike a random per-session salt).
2833
+ *
2834
+ * @param masterBytes 32-byte pre-modulus key material from deriveMasterKeyBytes().
2835
+ */
2836
+ declare function deriveVaultBlindKey(masterBytes: Uint8Array): Promise<CryptoKey>;
2837
+ /**
2838
+ * Deterministic tag for a note identifier hex, as `0x`-prefixed HMAC-SHA-256.
2839
+ * Used as the blinded storage key for commitment / nullifier / assetId.
2840
+ */
2841
+ declare function blindTag(blindKey: CryptoKey, value: string): Promise<string>;
2806
2842
  /**
2807
2843
  * Serialises `payload` to JSON (bigint-safe) and encrypts it with AES-GCM.
2808
2844
  * Returns base64-encoded `iv` and `ciphertext`.
@@ -2824,18 +2860,26 @@ declare function decryptJson(key: CryptoKey, iv: string, ciphertext: string): Pr
2824
2860
  * Any backend (IndexedDB, SQLite, remote…) must produce/consume this shape
2825
2861
  * so that encryptNote / decryptNoteRecord work without modification.
2826
2862
  */
2827
- /** A single encrypted note record as stored in the vault backend. */
2863
+ /**
2864
+ * A single encrypted note record as stored in the vault backend.
2865
+ *
2866
+ * Note identifiers are BLINDED — stored as HMAC tags derived from the vault
2867
+ * blind key, not the raw on-chain hex. A storage dump reveals no
2868
+ * commitment/nullifier/asset that could be linked to chain activity, yet
2869
+ * equality lookups (find-my-note) still work by comparing tags. `spent` /
2870
+ * `spentAt` stay plaintext: they're local flags with no on-chain linkage.
2871
+ */
2828
2872
  interface EncryptedNoteRecord {
2829
- /** Primary key — note commitmentHex */
2830
- commitmentHex: string;
2873
+ /** Primary key — blinded commitment tag: HMAC(blindKey, commitmentHex). */
2874
+ commitmentTag: string;
2831
2875
  /** AES-GCM IV for this record — base64 */
2832
2876
  iv: string;
2833
2877
  /** AES-GCM ciphertext of the full ZkNote JSON — base64 */
2834
2878
  ciphertext: string;
2835
- /** Unencrypted nullifierHex for quick spent-check without unlocking */
2836
- nullifierHex: string;
2837
- /** Unencrypted assetId (string form of bigint) for filtering */
2838
- assetId: string;
2879
+ /** Blinded nullifier tag: HMAC(blindKey, nullifierHex). Quick spent-check. */
2880
+ nullifierTag: string;
2881
+ /** Blinded asset tag: HMAC(blindKey, assetId). Filter by asset without unlock. */
2882
+ assetTag: string;
2839
2883
  /** Whether the note has already been spent/nullified on-chain. */
2840
2884
  spent?: boolean;
2841
2885
  /** When the app marked the note as spent locally, if known. */
@@ -2869,17 +2913,25 @@ declare class VaultLockedError extends Error {
2869
2913
  */
2870
2914
  declare function applyNoteStatus(note: ZkNote, status?: NoteStatusUpdate): ZkNote;
2871
2915
  /**
2872
- * Encrypts a ZkNote into an EncryptedNoteRecord using AES-GCM.
2873
- * The commitmentHex, nullifierHex, and assetId are stored in plaintext
2874
- * for efficient filtering without requiring vault unlock.
2916
+ * Encrypts a ZkNote into a v2 EncryptedNoteRecord.
2917
+ *
2918
+ * The full note (values, secrets) is AES-GCM encrypted under `key`; the note
2919
+ * identifiers (commitment, nullifier, asset) are stored as BLIND TAGS under
2920
+ * `blindKey` instead of plaintext — a storage dump reveals nothing linkable to
2921
+ * chain activity, while equality lookups still work (compare tags).
2875
2922
  */
2876
- declare function encryptNote(key: CryptoKey, note: ZkNote): Promise<EncryptedNoteRecord>;
2923
+ declare function encryptNote(key: CryptoKey, blindKey: CryptoKey, note: ZkNote): Promise<EncryptedNoteRecord>;
2877
2924
  /**
2878
- * Decrypts an EncryptedNoteRecord back into a ZkNote using AES-GCM.
2925
+ * Decrypts a note record back into a ZkNote.
2879
2926
  * Applies the record's spent/spentAt metadata onto the decrypted note.
2880
2927
  * Throws DOMException on authentication failure (wrong key or corrupted data).
2881
2928
  */
2882
2929
  declare function decryptNoteRecord(key: CryptoKey, rec: EncryptedNoteRecord): Promise<ZkNote>;
2930
+ /**
2931
+ * Blind tag for a note identifier hex — use to build the storage key or to
2932
+ * look a record up by commitment/nullifier without exposing the raw hex.
2933
+ */
2934
+ declare function noteBlindTag(blindKey: CryptoKey, hex: string): Promise<string>;
2883
2935
 
2884
2936
  /**
2885
2937
  * Inputs required to generate an Unshield proof.
@@ -4474,4 +4526,4 @@ interface ExtrinsicFailedData {
4474
4526
  dispatch_info: DispatchInfo;
4475
4527
  }
4476
4528
 
4477
- export { type AccountListing, type AccountMappedData, type AccountMappedEvent, type AccountMappingCall, type AccountMappingEvent, AccountMappingModule, AccountMappingPrecompile, type AccountMetadata, type AccountUnmappedEvent, type ActiveVersionSetEvent, type ActivityBucket, 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, type ChainInfo, type ChainLink, type ChainLinkAddedEvent, type ChainLinkRemovedEvent, CircuitId, CircuitId as CircuitIdType, 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, type IndexedBlock, type IndexedEvmTx, type IndexedExtrinsic, type IndexedSession, type IndexedValidator, type IndexerActivity, IndexerClient, type IndexerClientConfig, type IndexerStats, KNOWN_PRECOMPILES, type KnownPrecompileInfo, type ListingInfo, type MerkleRoot, type MerkleRootUpdatedData, type MerkleRootUpdatedEvent, type MerkleTreeInfo, type MetadataUpdatedEvent, NoteBuilder, type NoteDisclosure, type NoteInput, type NoteStatusUpdate, type NullifierStatusResult, type NullifiersSpentEvent, type NullifiersSpentEventData, OrbinumClient, type OrbinumClientConfig, OrbinumClientProvider, PRECOMPILE_ADDR, type PaginatedResult, 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 PrivateTransferTimestamp, 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 RegisteredAsset, type RelayFeeEvent, type RelayFeeSummaryEntry, type Relayer, type RelayerInfo, RelayerStatusModule, type RemoveChainLinkArgs, type RemovePrivateLinkArgs, type RemoveSupportedChainArgs, type RemoveVerificationKeyArgs, type ReservedEventData, type ResolvedAlias, 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 ShieldedAddressEvent, type ShieldedCommitment, type ShieldedEvent, type ShieldedEventData, type ShieldedPoolCall, type ShieldedPoolEvent, ShieldedPoolModule, ShieldedPoolPrecompile, SignatureScheme, type SpentNullifier, type StatusChangeEvent, type StatusListener, type StealthScanHint, SubstrateClient, type SupportedChain, type SupportedChainAddedEvent, type SupportedChainRemovedEvent, type SystemHealth, type TokenInfo, type TokenTransfer, type TransferAliasArgs, type TransferEventData, type TransferInputNote, type TransferOutputNote, type TxResult, type UnsafeTxOptions, type Unshield, 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, buildDummyTransferInput, bytesToBigintLE, computeNullifier, computePathIndices, createNoteDisclosureKey, decodeNoteDisclosureKey, decodePrecompileCalldata, decryptJson, decryptNoteRecord, deriveMasterKeyBytes, deriveOwnerPk, deriveSpendingKeyFromSignature, deriveSpendingKeyMessage, deriveStealthOwnerPk, deriveStealthSk, deriveVaultKey, 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, randomBlinding, recoverOwnerPkPoint, selectNotes, shortHash, substrateSs58ToAccountIdHex, substrateToEvm, toBase64, toHex, toTxResult, truncateMiddle, tryDecryptNote, tryDecryptNoteVerbose, vaultReplacer, vaultReviver };
4529
+ export { type AccountListing, type AccountMappedData, type AccountMappedEvent, type AccountMappingCall, type AccountMappingEvent, AccountMappingModule, AccountMappingPrecompile, type AccountMetadata, type AccountUnmappedEvent, type ActiveVersionSetEvent, type ActivityBucket, 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, type ChainInfo, type ChainLink, type ChainLinkAddedEvent, type ChainLinkRemovedEvent, CircuitId, CircuitId as CircuitIdType, 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, type IndexedBlock, type IndexedEvmTx, type IndexedExtrinsic, type IndexedSession, type IndexedValidator, type IndexerActivity, IndexerClient, type IndexerClientConfig, type IndexerStats, KNOWN_PRECOMPILES, type KnownPrecompileInfo, type ListingInfo, type MerkleRoot, type MerkleRootUpdatedData, type MerkleRootUpdatedEvent, type MerkleTreeInfo, type MetadataUpdatedEvent, NoteBuilder, type NoteDisclosure, type NoteInput, type NoteStatusUpdate, type NullifierStatusResult, type NullifiersSpentEvent, type NullifiersSpentEventData, OrbinumClient, type OrbinumClientConfig, OrbinumClientProvider, PRECOMPILE_ADDR, type PaginatedResult, 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 PrivateTransferTimestamp, 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 RegisteredAsset, type RelayFeeEvent, type RelayFeeSummaryEntry, type Relayer, type RelayerInfo, RelayerStatusModule, type RemoveChainLinkArgs, type RemovePrivateLinkArgs, type RemoveSupportedChainArgs, type RemoveVerificationKeyArgs, type ReservedEventData, type ResolvedAlias, 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 ShieldedAddressEvent, type ShieldedCommitment, type ShieldedEvent, type ShieldedEventData, type ShieldedPoolCall, type ShieldedPoolEvent, ShieldedPoolModule, ShieldedPoolPrecompile, SignatureScheme, type SpentNullifier, type StatusChangeEvent, type StatusListener, type StealthScanHint, SubstrateClient, type SupportedChain, type SupportedChainAddedEvent, type SupportedChainRemovedEvent, type SystemHealth, type TokenInfo, type TokenTransfer, type TransferAliasArgs, type TransferEventData, type TransferInputNote, type TransferOutputNote, type TxResult, type UnsafeTxOptions, type Unshield, 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, 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 };
package/dist/index.js CHANGED
@@ -59,6 +59,7 @@ __export(index_exports, {
59
59
  bigintTo32Be: () => bigintTo32Be,
60
60
  bigintTo32Le: () => bigintTo32Le,
61
61
  bigintTo32LeArr: () => bigintTo32LeArr,
62
+ blindTag: () => blindTag,
62
63
  buildDummyTransferInput: () => buildDummyTransferInput,
63
64
  bytesToBigintLE: () => bytesToBigintLE,
64
65
  computeNullifier: () => computeNullifier,
@@ -75,6 +76,7 @@ __export(index_exports, {
75
76
  deriveSpendingKeyMessage: () => deriveSpendingKeyMessage,
76
77
  deriveStealthOwnerPk: () => deriveStealthOwnerPk,
77
78
  deriveStealthSk: () => deriveStealthSk,
79
+ deriveVaultBlindKey: () => deriveVaultBlindKey,
78
80
  deriveVaultKey: () => deriveVaultKey,
79
81
  deriveViewingPublicKey: () => deriveViewingPublicKey,
80
82
  deriveViewingSecretKey: () => deriveViewingSecretKey,
@@ -109,6 +111,7 @@ __export(index_exports, {
109
111
  mapExtrinsicArgs: () => mapExtrinsicArgs,
110
112
  mapZkEventData: () => mapZkEventData,
111
113
  normalizeEvmAddress: () => normalizeEvmAddress,
114
+ noteBlindTag: () => noteBlindTag,
112
115
  randomBlinding: () => randomBlinding,
113
116
  recoverOwnerPkPoint: () => recoverOwnerPkPoint,
114
117
  selectNotes: () => selectNotes,
@@ -1147,7 +1150,7 @@ var EvmExplorer = class _EvmExplorer {
1147
1150
  };
1148
1151
 
1149
1152
  // src/indexer/IndexerClient.ts
1150
- var IndexerClient = class {
1153
+ var IndexerClient = class _IndexerClient {
1151
1154
  baseUrl;
1152
1155
  timeoutMs;
1153
1156
  constructor(config) {
@@ -1247,37 +1250,82 @@ var IndexerClient = class {
1247
1250
  return new Set(res.data.map((h) => h.toLowerCase()));
1248
1251
  }
1249
1252
  // ─── Private transfers ─────────────────────────────────────────────────────
1253
+ /** Server-enforced max items per by-nullifiers / by-commitments request. */
1254
+ static TRANSFER_LOOKUP_CHUNK = 50;
1255
+ /**
1256
+ * Chunked fetch for the transfer timestamp lookups. The reader silently
1257
+ * truncates each request to 50 items, so larger inputs MUST be split or
1258
+ * results are silently lost. Responses are merged per extrinsic
1259
+ * (`blockNumber:extrinsicIndex`), concatenating the matched arrays, and
1260
+ * sorted by block descending.
1261
+ *
1262
+ * Privacy note: these lookups send the wallet's own note identifiers to
1263
+ * the indexer — a bounded, documented linkage tradeoff for timestamp
1264
+ * recovery. They are NEVER used for spent-STATUS checks (PIR-A: status
1265
+ * comes from the anonymous full-set `/shielded/nullifiers/all` download).
1266
+ */
1267
+ async fetchTransfersChunked(path, param, items, matchedField) {
1268
+ if (items.length === 0) return [];
1269
+ const normalized = items.map((i) => i.toLowerCase());
1270
+ const chunks = [];
1271
+ for (let i = 0; i < normalized.length; i += _IndexerClient.TRANSFER_LOOKUP_CHUNK) {
1272
+ chunks.push(normalized.slice(i, i + _IndexerClient.TRANSFER_LOOKUP_CHUNK));
1273
+ }
1274
+ const responses = await Promise.all(
1275
+ chunks.map((chunk) => {
1276
+ const qs = this.buildQuery({ [param]: chunk.join(",") });
1277
+ return this.get(
1278
+ `${path}${qs}`
1279
+ );
1280
+ })
1281
+ );
1282
+ const byExtrinsic = /* @__PURE__ */ new Map();
1283
+ for (const res of responses) {
1284
+ for (const transfer of res.data) {
1285
+ const key = `${transfer.blockNumber}:${transfer.extrinsicIndex ?? "null"}`;
1286
+ const existing = byExtrinsic.get(key);
1287
+ if (!existing) {
1288
+ byExtrinsic.set(key, transfer);
1289
+ continue;
1290
+ }
1291
+ const merged = /* @__PURE__ */ new Set([
1292
+ ...existing[matchedField] ?? [],
1293
+ ...transfer[matchedField] ?? []
1294
+ ]);
1295
+ existing[matchedField] = [...merged];
1296
+ }
1297
+ }
1298
+ return [...byExtrinsic.values()].sort((a, b) => b.blockNumber - a.blockNumber);
1299
+ }
1250
1300
  /**
1251
1301
  * Returns temporal metadata for private transfers that spent any of the given nullifiers.
1252
1302
  * Only blockNumber, extrinsicIndex, timestampMs, and hash are returned — no cross-link
1253
1303
  * between inputs and outputs to prevent graph reconstruction.
1254
- * Accepts up to 50 nullifiers (0x-prefixed hex).
1304
+ * Inputs of any size are transparently chunked into requests of 50 (the server cap)
1305
+ * and merged per extrinsic.
1255
1306
  */
1256
1307
  async getTransfersByNullifiers(nullifiers) {
1257
- if (nullifiers.length === 0) return [];
1258
- const qs = this.buildQuery({
1259
- nullifiers: nullifiers.map((n) => n.toLowerCase()).join(",")
1260
- });
1261
- const res = await this.get(
1262
- `/shielded/transfers/by-nullifiers${qs}`
1308
+ return this.fetchTransfersChunked(
1309
+ "/shielded/transfers/by-nullifiers",
1310
+ "nullifiers",
1311
+ nullifiers,
1312
+ "matchedNullifiers"
1263
1313
  );
1264
- return res.data;
1265
1314
  }
1266
1315
  /**
1267
1316
  * Returns temporal metadata for private transfers that produced any of the given commitments.
1268
1317
  * Only blockNumber, extrinsicIndex, timestampMs, and hash are returned — no cross-link
1269
1318
  * between outputs and inputs to prevent graph reconstruction.
1270
- * Accepts up to 50 commitments (0x-prefixed hex).
1319
+ * Inputs of any size are transparently chunked into requests of 50 (the server cap)
1320
+ * and merged per extrinsic.
1271
1321
  */
1272
1322
  async getTransfersByCommitments(commitments) {
1273
- if (commitments.length === 0) return [];
1274
- const qs = this.buildQuery({
1275
- commitments: commitments.map((c) => c.toLowerCase()).join(",")
1276
- });
1277
- const res = await this.get(
1278
- `/shielded/transfers/by-commitments${qs}`
1323
+ return this.fetchTransfersChunked(
1324
+ "/shielded/transfers/by-commitments",
1325
+ "commitments",
1326
+ commitments,
1327
+ "matchedCommitments"
1279
1328
  );
1280
- return res.data;
1281
1329
  }
1282
1330
  // ─── Unshields ─────────────────────────────────────────────────────────────
1283
1331
  /** Returns a paginated list of unshield events. */
@@ -4439,6 +4487,7 @@ function fromBase64(b64) {
4439
4487
 
4440
4488
  // src/vault/VaultCrypto.ts
4441
4489
  var VAULT_KEY_INFO = new TextEncoder().encode("orbinum-vault-key-v1");
4490
+ var VAULT_BLIND_INFO = new TextEncoder().encode("orbinum-vault-blind-v1");
4442
4491
  var IV_BYTES = 12;
4443
4492
  async function deriveVaultKey(masterBytes) {
4444
4493
  const keyMaterial = await crypto.subtle.importKey("raw", masterBytes.slice(0), "HKDF", false, [
@@ -4457,6 +4506,28 @@ async function deriveVaultKey(masterBytes) {
4457
4506
  ["encrypt", "decrypt"]
4458
4507
  );
4459
4508
  }
4509
+ async function deriveVaultBlindKey(masterBytes) {
4510
+ const keyMaterial = await crypto.subtle.importKey("raw", masterBytes.slice(0), "HKDF", false, [
4511
+ "deriveKey"
4512
+ ]);
4513
+ return crypto.subtle.deriveKey(
4514
+ {
4515
+ name: "HKDF",
4516
+ hash: "SHA-256",
4517
+ salt: new Uint8Array(0),
4518
+ info: VAULT_BLIND_INFO
4519
+ },
4520
+ keyMaterial,
4521
+ { name: "HMAC", hash: "SHA-256", length: 256 },
4522
+ false,
4523
+ ["sign"]
4524
+ );
4525
+ }
4526
+ async function blindTag(blindKey, value) {
4527
+ const data = new TextEncoder().encode(value.toLowerCase());
4528
+ const sig = await crypto.subtle.sign("HMAC", blindKey, data);
4529
+ return "0x" + toBase64(sig).replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
4530
+ }
4460
4531
  async function encryptJson(key, payload) {
4461
4532
  const iv = crypto.getRandomValues(new Uint8Array(IV_BYTES));
4462
4533
  const plaintext = new TextEncoder().encode(JSON.stringify(payload, vaultReplacer));
@@ -4488,14 +4559,19 @@ function applyNoteStatus(note, status) {
4488
4559
  spentAt: status?.spentAt ?? note.spentAt ?? null
4489
4560
  };
4490
4561
  }
4491
- async function encryptNote(key, note) {
4562
+ async function encryptNote(key, blindKey, note) {
4492
4563
  const { iv, ciphertext } = await encryptJson(key, note);
4564
+ const [commitmentTag, nullifierTag, assetTag] = await Promise.all([
4565
+ blindTag(blindKey, note.commitmentHex),
4566
+ blindTag(blindKey, note.nullifierHex),
4567
+ blindTag(blindKey, note.assetId.toString())
4568
+ ]);
4493
4569
  return {
4494
- commitmentHex: note.commitmentHex,
4570
+ commitmentTag,
4495
4571
  iv,
4496
4572
  ciphertext,
4497
- nullifierHex: note.nullifierHex,
4498
- assetId: note.assetId.toString(),
4573
+ nullifierTag,
4574
+ assetTag,
4499
4575
  spent: note.spent,
4500
4576
  spentAt: note.spentAt,
4501
4577
  updatedAt: Date.now()
@@ -4508,6 +4584,9 @@ async function decryptNoteRecord(key, rec) {
4508
4584
  spentAt: rec.spentAt ?? null
4509
4585
  });
4510
4586
  }
4587
+ async function noteBlindTag(blindKey, hex) {
4588
+ return blindTag(blindKey, hex);
4589
+ }
4511
4590
 
4512
4591
  // src/proof-generator/unshield.ts
4513
4592
  var import_proof_generator = require("@orbinum/proof-generator");
@@ -5414,6 +5493,7 @@ var import_polkadot_api4 = require("polkadot-api");
5414
5493
  bigintTo32Be,
5415
5494
  bigintTo32Le,
5416
5495
  bigintTo32LeArr,
5496
+ blindTag,
5417
5497
  buildDummyTransferInput,
5418
5498
  bytesToBigintLE,
5419
5499
  computeNullifier,
@@ -5430,6 +5510,7 @@ var import_polkadot_api4 = require("polkadot-api");
5430
5510
  deriveSpendingKeyMessage,
5431
5511
  deriveStealthOwnerPk,
5432
5512
  deriveStealthSk,
5513
+ deriveVaultBlindKey,
5433
5514
  deriveVaultKey,
5434
5515
  deriveViewingPublicKey,
5435
5516
  deriveViewingSecretKey,
@@ -5464,6 +5545,7 @@ var import_polkadot_api4 = require("polkadot-api");
5464
5545
  mapExtrinsicArgs,
5465
5546
  mapZkEventData,
5466
5547
  normalizeEvmAddress,
5548
+ noteBlindTag,
5467
5549
  randomBlinding,
5468
5550
  recoverOwnerPkPoint,
5469
5551
  selectNotes,
package/dist/index.mjs CHANGED
@@ -1020,7 +1020,7 @@ var EvmExplorer = class _EvmExplorer {
1020
1020
  };
1021
1021
 
1022
1022
  // src/indexer/IndexerClient.ts
1023
- var IndexerClient = class {
1023
+ var IndexerClient = class _IndexerClient {
1024
1024
  baseUrl;
1025
1025
  timeoutMs;
1026
1026
  constructor(config) {
@@ -1120,37 +1120,82 @@ var IndexerClient = class {
1120
1120
  return new Set(res.data.map((h) => h.toLowerCase()));
1121
1121
  }
1122
1122
  // ─── Private transfers ─────────────────────────────────────────────────────
1123
+ /** Server-enforced max items per by-nullifiers / by-commitments request. */
1124
+ static TRANSFER_LOOKUP_CHUNK = 50;
1125
+ /**
1126
+ * Chunked fetch for the transfer timestamp lookups. The reader silently
1127
+ * truncates each request to 50 items, so larger inputs MUST be split or
1128
+ * results are silently lost. Responses are merged per extrinsic
1129
+ * (`blockNumber:extrinsicIndex`), concatenating the matched arrays, and
1130
+ * sorted by block descending.
1131
+ *
1132
+ * Privacy note: these lookups send the wallet's own note identifiers to
1133
+ * the indexer — a bounded, documented linkage tradeoff for timestamp
1134
+ * recovery. They are NEVER used for spent-STATUS checks (PIR-A: status
1135
+ * comes from the anonymous full-set `/shielded/nullifiers/all` download).
1136
+ */
1137
+ async fetchTransfersChunked(path, param, items, matchedField) {
1138
+ if (items.length === 0) return [];
1139
+ const normalized = items.map((i) => i.toLowerCase());
1140
+ const chunks = [];
1141
+ for (let i = 0; i < normalized.length; i += _IndexerClient.TRANSFER_LOOKUP_CHUNK) {
1142
+ chunks.push(normalized.slice(i, i + _IndexerClient.TRANSFER_LOOKUP_CHUNK));
1143
+ }
1144
+ const responses = await Promise.all(
1145
+ chunks.map((chunk) => {
1146
+ const qs = this.buildQuery({ [param]: chunk.join(",") });
1147
+ return this.get(
1148
+ `${path}${qs}`
1149
+ );
1150
+ })
1151
+ );
1152
+ const byExtrinsic = /* @__PURE__ */ new Map();
1153
+ for (const res of responses) {
1154
+ for (const transfer of res.data) {
1155
+ const key = `${transfer.blockNumber}:${transfer.extrinsicIndex ?? "null"}`;
1156
+ const existing = byExtrinsic.get(key);
1157
+ if (!existing) {
1158
+ byExtrinsic.set(key, transfer);
1159
+ continue;
1160
+ }
1161
+ const merged = /* @__PURE__ */ new Set([
1162
+ ...existing[matchedField] ?? [],
1163
+ ...transfer[matchedField] ?? []
1164
+ ]);
1165
+ existing[matchedField] = [...merged];
1166
+ }
1167
+ }
1168
+ return [...byExtrinsic.values()].sort((a, b) => b.blockNumber - a.blockNumber);
1169
+ }
1123
1170
  /**
1124
1171
  * Returns temporal metadata for private transfers that spent any of the given nullifiers.
1125
1172
  * Only blockNumber, extrinsicIndex, timestampMs, and hash are returned — no cross-link
1126
1173
  * between inputs and outputs to prevent graph reconstruction.
1127
- * Accepts up to 50 nullifiers (0x-prefixed hex).
1174
+ * Inputs of any size are transparently chunked into requests of 50 (the server cap)
1175
+ * and merged per extrinsic.
1128
1176
  */
1129
1177
  async getTransfersByNullifiers(nullifiers) {
1130
- if (nullifiers.length === 0) return [];
1131
- const qs = this.buildQuery({
1132
- nullifiers: nullifiers.map((n) => n.toLowerCase()).join(",")
1133
- });
1134
- const res = await this.get(
1135
- `/shielded/transfers/by-nullifiers${qs}`
1178
+ return this.fetchTransfersChunked(
1179
+ "/shielded/transfers/by-nullifiers",
1180
+ "nullifiers",
1181
+ nullifiers,
1182
+ "matchedNullifiers"
1136
1183
  );
1137
- return res.data;
1138
1184
  }
1139
1185
  /**
1140
1186
  * Returns temporal metadata for private transfers that produced any of the given commitments.
1141
1187
  * Only blockNumber, extrinsicIndex, timestampMs, and hash are returned — no cross-link
1142
1188
  * between outputs and inputs to prevent graph reconstruction.
1143
- * Accepts up to 50 commitments (0x-prefixed hex).
1189
+ * Inputs of any size are transparently chunked into requests of 50 (the server cap)
1190
+ * and merged per extrinsic.
1144
1191
  */
1145
1192
  async getTransfersByCommitments(commitments) {
1146
- if (commitments.length === 0) return [];
1147
- const qs = this.buildQuery({
1148
- commitments: commitments.map((c) => c.toLowerCase()).join(",")
1149
- });
1150
- const res = await this.get(
1151
- `/shielded/transfers/by-commitments${qs}`
1193
+ return this.fetchTransfersChunked(
1194
+ "/shielded/transfers/by-commitments",
1195
+ "commitments",
1196
+ commitments,
1197
+ "matchedCommitments"
1152
1198
  );
1153
- return res.data;
1154
1199
  }
1155
1200
  // ─── Unshields ─────────────────────────────────────────────────────────────
1156
1201
  /** Returns a paginated list of unshield events. */
@@ -4312,6 +4357,7 @@ function fromBase64(b64) {
4312
4357
 
4313
4358
  // src/vault/VaultCrypto.ts
4314
4359
  var VAULT_KEY_INFO = new TextEncoder().encode("orbinum-vault-key-v1");
4360
+ var VAULT_BLIND_INFO = new TextEncoder().encode("orbinum-vault-blind-v1");
4315
4361
  var IV_BYTES = 12;
4316
4362
  async function deriveVaultKey(masterBytes) {
4317
4363
  const keyMaterial = await crypto.subtle.importKey("raw", masterBytes.slice(0), "HKDF", false, [
@@ -4330,6 +4376,28 @@ async function deriveVaultKey(masterBytes) {
4330
4376
  ["encrypt", "decrypt"]
4331
4377
  );
4332
4378
  }
4379
+ async function deriveVaultBlindKey(masterBytes) {
4380
+ const keyMaterial = await crypto.subtle.importKey("raw", masterBytes.slice(0), "HKDF", false, [
4381
+ "deriveKey"
4382
+ ]);
4383
+ return crypto.subtle.deriveKey(
4384
+ {
4385
+ name: "HKDF",
4386
+ hash: "SHA-256",
4387
+ salt: new Uint8Array(0),
4388
+ info: VAULT_BLIND_INFO
4389
+ },
4390
+ keyMaterial,
4391
+ { name: "HMAC", hash: "SHA-256", length: 256 },
4392
+ false,
4393
+ ["sign"]
4394
+ );
4395
+ }
4396
+ async function blindTag(blindKey, value) {
4397
+ const data = new TextEncoder().encode(value.toLowerCase());
4398
+ const sig = await crypto.subtle.sign("HMAC", blindKey, data);
4399
+ return "0x" + toBase64(sig).replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
4400
+ }
4333
4401
  async function encryptJson(key, payload) {
4334
4402
  const iv = crypto.getRandomValues(new Uint8Array(IV_BYTES));
4335
4403
  const plaintext = new TextEncoder().encode(JSON.stringify(payload, vaultReplacer));
@@ -4361,14 +4429,19 @@ function applyNoteStatus(note, status) {
4361
4429
  spentAt: status?.spentAt ?? note.spentAt ?? null
4362
4430
  };
4363
4431
  }
4364
- async function encryptNote(key, note) {
4432
+ async function encryptNote(key, blindKey, note) {
4365
4433
  const { iv, ciphertext } = await encryptJson(key, note);
4434
+ const [commitmentTag, nullifierTag, assetTag] = await Promise.all([
4435
+ blindTag(blindKey, note.commitmentHex),
4436
+ blindTag(blindKey, note.nullifierHex),
4437
+ blindTag(blindKey, note.assetId.toString())
4438
+ ]);
4366
4439
  return {
4367
- commitmentHex: note.commitmentHex,
4440
+ commitmentTag,
4368
4441
  iv,
4369
4442
  ciphertext,
4370
- nullifierHex: note.nullifierHex,
4371
- assetId: note.assetId.toString(),
4443
+ nullifierTag,
4444
+ assetTag,
4372
4445
  spent: note.spent,
4373
4446
  spentAt: note.spentAt,
4374
4447
  updatedAt: Date.now()
@@ -4381,6 +4454,9 @@ async function decryptNoteRecord(key, rec) {
4381
4454
  spentAt: rec.spentAt ?? null
4382
4455
  });
4383
4456
  }
4457
+ async function noteBlindTag(blindKey, hex) {
4458
+ return blindTag(blindKey, hex);
4459
+ }
4384
4460
 
4385
4461
  // src/proof-generator/unshield.ts
4386
4462
  import {
@@ -5309,6 +5385,7 @@ export {
5309
5385
  bigintTo32Be,
5310
5386
  bigintTo32Le,
5311
5387
  bigintTo32LeArr,
5388
+ blindTag,
5312
5389
  buildDummyTransferInput,
5313
5390
  bytesToBigintLE,
5314
5391
  computeNullifier,
@@ -5325,6 +5402,7 @@ export {
5325
5402
  deriveSpendingKeyMessage,
5326
5403
  deriveStealthOwnerPk,
5327
5404
  deriveStealthSk,
5405
+ deriveVaultBlindKey,
5328
5406
  deriveVaultKey,
5329
5407
  deriveViewingPublicKey,
5330
5408
  deriveViewingSecretKey,
@@ -5359,6 +5437,7 @@ export {
5359
5437
  mapExtrinsicArgs,
5360
5438
  mapZkEventData,
5361
5439
  normalizeEvmAddress,
5440
+ noteBlindTag,
5362
5441
  randomBlinding,
5363
5442
  recoverOwnerPkPoint,
5364
5443
  selectNotes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbinum/sdk",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Official TypeScript SDK for Orbinum.",
5
5
  "author": "Orbinum",
6
6
  "license": "MIT",