new ValidityPeriod(validityPeriod, notBefore, notAfter)
A ValidityPeriod is used in a Data packet's SignatureInfo and represents the
begin and end times of a certificate's validity period.
There are three forms of the ValidityPeriod constructor:
ValidityPeriod() - Create a default ValidityPeriod where the period is not
specified.
ValidityPeriod(validityPeriod) - Create a new ValidityPeriod with a copy of
the fields in the given validityPeriod object.
ValidityPeriod(notBefore, notAfter) - Create a ValidityPeriod with the given
period.
Parameters:
Name | Type | Description |
---|---|---|
validityPeriod |
ValidityPeriod | The ValidityPeriod to copy. |
notBefore |
number | The beginning of the validity period range as milliseconds since Jan 1, 1970 UTC. Note that this is rounded up to the nearest whole second. |
notAfter |
number | The end of the validity period range as milliseconds since Jan 1, 1970 UTC. Note that this is rounded down to the nearest whole second. |
- Source:
Methods
(static) canGetFromSignature(An) → {boolean}
If the signature is a type that has a ValidityPeriod (so that
getFromSignature will succeed), return true. Note: This is a static method of
ValidityPeriod instead of a method of Signature so that the Signature base
class does not need to be overloaded with all the different kinds of
information that various signature algorithms may use.
Parameters:
Name | Type | Description |
---|---|---|
An |
Signature | object of a subclass of Signature. |
- Source:
Returns:
True if the signature is a type that has a ValidityPeriod,
otherwise false.
- Type
- boolean
(static) getFromSignature(An) → {ValidityPeriod}
If the signature is a type that has a ValidityPeriod, then return it.
Otherwise throw an error.
Parameters:
Name | Type | Description |
---|---|---|
An |
Signature | object of a subclass of Signature. |
- Source:
Returns:
The signature's ValidityPeriod. It is an error if
signature doesn't have a ValidityPeriod.
- Type
- ValidityPeriod
clear()
Reset to a default ValidityPeriod where the period is not specified.
- Source:
getChangeCount() → {number}
Get the change count, which is incremented each time this object is changed.
- Source:
Returns:
The change count.
- Type
- number
getNotAfter() → {number}
Get the end of the validity period range.
- Source:
Returns:
The time as milliseconds since Jan 1, 1970 UTC.
- Type
- number
getNotBefore() → {number}
Get the beginning of the validity period range.
- Source:
Returns:
The time as milliseconds since Jan 1, 1970 UTC.
- Type
- number
hasPeriod() → {boolean}
Check if the period has been set.
- Source:
Returns:
True if the period has been set, false if the period is not
specified (after calling the default constructor or clear).
- Type
- boolean
isValid(time) → {boolean}
Check if the time falls within the validity period.
Parameters:
Name | Type | Description |
---|---|---|
time |
number | (optional) The time to check as milliseconds since Jan 1, 1970 UTC. If omitted, use the current time. |
- Source:
Returns:
True if the beginning of the validity period is less than
or equal to time and time is less than or equal to the end of the validity
period.
- Type
- boolean
setPeriod(notBefore, notAfter) → {ValidityPeriod}
Set the validity period.
Parameters:
Name | Type | Description |
---|---|---|
notBefore |
number | The beginning of the validity period range as milliseconds since Jan 1, 1970 UTC. Note that this is rounded up to the nearest whole second. |
notAfter |
number | The end of the validity period range as milliseconds since Jan 1, 1970 UTC. Note that this is rounded down to the nearest whole second. |
- Source:
Returns:
This ValidityPeriod so that you can chain calls to
update values.
- Type
- ValidityPeriod