Skip to content

Commit

Permalink
minimize reindex attributes used to create credential hash
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonelizabeth committed Jan 25, 2022
1 parent 6d7baa4 commit c93afea
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,17 @@ import { ReindexSavedObject, ReindexStatus } from '../../../common/types';
export type Credential = Record<string, any>;

// Generates a stable hash for the reindex operation's current state.
const getHash = (reindexOp: ReindexSavedObject) =>
createHash('sha256')
.update(stringify({ id: reindexOp.id, ...reindexOp.attributes }))
const getHash = (reindexOp: ReindexSavedObject) => {
return createHash('sha256')
.update(
stringify({
id: reindexOp.id,
reindexTaskId: reindexOp.attributes.reindexTaskId,
status: reindexOp.attributes.status,
})
)
.digest('base64');
};

// Returns a base64-encoded API key string or undefined
const getApiKey = async ({
Expand Down

0 comments on commit c93afea

Please sign in to comment.