docs: Display static provider functions as Identities module functions.

This commit is contained in:
Hayden Young 2023-06-30 16:43:26 +01:00
parent 86358ea2c5
commit 745af170c4
2 changed files with 2 additions and 23 deletions

View File

@ -17,7 +17,7 @@
<div id="main">
<h1 class="page-title">OrbitDB API</h1>
<h1 class="page-title"><?js= title ?></h1>
<?js= content ?>
</div>

View File

@ -1,35 +1,13 @@
/**
* @module IdentityProviders
* @description
* Identity providers for signing and verifying an identity using various
* cryptographic mechanism.
*/
import * as PublicKeyIdentityProvider from './publickey.js'
const identityProviders = {
publickey: PublicKeyIdentityProvider
}
/**
* Checks whether an identity provider is supported.
* @param {string} type The identity provider type.
* @return {boolean} True if the identity provider is supported, false
* otherwise.
* @static
*/
const isProviderSupported = (type) => {
return Object.keys(identityProviders).includes(type)
}
/**
* Gets an identity provider.
* @param {string} type The identity provider type.
* @return {IdentityProvider} The IdentityProvider module corresponding to
* type.
* @throws IdentityProvider type is not supported if the identity provider is
* not supported.
* @static
*/
const getIdentityProvider = (type) => {
if (!isProviderSupported(type)) {
throw new Error(`IdentityProvider type '${type}' is not supported`)
@ -46,6 +24,7 @@ const getIdentityProvider = (type) => {
* @throws 'Given IdentityProvider doesn't have a field 'type' if the
* IdentityProvider does not include a type property.
* @static
* @memberof module:Identities
*/
const addIdentityProvider = (IdentityProvider) => {
if (!IdentityProvider) {