1.\" Copyright (c) 2018 Yubico AB. All rights reserved.
2.\"
3.\" Redistribution and use in source and binary forms, with or without
4.\" modification, are permitted provided that the following conditions are
5.\" met:
6.\"
7.\"    1. Redistributions of source code must retain the above copyright
8.\"       notice, this list of conditions and the following disclaimer.
9.\"    2. Redistributions in binary form must reproduce the above copyright
10.\"       notice, this list of conditions and the following disclaimer in
11.\"       the documentation and/or other materials provided with the
12.\"       distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
18.\" HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25.\"
26.\" SPDX-License-Identifier: BSD-2-Clause
27.\"
28.Dd $Mdocdate: May 23 2018 $
29.Dt FIDO_DEV_MAKE_CRED 3
30.Os
31.Sh NAME
32.Nm fido_dev_make_cred
33.Nd generates a new credential on a FIDO2 device
34.Sh SYNOPSIS
35.In fido.h
36.Ft int
37.Fn fido_dev_make_cred "fido_dev_t *dev" "fido_cred_t *cred" "const char *pin"
38.Sh DESCRIPTION
39The
40.Fn fido_dev_make_cred
41function asks the FIDO2 device represented by
42.Fa dev
43to generate a new credential according to the following parameters
44defined in
45.Fa cred :
46.Pp
47.Bl -dash -compact
48.It
49.Nm type ;
50.It
51.Nm client data hash ;
52.It
53.Nm relying party ;
54.It
55.Nm user attributes ;
56.It
57.Nm list of excluded credential IDs ;
58.It
59.Nm resident/discoverable key and user verification attributes .
60.El
61.Pp
62See
63.Xr fido_cred_set_authdata 3
64for information on how these values are set.
65.Pp
66If a PIN is not needed to authenticate the request against
67.Fa dev ,
68then
69.Fa pin
70may be NULL.
71Otherwise
72.Fa pin
73must point to a NUL-terminated UTF-8 string.
74.Pp
75After a successful call to
76.Fn fido_dev_make_cred ,
77the
78.Xr fido_cred_authdata_ptr 3 ,
79.Xr fido_cred_pubkey_ptr 3 ,
80.Xr fido_cred_x5c_ptr 3 ,
81and
82.Xr fido_cred_sig_ptr 3
83functions may be invoked on
84.Fa cred
85to retrieve the various parts of the generated credential.
86.Pp
87Please note that
88.Fn fido_dev_make_cred
89is synchronous and will block if necessary.
90.Sh RETURN VALUES
91The error codes returned by
92.Fn fido_dev_make_cred
93are defined in
94.In fido/err.h .
95On success,
96.Dv FIDO_OK
97is returned.
98.Sh SEE ALSO
99.Xr fido_cred_new 3 ,
100.Xr fido_cred_set_authdata 3
101