aboutsummaryrefslogtreecommitdiff
path: root/src/nfc-wallet/wallet.h
blob: 4d51088ee79f9c47121f5e19e1cc88775292239a (plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
 This file is part of TALER
 Copyright (C) 2019 GNUnet e.V.

 TALER is free software; you can redistribute it and/or modify it under the
 terms of the GNU General Public License as published by the Free Software
 Foundation; either version 3, or (at your option) any later version.

 TALER is distributed in the hope that it will be useful, but WITHOUT ANY
 WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR
 A PARTICULAR PURPOSE.  See the GNU General Public License for more
details.

 You should have received a copy of the GNU General Public License
along with
 TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
*/

/**
* @file wallet.h
* @brief functions to communicate with taler wallet over nfc
* @author BOSS Marco
*/

#ifndef WALLET_H
#define WALLET_H

#include <nfc/nfc.h>


// New AID
// static uint8_t taler_aid[] = { 0xF0, 0x00, 0x54, 0x41, 0x4c, 0x45, 0x52 };

// Demo AID until uptade
static const uint8_t taler_aid[] = { 0xA0, 0x00, 0x00, 0x02, 0x47, 0x10, 0x01 };

#define TRANSMIT_TIMEOUT 500

// APDU commands
#define APDU_SUCCESS "\x90\x00"
static const uint8_t select_file[] = { 0x00, 0xA4, 0x04, 0x00, 0x07 };
static const uint8_t put_data[] = { 0x00, 0xDA, 0x01, 0x00, 0x7c, 0x01 };



int wallet_select_aid( nfc_device *pnd );

int wallet_put_message( nfc_device *pnd, const char *msg, size_t msgSize );

int wallet_transmit( nfc_device* pnd, const char *msg, size_t msgLen );

int concat_message( const uint8_t* command, size_t commandSize, const uint8_t *message, uint8_t *retMsg, size_t returnSize );

int check_response( uint8_t *response, uint8_t responseLen );

#endif // WALLET_H