Skip to content

Commit

Permalink
tests on push
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Nov 30, 2023
1 parent 66be50b commit 848a0f5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@

name: Node.js CI

on:
on:
# push for all branches
push:
branches:
- '*'
pull_request:
types:
- ready_for_review
Expand All @@ -27,4 +31,4 @@ jobs:
cache: 'npm'
- run: npm ci
- run: npm run compile
- run: npm test
- run: npm test
5 changes: 3 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,13 @@ function handleTokens(token: string): Token {
* @returns
*/
export function deriveKeysetId(keys: MintKeys) {
const pubkeysConcat = Object.entries(keys)
const pubkeysConcat = Object.entries(keys.keys)
.sort((a, b) => +a[0] - +b[0])
.map(([, pubKey]) => pubKey)
.join('');
const hash = sha256(new TextEncoder().encode(pubkeysConcat));
return Buffer.from(hash).toString('base64').slice(0, 12);
const hashHex = bytesToHex(hash);
return "00" + hashHex.slice(0, 12);
}
/**
* merge proofs from same mint,
Expand Down
2 changes: 1 addition & 1 deletion test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CashuMint } from '../src/CashuMint.js';
import { CashuWallet } from '../src/CashuWallet.js';

import dns from 'node:dns';
import { getEncodedToken } from '../src/utils.js';
import { deriveKeysetId, getEncodedToken } from '../src/utils.js';
dns.setDefaultResultOrder('ipv4first');

const externalInvoice =
Expand Down

0 comments on commit 848a0f5

Please sign in to comment.