Skip to content
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

Update expiration block height computation #32

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/identity/derived-key-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export async function generateDerivedKeyPayload(
) {
const { BlockHeight } = await getAppState();

// days * (24 hours / day) * (60 minutes / hour) * (1 block / 5 minutes) = blocks
// days * (24 hours / day) * (60 minutes / hour) * (60 seconds / minute) * (1 block / 1 second) = blocks
const expirationBlockHeight =
BlockHeight + (numDaysBeforeExpiration * 24 * 60) / 5;
BlockHeight + numDaysBeforeExpiration * 24 * 60 * 60;
const ownerPublicKeyBase58 = publicKeyToBase58Check(ownerKeys.public, {
network,
});
Expand Down
2 changes: 1 addition & 1 deletion src/identity/identity.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ describe('identity', () => {
});
describe('loginWithAutoDerive()', () => {
it('it stores the expected derive data when generating a local derived key payload', async () => {
const expectedExpirationBlock = 1294652;
const expectedExpirationBlock = 315603452;
const expectedDerivePayload = {
derivedPublicKeyBase58Check:
'BC1YLhKdgXgrZ1XkCzbmP6T9bumth2DgPwNjMksCAXe5kGU9LnxQtsX',
Expand Down
Loading