OneShotSecret

com.geirolz.secret.OneShotSecret
See theOneShotSecret companion object
final class OneShotSecret[T]

A OneShotSecret is a secret that can be used only once.

After the first use, the secret is destroyed.

Type parameters

T

type of the secret

Attributes

Companion
object
Graph
Supertypes
trait AutoCloseable
class Object
trait Matchable
class Any

Members list

Value members

Inherited methods

final inline override def close(): Unit

Alias for destroy

Alias for destroy

Attributes

Definition Classes
SecretApi -> AutoCloseable
Inherited from:
SecretApi (hidden)
final def destroy()(using Location): Unit

Destroy the secret value by filling the obfuscated value with '\0'.

Destroy the secret value by filling the obfuscated value with '\0'.

This method is idempotent.

Once the secret is destroyed it can't be used anymore. If you try to use it using use, useAndDestroy, evalUse, evalUseAndDestroy and other methods, it will raise a NoLongerValidSecret exception.

Attributes

Inherited from:
SecretApi (hidden)
final def destructionLocation: Option[Location]

Attributes

Returns

the location where the secret was destroyed if the collection is enabled.

Inherited from:
SecretApi (hidden)
final inline override def equals(obj: Any): Boolean

Always returns false to prevents leaking information.

Always returns false to prevents leaking information.

Use isHashedEquals or isValueEquals

Attributes

Definition Classes
SecretApi -> Any
Inherited from:
SecretApi (hidden)
final inline def euseAndDestroy[U](f: T => U)(using Location): Either[SecretDestroyed, U]

Alias for useAndDestroy with Either[Throwable, *]

Alias for useAndDestroy with Either[Throwable, *]

Attributes

Inherited from:
SecretApi (hidden)
final inline def evalUseAndDestroy[F[_] : MonadSecretError, U](f: T => F[U])(implicit evidence$1: MonadSecretError[F], Location): F[U]

Apply f with the de-obfuscated value and then destroy the secret value by invoking destroy method.

Apply f with the de-obfuscated value and then destroy the secret value by invoking destroy method.

Once the secret is destroyed it can't be used anymore. If you try to use it using use, useAndDestroy, evalUse, evalUseAndDestroy and other methods, it will raise a SecretDestroyed exception.

Attributes

Inherited from:
SecretApi (hidden)
final def flatMapAndDestroy[U : SecretStrategy](f: T => Secret[U])(implicit evidence$1: SecretStrategy[U], Location, Hasher): Secret[U]

flat map the value using the specified function and then destroy this.

flat map the value using the specified function and then destroy this.

If the secret were destroyed it will raise a SecretDestroyed when you try to use the new secret.

Attributes

Inherited from:
SecretApi (hidden)
final def hashed: String

Attributes

Returns

a hashed representation of the secret value

Inherited from:
SecretApi (hidden)
final def isDestroyed: Boolean

Check if the secret is destroyed

Check if the secret is destroyed

Attributes

Returns

true if the secret is destroyed, false otherwise

Inherited from:
SecretApi (hidden)
inline def isHashedEquals(that: Secret[T]): Boolean

Safely compare the hashed value of this secret with the provided Secret.

Safely compare the hashed value of this secret with the provided Secret.

Attributes

Inherited from:
SecretApi (hidden)
final def mapAndDestroy[U : SecretStrategy](f: T => U)(implicit evidence$1: SecretStrategy[U], Location, Hasher): Secret[U]

map the value using the specified function and then destroy this.

map the value using the specified function and then destroy this.

If the secret were destroyed it will raise a SecretDestroyed when you try to use the new secret.

Attributes

Inherited from:
SecretApi (hidden)
final inline def useAndDestroy[F[_] : MonadSecretError, U](f: T => U)(implicit evidence$1: MonadSecretError[F], Location): F[U]

Apply f with the de-obfuscated value and then destroy the secret value by invoking destroy method.

Apply f with the de-obfuscated value and then destroy the secret value by invoking destroy method.

Once the secret is destroyed it can't be used anymore. If you try to use it using use, useAndDestroy, evalUse, evalUseAndDestroy and other methods, it will raise a SecretDestroyed exception.

Attributes

Inherited from:
SecretApi (hidden)

Inherited fields

final override val toString: String

Attributes

Returns

always returns a static place holder string "** SECRET **" to avoid leaking information

Inherited from:
SecretApi (hidden)