Skip to content

Commit

Permalink
Merge pull request #245 from automerge/whitespace
Browse files Browse the repository at this point in the history
whitespace-only changes
  • Loading branch information
HerbCaudill authored Dec 4, 2023
2 parents d73e715 + c15960f commit 8c5da6c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 1 addition & 4 deletions packages/automerge-repo/src/network/NetworkAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ export abstract class NetworkAdapter extends EventEmitter<NetworkAdapterEvents>
* @argument peerId - the peerId of this repo
* @argument peerMetadata - how this adapter should present itself to other peers
*/
abstract connect(
peerId: PeerId,
peerMetadata?: PeerMetadata
): void
abstract connect(peerId: PeerId, peerMetadata?: PeerMetadata): void

/** Called by the {@link Repo} to send a message to a peer
*
Expand Down
2 changes: 2 additions & 0 deletions packages/automerge-repo/src/storage/keyHash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ export function keyHash(binary: Uint8Array) {
const hash = sha256.hash(binary)
return bufferToHexString(hash)
}

export function headsHash(heads: A.Heads): string {
const encoder = new TextEncoder()
const headsbinary = mergeArrays(heads.map((h: string) => encoder.encode(h)))
return keyHash(headsbinary)
}

function bufferToHexString(data: Uint8Array) {
return Array.from(data, byte => byte.toString(16).padStart(2, "0")).join("")
}

0 comments on commit 8c5da6c

Please sign in to comment.