Skip to content

Commit

Permalink
adding trusted dealer key package napi struct
Browse files Browse the repository at this point in the history
  • Loading branch information
patnir committed Jan 9, 2024
1 parent 9f75391 commit 8f2e27e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ironfish-rust-nodejs/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ 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<string, string>
publicKeyPackage: string
}
export class BoxKeyPair {
constructor()
static fromHex(secretHex: string): BoxKeyPair
Expand Down
13 changes: 13 additions & 0 deletions ironfish-rust-nodejs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* 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;
Expand Down Expand Up @@ -167,3 +168,15 @@ impl ThreadPoolHandler {
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<String, String>,
pub public_key_package: String,
}

0 comments on commit 8f2e27e

Please sign in to comment.