-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d1a46d5
commit c693097
Showing
3 changed files
with
40 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from fido2.server import Fido2Server | ||
|
||
|
||
def test_make_assert(client, pin_protocol, algorithm): | ||
rp = {"id": "example.com", "name": "Example RP"} | ||
server = Fido2Server(rp) | ||
user = {"id": b"user_id", "name": "A. User"} | ||
|
||
create_options, state = server.register_begin(user) | ||
|
||
# Create a credential | ||
result = client.make_credential( | ||
{ | ||
**create_options["publicKey"], | ||
"pubKeyCredParams": [algorithm], | ||
} | ||
) | ||
|
||
auth_data = server.register_complete(state, result) | ||
cred = auth_data.credential_data | ||
assert cred.public_key[3] == algorithm["alg"] | ||
credentials = [cred] | ||
|
||
# Get assertion | ||
request_options, state = server.authenticate_begin(credentials) | ||
|
||
# Authenticate the credential | ||
result = client.get_assertion(request_options.public_key).get_response(0) | ||
cred_data = server.authenticate_complete(state, credentials, result) | ||
assert cred_data == cred |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters