Skip to content
This repository was archived by the owner on Jul 6, 2022. It is now read-only.

feat: add function to return password creation date for user#417

Merged
vardan-arm merged 3 commits intomasterfrom
feat/get-password-creation-date
Sep 8, 2021
Merged

feat: add function to return password creation date for user#417
vardan-arm merged 3 commits intomasterfrom
feat/get-password-creation-date

Conversation

@vardan-arm
Copy link
Copy Markdown
Contributor

No description provided.

@vardan-arm
Copy link
Copy Markdown
Contributor Author

}

public getPasswordCreatedDate(): number | undefined {
const rootKey = this.protocolService.getRootKey()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const rootKey = this.protocolService.getRootKey()
const rootKey = this.protocolService.getRootKey();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


public getPasswordCreatedDate(): number | undefined {
const rootKey = this.protocolService.getRootKey()
return rootKey ? Number(rootKey.keyParams.content.created) : undefined;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return rootKey ? Number(rootKey.keyParams.content.created) : undefined;
return rootKey ? rootKey.keyParams.createdDate : undefined;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would change the return type to date. Do you need it to be a Number?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I just didn't want stringified timestamp, therefore converted to Number :) Thanks, updated!

}
}

public getPasswordCreatedDate(): Date | undefined {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry didn't catch this earlier, but I would put this function in protocol_service instead since root key is the domain of the protocol service.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, yeah, getRootKey comes from protocol service, so it makes more sense, done.

@vardan-arm vardan-arm merged commit 4c8dd30 into master Sep 8, 2021
@vardan-arm vardan-arm deleted the feat/get-password-creation-date branch September 8, 2021 12:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants