Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove unused utils #852

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,10 @@
import b4a from 'b4a'
import sodium from 'sodium-universal'
import { keyToPublicId } from '@mapeo/crypto'
import { createHash } from 'node:crypto'
import stableStringify from 'json-stable-stringify'

const PROJECT_INVITE_ID_SALT = Buffer.from('mapeo project invite id', 'ascii')

/**
* @param {String|Buffer} id
* @returns {Buffer | Uint8Array}
*/
export function idToKey(id) {
if (b4a.isBuffer(id)) {
return /** @type {Buffer} */ (id)
}

return b4a.from(/** @type {String} */ (id), 'hex')
}

/**
*
* @param {Buffer|String} key
Expand All @@ -31,18 +18,6 @@ export function keyToId(key) {
return key.toString('hex')
}

/**
* @param {String} version
* @returns {{coreId: String, blockIndex: Number}}
*/
export function parseVersion(version) {
const [coreId, blockIndex] = version.split('@')
return {
coreId,
blockIndex: Number(blockIndex),
}
}

export class ExhaustivenessError extends Error {
/** @param {never} value */
constructor(value) {
Expand Down
Loading