All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.imunity.fido.web.FidoCredentialInfoWrapper Maven / Gradle / Ivy

There is a newer version: 4.0.3
Show newest version
/*
 * Copyright (c) 2018 Bixbit - Krzysztof Benedyczak. All rights reserved.
 * See LICENCE.txt file for licensing information.
 */
package io.imunity.fido.web;

import io.imunity.fido.credential.FidoCredentialInfo;

import java.util.Date;

/**
 * Wrapper over {@link FidoCredentialInfo}. Keeps also persistence state for UI needs.
 *
 * @author R. Ledzinski
 */
public class FidoCredentialInfoWrapper
{
	private CredentialState state;

	public FidoCredentialInfo getCredential()
	{
		return credential;
	}

	private FidoCredentialInfo credential;

	public FidoCredentialInfoWrapper(final CredentialState state, final FidoCredentialInfo credential)
	{
		this.state = state;
		this.credential = credential;
	}

	public CredentialState getState()
	{
		return state;
	}

	public void setState(final CredentialState state)
	{
		this.state = state;
	}

	public Date getRegistrationTimestamp()
	{
		return new Date(credential.getRegistrationTimestamp());
	}

	public void setDescription(String description)
	{
		credential = credential.copyBuilder()
				.description(description)
				.build();
	}

	public boolean isDeleted()
	{
		return CredentialState.DELETED == state;
	}

	public enum CredentialState
	{
		STORED,
		NEW,
		DELETED
	};
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy