Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::testing::mock::webauthn_private_key Struct Reference

#include <tester.hpp>

Collaboration diagram for sysio::testing::mock::webauthn_private_key:

Public Member Functions

 webauthn_private_key (r1::private_key &&priv_key)
 
 webauthn_private_key (webauthn_private_key &&)=default
 
 webauthn_private_key (const webauthn_private_key &)=default
 
public_key get_public_key (webauthn::public_key::user_presence_t presence=webauthn::public_key::user_presence_t::USER_PRESENCE_NONE) const
 
signature sign (const sha256 &digest, bool=true) const
 

Static Public Member Functions

static auto regenerate (const fc::sha256 &secret)
 

Public Attributes

r1::private_key priv_key
 

Static Public Attributes

static const std::string _origin = "mock.webauthn.invalid"
 
static const fc::sha256 _origin_hash = fc::sha256::hash(mock::webauthn_private_key::_origin)
 

Detailed Description

Definition at line 91 of file tester.hpp.

Constructor & Destructor Documentation

◆ webauthn_private_key() [1/3]

sysio::testing::mock::webauthn_private_key::webauthn_private_key ( r1::private_key && priv_key)
inlineexplicit

Definition at line 92 of file tester.hpp.

93 :priv_key(std::move(priv_key))
94 {
95 }
Here is the caller graph for this function:

◆ webauthn_private_key() [2/3]

sysio::testing::mock::webauthn_private_key::webauthn_private_key ( webauthn_private_key && )
default

◆ webauthn_private_key() [3/3]

sysio::testing::mock::webauthn_private_key::webauthn_private_key ( const webauthn_private_key & )
default

Member Function Documentation

◆ get_public_key()

public_key sysio::testing::mock::webauthn_private_key::get_public_key ( webauthn::public_key::user_presence_t presence = webauthn::public_key::user_presence_t::USER_PRESENCE_NONE) const
inline

Definition at line 104 of file tester.hpp.

104 {
105 return public_key_type(webauthn::public_key(priv_key.get_public_key().serialize(), presence, _origin));
106 }
public_key get_public_key() const
public_key_data serialize() const
fc::crypto::public_key public_key_type
Definition types.hpp:76
Here is the call graph for this function:

◆ regenerate()

static auto sysio::testing::mock::webauthn_private_key::regenerate ( const fc::sha256 & secret)
inlinestatic

Definition at line 100 of file tester.hpp.

100 {
102 }
static private_key regenerate(const fc::sha256 &secret)
webauthn_private_key(r1::private_key &&priv_key)
Definition tester.hpp:92
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sign()

signature sysio::testing::mock::webauthn_private_key::sign ( const sha256 & digest,
bool = true ) const
inline

Definition at line 108 of file tester.hpp.

108 {
109 auto json = std::string("{\"origin\":\"https://") +
110 _origin +
111 "\",\"type\":\"webauthn.get\",\"challenge\":\"" +
113 "\"}";
114 std::vector<uint8_t> auth_data(37);
115 memcpy(auth_data.data(), _origin_hash.data(), sizeof(_origin_hash));
116
117 auto client_data_hash = fc::sha256::hash(json);
119 e.write((char*)auth_data.data(), auth_data.size());
120 e.write(client_data_hash.data(), client_data_hash.data_size());
121 auto sig = priv_key.sign_compact(e.result());
122
123 char serialized_sig[4096];
124 datastream<char*> sig_ds(serialized_sig, sizeof(serialized_sig));
126 fc::raw::pack(sig_ds, sig);
127 fc::raw::pack(sig_ds, auth_data);
128 fc::raw::pack(sig_ds, json);
129 sig_ds.seekp(0);
130
132 fc::raw::unpack(sig_ds, ret);
133 return ret;
134 }
compact_signature sign_compact(const fc::sha256 &digest) const
void write(const char *d, uint32_t dlen)
Definition sha256.cpp:59
static sha256 hash(const char *d, uint32_t dlen)
Definition sha256.cpp:44
const char * data() const
Definition sha256.cpp:31
size_t data_size() const
Definition sha256.hpp:23
void unpack(Stream &s, std::deque< T > &value)
Definition raw.hpp:540
void pack(Stream &s, const std::deque< T > &value)
Definition raw.hpp:531
fc::sha256 digest(const T &value)
Definition digest.hpp:9
std::string base64url_encode(unsigned char const *bytes_to_encode, unsigned int in_len)
Definition base64.cpp:101
bytes signature
Definition pke.hpp:17
constexpr std::size_t get_index()
unsigned char uint8_t
Definition stdint.h:124
static const fc::sha256 _origin_hash
Definition tester.hpp:138
CK_RV ret
memcpy((char *) pInfo->slotDescription, s, l)
Here is the call graph for this function:

Member Data Documentation

◆ _origin

const std::string sysio::testing::mock::webauthn_private_key::_origin = "mock.webauthn.invalid"
static

Definition at line 137 of file tester.hpp.

◆ _origin_hash

const sha256 sysio::testing::mock::webauthn_private_key::_origin_hash = fc::sha256::hash(mock::webauthn_private_key::_origin)
static

Definition at line 138 of file tester.hpp.

◆ priv_key

r1::private_key sysio::testing::mock::webauthn_private_key::priv_key

Definition at line 136 of file tester.hpp.


The documentation for this struct was generated from the following files: