1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright (c) 2022-2023 The MobileCoin Foundation

use encdec::{Decode, Encode};

use super::{ApduError, ApduStatic, Instruction, MOB_APDU_CLA};
use crate::helpers::arr;

#[derive(Clone, PartialEq, Debug, Encode, Decode)]
#[encdec(error = "ApduError")]
pub struct RandomReq {}

impl ApduStatic for RandomReq {
    const CLA: u8 = MOB_APDU_CLA;
    const INS: u8 = Instruction::GetRandom as u8;
}

#[derive(Clone, PartialEq, Debug, Encode, Decode)]
#[encdec(error = "ApduError")]
pub struct RandomResp {
    /// Random value
    #[encdec(with = "arr")]
    pub value: [u8; 32],
}