@@ -57,17 +57,20 @@ public class AssertionExtensionInputs implements ExtensionInputs {
5757 private final AppId appid ;
5858 private final Extensions .LargeBlob .LargeBlobAuthenticationInput largeBlob ;
5959 private final Extensions .Prf .PrfAuthenticationInput prf ;
60+ private final Extensions .Spc .SpcAuthenticationInput spc ;
6061 private final Boolean uvm ;
6162
6263 @ JsonCreator
6364 private AssertionExtensionInputs (
6465 @ JsonProperty ("appid" ) AppId appid ,
6566 @ JsonProperty ("largeBlob" ) Extensions .LargeBlob .LargeBlobAuthenticationInput largeBlob ,
6667 @ JsonProperty ("prf" ) Extensions .Prf .PrfAuthenticationInput prf ,
68+ @ JsonProperty ("spc" ) Extensions .Spc .SpcAuthenticationInput spc ,
6769 @ JsonProperty ("uvm" ) Boolean uvm ) {
6870 this .appid = appid ;
6971 this .largeBlob = largeBlob ;
7072 this .prf = prf ;
73+ this .spc = spc ;
7174 this .uvm = (uvm != null && uvm ) ? true : null ;
7275 }
7376
@@ -83,6 +86,7 @@ public AssertionExtensionInputs merge(AssertionExtensionInputs other) {
8386 this .appid != null ? this .appid : other .appid ,
8487 this .largeBlob != null ? this .largeBlob : other .largeBlob ,
8588 this .prf != null ? this .prf : other .prf ,
89+ this .spc != null ? this .spc : other .spc ,
8690 this .uvm != null ? this .uvm : other .uvm );
8791 }
8892
@@ -103,6 +107,9 @@ public Set<String> getExtensionIds() {
103107 if (prf != null ) {
104108 ids .add (Extensions .Prf .EXTENSION_ID );
105109 }
110+ if (spc != null ) {
111+ ids .add (Extensions .Spc .EXTENSION_ID );
112+ }
106113 if (getUvm ()) {
107114 ids .add (Extensions .Uvm .EXTENSION_ID );
108115 }
@@ -212,6 +219,21 @@ public AssertionExtensionInputsBuilder prf(Extensions.Prf.PrfAuthenticationInput
212219 return this ;
213220 }
214221
222+ /**
223+ * Enable the Secure Payment Confirmation extension (<code>spc</code>).
224+ *
225+ * <p>This extension indicates that a credential is either being created for or used for Secure
226+ * Payment Confirmation, respectively.
227+ *
228+ * @see <a
229+ * href="https://www.w3.org/TR/secure-payment-confirmation/#sctn-payment-extension-registration">§5.
230+ * Secure Payment Confirmation extension (SPC)</a>
231+ */
232+ public AssertionExtensionInputsBuilder spc (Extensions .Spc .SpcAuthenticationInput spc ) {
233+ this .spc = spc ;
234+ return this ;
235+ }
236+
215237 /**
216238 * Enable the User Verification Method Extension (<code>uvm</code>).
217239 *
@@ -299,6 +321,37 @@ private Extensions.Prf.PrfAuthenticationInput getPrfJson() {
299321 : null ;
300322 }
301323
324+ /**
325+ * The input to the Secure Payment Confirmation (<code>spc</code>) extension, if any.
326+ *
327+ * <p>This extension indicates that a credential is either being created for or used for Secure
328+ * Payment Confirmation, respectively.
329+ *
330+ * @see <a
331+ * href="https://www.w3.org/TR/secure-payment-confirmation/#sctn-payment-extension-registration">§5.
332+ * Secure Payment Confirmation extension (SPC)</a>
333+ */
334+ public Optional <Extensions .Spc .SpcAuthenticationInput > getSpc () {
335+ return Optional .ofNullable (spc );
336+ }
337+
338+ /** For JSON serialization, to omit false and null values. */
339+ @ JsonProperty ("spc" )
340+ private Extensions .Spc .SpcAuthenticationInput getSpcJson () {
341+ return spc != null
342+ && (spc .getIsPayment ()
343+ || spc .getBrowserBoundPubKeyCredParams ().isPresent ()
344+ || spc .getRpId ().isPresent ()
345+ || spc .getTopOrigin ().isPresent ()
346+ || spc .getPayeeName ().isPresent ()
347+ || spc .getPayeeOrigin ().isPresent ()
348+ || spc .getPaymentEntitiesLogos ().isPresent ()
349+ || spc .getTotal ().isPresent ()
350+ || spc .getInstrument ().isPresent ())
351+ ? spc
352+ : null ;
353+ }
354+
302355 /**
303356 * @return <code>true</code> if the User Verification Method Extension (<code>uvm</code>) is
304357 * enabled, <code>false</code> otherwise.
0 commit comments