@@ -69,6 +69,36 @@ private AuthenticatorRegistrationExtensionOutputs(
69
69
this .uvm = uvm == null ? null : CollectionUtil .immutableList (uvm );
70
70
}
71
71
72
+ /**
73
+ * Parse <a
74
+ * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#registration-extension">registration</a>
75
+ * <a
76
+ * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#authenticator-extension-output">authenticator
77
+ * extension outputs</a> from the given authenticator data.
78
+ *
79
+ * <p>If the <code>authData</code> does not contain authenticator extension outputs, this returns
80
+ * an empty {@link Optional}.
81
+ *
82
+ * <p>Otherwise, this returns a present {@link Optional} containing an {@link
83
+ * AuthenticatorRegistrationExtensionOutputs} value with all validly-formatted <a
84
+ * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#registration-extension">registration</a>
85
+ * <a
86
+ * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#authenticator-extension-output">extension
87
+ * outputs</a> supported by this library. This silently ignores <a
88
+ * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#authentication-extension">authentication</a>
89
+ * extension outputs, malformed extension outputs, and unsupported extensions. The raw set of
90
+ * extension outputs can instead be obtained via {@link AuthenticatorData#getExtensions()}.
91
+ *
92
+ * <p>Note that a present {@link AuthenticatorRegistrationExtensionOutputs} may contain zero
93
+ * extension outputs.
94
+ *
95
+ * @param authData the <a
96
+ * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#authenticator-data">authenticator
97
+ * data</a> to parse extension outputs from
98
+ * @return an empty {@link Optional} if the <code>authData</code> does not contain authenticator
99
+ * extension outputs. Otherwise a present {@link Optional} containing parsed extension output
100
+ * values.
101
+ */
72
102
public static Optional <AuthenticatorRegistrationExtensionOutputs > fromAuthenticatorData (
73
103
AuthenticatorData authData ) {
74
104
return authData .getExtensions ().flatMap (AuthenticatorRegistrationExtensionOutputs ::fromCbor );
0 commit comments