-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Key deprecation policy. #194
base: main
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,10 @@ | |
"description": "Key Management Service", | ||
"version": "1.0.0", | ||
"debug": true | ||
}, | ||
"keyRotation": { | ||
"gracePeriodDays": 2, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have not yet integrated the key rotation in the endpoints. |
||
"ttlDays": 7 | ||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,8 @@ export interface IKeyItem extends JsonWebKeyEdDSAPublic { | |
receipt?: string; | ||
id?: number; | ||
d?: string; | ||
creationDate?: string; | ||
expiryDate?: string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be calculated because the rotation policy can be changed after the creation of the key There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. creation date already exists: |
||
} | ||
|
||
// Define an interface for a wrap key | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export class TrustedTime { | ||
private static lastTimestamp: number = 0; | ||
|
||
public static getCurrentTime(): number { | ||
const currentTime = Date.now(); | ||
if (currentTime <= this.lastTimestamp) { | ||
throw new Error("System time moved backwards."); | ||
} | ||
this.lastTimestamp = currentTime; | ||
return currentTime; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This policy already exist. See governance/policies/key-rotation-policy.json