1.\" Copyright (c) 2019 Yubico AB. All rights reserved. 2.\" Use of this source code is governed by a BSD-style 3.\" license that can be found in the LICENSE file. 4.\" 5.Dd $Mdocdate: September 13 2019 $ 6.Dt FIDO_BIO_TEMPLATE 3 7.Os 8.Sh NAME 9.Nm fido_bio_template , 10.Nm fido_bio_template_array_count , 11.Nm fido_bio_template_array_free , 12.Nm fido_bio_template_array_new , 13.Nm fido_bio_template_free , 14.Nm fido_bio_template_id_len , 15.Nm fido_bio_template_id_ptr , 16.Nm fido_bio_template_name , 17.Nm fido_bio_template_new , 18.Nm fido_bio_template_set_id , 19.Nm fido_bio_template_set_name 20.Nd FIDO 2 biometric template API 21.Sh SYNOPSIS 22.In fido.h 23.In fido/bio.h 24.Ft fido_bio_template_t * 25.Fn fido_bio_template_new "void" 26.Ft void 27.Fn fido_bio_template_free "fido_bio_template_t **template_p" 28.Ft const char * 29.Fn fido_bio_template_name "const fido_bio_template_t *template" 30.Ft const unsigned char * 31.Fn fido_bio_template_id_ptr "const fido_bio_template_t *template" 32.Ft size_t 33.Fn fido_bio_template_id_len "const fido_bio_template_t *template" 34.Ft int 35.Fn fido_bio_template_set_id "fido_bio_template_t *template" "const unsigned char *ptr" "size_t len" 36.Ft int 37.Fn fido_bio_template_set_name "fido_bio_template_t *template" "const char *name" 38.Ft fido_bio_template_array_t * 39.Fn fido_bio_template_array_new "void" 40.Ft void 41.Fn fido_bio_template_array_free "fido_bio_template_array_t **array_p" 42.Ft size_t 43.Fn fido_bio_template_array_count "const fido_bio_template_array_t *array" 44.Ft const fido_bio_template_t * 45.Fn fido_bio_template "const fido_bio_template_array_t *array" "size_t idx" 46.Sh DESCRIPTION 47Existing FIDO 2 biometric enrollments are abstracted in 48.Em libfido2 49by the 50.Vt fido_bio_template_t 51and 52.Vt fido_bio_template_array_t 53types. 54.Pp 55The functions described in this page allow a 56.Vt fido_bio_template_t 57type to be allocated, deallocated, changed, and inspected, 58and a 59.Vt fido_bio_template_array_t 60type to be allocated, deallocated, and inspected. 61For device operations on 62.Vt fido_bio_template_t 63and 64.Vt fido_bio_template_array_t , 65please refer to 66.Xr fido_bio_dev_get_info 3 . 67.Pp 68The 69.Fn fido_bio_template_new 70function returns a pointer to a newly allocated, empty 71.Vt fido_bio_template_t 72type. 73If memory cannot be allocated, NULL is returned. 74.Pp 75The 76.Fn fido_bio_template_free 77function releases the memory backing 78.Fa *template_p , 79where 80.Fa *template_p 81must have been previously allocated by 82.Fn fido_bio_template_new . 83On return, 84.Fa *template_p 85is set to NULL. 86Either 87.Fa template_p 88or 89.Fa *template_p 90may be NULL, in which case 91.Fn fido_bio_template_free 92is a NOP. 93.Pp 94The 95.Fn fido_bio_template_name 96function returns a pointer to a NUL-terminated string containing 97the friendly name of 98.Fa template , 99or NULL if 100.Fa template 101does not have a friendly name set. 102.Pp 103The 104.Fn fido_bio_template_id_ptr 105function returns a pointer to the template id of 106.Fa template , 107or NULL if 108.Fa template 109does not have an id. 110The corresponding length can be obtained by 111.Fn fido_bio_template_id_len . 112.Pp 113The 114.Fn fido_bio_template_set_name 115function sets the friendly name of 116.Fa template 117to 118.Fa name . 119If 120.Fa name 121is NULL, the friendly name of 122.Fa template 123is unset. 124.Pp 125The 126.Fn fido_bio_template_array_new 127function returns a pointer to a newly allocated, empty 128.Vt fido_bio_template_array_t 129type. 130If memory cannot be allocated, NULL is returned. 131.Pp 132The 133.Fn fido_bio_template_array_free 134function releases the memory backing 135.Fa *array_p , 136where 137.Fa *array_p 138must have been previously allocated by 139.Fn fido_bio_template_array_new . 140On return, 141.Fa *array_p 142is set to NULL. 143Either 144.Fa array_p 145or 146.Fa *array_p 147may be NULL, in which case 148.Fn fido_bio_template_array_free 149is a NOP. 150.Pp 151The 152.Fn fido_bio_template_array_count 153function returns the number of templates in 154.Fa array . 155.Pp 156The 157.Fn fido_bio_template 158function returns a pointer to the template at index 159.Fa idx 160in 161.Fa array . 162Please note that the first template in 163.Fa array 164has an 165.Fa idx 166(index) value of 0. 167.Sh RETURN VALUES 168The error codes returned by 169.Fn fido_bio_template_set_id 170and 171.Fn fido_bio_template_set_name 172are defined in 173.In fido/err.h . 174On success, 175.Dv FIDO_OK 176is returned. 177.Sh SEE ALSO 178.Xr fido_bio_dev_get_info 3 , 179.Xr fido_bio_enroll_new 3 180