mirror of https://codeberg.org/pzp/pzp-db.git
remove dead comments
This commit is contained in:
parent
f1e313461e
commit
d040da5409
|
@ -70,33 +70,6 @@ function isEmptyObject(obj) {
|
||||||
* @property {string} keys.private
|
* @property {string} keys.private
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Msg} msg
|
|
||||||
*/
|
|
||||||
// function getFeedId(msg) {
|
|
||||||
// if (msg.metadata.type) {
|
|
||||||
// return `ppppp:feed/v1/${msg.metadata.who}/${msg.metadata.type}`
|
|
||||||
// } else {
|
|
||||||
// return `ppppp:feed/v1/${msg.metadata.who}`
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// function isMsg(x) {
|
|
||||||
// return (
|
|
||||||
// typeof x === 'object' &&
|
|
||||||
// !!x &&
|
|
||||||
// typeof x.metadata.author === 'string' &&
|
|
||||||
// x.metadata.author &&
|
|
||||||
// typeof x.metadata.type === 'string' &&
|
|
||||||
// x.metadata.type
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
|
|
||||||
// function isFeedId(author) {
|
|
||||||
// if (typeof author !== 'string') return false
|
|
||||||
// return author.startsWith('ppppp:feed/v1/')
|
|
||||||
// }
|
|
||||||
|
|
||||||
function isFeedRoot(msg, authorId, findType) {
|
function isFeedRoot(msg, authorId, findType) {
|
||||||
const findWho = stripAuthor(authorId)
|
const findWho = stripAuthor(authorId)
|
||||||
const { who, type, tangles } = msg.metadata
|
const { who, type, tangles } = msg.metadata
|
||||||
|
@ -231,9 +204,6 @@ module.exports = {
|
||||||
getMsgId,
|
getMsgId,
|
||||||
isFeedRoot,
|
isFeedRoot,
|
||||||
getFeedRootHash,
|
getFeedRootHash,
|
||||||
// getFeedId,
|
|
||||||
// isFeedId,
|
|
||||||
// isMsg,
|
|
||||||
create,
|
create,
|
||||||
createRoot,
|
createRoot,
|
||||||
erase,
|
erase,
|
||||||
|
|
|
@ -229,6 +229,16 @@ class Tangle {
|
||||||
getMaxDepth() {
|
getMaxDepth() {
|
||||||
return this.#maxDepth
|
return this.#maxDepth
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug() {
|
||||||
|
let str = ''
|
||||||
|
const max = this.#maxDepth
|
||||||
|
for (let i = 0; i <= max; i++) {
|
||||||
|
const atDepth = this.#getAllAtDepth(i)
|
||||||
|
str += `Depth ${i}: ${atDepth.join(', ')}\n`
|
||||||
|
}
|
||||||
|
return str
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Tangle
|
module.exports = Tangle
|
||||||
|
|
|
@ -40,7 +40,6 @@ function validateWho(msg) {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return new Error('invalid message: must have "who" as base58 string')
|
return new Error('invalid message: must have "who" as base58 string')
|
||||||
}
|
}
|
||||||
// FIXME: if there are prev, then `who` must match
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateMsgHash(str) {
|
function validateMsgHash(str) {
|
||||||
|
@ -199,8 +198,6 @@ function validateContent(msg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: validateDepth should be +1 of the max of prev depth
|
|
||||||
|
|
||||||
function validate(msg, tangle, msgHash, rootHash) {
|
function validate(msg, tangle, msgHash, rootHash) {
|
||||||
let err
|
let err
|
||||||
if ((err = validateShape(msg))) return err
|
if ((err = validateShape(msg))) return err
|
||||||
|
@ -214,22 +211,9 @@ function validate(msg, tangle, msgHash, rootHash) {
|
||||||
if ((err = validateSignature(msg))) return err
|
if ((err = validateSignature(msg))) return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// function validateBatch(nativeMsgs, prevNativeMsg, hmacKey, cb) {
|
|
||||||
// let err
|
|
||||||
// let prev = prevNativeMsg
|
|
||||||
// for (const nativeMsg of nativeMsgs) {
|
|
||||||
// err = validateSync(nativeMsg, prev, hmacKey)
|
|
||||||
// if (err) return cb(err)
|
|
||||||
// prev = nativeMsg
|
|
||||||
// }
|
|
||||||
// cb()
|
|
||||||
// }
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
validateType,
|
validateType,
|
||||||
validateContent,
|
validateContent,
|
||||||
|
|
||||||
validate,
|
validate,
|
||||||
validateMsgHash,
|
validateMsgHash,
|
||||||
// validateBatch,
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue