-
Notifications
You must be signed in to change notification settings - Fork 3
/
my-identifier-provider.ts
63 lines (53 loc) · 2.15 KB
/
my-identifier-provider.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { IIdentifier, IKey, IService, IAgentContext, IKeyManager, DIDDocument } from '@veramo/core-types'
import { AbstractIdentifierProvider } from '@veramo/did-manager'
type IContext = IAgentContext<IKeyManager>
/**
* You can use this template for an `AbstractIdentifierProvider` implementation.
*
* Implementations of this interface are used by `@veramo/did-manager` to implement
* CRUD operations for various DID methods.
*
* If you wish to implement support for a particular DID method, this is the type of class
* you need to implement.
*
* If you don't want to customize this, then it is safe to remove from the template.
*
* @alpha
*/
export class MyIdentifierProvider extends AbstractIdentifierProvider {
private defaultKms: string
constructor(options: { defaultKms: string }) {
super()
this.defaultKms = options.defaultKms
}
async createIdentifier(
{ kms, alias }: { kms?: string; alias?: string },
context: IContext
): Promise<Omit<IIdentifier, 'provider'>> {
throw new Error('not_implemented: createIdentifier')
}
async deleteIdentifier(identity: IIdentifier, context: IContext): Promise<boolean> {
throw new Error('not_implemented: deleteIdentifier')
}
async addKey(
{ identifier, key, options }: { identifier: IIdentifier; key: IKey; options?: any },
context: IContext
): Promise<any> {
throw new Error('not_implemented: addKey')
}
async addService(
{ identifier, service, options }: { identifier: IIdentifier; service: IService; options?: any },
context: IContext
): Promise<any> {
throw new Error('not_implemented: addService')
}
async removeKey(args: { identifier: IIdentifier; kid: string; options?: any }, context: IContext): Promise<any> {
throw new Error('not_implemented: removeKey')
}
async removeService(args: { identifier: IIdentifier; id: string; options?: any }, context: IContext): Promise<any> {
throw new Error('not_implemented: removeService')
}
updateIdentifier?(args: { did: string; document: Partial<DIDDocument>; options?: { [x: string]: any } }, context: IContext): Promise<IIdentifier> {
throw new Error('not_implemented: updateIdentifier')
}
}