dictionary Error {
int errorCode;
DOMString errorMessage;
optional any errorData;
}
U2FVAL exposes its functionality over a REST API, which is made accessible to authenticated clients. Clients are responsible for supplying a unique-per-user persistent identifier for each user in its system in the form of a string no more than 32 characters long. Usernames should only be used if they are immutable. This user identification string is denoted userId in the API below.
The return types for register and sign operations have changed to be in line with the FIDO U2F JavaScript API v1.1.
The /:userId/authenticate endpoint has been renamed to /:userId/sign to
better map to the FIDO JavaScript API.
Properties can be given during creation of register/sign challenges, to be set on successful device creation/authentication.
More control is available in the creation of register/sign requests.
The following JavaScript objects are used when interacting with the REST API. In addition to these, the types from the FIDO U2F JavaScript API v1.1 specification are used.
Whenever an API call results in an error, an Error object is returned. The
errorCode determines the type of error, and the errorMessage gives a textual
description of the error. If applicable to the specific error, additional data
will be available in the errorData field. The HTTP status code for an error is
always a 4XX status code, such as 400 (Bad Request) or 404 (Not Found).
dictionary Error {
int errorCode;
DOMString errorMessage;
optional any errorData;
}
| Name | Code | Description |
|---|---|---|
BadInput |
10 |
The arguments passed to the function are invalid. |
NoEligibleDevices |
11 |
The user has no eligible devices capable of performing the requested action.
A |
DeviceCompromised |
12 |
The requested action caused the server to determine that one of the users
devices may be compromised, and has been disabled. The |
The Properties dictionary is simply a regular JSON object with values being
either strings or null. When sending Properties, a null value denotes
unsetting the property, ie. deleting it. When getting Properties all values
will be strings. Keys have a 40 character limit.
The DeviceDescriptor describes a registered U2F device. Each Device has a
unique handle used to identify the device, as well as fields showing when the
device was registered (created) and last successfully used (lastUsed).
When available, metadata about the device will be present in the metadata
field, containing vendor and device information. This field will be omitted if
no such metadata exists. A dictionary of key-value properties is available,
which can be used by the client to store arbitrary data. A boolean shows if the
device has been marked as compromised. A compromised device cannot be used for
authentication. The system will mark a device as compromised if it detects
something which may indicate this, and a compromised device should be replaced.
Lastly, there may be an array indicating the available transports a device
has. As this is an optional field, and the data is provided by the device
itself, this should not be fully trusted but rather treated as a hint about
what is available. While it is unlikely that a device specifies support for a
transport which it does not actually support, it may happen. More likely is
that a device supports additional transports which are not listed in this
field. For a description on how to interpret the value of this field, see
section 4 of the FIDO U2F JavaScript API v1.1
available
here.
dictionary DeviceDescriptor {
DOMString handle;
DOMString created;
DOMString lastUsed;
DeviceMetadata metadata;
Properties properties;
boolean compromised;
optional DOMString[] transports;
};
handle
|
A U2FVAL specific identifier for the credential. |
created
|
The time and date of registration of the credential. |
lastUsed
|
The time and date of the last successful use of the credential. |
metadata
|
Metadata for the device. |
properties
|
Client-settable key-value pairs. |
compromised
|
Flag indicating if the credential is considered to be compromised or not. |
transports
|
An optional list of transports supported by the credential. |
The metadata provided in the DeviceDescriptor contains metadata about the
device vendor as well as the device itself. The two contained fields
(VendorInfo and DeviceInfo) are described here.
If no metadata exists for either (or both) of these fields the fields will be
omitted.
dictionary DeviceMetadata {
optional VendorInfo vendor;
optional DeviceInfo device;
};
The RegisterRequestData contains the parameters needed to invoke the register
function of a FIDO client, as well as an array of DeviceDescriptors to
provide more information about the devices that are already registered. Each
descriptor in the descriptors array matches the RegisteredKey in
registeredKeys with the same index.
dictionary RegisterRequestData {
DOMString appId;
RegisterRequest[] registerRequests;
RegisteredKey[] registeredKeys;
DeviceDescriptor[] descriptors;
};
appId
|
The AppID for the request. |
registeredKeys
|
A list of RegisteredKey dictionaries, one for each U2F device already registered by the user. |
registerRequests
|
A list of RegisterRequest dictionaries, one for each protocol version that the server is willing to support. |
descriptors
|
A list of DeviceDescriptors matching the |
The RegisterResponseData contains the RegisterResponse returned by a successful
call to the register function of a FIDO client, as well as any properties to
set, and names of properties to return, if the registration succeeds.
dictionary RegisterResponseData {
RegisterResponse registerResponse;
Properties properties;
};
registerResponse
|
The RegisterResponse to return to the server for validation. |
properties
|
A Dictionary of properties to set for the Device created upon successful validation of the RegisterResponse. |
The SignRequestData contains the parameters needed to invoke the sign
function of a FIDO client, as well as an array of DeviceDescriptors to
provide more information about the devices that are eligible for
authentication. Each descriptor in the descriptors array matches the
RegisteredKey in registeredKeys with the same index.
dictionary SignRequestData {
DOMString appId;
DOMString challenge;
RegisteredKey[] registeredKeys;
DeviceDescriptor[] descriptors;
}
appId
|
The AppID for the request. |
challenge
|
The challenge for the request. |
registeredKeys
|
A list of RegisteredKey dictionaries, one for each U2F device available for authentication. |
descriptors
|
A list of DeviceDescriptors matching the |
The SignResponseData contains the SignResponse returned by a successful call to the sign function of a FIDO client, as well as any properties to set, and names of properties to return, if the authentication succeeds.
dictionary SignResponseData {
SignResponse signResponse;
Properties properties;
};
signResponse
|
The SignResponse to return to the server for validation. |
properties
|
A Dictionary of properties to set for the Device for which authentication is performed, if authentication succeeds. |
|
Example
|
https://example.com/johndoe |
HTTP GETReturns a list of device handles, with their properties.
DeviceDescriptor[]
HTTP DELETEDeletes all data associated with the user.
|
Example
|
https://example.com/johndoe/register |
HTTP GETInitializes registration for the given user (all registered devices).
challenge
|
An optional challenge as websafe base64 string. |
properties
|
Optional key-value Properties to set upon successful completion of device registration as a urlencoded JSON object. |
RegisterRequestData
HTTP POSTCompletes the registration, storing a new device associated with the user.
RegisterResponseData
DeviceDescriptor
|
Example
|
_https://example.com/johndoe/sign |
|
Note
|
This has been renamed from /:userId/authenticate. |
HTTP GETInitializes authentication for the given user (all registered devices).
challenge
|
An optional challenge as websafe base64 string. |
properties
|
Optional key-value Properties to set upon successful completion of device registration as a urlencoded JSON object. |
handle
|
Optional device handle to specify which of the users devices to generate the sign challenge for. Can be provided multiple times. If omitted, all eligible devices are used. |
SignRequestData
HTTP POSTCompletes the authentication, updating and returning properties for the device which signed the challenge.
SignResponseData
DeviceDescriptor
|
Example
|
https://example.com/johndoe/0f0f0f0f0f…0f |
HTTP GETReturns properties for the device.
DeviceDescriptor
HTTP POSTSets properties for the device, then returns the devices (updated) properties.
Dictionary
DeviceDescriptor
HTTP DELETERemoves the device registration.
HTTP 204 No Content
|
Example
|
https://example.com/johndoe/0f0f0f0f0f…0f/certificate |
HTTP GETReturns the attestation certificate for the device.
<PEM encoded X509 certificate>