diff --git a/ironfish-rust-nodejs/index.d.ts b/ironfish-rust-nodejs/index.d.ts index 05b62ceb3d..acb5fc40e8 100644 --- a/ironfish-rust-nodejs/index.d.ts +++ b/ironfish-rust-nodejs/index.d.ts @@ -3,6 +3,13 @@ /* auto-generated by NAPI-RS */ +export interface RoundOneSigningData { + nonceHiding: string + nonceBinding: string + commitmentHiding: string + commitmentBinding: string +} +export function roundOne(keyPackage: string, seed: number): RoundOneSigningData export function contribute(inputPath: string, outputPath: string, seed?: string | undefined | null): Promise export function verifyTransform(paramsPath: string, newParamsPath: string): Promise export const KEY_LENGTH: number @@ -75,6 +82,7 @@ export interface Key { incomingViewKey: string outgoingViewKey: string publicAddress: string + proofGenerationKey: string } export function generateKey(): Key export function spendingKeyToWords(privateKey: string, languageCode: LanguageCode): string @@ -215,6 +223,7 @@ export class Transaction { * aka: self.value_balance - intended_transaction_fee - change = 0 */ post(spenderHexKey: string, changeGoesTo: string | undefined | null, intendedTransactionFee: bigint): Buffer + build(proofGenerationKeyStr: string, viewKeyStr: string, outgoingViewKeyStr: string, publicAddressStr: string, intendedTransactionFee: bigint): Buffer setExpiration(sequence: number): void } export class FoundBlockResult { diff --git a/ironfish-rust-nodejs/index.js b/ironfish-rust-nodejs/index.js index 5b2524eb0b..df7b6811f1 100644 --- a/ironfish-rust-nodejs/index.js +++ b/ironfish-rust-nodejs/index.js @@ -252,9 +252,10 @@ if (!nativeBinding) { throw new Error(`Failed to load native binding`) } -const { FishHashContext, contribute, verifyTransform, KEY_LENGTH, NONCE_LENGTH, BoxKeyPair, randomBytes, boxMessage, unboxMessage, RollingFilter, initSignalHandler, triggerSegfault, ASSET_ID_LENGTH, ASSET_METADATA_LENGTH, ASSET_NAME_LENGTH, ASSET_LENGTH, Asset, NOTE_ENCRYPTION_KEY_LENGTH, MAC_LENGTH, ENCRYPTED_NOTE_PLAINTEXT_LENGTH, ENCRYPTED_NOTE_LENGTH, NoteEncrypted, PUBLIC_ADDRESS_LENGTH, RANDOMNESS_LENGTH, MEMO_LENGTH, AMOUNT_VALUE_LENGTH, DECRYPTED_NOTE_LENGTH, Note, PROOF_LENGTH, TRANSACTION_SIGNATURE_LENGTH, TRANSACTION_PUBLIC_KEY_RANDOMNESS_LENGTH, TRANSACTION_EXPIRATION_LENGTH, TRANSACTION_FEE_LENGTH, LATEST_TRANSACTION_VERSION, TransactionPosted, Transaction, verifyTransactions, LanguageCode, generateKey, spendingKeyToWords, wordsToSpendingKey, generateKeyFromPrivateKey, initializeSapling, FoundBlockResult, ThreadPoolHandler, isValidPublicAddress } = nativeBinding +const { FishHashContext, roundOne, contribute, verifyTransform, KEY_LENGTH, NONCE_LENGTH, BoxKeyPair, randomBytes, boxMessage, unboxMessage, RollingFilter, initSignalHandler, triggerSegfault, ASSET_ID_LENGTH, ASSET_METADATA_LENGTH, ASSET_NAME_LENGTH, ASSET_LENGTH, Asset, NOTE_ENCRYPTION_KEY_LENGTH, MAC_LENGTH, ENCRYPTED_NOTE_PLAINTEXT_LENGTH, ENCRYPTED_NOTE_LENGTH, NoteEncrypted, PUBLIC_ADDRESS_LENGTH, RANDOMNESS_LENGTH, MEMO_LENGTH, AMOUNT_VALUE_LENGTH, DECRYPTED_NOTE_LENGTH, Note, PROOF_LENGTH, TRANSACTION_SIGNATURE_LENGTH, TRANSACTION_PUBLIC_KEY_RANDOMNESS_LENGTH, TRANSACTION_EXPIRATION_LENGTH, TRANSACTION_FEE_LENGTH, LATEST_TRANSACTION_VERSION, TransactionPosted, Transaction, verifyTransactions, LanguageCode, generateKey, spendingKeyToWords, wordsToSpendingKey, generateKeyFromPrivateKey, initializeSapling, FoundBlockResult, ThreadPoolHandler, isValidPublicAddress } = nativeBinding module.exports.FishHashContext = FishHashContext +module.exports.roundOne = roundOne module.exports.contribute = contribute module.exports.verifyTransform = verifyTransform module.exports.KEY_LENGTH = KEY_LENGTH diff --git a/ironfish-rust-nodejs/src/lib.rs b/ironfish-rust-nodejs/src/lib.rs index 57e481069b..6109d5c1ad 100644 --- a/ironfish-rust-nodejs/src/lib.rs +++ b/ironfish-rust-nodejs/src/lib.rs @@ -5,8 +5,10 @@ use std::fmt::Display; use ironfish::keys::Language; +use ironfish::keys::ProofGenerationKeySerializable; use ironfish::PublicAddress; use ironfish::SaplingKey; + use napi::bindgen_prelude::*; use napi_derive::napi; @@ -63,6 +65,7 @@ pub struct Key { pub incoming_view_key: String, pub outgoing_view_key: String, pub public_address: String, + pub proof_generation_key: String, } #[napi] @@ -75,6 +78,7 @@ pub fn generate_key() -> Key { incoming_view_key: sapling_key.incoming_view_key().hex_key(), outgoing_view_key: sapling_key.outgoing_view_key().hex_key(), public_address: sapling_key.public_address().hex_public_address(), + proof_generation_key: sapling_key.sapling_proof_generation_key().hex_key(), } } @@ -101,6 +105,7 @@ pub fn generate_key_from_private_key(private_key: String) -> Result { incoming_view_key: sapling_key.incoming_view_key().hex_key(), outgoing_view_key: sapling_key.outgoing_view_key().hex_key(), public_address: sapling_key.public_address().hex_public_address(), + proof_generation_key: sapling_key.sapling_proof_generation_key().hex_key(), }) } diff --git a/ironfish-rust/src/keys/mod.rs b/ironfish-rust/src/keys/mod.rs index e5b7a9a5ea..97cbf98535 100644 --- a/ironfish-rust/src/keys/mod.rs +++ b/ironfish-rust/src/keys/mod.rs @@ -208,7 +208,7 @@ impl SaplingKey { /// Adapter to convert this key to a proof generation key for use in /// sapling functions - pub(crate) fn sapling_proof_generation_key(&self) -> ProofGenerationKey { + pub fn sapling_proof_generation_key(&self) -> ProofGenerationKey { ProofGenerationKey { ak: self.view_key.authorizing_key, nsk: self.proof_authorizing_key,