Skip to main content

GravityKit\GravityExport\Save\Service\PasswordService

Service that handles encrypting and decrypting passwords.

Since: 1.0

Source: add-ons/save/src/Service/PasswordService.php:13

Details

  • Kind: class
  • Namespace: GravityKit\GravityExport\Save\Service

Methods

MethodDescription
__construct()Creates the service.
encrypt()Encrypts the password using a predefined secret.
is_legacy_encryption()Whether this was encrypted with the legacy implementation.
decrypt()Decrypts a hash back to a password.

Method Reference

__construct()

public function __construct( string $secret, ?Encryption $foundation_encryption=null )

Creates the service.

Parameters

NameTypeDefaultDescription
$secretstringThe hashing secret.
$foundation_encryption?Encryptionnull

Since: 1.0

Source: add-ons/save/src/Service/PasswordService.php:43

encrypt()

public function encrypt( string $password ): string

Encrypts the password using a predefined secret.

Parameters

NameTypeDefaultDescription
$passwordstringThe password to encrypt.

Returns

  • string — The encrypted password.

Since: 1.0

Source: add-ons/save/src/Service/PasswordService.php:57

is_legacy_encryption()

public function is_legacy_encryption( string $encrypted_password ): bool

Whether this was encrypted with the legacy implementation.

Parameters

NameTypeDefaultDescription
$encrypted_passwordstring

Returns

  • bool

Since: $ver$

Source: add-ons/save/src/Service/PasswordService.php:73

decrypt()

public function decrypt( string $encrypted_password ): ?string

Decrypts a hash back to a password.

Parameters

NameTypeDefaultDescription
$encrypted_passwordstringThe password to decrypt.

Returns

  • string | null — The decrypted password.

Since: 1.0

Source: add-ons/save/src/Service/PasswordService.php:95