package crypto
- Source
- package.scala
- Alphabetic
- By Inheritance
- crypto
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- type AuthEnv = AuthEnvironment[AuthResult]
-
sealed abstract
class
AuthEnvironment[F[_]] extends AnyRef
An environment in which authentication is performed.
An environment in which authentication is performed.
It is expected that you will have a singleton instance of this class for your entire app/service. The
default
method in the companion object creates an instance with some reasonable defaults and caching.It is not strictly necessary to use this class, but it certain classes such as
EncryptedCodec
andSignedCodec
have convenient instantiation methods that take an authentication environment.The environment can also be set up for asymmetric signing and verification. To set it up for asymmetric signing, set the signing key. For asymmetric verification, set the verify key. Both can be set if the library user needs to perform both functions.
- F
the context wrapping most of the results of the environment. For example,
F
is usuallyAuthResult
, which means that anF[A]
is either anAuthFailure
or a successfulA
.
-
sealed abstract
class
AuthFailure extends Product with Serializable
An error encountered during authentication.
- type AuthResult[A] = Either[AuthFailure, A]
- sealed abstract class CipherMode extends AnyRef
- trait Decryptor[F[_]] extends AnyRef
- final class EncryptionKey extends AnyRef
- trait Encryptor[F[_]] extends AnyRef
- final class InitializationVector extends AnyRef
- class Nonce extends AnyRef
-
final
class
SafeHolder[V] extends AnyRef
The SafeHolder utility provide safe reuse of objects that could not be shared between thread (not thread-safe) like many java crypto objects, e.g.
The SafeHolder utility provide safe reuse of objects that could not be shared between thread (not thread-safe) like many java crypto objects, e.g. Cipher.
- final class SafeHolderEncryption extends Encryptor[AuthResult] with Decryptor[AuthResult]
-
final
class
SafeHolderHmac extends Signer[AuthResult]
An HMAC-based implementation of Signer that caches
Mac
instances to reduce the overhead of initialization.An HMAC-based implementation of Signer that caches
Mac
instances to reduce the overhead of initialization.Caching a per-key
Mac
instead of just a thread-localMac
would remove the need to initialize the mac on each signature, but benchmarks show that it doesn't make a significant performance difference. - final class SignatureKey extends AnyRef
-
abstract
class
Signer[F[_]] extends AnyRef
A
Signer
computes a signature (such as a checksum) of data.A
Signer
computes a signature (such as a checksum) of data.- F
The context in which results are wrapped. This allows a Signer to return a possible failure via Option, a disjunction, etc.
-
trait
TokenAuthenticator[SerializedToken, DeserializedToken] extends AnyRef
A TokenAuthenticator can authenticate with a provided encoded token and can serialize a decoded token.
A TokenAuthenticator can authenticate with a provided encoded token and can serialize a decoded token.
- SerializedToken
the form of the serialized token (for example String for tokens that are base-64-encoded).
- DeserializedToken
the result of successful authentication (for example an
AuthToken
orUser
model).
-
final
case class
TokenVersion(major: Int, minor: Int, micro: Int) extends Product with Serializable
The serialization version of a token.
The serialization version of a token.
While the major/minor/micro versions are represented as
Int
at runtime, note that the serializer treats them as unsigned integers, so their range is 0 to 255.We must increment major whenever there are incompatible structural changes on the part of the core library:
- changes to secret part structure 2. change to secret encryption algorithm, 3. change token signing algorithm 4. change to keyId -> key calculation Changes 2-4 could come from authentication library or if we overwrite the default values.
Value Members
- object AuthEnv
- object AuthFailure extends Serializable
- object CipherMode
-
object
Encryption
Set of cipher functions for Web Service Key (WSK-based) authentication exposed through instances of
Encryptor
andDecryptor
Set of cipher functions for Web Service Key (WSK-based) authentication exposed through instances of
Encryptor
andDecryptor
CBC mode is used with a dynamic initialization vector.
There is a large performance improvement with caching a cipher per-thread and reusing it instead of creating new cipher instances.
- object EncryptionKey
- object Hmac
- object InitializationVector
- object Nonce
- object SignatureKey