注册接口

注册接口

整个注册过程分两个接口,一个是获取注册挑战 challenge,一个是进行实际注册。

webauthn-registration-flow-01

预注册

POST /ta-fido-server/preregister

1、鉴权Header

Host: api.wekey.com
X-Wekey-Date: 20150830T123600Z
Authorization: WEKEY-HMAC-SHA256 host;x-wekey-date,fe5f80f77445342fe2855ddc963176630326f102d5fa3beca038a248ff027d04

2、请求参数

名称 类型 必填 描述 示例
rpId string 调用者在wekey分配的ID example.com
userId string Base64url encoded用户ID MQ==
username string 用户名 xiaoming
displayName string 显示名称 xiaoming
icon string 用户头像 Https://
extensions object 扩展选项
attestation string 证明偏好 direct
authenticatorSelection object 选项 {“authenticatorAttachment”:“paltform”}

2、返回参数

名称 类型 描述
code int 错误码,0 为OK
data object publicKey,PublicKeyCredential对象,可直接调用window.create
error string 错误码不为0时有值

注册

POST /ta-fido-server/register

1、鉴权Header

Host: api.wekey.com
X-Wekey-Date: 20150830T123600Z
Authorization: WEKEY-HMAC-SHA256 host;x-wekey-date,fe5f80f77445342fe2855ddc963176630326f102d5fa3beca038a248ff027d04

2、请求参数

名称 类型 必填 描述 示例
rpId string 调用者在wekey分配的ID example.com
object PublicKeyCredential对象,由webauthn api: window.create 产生

2、返回参数

名称 类型 描述
code int 错误码,0 为OK
data
error string 错误码不为0时有值