mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-03-30 15:08:28 +00:00
docs: Display static provider functions as Identities module functions.
This commit is contained in:
parent
86358ea2c5
commit
745af170c4
@ -17,7 +17,7 @@
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">OrbitDB API</h1>
|
||||
<h1 class="page-title"><?js= title ?></h1>
|
||||
|
||||
<?js= content ?>
|
||||
</div>
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user