DeviceAuthenticator
public protocol DeviceAuthenticator
Protocol to override keypair generation, authentication, signing and access control
-
Generate public and private key pair
Declaration
Swift
func generateKeys() throws -> KeyPair
-
Sign the challenge sent from the server and generate signed JWT
Throws
DeviceBindingStatus
if any error occurs while signingDeclaration
Swift
func sign(keyPair: KeyPair, kid: String, userId: String, challenge: String, expiration: Date) throws -> String
Parameters
keyPair
Public and private key pair
kid
Generated key id
userId
user Id received from server
challenge
challenge received from server
expiration
experation Date of jws
Return Value
compact serialized jws
-
Sign the challenge sent from the server and generate signed JWT
Throws
DeviceBindingStatus
if any error occurs while signingDeclaration
Swift
func sign(userKey: UserKey, challenge: String, expiration: Date, customClaims: [String : Any]) throws -> String
Parameters
userKey
user Information
challenge
challenge received from server
expiration
experation Date of jws
customClaims
A dictionary of custom claims to be added to the jws payload
Return Value
compact serialized jws
-
Check if authentication is supported
Declaration
Swift
func isSupported() -> Bool
-
Access Control for the authetication type
Declaration
Swift
func accessControl() -> SecAccessControl?
-
Set the Authentication Prompt
Declaration
Swift
func setPrompt(_ prompt: Prompt)
-
Get the Device Binding Authentication Type
Declaration
Swift
func type() -> DeviceBindingAuthenticationType
-
initialize already created entity with useriD and Promp
Declaration
Swift
func initialize(userId: String, prompt: Prompt)
Parameters
userId
userId of the authentication
prompt
Prompt containing the description for authentication
-
initialize already created entity with useriD and Promp
Declaration
Swift
func initialize(userId: String)
Parameters
userId
userId of the authentication
-
Remove Keys
Declaration
Swift
func deleteKeys()
-
Get the token signed issue time.
Declaration
Swift
func issueTime() -> Date
-
Get the token not before time.
Declaration
Swift
func notBeforeTime() -> Date
-
Validate custom claims
Declaration
Swift
func validateCustomClaims(_ customClaims: [String : Any]) -> Bool
Parameters
customClaims
A dictionary of custom claims to be validated
Return Value
Bool value indicating whether the custom claims are valid or not