Skip to content

Commit

Permalink
Merge pull request #32 from deso-protocol/bump-derived-key-expiration
Browse files Browse the repository at this point in the history
Update expiration block height computation
  • Loading branch information
lazynina authored Feb 14, 2024
2 parents e3dabc4 + ea675d8 commit d4723fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
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

0 comments on commit d4723fd

Please sign in to comment.