Skip to content

Commit

Permalink
feat(jwe): add a new default encryption module
Browse files Browse the repository at this point in the history
  • Loading branch information
beatt83 committed Jan 19, 2024
1 parent c292a3d commit e2e556b
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,21 @@ extension JWEEncryptionModule {
multiEncryptor: MultiEncryptor(),
multiDecryptor: MultiDecryptor()
)

/// The default `JWEEncryptionModule` instance with a predefined set of encryption providers, were ECDH-1PU and ECDH-ES
/// use a master ephemeral key for multiple recipients.
public static var defaultWithMasterEphemeralKey: JWEEncryptionModule = .init(
registeredEncryptions: Set(
[
.init(family: .aes, encryptor: AESJWEEncryptor(), decryptor: AESJWEDecryptor()),
.init(family: .direct, encryptor: DirectJWEEncryptor(), decryptor: DirectJWEDecryptor()),
.init(family: .ecdh1pu, encryptor: ECDH1PUJWEEncryptor(masterEphemeralKey: true), decryptor: ECDH1PUJWEDecryptor()),
.init(family: .ecdhes, encryptor: ECDHJWEEncryptor(masterEphemeralKey: true), decryptor: ECDHJWEDecryptor()),
.init(family: .rsa, encryptor: RSAJWEEncryptor(), decryptor: RSAJWEDecryptor()),
.init(family: .aes, encryptor: AESJWEEncryptor(), decryptor: AESJWEDecryptor()),
]
),
multiEncryptor: MultiEncryptor(),
multiDecryptor: MultiDecryptor()
)
}

0 comments on commit e2e556b

Please sign in to comment.