diff --git a/ironfish-rust-nodejs/index.d.ts b/ironfish-rust-nodejs/index.d.ts index fef1c8aacb..ffb481a73b 100644 --- a/ironfish-rust-nodejs/index.d.ts +++ b/ironfish-rust-nodejs/index.d.ts @@ -49,6 +49,16 @@ export const TRANSACTION_EXPIRATION_LENGTH: number export const TRANSACTION_FEE_LENGTH: number export const LATEST_TRANSACTION_VERSION: number export function verifyTransactions(serializedTransactions: Array): boolean +export interface TrustedDealerKeyPackages { + verifyingKey: string + proofGenerationKey: string + viewKey: string + incomingViewKey: string + outgoingViewKey: string + publicAddress: string + keyPackages: Record + publicKeyPackage: string +} export const enum LanguageCode { English = 0, ChineseSimplified = 1, @@ -72,16 +82,6 @@ export function wordsToSpendingKey(words: string, languageCode: LanguageCode): s export function generateKeyFromPrivateKey(privateKey: string): Key export function initializeSapling(): void export function isValidPublicAddress(hexAddress: string): boolean -export interface TrustedDealerKeyPackages { - verifyingKey: string - proofGenerationKey: string - viewKey: string - incomingViewKey: string - outgoingViewKey: string - publicAddress: string - keyPackages: Record - publicKeyPackage: string -} export class BoxKeyPair { constructor() static fromHex(secretHex: string): BoxKeyPair diff --git a/ironfish-rust-nodejs/src/lib.rs b/ironfish-rust-nodejs/src/lib.rs index 428e034c23..ee65528de1 100644 --- a/ironfish-rust-nodejs/src/lib.rs +++ b/ironfish-rust-nodejs/src/lib.rs @@ -2,7 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use std::collections::HashMap; use std::fmt::Display; use ironfish::keys::Language; @@ -169,14 +168,3 @@ pub fn is_valid_public_address(hex_address: String) -> bool { PublicAddress::from_hex(&hex_address).is_ok() } -#[napi(object)] -pub struct TrustedDealerKeyPackages { - pub verifying_key: String, - pub proof_generation_key: String, - pub view_key: String, - pub incoming_view_key: String, - pub outgoing_view_key: String, - pub public_address: String, - pub key_packages: HashMap, - pub public_key_package: String, -} \ No newline at end of file diff --git a/ironfish-rust-nodejs/src/structs/key_packages.rs b/ironfish-rust-nodejs/src/structs/key_packages.rs new file mode 100644 index 0000000000..775ae5022a --- /dev/null +++ b/ironfish-rust-nodejs/src/structs/key_packages.rs @@ -0,0 +1,15 @@ +use std::collections::HashMap; +use napi_derive::napi; + +#[napi(object)] + +pub struct TrustedDealerKeyPackages { + pub verifying_key: String, + pub proof_generation_key: String, + pub view_key: String, + pub incoming_view_key: String, + pub outgoing_view_key: String, + pub public_address: String, + pub key_packages: HashMap, + pub public_key_package: String, +} \ No newline at end of file diff --git a/ironfish-rust-nodejs/src/structs/mod.rs b/ironfish-rust-nodejs/src/structs/mod.rs index 29bc282c2d..e6cf60667f 100644 --- a/ironfish-rust-nodejs/src/structs/mod.rs +++ b/ironfish-rust-nodejs/src/structs/mod.rs @@ -19,3 +19,6 @@ pub use transaction::*; mod witness; pub use witness::*; + +mod key_packages; +pub use key_packages::*;