mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-06-06 06:06:38 +00:00
docs: Move custom identity provider docs to READMEs.
This commit is contained in:
parent
3af0fc2306
commit
8b17f172fa
@ -129,3 +129,42 @@ The resulting output is a JSON object containing the identity information:
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Custom identity providers
|
||||
|
||||
A custom identity provider can be used provided the module takes the following form:
|
||||
```javascript
|
||||
// A unique name for the identity provider
|
||||
const type = 'custom'
|
||||
|
||||
// check whether the identity was signed by the identity's id.
|
||||
const verifyIdentity = identity => {
|
||||
|
||||
}
|
||||
// The identity provider.
|
||||
const MyCustomIdentityProvider = ({ keystore }) => {
|
||||
const getId = async ({ id } = {}) => {
|
||||
|
||||
}
|
||||
|
||||
const signIdentity = async (data, { id } = {}) => {
|
||||
|
||||
}
|
||||
|
||||
return {
|
||||
getId,
|
||||
signIdentity
|
||||
}
|
||||
}
|
||||
|
||||
export { MyCustomIdentityProvider as default, verifyIdentity, type }
|
||||
```
|
||||
|
||||
To use it, add it to the list of known identity providers:
|
||||
|
||||
```javascript
|
||||
import as MyCustomIdentityProvider from 'my-custom-identity-provider'
|
||||
addIdentityProvider(MyCustomIdentityProvider)
|
||||
```
|
||||
|
||||
where my-custom-identity-provider is the custom module.
|
@ -1,57 +1,13 @@
|
||||
/**
|
||||
* @module IdentityProviders
|
||||
* @description
|
||||
* Identity providers.
|
||||
*
|
||||
* ## Custom Providers
|
||||
*
|
||||
* An identity provider provides a method for signing and verifying an
|
||||
* identity using a particular cryptographic mechanism.
|
||||
*
|
||||
* A custom identity provider can be used provided the module takes the
|
||||
* following form:
|
||||
* ```javascript
|
||||
* // A unique name for the identity provider
|
||||
* const type = 'custom'
|
||||
*
|
||||
* // check whether the identity was signed by the identity's id.
|
||||
* const verifyIdentity = identity => {
|
||||
*
|
||||
* }
|
||||
*
|
||||
* // The identity provider.
|
||||
* const MyCustomIdentityProvider = ({ keystore }) => {
|
||||
* const getId = async ({ id } = {}) => {
|
||||
*
|
||||
* }
|
||||
*
|
||||
* const signIdentity = async (data, { id } = {}) => {
|
||||
*
|
||||
* }
|
||||
*
|
||||
* return {
|
||||
* getId,
|
||||
* signIdentity
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* export { MyCustomIdentityProvider as default, verifyIdentity, type }
|
||||
* ```
|
||||
*
|
||||
* To use it, add it to the list of known identity providers:
|
||||
* ```javascript
|
||||
* import * as MyCustomIdentityProvider from 'my-custom-identity-provider'
|
||||
* addIdentityProvider(MyCustomIdentityProvider)
|
||||
* ```
|
||||
*
|
||||
* where my-custom-identity-provider is the custom module.
|
||||
* Identity providers for signing and verifying an identity using various
|
||||
* cryptographic mechanism.
|
||||
*/
|
||||
import * as PublicKeyIdentityProvider from './publickey.js'
|
||||
|
||||
const identityProviders = {
|
||||
publickey: PublicKeyIdentityProvider
|
||||
// [DIDIdentityProvider.type]: DIDIdentityProvider,
|
||||
// [EthIdentityProvider.type]: EthIdentityProvider
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user