add more JSDocs

This commit is contained in:
Andre Staltz 2023-08-08 14:04:27 +03:00
parent 5f76000531
commit e6aa33d3f0
No known key found for this signature in database
GPG Key ID: 9EDE23EA7E8A4890
2 changed files with 25 additions and 8 deletions

View File

@ -331,7 +331,9 @@ function initDB(peer, config) {
}
/**
* @param {Rec} rec
* Public the identity ID from the given record.
*
* @param {Pick<RecPresent, 'msg' | 'hash'>} rec
* @returns {string | null}
*/
function getIdentityId(rec) {
@ -349,6 +351,10 @@ function initDB(peer, config) {
}
/**
* Find the identity that contains this `keypair` (or the implicit
* config.keypair) under the given `domain`.
*
* @public
* @param {{
* keypair?: KeypairPublicSlice;
* domain: string;
@ -386,10 +392,14 @@ function initDB(peer, config) {
}
/**
* Does this `identity` have this `keypair` (or the implicit config.keypair)?
*
* @public
* @param {{
* keypair?: KeypairPublicSlice;
* identity: string;
* }} opts
* @returns {boolean}
*/
function identityHas(opts) {
const keypair = opts?.keypair ?? config.keypair
@ -410,6 +420,10 @@ function initDB(peer, config) {
}
/**
* Create an identity (root msg) for the given `keypair` (or the implicit
* config.keypair) under this `domain`.
*
* @public
* @param {{
* keypair?: Keypair,
* domain: string,
@ -441,6 +455,10 @@ function initDB(peer, config) {
}
/**
* Find or create an identity (root msg) for the given `keypair` (or the
* implicit config.keypair) under this `domain`.
*
* @public
* @param {{
* keypair?: Keypair,
* domain: string,
@ -461,6 +479,10 @@ function initDB(peer, config) {
}
/**
* Create a consent signature for the given `keypair` (or the implicit
* config.keypair) to be added to the given `identity`.
*
* @public
* @param {{
* keypair?: KeypairPrivateSlice;
* identity: string;

View File

@ -34,7 +34,7 @@ interface Msg {
}
}
domain: string // alphanumeric string, at least 3 chars, max 100 chars
v: 2 // hard-coded at 2, indicates the version of the feed format
v: 3 // hard-coded at 3, indicates the version of the feed format
}
pubkey: Pubkey // base58 encoded string for the author's public key
sig: Signature // Signs the `metadata` object
@ -60,7 +60,7 @@ interface Msg {
}
}
domain: string // alphanumeric string, at least 3 chars, max 100 chars
v: 2
v: 3
}
pubkey: Pubkey
sig: Signature
@ -86,11 +86,6 @@ type Key =
algorithm: 'ed25519' // libsodium crypto_sign_detached
bytes: string // base58 encoded string for the public key being added
}
| {
purpose: 'subidentity'
algorithm: 'tangle' // PPPPP tangle
bytes: string // subidentity ID
}
| {
// WIP!!
purpose: 'box' // asymmetric encryption