Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
public interface UserCredentialRepository
Known subtypesInMemoryUserCredentialRepository, JdbcUserCredentialRepository
Where the passkeys users have registered are kept.
InMemoryUserCredentialRepository keeps them in this process, for a test
or a demonstration; JdbcUserCredentialRepository keeps them in the
server’s database. Both do the two things the ceremonies depend on as one
step each, so that two requests at once cannot both pass:
Methods
public abstract boolean save(CredentialRecord record) | Stores a new credential. |
public abstract CredentialRecord findByCredentialId(byte[] credentialId) | The credential with this id, or null. |
public abstract List<CredentialRecord> findByUserId(byte[] userEntityUserId) | The credentials of the user with this handle, oldest first; empty when they have none. |
public abstract boolean advance(byte[] credentialId, long signatureCount, boolean uvInitialized, boolean backupState, long lastUsed) | Records a sign-in: the counter the authenticator sent, the flags it sent, and when. |
public abstract boolean delete(byte[] credentialId) | Removes a credential. |
Method details
save
public abstract boolean save(CredentialRecord record)Returns
findByCredentialId
public abstract CredentialRecord findByCredentialId(byte[] credentialId)findByUserId
public abstract List<CredentialRecord> findByUserId(byte[] userEntityUserId)advance
public abstract boolean advance(byte[] credentialId, long signatureCount, boolean uvInitialized, boolean backupState, long lastUsed)Records a sign-in: the counter the authenticator sent, the flags it sent, and when.
The counter is taken only when it is greater than the one stored – or when both are zero, which is an authenticator that keeps no counter. One statement decides and stores, so of two requests with the same assertion one is refused.
Returns
delete
public abstract boolean delete(byte[] credentialId)