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 null or undefined if a protected authentication path exists (see Token.protectedAuthPath).

  • so – (optional) Boolean indicating if the verification operation must be made against the security officer (admnistrator or unblocking) PIN. If false or undefined, targets the user PIN.

Returns

A Promise resolved 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 null or undefined if a protected authentication path exists (see Token.protectedAuthPath).

  • newValue – The new PIN value. May be null or undefined if a protected authentication path exists.

Returns

A Promise resolved 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 null or undefined if a protected authentication path exists.

Returns

A Promise resolved 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 Promise resolved 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 type field, indicating the type of constraint, and optionally, some additional fields providing the parameters for the constraint. The type can 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 the minLength field.

  • "exactLength": The number of characters in the PIN must be exactly the value given in the length field.

  • "minMaxLength": The number of characters in the PIN must be between the value given in the minLength field and the value given in the maxLength field (inclusive).

  • "numeric": The PIN must contain only numeric characters (0 to 9).

  • "minDigits": The PIN must contain at least count digits characters.

  • "minUpperCase": The PIN must contain at least count uppercase letters.

  • "minSpecial": The PIN must contain at least count special characters.

  • "minLowerCase": The PIN must contain at least count lowercase letters.

  • "newOldDifferent": The new PIN value must be different from the old PIN value.

  • "newOldDissimilar": At least threshold percent of the characters must differ between the new PIN and the old PIN value.

  • "maxIdenticalSequence": There must be no sequences of count identical characters.

  • "maxIncDecSequence": There must be no sequences of count increasing/decreasing characters”

Returns

A Promise resolving 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 Promise resolving to the result array.