mirror of https://codeberg.org/pzp/pzp-db.git
fix which domain is used in identity.add()
This commit is contained in:
parent
54f00d1944
commit
5f76000531
|
@ -518,6 +518,12 @@ function initDB(peer, config) {
|
||||||
return cb(new Error('identity.add() failed because the consent is invalid'))
|
return cb(new Error('identity.add() failed because the consent is invalid'))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const identityRoot = get(opts.identity)
|
||||||
|
if (!identityRoot) {
|
||||||
|
// prettier-ignore
|
||||||
|
return cb(new Error(`identity.add() failed because the identity root "${opts.identity}" is unknown`))
|
||||||
|
}
|
||||||
|
|
||||||
/** @type {IdentityData} */
|
/** @type {IdentityData} */
|
||||||
const data = {
|
const data = {
|
||||||
action: 'add',
|
action: 'add',
|
||||||
|
@ -538,7 +544,7 @@ function initDB(peer, config) {
|
||||||
tangles: populateTangles([opts.identity]),
|
tangles: populateTangles([opts.identity]),
|
||||||
keypair: signingKeypair,
|
keypair: signingKeypair,
|
||||||
data,
|
data,
|
||||||
domain: 'identity',
|
domain: identityRoot.metadata.domain,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the actual message:
|
// Create the actual message:
|
||||||
|
|
|
@ -55,6 +55,7 @@ test('identity.add()', async (t) => {
|
||||||
)
|
)
|
||||||
assert.equal(msg.metadata.identity, 'self', 'msg.metadata.identity')
|
assert.equal(msg.metadata.identity, 'self', 'msg.metadata.identity')
|
||||||
assert.equal(msg.metadata.identityTips, null, 'msg.metadata.identityTips')
|
assert.equal(msg.metadata.identityTips, null, 'msg.metadata.identityTips')
|
||||||
|
assert.equal(msg.metadata.domain, 'person', 'msg.metadata.domain')
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
msg.metadata.tangles,
|
msg.metadata.tangles,
|
||||||
{ [id]: { depth: 1, prev: [id] } },
|
{ [id]: { depth: 1, prev: [id] } },
|
||||||
|
|
Loading…
Reference in New Issue