forked from facebookresearch/acs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SimpleAnonCredServiceHandler.h
48 lines (38 loc) · 1.19 KB
/
SimpleAnonCredServiceHandler.h
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
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include "gen-cpp/SimpleAnonCredService.h"
extern "C" {
#include "lib/curve/curve_ristretto.h"
#include "lib/kdf/kdf_sdhi.h"
#include "lib/voprf/voprf_mul_twohashdh.h"
}
namespace anon_cred {
using namespace thrift;
class SimpleAnonCredServiceHandler : virtual public SimpleAnonCredServiceIf {
public:
SimpleAnonCredServiceHandler();
void getPrimaryPublicKey(GetPrimaryPublicKeyResponse& response);
void getPublicKeyAndProof(
GetPublicKeyResponse& response,
const GetPublicKeyRequest& request);
void signCredential(
SignCredentialResponse& response,
const SignCredentialRequest& request);
void redeemCredential(const RedeemCredentialRequest& request);
private:
void deriveKeyPair(
std::vector<unsigned char>& sk,
std::vector<unsigned char>& pk,
std::vector<unsigned char>& pkProof,
const std::vector<std::string>& attributes);
curve_t curve_;
voprf_t voprf_;
kdf_t kdf_;
std::vector<unsigned char> primaryKey_;
};
} // namespace anon_cred