@orbinum/sdk 0.19.0 → 0.20.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 +5 -22
- package/dist/index.d.ts +5 -22
- package/dist/index.js +5 -11
- package/dist/index.mjs +5 -10
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2449,16 +2449,6 @@ declare function deriveSpendingKeyTypedData(chainId: number, address: string): S
|
|
|
2449
2449
|
* only the HKDF domain separation in `PrivacyKeys` still applies.
|
|
2450
2450
|
*/
|
|
2451
2451
|
declare function deriveSpendingKeyMessageV2(chainId: number, address: string): string;
|
|
2452
|
-
/**
|
|
2453
|
-
* @deprecated INSECURE — v1 derivation. Signs a fixed public string via
|
|
2454
|
-
* `personal_sign`, so any dapp can request it and, because the signature is
|
|
2455
|
-
* deterministic, reconstruct the user's spending key, viewing key and vault key.
|
|
2456
|
-
*
|
|
2457
|
-
* Retained ONLY so existing v1 notes can be swept into a v2 identity. Never call
|
|
2458
|
-
* it on a connect/login path. Use {@link deriveSpendingKeyTypedData} (EVM) or
|
|
2459
|
-
* {@link deriveSpendingKeyMessageV2} (Substrate) instead.
|
|
2460
|
-
*/
|
|
2461
|
-
declare function deriveSpendingKeyMessage(chainId: number, address: string): string;
|
|
2462
2452
|
|
|
2463
2453
|
/**
|
|
2464
2454
|
* PrivacyKeys
|
|
@@ -2491,8 +2481,6 @@ declare function deriveSpendingKeyMessage(chainId: number, address: string): str
|
|
|
2491
2481
|
* Num2Bits(253), asserting spending_key < 2^253. BABYJUB_SUBORDER < 2^252
|
|
2492
2482
|
* satisfies it; BN254_R ≈ 2^254.8 does not — ~34% of values would fail at runtime.
|
|
2493
2483
|
*/
|
|
2494
|
-
/** Identity version. `v1` is the legacy personal_sign scheme, kept for sweeping only. */
|
|
2495
|
-
type KeyVersion = 'v1' | 'v2';
|
|
2496
2484
|
/**
|
|
2497
2485
|
* Shortest signature any supported signer produces: sr25519 VRF output is 32
|
|
2498
2486
|
* bytes, ed25519 is 64, ECDSA `personal_sign` is 65. Anything shorter is not a
|
|
@@ -2502,7 +2490,7 @@ declare const MIN_SIGNATURE_BYTES = 32;
|
|
|
2502
2490
|
/**
|
|
2503
2491
|
* Derives the 32-byte master key bytes from a wallet signature.
|
|
2504
2492
|
*
|
|
2505
|
-
* masterBytes = HKDF-SHA256(ikm=sigBytes, salt=empty, info="orbinum-sk-
|
|
2493
|
+
* masterBytes = HKDF-SHA256(ikm=sigBytes, salt=empty, info="orbinum-sk-v2:{chainId}:{address}")
|
|
2506
2494
|
*
|
|
2507
2495
|
* These bytes are the stable root for ALL derived keys:
|
|
2508
2496
|
* - spendingKey (circuit scalar) = BigInt(masterBytes) % BABYJUB_SUBORDER
|
|
@@ -2513,18 +2501,14 @@ declare const MIN_SIGNATURE_BYTES = 32;
|
|
|
2513
2501
|
* vault key are STABLE across any future change to the modulus — they never
|
|
2514
2502
|
* depend on which prime field the circuit uses.
|
|
2515
2503
|
*
|
|
2516
|
-
* The version is folded into the HKDF `info`, so v1 and v2 stay disjoint even if
|
|
2517
|
-
* the underlying signature bytes were somehow identical.
|
|
2518
|
-
*
|
|
2519
|
-
* @param version Defaults to 'v2'. Pass 'v1' only from the legacy sweep flow.
|
|
2520
2504
|
* @throws If the signature is not valid hex, or carries less entropy than the
|
|
2521
2505
|
* shortest real signing scheme (see {@link MIN_SIGNATURE_BYTES}).
|
|
2522
2506
|
*/
|
|
2523
|
-
declare function deriveMasterKeyBytes(signatureHex: string, chainId: number, address: string
|
|
2507
|
+
declare function deriveMasterKeyBytes(signatureHex: string, chainId: number, address: string): Promise<Uint8Array>;
|
|
2524
2508
|
/**
|
|
2525
2509
|
* Derives an Orbinum spending key from a wallet signature.
|
|
2526
2510
|
*
|
|
2527
|
-
* Uses HKDF-SHA256(ikm=sigBytes, salt=empty, info="orbinum-sk-
|
|
2511
|
+
* Uses HKDF-SHA256(ikm=sigBytes, salt=empty, info="orbinum-sk-v2:{chainId}:{address}")
|
|
2528
2512
|
* and reduces the resulting 32-byte value modulo BABYJUB_SUBORDER.
|
|
2529
2513
|
*
|
|
2530
2514
|
* IMPORTANT: viewingSecretKey and vaultKey must be derived from masterBytes (via
|
|
@@ -2534,12 +2518,11 @@ declare function deriveMasterKeyBytes(signatureHex: string, chainId: number, add
|
|
|
2534
2518
|
* @param signatureHex 0x-prefixed or bare hex of the wallet signature.
|
|
2535
2519
|
* @param chainId Chain ID used when building the signing message.
|
|
2536
2520
|
* @param address Signer address (EVM or SS58) used in the signing message.
|
|
2537
|
-
* @param version Defaults to 'v2'. Pass 'v1' only from the legacy sweep flow.
|
|
2538
2521
|
* @returns bigint in [1, BABYJUB_SUBORDER)
|
|
2539
2522
|
* @throws If the signature is not valid hex or is shorter than
|
|
2540
2523
|
* {@link MIN_SIGNATURE_BYTES} — see `deriveMasterKeyBytes`.
|
|
2541
2524
|
*/
|
|
2542
|
-
declare function deriveSpendingKeyFromSignature(signatureHex: string, chainId: number, address: string
|
|
2525
|
+
declare function deriveSpendingKeyFromSignature(signatureHex: string, chainId: number, address: string): Promise<bigint>;
|
|
2543
2526
|
/**
|
|
2544
2527
|
* Derive a 32-byte viewing secret key (ivsk) from the spending key.
|
|
2545
2528
|
* ivsk = HKDF-SHA256(ikm=bigintTo32Le(spendingKey), info="orbinum-ivk-v1")
|
|
@@ -4434,4 +4417,4 @@ interface ExtrinsicFailedData {
|
|
|
4434
4417
|
dispatch_info: DispatchInfo;
|
|
4435
4418
|
}
|
|
4436
4419
|
|
|
4437
|
-
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
|
|
4420
|
+
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, MIN_SIGNATURE_BYTES, 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, SPENDING_KEY_VERIFYING_CONTRACT, SPENDING_KEY_WARNING, 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 SpendingKeyTypedData, 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, computeNoteCommitment, computeNullifier, computePathIndices, createNoteDisclosureKey, decodeNoteDisclosureKey, decodePrecompileCalldata, decryptJson, decryptNoteRecord, deriveMasterKeyBytes, deriveOwnerPk, deriveSelfEphSk, deriveSpendingKeyFromSignature, deriveSpendingKeyMessageV2, deriveSpendingKeyTypedData, 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
|
@@ -2449,16 +2449,6 @@ declare function deriveSpendingKeyTypedData(chainId: number, address: string): S
|
|
|
2449
2449
|
* only the HKDF domain separation in `PrivacyKeys` still applies.
|
|
2450
2450
|
*/
|
|
2451
2451
|
declare function deriveSpendingKeyMessageV2(chainId: number, address: string): string;
|
|
2452
|
-
/**
|
|
2453
|
-
* @deprecated INSECURE — v1 derivation. Signs a fixed public string via
|
|
2454
|
-
* `personal_sign`, so any dapp can request it and, because the signature is
|
|
2455
|
-
* deterministic, reconstruct the user's spending key, viewing key and vault key.
|
|
2456
|
-
*
|
|
2457
|
-
* Retained ONLY so existing v1 notes can be swept into a v2 identity. Never call
|
|
2458
|
-
* it on a connect/login path. Use {@link deriveSpendingKeyTypedData} (EVM) or
|
|
2459
|
-
* {@link deriveSpendingKeyMessageV2} (Substrate) instead.
|
|
2460
|
-
*/
|
|
2461
|
-
declare function deriveSpendingKeyMessage(chainId: number, address: string): string;
|
|
2462
2452
|
|
|
2463
2453
|
/**
|
|
2464
2454
|
* PrivacyKeys
|
|
@@ -2491,8 +2481,6 @@ declare function deriveSpendingKeyMessage(chainId: number, address: string): str
|
|
|
2491
2481
|
* Num2Bits(253), asserting spending_key < 2^253. BABYJUB_SUBORDER < 2^252
|
|
2492
2482
|
* satisfies it; BN254_R ≈ 2^254.8 does not — ~34% of values would fail at runtime.
|
|
2493
2483
|
*/
|
|
2494
|
-
/** Identity version. `v1` is the legacy personal_sign scheme, kept for sweeping only. */
|
|
2495
|
-
type KeyVersion = 'v1' | 'v2';
|
|
2496
2484
|
/**
|
|
2497
2485
|
* Shortest signature any supported signer produces: sr25519 VRF output is 32
|
|
2498
2486
|
* bytes, ed25519 is 64, ECDSA `personal_sign` is 65. Anything shorter is not a
|
|
@@ -2502,7 +2490,7 @@ declare const MIN_SIGNATURE_BYTES = 32;
|
|
|
2502
2490
|
/**
|
|
2503
2491
|
* Derives the 32-byte master key bytes from a wallet signature.
|
|
2504
2492
|
*
|
|
2505
|
-
* masterBytes = HKDF-SHA256(ikm=sigBytes, salt=empty, info="orbinum-sk-
|
|
2493
|
+
* masterBytes = HKDF-SHA256(ikm=sigBytes, salt=empty, info="orbinum-sk-v2:{chainId}:{address}")
|
|
2506
2494
|
*
|
|
2507
2495
|
* These bytes are the stable root for ALL derived keys:
|
|
2508
2496
|
* - spendingKey (circuit scalar) = BigInt(masterBytes) % BABYJUB_SUBORDER
|
|
@@ -2513,18 +2501,14 @@ declare const MIN_SIGNATURE_BYTES = 32;
|
|
|
2513
2501
|
* vault key are STABLE across any future change to the modulus — they never
|
|
2514
2502
|
* depend on which prime field the circuit uses.
|
|
2515
2503
|
*
|
|
2516
|
-
* The version is folded into the HKDF `info`, so v1 and v2 stay disjoint even if
|
|
2517
|
-
* the underlying signature bytes were somehow identical.
|
|
2518
|
-
*
|
|
2519
|
-
* @param version Defaults to 'v2'. Pass 'v1' only from the legacy sweep flow.
|
|
2520
2504
|
* @throws If the signature is not valid hex, or carries less entropy than the
|
|
2521
2505
|
* shortest real signing scheme (see {@link MIN_SIGNATURE_BYTES}).
|
|
2522
2506
|
*/
|
|
2523
|
-
declare function deriveMasterKeyBytes(signatureHex: string, chainId: number, address: string
|
|
2507
|
+
declare function deriveMasterKeyBytes(signatureHex: string, chainId: number, address: string): Promise<Uint8Array>;
|
|
2524
2508
|
/**
|
|
2525
2509
|
* Derives an Orbinum spending key from a wallet signature.
|
|
2526
2510
|
*
|
|
2527
|
-
* Uses HKDF-SHA256(ikm=sigBytes, salt=empty, info="orbinum-sk-
|
|
2511
|
+
* Uses HKDF-SHA256(ikm=sigBytes, salt=empty, info="orbinum-sk-v2:{chainId}:{address}")
|
|
2528
2512
|
* and reduces the resulting 32-byte value modulo BABYJUB_SUBORDER.
|
|
2529
2513
|
*
|
|
2530
2514
|
* IMPORTANT: viewingSecretKey and vaultKey must be derived from masterBytes (via
|
|
@@ -2534,12 +2518,11 @@ declare function deriveMasterKeyBytes(signatureHex: string, chainId: number, add
|
|
|
2534
2518
|
* @param signatureHex 0x-prefixed or bare hex of the wallet signature.
|
|
2535
2519
|
* @param chainId Chain ID used when building the signing message.
|
|
2536
2520
|
* @param address Signer address (EVM or SS58) used in the signing message.
|
|
2537
|
-
* @param version Defaults to 'v2'. Pass 'v1' only from the legacy sweep flow.
|
|
2538
2521
|
* @returns bigint in [1, BABYJUB_SUBORDER)
|
|
2539
2522
|
* @throws If the signature is not valid hex or is shorter than
|
|
2540
2523
|
* {@link MIN_SIGNATURE_BYTES} — see `deriveMasterKeyBytes`.
|
|
2541
2524
|
*/
|
|
2542
|
-
declare function deriveSpendingKeyFromSignature(signatureHex: string, chainId: number, address: string
|
|
2525
|
+
declare function deriveSpendingKeyFromSignature(signatureHex: string, chainId: number, address: string): Promise<bigint>;
|
|
2543
2526
|
/**
|
|
2544
2527
|
* Derive a 32-byte viewing secret key (ivsk) from the spending key.
|
|
2545
2528
|
* ivsk = HKDF-SHA256(ikm=bigintTo32Le(spendingKey), info="orbinum-ivk-v1")
|
|
@@ -4434,4 +4417,4 @@ interface ExtrinsicFailedData {
|
|
|
4434
4417
|
dispatch_info: DispatchInfo;
|
|
4435
4418
|
}
|
|
4436
4419
|
|
|
4437
|
-
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
|
|
4420
|
+
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, MIN_SIGNATURE_BYTES, 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, SPENDING_KEY_VERIFYING_CONTRACT, SPENDING_KEY_WARNING, 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 SpendingKeyTypedData, 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, computeNoteCommitment, computeNullifier, computePathIndices, createNoteDisclosureKey, decodeNoteDisclosureKey, decodePrecompileCalldata, decryptJson, decryptNoteRecord, deriveMasterKeyBytes, deriveOwnerPk, deriveSelfEphSk, deriveSpendingKeyFromSignature, deriveSpendingKeyMessageV2, deriveSpendingKeyTypedData, 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
|
@@ -79,7 +79,6 @@ __export(index_exports, {
|
|
|
79
79
|
deriveOwnerPk: () => deriveOwnerPk,
|
|
80
80
|
deriveSelfEphSk: () => deriveSelfEphSk,
|
|
81
81
|
deriveSpendingKeyFromSignature: () => deriveSpendingKeyFromSignature,
|
|
82
|
-
deriveSpendingKeyMessage: () => deriveSpendingKeyMessage,
|
|
83
82
|
deriveSpendingKeyMessageV2: () => deriveSpendingKeyMessageV2,
|
|
84
83
|
deriveSpendingKeyTypedData: () => deriveSpendingKeyTypedData,
|
|
85
84
|
deriveStealthOwnerPk: () => deriveStealthOwnerPk,
|
|
@@ -4237,17 +4236,13 @@ orbinum-spending-key-v2
|
|
|
4237
4236
|
${chainId}
|
|
4238
4237
|
${address.toLowerCase()}`;
|
|
4239
4238
|
}
|
|
4240
|
-
function deriveSpendingKeyMessage(chainId, address) {
|
|
4241
|
-
return `orbinum-spending-key-v1
|
|
4242
|
-
${chainId}
|
|
4243
|
-
${address.toLowerCase()}`;
|
|
4244
|
-
}
|
|
4245
4239
|
|
|
4246
4240
|
// src/privacy-keys/PrivacyKeys.ts
|
|
4247
4241
|
var import_hkdf2 = require("@noble/hashes/hkdf.js");
|
|
4248
4242
|
var import_sha24 = require("@noble/hashes/sha2.js");
|
|
4249
4243
|
var import_baby_jubjub6 = require("@zk-kit/baby-jubjub");
|
|
4250
4244
|
var IVK_DOMAIN = new TextEncoder().encode("orbinum-ivk-v1");
|
|
4245
|
+
var KEY_VERSION = "v2";
|
|
4251
4246
|
var MIN_SIGNATURE_BYTES = 32;
|
|
4252
4247
|
function assertUsableSignature(sigBytes) {
|
|
4253
4248
|
if (sigBytes.length < MIN_SIGNATURE_BYTES) {
|
|
@@ -4256,16 +4251,16 @@ function assertUsableSignature(sigBytes) {
|
|
|
4256
4251
|
);
|
|
4257
4252
|
}
|
|
4258
4253
|
}
|
|
4259
|
-
async function deriveMasterKeyBytes(signatureHex, chainId, address
|
|
4254
|
+
async function deriveMasterKeyBytes(signatureHex, chainId, address) {
|
|
4260
4255
|
const sigBytes = fromHex(signatureHex);
|
|
4261
4256
|
assertUsableSignature(sigBytes);
|
|
4262
4257
|
const info = new TextEncoder().encode(
|
|
4263
|
-
`orbinum-sk-${
|
|
4258
|
+
`orbinum-sk-${KEY_VERSION}:${chainId}:${address.toLowerCase()}`
|
|
4264
4259
|
);
|
|
4265
4260
|
return (0, import_hkdf2.hkdf)(import_sha24.sha256, sigBytes, new Uint8Array(0), info, 32);
|
|
4266
4261
|
}
|
|
4267
|
-
async function deriveSpendingKeyFromSignature(signatureHex, chainId, address
|
|
4268
|
-
const masterBytes = await deriveMasterKeyBytes(signatureHex, chainId, address
|
|
4262
|
+
async function deriveSpendingKeyFromSignature(signatureHex, chainId, address) {
|
|
4263
|
+
const masterBytes = await deriveMasterKeyBytes(signatureHex, chainId, address);
|
|
4269
4264
|
const skBigint = BigInt(toHex(masterBytes)) % BABYJUB_SUBORDER;
|
|
4270
4265
|
return skBigint === 0n ? 1n : skBigint;
|
|
4271
4266
|
}
|
|
@@ -5524,7 +5519,6 @@ var import_polkadot_api4 = require("polkadot-api");
|
|
|
5524
5519
|
deriveOwnerPk,
|
|
5525
5520
|
deriveSelfEphSk,
|
|
5526
5521
|
deriveSpendingKeyFromSignature,
|
|
5527
|
-
deriveSpendingKeyMessage,
|
|
5528
5522
|
deriveSpendingKeyMessageV2,
|
|
5529
5523
|
deriveSpendingKeyTypedData,
|
|
5530
5524
|
deriveStealthOwnerPk,
|
package/dist/index.mjs
CHANGED
|
@@ -4100,17 +4100,13 @@ orbinum-spending-key-v2
|
|
|
4100
4100
|
${chainId}
|
|
4101
4101
|
${address.toLowerCase()}`;
|
|
4102
4102
|
}
|
|
4103
|
-
function deriveSpendingKeyMessage(chainId, address) {
|
|
4104
|
-
return `orbinum-spending-key-v1
|
|
4105
|
-
${chainId}
|
|
4106
|
-
${address.toLowerCase()}`;
|
|
4107
|
-
}
|
|
4108
4103
|
|
|
4109
4104
|
// src/privacy-keys/PrivacyKeys.ts
|
|
4110
4105
|
import { hkdf as hkdf2 } from "@noble/hashes/hkdf.js";
|
|
4111
4106
|
import { sha256 as sha2564 } from "@noble/hashes/sha2.js";
|
|
4112
4107
|
import { mulPointEscalar as mulPointEscalar4, Base8 as Base82, packPoint as packPoint3 } from "@zk-kit/baby-jubjub";
|
|
4113
4108
|
var IVK_DOMAIN = new TextEncoder().encode("orbinum-ivk-v1");
|
|
4109
|
+
var KEY_VERSION = "v2";
|
|
4114
4110
|
var MIN_SIGNATURE_BYTES = 32;
|
|
4115
4111
|
function assertUsableSignature(sigBytes) {
|
|
4116
4112
|
if (sigBytes.length < MIN_SIGNATURE_BYTES) {
|
|
@@ -4119,16 +4115,16 @@ function assertUsableSignature(sigBytes) {
|
|
|
4119
4115
|
);
|
|
4120
4116
|
}
|
|
4121
4117
|
}
|
|
4122
|
-
async function deriveMasterKeyBytes(signatureHex, chainId, address
|
|
4118
|
+
async function deriveMasterKeyBytes(signatureHex, chainId, address) {
|
|
4123
4119
|
const sigBytes = fromHex(signatureHex);
|
|
4124
4120
|
assertUsableSignature(sigBytes);
|
|
4125
4121
|
const info = new TextEncoder().encode(
|
|
4126
|
-
`orbinum-sk-${
|
|
4122
|
+
`orbinum-sk-${KEY_VERSION}:${chainId}:${address.toLowerCase()}`
|
|
4127
4123
|
);
|
|
4128
4124
|
return hkdf2(sha2564, sigBytes, new Uint8Array(0), info, 32);
|
|
4129
4125
|
}
|
|
4130
|
-
async function deriveSpendingKeyFromSignature(signatureHex, chainId, address
|
|
4131
|
-
const masterBytes = await deriveMasterKeyBytes(signatureHex, chainId, address
|
|
4126
|
+
async function deriveSpendingKeyFromSignature(signatureHex, chainId, address) {
|
|
4127
|
+
const masterBytes = await deriveMasterKeyBytes(signatureHex, chainId, address);
|
|
4132
4128
|
const skBigint = BigInt(toHex(masterBytes)) % BABYJUB_SUBORDER;
|
|
4133
4129
|
return skBigint === 0n ? 1n : skBigint;
|
|
4134
4130
|
}
|
|
@@ -5409,7 +5405,6 @@ export {
|
|
|
5409
5405
|
deriveOwnerPk,
|
|
5410
5406
|
deriveSelfEphSk,
|
|
5411
5407
|
deriveSpendingKeyFromSignature,
|
|
5412
|
-
deriveSpendingKeyMessage,
|
|
5413
5408
|
deriveSpendingKeyMessageV2,
|
|
5414
5409
|
deriveSpendingKeyTypedData,
|
|
5415
5410
|
deriveStealthOwnerPk,
|