PINs¶
The PINs of a given token are retrieved using the Token.pins property. They can then be manipulated using the methods described below.
-
class
SCWS.Pin()¶ SCWS.Pin Represents a PIN that protects smart card contents.
-
Pin.token¶ The
SCWS.Token()object this PIN belongs to.
-
Pin.label¶ The PIN label. Can be undefined if the card has a single PIN without explicit label defined.
-
Pin.initialized¶ Boolean indicating if the PIN has been initialized.
-
Pin.toBeChanged¶ Boolean indicating if the PIN need to be changed before use.
-
Pin.blocked¶ Boolean indicating if the PIN is blocked.
-
Pin.tryCountLow¶ Boolean indicating if the PIN try counter is lower than the maximum (an unsuccessful verification attempt has been made).
-
Pin.lastTry¶ Boolean indicating if the PIN try counter shows only one attempt remaining.
-
Pin.remainingTries¶ Number of remaining tries for the PIN verification. Can be undefined if the information is unavailable.
-
Pin.validated¶ Boolean indicating if the PIN has been successfully verified (access to the private objects is granted).
-
Pin.login(value, so)¶ Verifies the PIN.
- Arguments
value – The PIN value. May be
nullorundefinedif a protected authentication path exists (seeToken.protectedAuthPath).so – (optional) Boolean indicating if the verification operation must be made against the security officer (admnistrator or unblocking) PIN. If
falseorundefined, targets the user PIN.
- Returns
A
Promiseresolved when the operation has been made (the resolution value is undefined).
-
Pin.change(oldValue, newValue)¶ Changes the PIN. The operation can only be made against the user PIN.
- Arguments
oldValue – The current PIN value. May be
nullorundefinedif a protected authentication path exists (seeToken.protectedAuthPath).newValue – The new PIN value. May be
nullorundefinedif a protected authentication path exists.
- Returns
A
Promiseresolved when the operation has been made (the resolution value is undefined).
-
Pin.init(newValue)¶ Reinitializes the PIN value (unblocking it if required). The operation can only be made against the user PIN, and requires the security officer PIN to be verified (see
Pin.login()).- Arguments
newValue – The new PIN value. May be
nullorundefinedif a protected authentication path exists.
- Returns
A
Promiseresolved when the operation has been made (the resolution value is undefined).
-
Pin.logout()¶ Resets the verified status of the PIN (cancels a call to
Pin.login()).- Returns
A
Promiseresolved when the operation has been made (the resolution value is undefined).
-
Pin.getConstraints()¶ Returns the format constraints of the PIN (which must be enforced when changing the PIN value).
The constraints are returned as an array of JavaScript objects, one for each constraint. The objects describing a constraint all have a
typefield, indicating the type of constraint, and optionally, some additional fields providing the parameters for the constraint. Thetypecan be one of the following (this list may be extended in the future):"minLength": The number of characters in the PIN must be at least the value given in theminLengthfield."exactLength": The number of characters in the PIN must be exactly the value given in thelengthfield."minMaxLength": The number of characters in the PIN must be between the value given in theminLengthfield and the value given in themaxLengthfield (inclusive)."numeric": The PIN must contain only numeric characters (0to9)."minDigits": The PIN must contain at leastcountdigits characters."minUpperCase": The PIN must contain at leastcountuppercase letters."minSpecial": The PIN must contain at leastcountspecial characters."minLowerCase": The PIN must contain at leastcountlowercase letters."newOldDifferent": The new PIN value must be different from the old PIN value."newOldDissimilar": At leastthresholdpercent of the characters must differ between the new PIN and the old PIN value."maxIdenticalSequence": There must be no sequences ofcountidentical characters."maxIncDecSequence": There must be no sequences ofcountincreasing/decreasing characters”
- Returns
A
Promiseresolving to the constraints description, as described above.
-
Pin.checkConstraints(oldPin, newPin)¶ Checks the format constraints of the PIN.
The constraints (obtained using the
Pin.getConstraints()method) are checked against the provided old and new PIN values. This method can be used to provide feedback to the user when changing their PIN value.The result of the check is returned as an array of boolean, each value indicating whether the constraint is fulfilled or not (in the same order as the array returned from
getConstraints).- Arguments
oldPin – The current PIN value (only used to check the
"newOldDifferent"and"newOldDissimilar"constraints).newPin – The new PIN value to be checked.
- Returns
A
Promiseresolving to the result array.