Yubico / yubikit-android

Yubico Mobile Android SDK - YubiKit
Apache License 2.0
102 stars 38 forks source link

[fido] Add SerializationType parameter to webauthn `toMap`/`fromMap` #104

Closed AdamVe closed 9 months ago

AdamVe commented 9 months ago

This change adds new enum type SerializationType with two values CBOR and JSON (and a static DEFAULT variable initialized to JSON).

toMap and fromMap serialization methods of webauthn classes will now encode/decode webauthn binary data in Base64 url safe format, if the wanted serialization type is JSON and use byte[] for CBOR.

The reason for adding the parameter is that when communicating with RPs, we need to use the JSON format and when communicating over CTAP we need the plain byte array format.

This PR also updated the serialization test and added hashCode() and equals(Object) overrides to all webauthn classes.