1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright 2020 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0

use super::*;
use argon2::password_hash::SaltString;

/// Json representation of the wallet file
#[derive(Serialize, Deserialize, Clone, Debug, Default)]
pub(super) struct SecretBoxJson {
    pub box_primitive: String,
    pub pw_primitive: String,
    pub nonce: String,
    pub pwsalt: String,
    pub pwdiff: [i64; 2],
    pub ciphertext: String,
}

/// Type that represents a wallet loaded from a wallet file
/// that is generated by mina-keypair-gen tool
#[derive(Clone, Debug)]
pub struct SecretBox {
    pub(super) box_primitive: String,
    pub(super) pw_primitive: String,
    pub(super) nonce: Vec<u8>,
    pub(super) pwsalt: SaltString,
    pub(super) pw_mem_limit_bytes: i64,
    pub(super) pw_ops_limit: u32,
    pub(super) ciphertext: Vec<u8>,
}