Package org.signal.libsignal.svr2
Class Pin
-
- All Implemented Interfaces:
public class PinSupports operations on pins for Secure Value Recovery
This class provides hashing pins for local verification and for use with the remote SVR service. In either case, all pins are UTF-8 encoded bytes that must be normalized *before* being provided to this class. Normalizing a string pin requires the following steps:
The string should be trimmed for leading and trailing whitespace. If the whole string consists of digits, then non-arabic digits must be replaced with their arabic 0-9 equivalents. The string must then be NKFD normalized
-
-
Method Summary
-
-
Method Detail
-
localHash
static String localHash(Array<byte> pin)
Create an encoded password hash string.
This creates a hashed pin that should be used for local pin verification only.
- Parameters:
pin- A normalized, UTF-8 encoded byte representation of the pin- Returns:
A hashed pin string that can be verified later
-
verifyLocalHash
static boolean verifyLocalHash(String encodedHash, Array<byte> pin)
Verify an encoded password hash against a pin
- Parameters:
encodedHash- An encoded string of the hash, as returned by localHashpin- A normalized, UTF-8 encoded byte representation of the pin to verify- Returns:
true if the pin matches the hash, false otherwise
-
-
-
-