forked from DarkGhostHunter/Larapass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWebAuthnAuthenticatable.php
136 lines (119 loc) · 3.23 KB
/
WebAuthnAuthenticatable.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
namespace DarkGhostHunter\Larapass\Contracts;
use Webauthn\PublicKeyCredentialSource;
use Webauthn\PublicKeyCredentialUserEntity;
interface WebAuthnAuthenticatable
{
/**
* Creates an user entity information for attestation (registration).
*
* @return \Webauthn\PublicKeyCredentialUserEntity
*/
public function userEntity(): PublicKeyCredentialUserEntity;
/**
* Return the handle used to identify his credentials.
*
* @return string
*/
public function userHandle(): string;
/**
* Return a list of "blacklisted" credentials for attestation.
*
* @return array
*/
public function attestationExcludedCredentials(): array;
/**
* Checks if a given credential exists.
*
* @param string $id
*
* @return bool
*/
public function hasCredential(string $id): bool;
/**
* Register a new credential by its ID for this user.
*
* @param \Webauthn\PublicKeyCredentialSource $source
*
* @return void
*/
public function addCredential(PublicKeyCredentialSource $source): void;
/**
* Removes a credential previously registered.
*
* @param string|array $id
*
* @return void
*/
public function removeCredential($id): void;
/**
* Removes all credentials previously registered.
*
* @param string|array|null $except
*
* @return void
*/
public function flushCredentials($except = null): void;
/**
* Checks if a given credential exists and is enabled.
*
* @param string $id
*
* @return bool
*/
public function hasCredentialEnabled(string $id): bool;
/**
* Enable the credential for authentication.
*
* @param string|array $id
*
* @return void
*/
public function enableCredential($id): void;
/**
* Disable the credential for authentication.
*
* @param string|array $id
*
* @return void
*/
public function disableCredential($id): void;
/**
* Disables all credentials for the user.
*
* @param string|array|null $except
*
* @return void
*/
public function disableAllCredentials($except = null): void;
/**
* Returns all credentials descriptors of the user.
*
* @return array|\Webauthn\PublicKeyCredentialDescriptor[]
*/
public function allCredentialDescriptors(): array;
/**
* Sends a credential recovery email to the user.
*
* @param string $token
*
* @return void
*/
public function sendCredentialRecoveryNotification(string $token): void;
/**
* Returns an WebAuthnAuthenticatable user from a given Credential ID.
*
* @param string $id
*
* @return \DarkGhostHunter\Larapass\Contracts\WebAuthnAuthenticatable|null
*/
public static function getFromCredentialId(string $id): ?WebAuthnAuthenticatable;
/**
* Returns a WebAuthAuthenticatable user from a given User Handle.
*
* @param string $handle
*
* @return \DarkGhostHunter\Larapass\Contracts\WebAuthnAuthenticatable|null
*/
public static function getFromCredentialUserHandle(string $handle): ?WebAuthnAuthenticatable;
}