Skip to content

Commit

Permalink
WIP: add signWithIntegritySha
Browse files Browse the repository at this point in the history
  • Loading branch information
sultanmyrza committed Nov 21, 2023
1 parent b1c22ad commit 42ff172
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/app/utils/nit/nit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,25 @@ export async function generateIntegritySha(message: SignedMessage) {

return integritySha;
}

export async function signWithIntegritySha(
sha256sum: string,
privateKey: string
) {
const signer = new ethers.Wallet(privateKey);

/**
* WORKAROUND: <TODO-paste-related-url-link>
* Ideally we should use nit module to get sign integrity hash as show below
* ```
* import * as nit from "@numbersprotocol/nit";
* const signature = await nit.signIntegrityHash(sha256, signer);
* ```
* However installing "@numbersprotocol/nit" causing ionic build errors.
* Once "@numbersprotocol/nit" become browser friendly we can
* remove this workaround and completely rely on "@numbersprotocol/nit"
*/
const signature = await signer.signMessage(sha256sum);

return signature;
}

0 comments on commit 42ff172

Please sign in to comment.