diff --git a/lib/index.js b/lib/index.js index 26870c3..6851c95 100644 --- a/lib/index.js +++ b/lib/index.js @@ -76,6 +76,7 @@ function initRecord(peer, config) { assertDBPlugin(peer) const ghostSpan = config.record?.ghostSpan ?? 32 + if (ghostSpan < 1) throw new Error('config.record.ghostSpan must be >= 0') //#region state let accountID = /** @type {string | null} */ (null) @@ -475,6 +476,13 @@ function initRecord(peer, config) { return false } + /** + * @returns {number} + */ + function getGhostSpan() { + return ghostSpan + } + /** * @public * @param {string} subdomain @@ -532,6 +540,7 @@ function initRecord(peer, config) { read, getFeedID, isGhostable, + getGhostSpan, minGhostDepth, minRequiredDepth, squeeze, diff --git a/test/index.test.js b/test/index.test.js index 25820e7..b5c1a9a 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -29,6 +29,8 @@ test('setup', async (t) => { _nonce: 'alice', }) await p(peer.record.load)(aliceID) + + assert.equal(peer.record.getGhostSpan(), 4, 'getGhostSpan') }) test('Record update() and get()', async (t) => {