Provides the KeyStack class which implements the
KeyRing interface for managing rotatable keys.
Classes
A cryptographic key chain which allows signing of data to prevent tampering, but also allows for easy key rotation without needing to re-sign the data.
- indexOf(): Promise<number>data: Data,digest: string
Given
dataand adigest, return the current index of the key in thekeyspassed the constructor that was used to generate the digest. If no key can be found, the method returns-1. - length(): number
Number of keys
- sign(data: Data): Promise<string>
Take
dataand return a SHA256 HMAC digest that uses the current 0 index of thekeyspassed to the constructor. This digest is in the form of a URL safe base64 encoded string. - verify(): Promise<boolean>data: Data,digest: string
Given
dataand adigest, verify that one of thekeysprovided the constructor was used to generate thedigest. Returnstrueif one of the keys was used, otherwisefalse.