Package io.vertx.ext.auth.webauthn4j

## Interface CredentialStorage

-     public interface CredentialStorage

  Used to represent persistent storage of credentials, this gives you a way to abstract how you want to store them (in memory, database, other).

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Future<List<Authenticator>>` | `find​(String userName, String credentialId)` | Finds an existing list of credentials for a given user name and credential ID.
    `Future<Void>` | `storeCredential​(Authenticator authenticator)` | Persists a new credential, bound by its user name (may be `null`) and credential ID (cannot be `null`, must be unique).
    `Future<Void>` | `updateCounter​(Authenticator authenticator)` | Updates a previously stored credential counter, as identified by its user name (may be `null`) and credential ID (cannot be `null`, must be unique).

- - ### Method Detail

    - #### find

          Future<List<Authenticator>> find​(String userName,
                                           String credentialId)

      Finds an existing list of credentials for a given user name and credential ID. Both the `userName` and `credentialId` parameters are optional but at least one of them must be specified. If only one is specified, it must match the results. If both are specified, then both must match the result at the same time. This may return more than one element if one of the parameters is not set. If both are set, then the returned list of credentials must contain at maximum 1 element. If the user is not known or does not allow any authenticator, returns an empty list.
      Parameters:
        `userName` - the user name (may be `null`, but must match if specified)
        `credentialId` - the credential ID (must match the results)
      Returns:
        the list of authenticators allowed for the given userName and credential ID, or an empty list.

    - #### storeCredential

          Future<Void> storeCredential​(Authenticator authenticator)

      Persists a new credential, bound by its user name (may be `null`) and credential ID (cannot be `null`, must be unique). If attempting to store a credential with a `credId` that is not unique, you should return a failed `Future`. If attempting to store a credential with a `userName` that already exists, you should first make sure that the current user is already logged in under the same `userName`, because this will in practice add a new credential to identify the existing user, so this must be restricted to the already existing user, otherwise you will allow anyone to gain access to existing users. If attempting to store a credential with a `userName` that already exists, and the current user is not logged in, or the logged in user does not have the same `userName`, you should return a failed `Future`.
      Parameters:
        `authenticator` - the new credential to persist
      Returns:
        a future of nothing, or a failed future if the `credId` already exists, or if the `userName` already exists and does not represent the currently logged in user.

    - #### updateCounter

          Future<Void> updateCounter​(Authenticator authenticator)

      Updates a previously stored credential counter, as identified by its user name (may be `null`) and credential ID (cannot be `null`, must be unique).
      Parameters:
        `authenticator` - the credential to update
      Returns:
        a future of nothing