Comparing version 7.0.0-beta.8 to 7.0.0-beta.9
@@ -1,2 +0,2 @@ | ||
import { IKey, EcdsaSignature, TKeyType } from '../types'; | ||
import { IKey, TKeyType } from '../types'; | ||
export declare abstract class AbstractKeyManagementSystem { | ||
@@ -12,3 +12,3 @@ abstract createKey(args: { | ||
key: IKey; | ||
to: IKey; | ||
to: Omit<IKey, 'kms'>; | ||
data: string; | ||
@@ -23,3 +23,3 @@ }): Promise<string>; | ||
data: string; | ||
}): Promise<EcdsaSignature | string>; | ||
}): Promise<string>; | ||
abstract signEthTX(args: { | ||
@@ -26,0 +26,0 @@ key: IKey; |
@@ -5,44 +5,52 @@ import { AbstractIdentityProvider } from './abstract/abstract-identity-provider'; | ||
import { IKeyManager } from './key-manager'; | ||
export interface IIdentityManagerGetIdentityArgs { | ||
did: string; | ||
} | ||
export interface IIdentityManagerDeleteIdentityArgs { | ||
did: string; | ||
} | ||
export interface IIdentityManagerCreateIdentityArgs { | ||
alias?: string; | ||
provider?: string; | ||
kms?: string; | ||
options?: any; | ||
} | ||
export interface IIdentityManagerGetOrCreateIdentityArgs { | ||
alias: string; | ||
provider?: string; | ||
kms?: string; | ||
options?: any; | ||
} | ||
export interface IIdentityManagerAddKeyArgs { | ||
did: string; | ||
key: IKey; | ||
options?: any; | ||
} | ||
export interface IIdentityManagerRemoveKeyArgs { | ||
did: string; | ||
kid: string; | ||
options?: any; | ||
} | ||
export interface IIdentityManagerAddServiceArgs { | ||
did: string; | ||
service: IService; | ||
options?: any; | ||
} | ||
export interface IIdentityManagerRemoveServiceArgs { | ||
did: string; | ||
id: string; | ||
options?: any; | ||
} | ||
export interface IIdentityManager extends IPluginMethodMap { | ||
identityManagerGetProviders: () => Promise<string[]>; | ||
identityManagerGetIdentities: () => Promise<IIdentity[]>; | ||
identityManagerGetIdentity: (args: { | ||
did: string; | ||
}) => Promise<IIdentity>; | ||
identityManagerCreateIdentity: (args: { | ||
alias?: string; | ||
provider?: string; | ||
kms?: string; | ||
options?: any; | ||
}, context: IAgentContext<IKeyManager>) => Promise<IIdentity>; | ||
identityManagerGetOrCreateIdentity: (args: { | ||
alias: string; | ||
provider?: string; | ||
kms?: string; | ||
options?: any; | ||
}, context: IAgentContext<IKeyManager>) => Promise<IIdentity>; | ||
identityManagerImportIdentity: (args: IIdentity) => Promise<IIdentity>; | ||
identityManagerDeleteIdentity: (args: { | ||
did: string; | ||
}, context: IAgentContext<IKeyManager>) => Promise<boolean>; | ||
identityManagerAddKey: (args: { | ||
did: string; | ||
key: IKey; | ||
options?: any; | ||
}, context: IAgentContext<IKeyManager>) => Promise<any>; | ||
identityManagerRemoveKey: (args: { | ||
did: string; | ||
kid: string; | ||
options?: any; | ||
}, context: IAgentContext<IKeyManager>) => Promise<any>; | ||
identityManagerAddService: (args: { | ||
did: string; | ||
service: IService; | ||
options?: any; | ||
}, context: IAgentContext<IKeyManager>) => Promise<any>; | ||
identityManagerRemoveService: (args: { | ||
did: string; | ||
id: string; | ||
options?: any; | ||
}, context: IAgentContext<IKeyManager>) => Promise<any>; | ||
identityManagerGetProviders(): Promise<Array<string>>; | ||
identityManagerGetIdentities(): Promise<Array<IIdentity>>; | ||
identityManagerGetIdentity(args: IIdentityManagerGetIdentityArgs): Promise<IIdentity>; | ||
identityManagerCreateIdentity(args: IIdentityManagerCreateIdentityArgs, context: IAgentContext<IKeyManager>): Promise<IIdentity>; | ||
identityManagerGetOrCreateIdentity(args: IIdentityManagerGetOrCreateIdentityArgs, context: IAgentContext<IKeyManager>): Promise<IIdentity>; | ||
identityManagerImportIdentity(args: IIdentity): Promise<IIdentity>; | ||
identityManagerDeleteIdentity(args: IIdentityManagerDeleteIdentityArgs, context: IAgentContext<IKeyManager>): Promise<boolean>; | ||
identityManagerAddKey(args: IIdentityManagerAddKeyArgs, context: IAgentContext<IKeyManager>): Promise<any>; | ||
identityManagerRemoveKey(args: IIdentityManagerRemoveKeyArgs, context: IAgentContext<IKeyManager>): Promise<any>; | ||
identityManagerAddService(args: IIdentityManagerAddServiceArgs, context: IAgentContext<IKeyManager>): Promise<any>; | ||
identityManagerRemoveService(args: IIdentityManagerRemoveServiceArgs, context: IAgentContext<IKeyManager>): Promise<any>; | ||
} | ||
@@ -62,42 +70,12 @@ export declare class IdentityManager implements IAgentPlugin { | ||
identityManagerGetIdentities(): Promise<IIdentity[]>; | ||
identityManagerGetIdentity({ did }: { | ||
did: string; | ||
}): Promise<IIdentity>; | ||
identityManagerCreateIdentity({ provider, alias, kms, options }: { | ||
alias?: string; | ||
provider?: string; | ||
kms?: string; | ||
options?: any; | ||
}, context: IAgentContext<IKeyManager>): Promise<IIdentity>; | ||
identityManagerGetOrCreateIdentity({ provider, alias, kms, options }: { | ||
alias: string; | ||
provider?: string; | ||
kms?: string; | ||
options?: any; | ||
}, context: IAgentContext<IKeyManager>): Promise<IIdentity>; | ||
identityManagerGetIdentity({ did }: IIdentityManagerGetIdentityArgs): Promise<IIdentity>; | ||
identityManagerCreateIdentity({ provider, alias, kms, options }: IIdentityManagerCreateIdentityArgs, context: IAgentContext<IKeyManager>): Promise<IIdentity>; | ||
identityManagerGetOrCreateIdentity({ provider, alias, kms, options }: IIdentityManagerGetOrCreateIdentityArgs, context: IAgentContext<IKeyManager>): Promise<IIdentity>; | ||
identityManagerImportIdentity(identity: IIdentity): Promise<IIdentity>; | ||
identityManagerDeleteIdentity({ did }: { | ||
did: string; | ||
}, context: IAgentContext<IKeyManager>): Promise<boolean>; | ||
identityManagerAddKey({ did, key, options, }: { | ||
did: string; | ||
key: IKey; | ||
options?: any; | ||
}, context: IAgentContext<IKeyManager>): Promise<any>; | ||
identityManagerRemoveKey({ did, kid, options, }: { | ||
did: string; | ||
kid: string; | ||
options?: any; | ||
}, context: IAgentContext<IKeyManager>): Promise<any>; | ||
identityManagerAddService({ did, service, options, }: { | ||
did: string; | ||
service: IService; | ||
options?: any; | ||
}, context: IAgentContext<IKeyManager>): Promise<any>; | ||
identityManagerRemoveService({ did, id, options, }: { | ||
did: string; | ||
id: string; | ||
options?: any; | ||
}, context: IAgentContext<IKeyManager>): Promise<any>; | ||
identityManagerDeleteIdentity({ did }: IIdentityManagerDeleteIdentityArgs, context: IAgentContext<IKeyManager>): Promise<boolean>; | ||
identityManagerAddKey({ did, key, options }: IIdentityManagerAddKeyArgs, context: IAgentContext<IKeyManager>): Promise<any>; | ||
identityManagerRemoveKey({ did, kid, options }: IIdentityManagerRemoveKeyArgs, context: IAgentContext<IKeyManager>): Promise<any>; | ||
identityManagerAddService({ did, service, options }: IIdentityManagerAddServiceArgs, context: IAgentContext<IKeyManager>): Promise<any>; | ||
identityManagerRemoveService({ did, id, options }: IIdentityManagerRemoveServiceArgs, context: IAgentContext<IKeyManager>): Promise<any>; | ||
} | ||
//# sourceMappingURL=identity-manager.d.ts.map |
@@ -8,5 +8,5 @@ /** | ||
export * from './types'; | ||
export { IdentityManager, IIdentityManager } from './identity-manager'; | ||
export { KeyManager, IKeyManager } from './key-manager'; | ||
export { MessageHandler, IHandleMessage } from './message-handler'; | ||
export { IdentityManager, IIdentityManager, IIdentityManagerAddKeyArgs, IIdentityManagerAddServiceArgs, IIdentityManagerCreateIdentityArgs, IIdentityManagerDeleteIdentityArgs, IIdentityManagerGetIdentityArgs, IIdentityManagerGetOrCreateIdentityArgs, IIdentityManagerRemoveKeyArgs, IIdentityManagerRemoveServiceArgs, } from './identity-manager'; | ||
export { KeyManager, IKeyManager, IKeyManagerCreateKeyArgs, IKeyManagerDecryptJWEArgs, IKeyManagerDeleteKeyArgs, IKeyManagerEncryptJWEArgs, IKeyManagerGetKeyArgs, IKeyManagerSignEthTXArgs, IKeyManagerSignJWTArgs, } from './key-manager'; | ||
export { MessageHandler, IHandleMessage, IHandleMessageArgs } from './message-handler'; | ||
export { Message } from './message'; | ||
@@ -13,0 +13,0 @@ export { AbstractIdentityProvider } from './abstract/abstract-identity-provider'; |
import { AbstractKeyStore } from './abstract/abstract-key-store'; | ||
import { AbstractKeyManagementSystem } from './abstract/abstract-key-management-system'; | ||
import { IKey, TKeyType, EcdsaSignature, IAgentPlugin, IPluginMethodMap } from './types'; | ||
import { IKey, TKeyType, IAgentPlugin, IPluginMethodMap } from './types'; | ||
export interface IKeyManagerCreateKeyArgs { | ||
type: TKeyType; | ||
kms: string; | ||
meta?: Record<string, any>; | ||
} | ||
export interface IKeyManagerGetKeyArgs { | ||
kid: string; | ||
} | ||
export interface IKeyManagerDeleteKeyArgs { | ||
kid: string; | ||
} | ||
export interface IKeyManagerEncryptJWEArgs { | ||
kid: string; | ||
to: Omit<IKey, 'kms'>; | ||
data: string; | ||
} | ||
export interface IKeyManagerDecryptJWEArgs { | ||
kid: string; | ||
data: string; | ||
} | ||
export interface IKeyManagerSignJWTArgs { | ||
kid: string; | ||
data: string; | ||
} | ||
export interface IKeyManagerSignEthTXArgs { | ||
kid: string; | ||
transaction: object; | ||
} | ||
export interface IKeyManager extends IPluginMethodMap { | ||
keyManagerCreateKey: (args: { | ||
type: TKeyType; | ||
kms: string; | ||
meta?: Record<string, any>; | ||
}) => Promise<IKey>; | ||
keyManagerGetKey: (args: { | ||
kid: string; | ||
}) => Promise<IKey>; | ||
keyManagerDeleteKey: (args: { | ||
kid: string; | ||
}) => Promise<boolean>; | ||
keyManagerImportKey: (args: IKey) => Promise<boolean>; | ||
keyManagerEncryptJWE: (args: { | ||
kid: string; | ||
to: Omit<IKey, 'kms'>; | ||
data: string; | ||
}) => Promise<string>; | ||
keyManagerDecryptJWE: (args: { | ||
kid: string; | ||
data: string; | ||
}) => Promise<string>; | ||
keyManagerSignJWT: (args: { | ||
kid: string; | ||
data: string; | ||
}) => Promise<EcdsaSignature | string>; | ||
keyManagerSignEthTX: (args: { | ||
kid: string; | ||
transaction: object; | ||
}) => Promise<string>; | ||
keyManagerCreateKey(args: IKeyManagerCreateKeyArgs): Promise<IKey>; | ||
keyManagerGetKey(args: IKeyManagerGetKeyArgs): Promise<IKey>; | ||
keyManagerDeleteKey(args: IKeyManagerDeleteKeyArgs): Promise<boolean>; | ||
keyManagerImportKey(args: IKey): Promise<boolean>; | ||
keyManagerEncryptJWE(args: IKeyManagerEncryptJWEArgs): Promise<string>; | ||
keyManagerDecryptJWE(args: IKeyManagerDecryptJWEArgs): Promise<string>; | ||
keyManagerSignJWT(args: IKeyManagerSignJWTArgs): Promise<string>; | ||
keyManagerSignEthTX(args: IKeyManagerSignEthTXArgs): Promise<string>; | ||
} | ||
@@ -44,32 +51,11 @@ export declare class KeyManager implements IAgentPlugin { | ||
private getKms; | ||
keyManagerCreateKey(args: { | ||
type: TKeyType; | ||
kms: string; | ||
meta?: Record<string, any>; | ||
}): Promise<IKey>; | ||
keyManagerGetKey({ kid }: { | ||
kid: string; | ||
}): Promise<IKey>; | ||
keyManagerDeleteKey({ kid }: { | ||
kid: string; | ||
}): Promise<boolean>; | ||
keyManagerCreateKey(args: IKeyManagerCreateKeyArgs): Promise<IKey>; | ||
keyManagerGetKey({ kid }: IKeyManagerGetKeyArgs): Promise<IKey>; | ||
keyManagerDeleteKey({ kid }: IKeyManagerDeleteKeyArgs): Promise<boolean>; | ||
keyManagerImportKey(key: IKey): Promise<boolean>; | ||
keyManagerEncryptJWE({ kid, to, data }: { | ||
kid: string; | ||
to: IKey; | ||
data: string; | ||
}): Promise<string>; | ||
keyManagerDecryptJWE({ kid, data }: { | ||
kid: string; | ||
data: string; | ||
}): Promise<string>; | ||
keyManagerSignJWT({ kid, data }: { | ||
kid: string; | ||
data: string; | ||
}): Promise<EcdsaSignature | string>; | ||
keyManagerSignEthTX({ kid, transaction }: { | ||
kid: string; | ||
transaction: object; | ||
}): Promise<string>; | ||
keyManagerEncryptJWE({ kid, to, data }: IKeyManagerEncryptJWEArgs): Promise<string>; | ||
keyManagerDecryptJWE({ kid, data }: IKeyManagerDecryptJWEArgs): Promise<string>; | ||
keyManagerSignJWT({ kid, data }: IKeyManagerSignJWTArgs): Promise<string>; | ||
keyManagerSignEthTX({ kid, transaction }: IKeyManagerSignEthTXArgs): Promise<string>; | ||
} | ||
//# sourceMappingURL=key-manager.d.ts.map |
@@ -11,8 +11,9 @@ /// <reference types="node" /> | ||
}; | ||
export interface IHandleMessageArgs { | ||
raw: string; | ||
metaData?: IMetaData[]; | ||
save?: boolean; | ||
} | ||
export interface IHandleMessage extends IPluginMethodMap { | ||
handleMessage: (args: { | ||
raw: string; | ||
metaData?: IMetaData[]; | ||
save?: boolean; | ||
}, context: IAgentContext<IDataStore>) => Promise<Message>; | ||
handleMessage(args: IHandleMessageArgs, context: IAgentContext<IDataStore>): Promise<Message>; | ||
} | ||
@@ -25,8 +26,4 @@ export declare class MessageHandler extends EventEmitter implements IAgentPlugin { | ||
}); | ||
handleMessage(args: { | ||
raw: string; | ||
metaData?: IMetaData[]; | ||
save?: boolean; | ||
}, context: IAgentContext<IDataStore>): Promise<Message>; | ||
handleMessage(args: IHandleMessageArgs, context: IAgentContext<IDataStore>): Promise<Message>; | ||
} | ||
//# sourceMappingURL=message-handler.d.ts.map |
@@ -29,7 +29,2 @@ import { DIDDocument } from 'did-resolver'; | ||
} | ||
export interface EcdsaSignature { | ||
r: string; | ||
s: string; | ||
recoveryParam?: number; | ||
} | ||
export interface IMetaData { | ||
@@ -83,7 +78,30 @@ type: string; | ||
} | ||
/** | ||
* Input arguments for {@link IResolveDid.resolveDid} | ||
* | ||
* @public | ||
*/ | ||
export interface ResolveDidArgs { | ||
/** | ||
* DID URL | ||
* | ||
* @example | ||
* `did:web:uport.me` | ||
*/ | ||
didUrl: string; | ||
} | ||
export interface IResolveDid extends IPluginMethodMap { | ||
resolveDid(args: { | ||
didUrl: string; | ||
}): Promise<DIDDocument>; | ||
/** | ||
* Resolves DID and returns DID Document | ||
* | ||
* @example | ||
* ```typescript | ||
* const doc = await agent.resolveDid({ didUrl: 'did:web:uport.me' }) | ||
* ``` | ||
* | ||
* @param args - Input arguments for resolving a DID | ||
* @public | ||
*/ | ||
resolveDid(args: ResolveDidArgs): Promise<DIDDocument>; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
@@ -6,2 +6,15 @@ # Change Log | ||
# [7.0.0-beta.9](https://github.com/uport-project/daf/compare/v7.0.0-beta.8...v7.0.0-beta.9) (2020-08-14) | ||
### Bug Fixes | ||
- IHandleMessage interface ([350a128](https://github.com/uport-project/daf/commit/350a128c9ddc4bf6ec3182f8da5837d00ad0c167)) | ||
- IIdentityManager interface ([a0362c0](https://github.com/uport-project/daf/commit/a0362c07776e461ee4505b077b69965876672b3b)) | ||
- IKeyManager arg types ([723db1d](https://github.com/uport-project/daf/commit/723db1d2d100f8e80bf2da900ded2c658584486a)) | ||
- Removing EcdsaSignature type ([df443e5](https://github.com/uport-project/daf/commit/df443e50c7df3cdc0de78e421e960769cced38ae)) | ||
### Features | ||
- Generating OpenAPI schema (broken) ([cf2f685](https://github.com/uport-project/daf/commit/cf2f685e842c5bc95caae5993beb2a687169914b)) | ||
# [7.0.0-beta.8](https://github.com/uport-project/daf/compare/v7.0.0-beta.7...v7.0.0-beta.8) (2020-07-14) | ||
@@ -8,0 +21,0 @@ |
{ | ||
"name": "daf-core", | ||
"description": "DID Agent Framework Core", | ||
"version": "7.0.0-beta.8", | ||
"version": "7.0.0-beta.9", | ||
"main": "build/index.js", | ||
@@ -30,3 +30,3 @@ "types": "build/index.d.ts", | ||
"keywords": [], | ||
"gitHead": "45594065b42d5a4df923fcf0ef1af44a7b46bf64" | ||
"gitHead": "2c0cb644e4cd3371c93ebad089882ae71785256f" | ||
} |
@@ -1,2 +0,2 @@ | ||
import { IKey, EcdsaSignature, TKeyType } from '../types' | ||
import { IKey, TKeyType } from '../types' | ||
@@ -6,6 +6,6 @@ export abstract class AbstractKeyManagementSystem { | ||
abstract deleteKey(args: { kid: string }): Promise<boolean> | ||
abstract encryptJWE(args: { key: IKey; to: IKey; data: string }): Promise<string> | ||
abstract encryptJWE(args: { key: IKey; to: Omit<IKey, 'kms'>; data: string }): Promise<string> | ||
abstract decryptJWE(args: { key: IKey; data: string }): Promise<string> | ||
abstract signJWT(args: { key: IKey; data: string }): Promise<EcdsaSignature | string> | ||
abstract signJWT(args: { key: IKey; data: string }): Promise<string> | ||
abstract signEthTX(args: { key: IKey; transaction: object }): Promise<string> | ||
} |
@@ -6,40 +6,72 @@ import { AbstractIdentityProvider } from './abstract/abstract-identity-provider' | ||
export interface IIdentityManagerGetIdentityArgs { | ||
did: string | ||
} | ||
export interface IIdentityManagerDeleteIdentityArgs { | ||
did: string | ||
} | ||
export interface IIdentityManagerCreateIdentityArgs { | ||
alias?: string | ||
provider?: string | ||
kms?: string | ||
options?: any | ||
} | ||
export interface IIdentityManagerGetOrCreateIdentityArgs { | ||
alias: string | ||
provider?: string | ||
kms?: string | ||
options?: any | ||
} | ||
export interface IIdentityManagerAddKeyArgs { | ||
did: string | ||
key: IKey | ||
options?: any | ||
} | ||
export interface IIdentityManagerRemoveKeyArgs { | ||
did: string | ||
kid: string | ||
options?: any | ||
} | ||
export interface IIdentityManagerAddServiceArgs { | ||
did: string | ||
service: IService | ||
options?: any | ||
} | ||
export interface IIdentityManagerRemoveServiceArgs { | ||
did: string | ||
id: string | ||
options?: any | ||
} | ||
export interface IIdentityManager extends IPluginMethodMap { | ||
identityManagerGetProviders: () => Promise<string[]> | ||
identityManagerGetIdentities: () => Promise<IIdentity[]> | ||
identityManagerGetIdentity: (args: { did: string }) => Promise<IIdentity> | ||
identityManagerCreateIdentity: ( | ||
args: { | ||
alias?: string | ||
provider?: string | ||
kms?: string | ||
options?: any | ||
}, | ||
identityManagerGetProviders(): Promise<Array<string>> | ||
identityManagerGetIdentities(): Promise<Array<IIdentity>> | ||
identityManagerGetIdentity(args: IIdentityManagerGetIdentityArgs): Promise<IIdentity> | ||
identityManagerCreateIdentity( | ||
args: IIdentityManagerCreateIdentityArgs, | ||
context: IAgentContext<IKeyManager>, | ||
) => Promise<IIdentity> | ||
identityManagerGetOrCreateIdentity: ( | ||
args: { alias: string; provider?: string; kms?: string; options?: any }, | ||
): Promise<IIdentity> | ||
identityManagerGetOrCreateIdentity( | ||
args: IIdentityManagerGetOrCreateIdentityArgs, | ||
context: IAgentContext<IKeyManager>, | ||
) => Promise<IIdentity> | ||
identityManagerImportIdentity: (args: IIdentity) => Promise<IIdentity> | ||
identityManagerDeleteIdentity: ( | ||
args: { did: string }, | ||
): Promise<IIdentity> | ||
identityManagerImportIdentity(args: IIdentity): Promise<IIdentity> | ||
identityManagerDeleteIdentity( | ||
args: IIdentityManagerDeleteIdentityArgs, | ||
context: IAgentContext<IKeyManager>, | ||
) => Promise<boolean> | ||
identityManagerAddKey: ( | ||
args: { did: string; key: IKey; options?: any }, | ||
): Promise<boolean> | ||
identityManagerAddKey(args: IIdentityManagerAddKeyArgs, context: IAgentContext<IKeyManager>): Promise<any> // txHash? | ||
identityManagerRemoveKey( | ||
args: IIdentityManagerRemoveKeyArgs, | ||
context: IAgentContext<IKeyManager>, | ||
) => Promise<any> // txHash? | ||
identityManagerRemoveKey: ( | ||
args: { did: string; kid: string; options?: any }, | ||
): Promise<any> // txHash? | ||
identityManagerAddService( | ||
args: IIdentityManagerAddServiceArgs, | ||
context: IAgentContext<IKeyManager>, | ||
) => Promise<any> // txHash? | ||
identityManagerAddService: ( | ||
args: { did: string; service: IService; options?: any }, | ||
): Promise<any> //txHash? | ||
identityManagerRemoveService( | ||
args: IIdentityManagerRemoveServiceArgs, | ||
context: IAgentContext<IKeyManager>, | ||
) => Promise<any> //txHash? | ||
identityManagerRemoveService: ( | ||
args: { did: string; id: string; options?: any }, | ||
context: IAgentContext<IKeyManager>, | ||
) => Promise<any> //txHash? | ||
): Promise<any> //txHash? | ||
} | ||
@@ -90,3 +122,3 @@ | ||
async identityManagerGetIdentity({ did }: { did: string }): Promise<IIdentity> { | ||
async identityManagerGetIdentity({ did }: IIdentityManagerGetIdentityArgs): Promise<IIdentity> { | ||
return this.store.get({ did }) | ||
@@ -96,3 +128,3 @@ } | ||
async identityManagerCreateIdentity( | ||
{ provider, alias, kms, options }: { alias?: string; provider?: string; kms?: string; options?: any }, | ||
{ provider, alias, kms, options }: IIdentityManagerCreateIdentityArgs, | ||
context: IAgentContext<IKeyManager>, | ||
@@ -109,3 +141,3 @@ ): Promise<IIdentity> { | ||
async identityManagerGetOrCreateIdentity( | ||
{ provider, alias, kms, options }: { alias: string; provider?: string; kms?: string; options?: any }, | ||
{ provider, alias, kms, options }: IIdentityManagerGetOrCreateIdentityArgs, | ||
context: IAgentContext<IKeyManager>, | ||
@@ -127,3 +159,3 @@ ): Promise<IIdentity> { | ||
async identityManagerDeleteIdentity( | ||
{ did }: { did: string }, | ||
{ did }: IIdentityManagerDeleteIdentityArgs, | ||
context: IAgentContext<IKeyManager>, | ||
@@ -138,11 +170,3 @@ ): Promise<boolean> { | ||
async identityManagerAddKey( | ||
{ | ||
did, | ||
key, | ||
options, | ||
}: { | ||
did: string | ||
key: IKey | ||
options?: any | ||
}, | ||
{ did, key, options }: IIdentityManagerAddKeyArgs, | ||
context: IAgentContext<IKeyManager>, | ||
@@ -159,11 +183,3 @@ ): Promise<any> { | ||
async identityManagerRemoveKey( | ||
{ | ||
did, | ||
kid, | ||
options, | ||
}: { | ||
did: string | ||
kid: string | ||
options?: any | ||
}, | ||
{ did, kid, options }: IIdentityManagerRemoveKeyArgs, | ||
context: IAgentContext<IKeyManager>, | ||
@@ -180,11 +196,3 @@ ): Promise<any> { | ||
async identityManagerAddService( | ||
{ | ||
did, | ||
service, | ||
options, | ||
}: { | ||
did: string | ||
service: IService | ||
options?: any | ||
}, | ||
{ did, service, options }: IIdentityManagerAddServiceArgs, | ||
context: IAgentContext<IKeyManager>, | ||
@@ -201,11 +209,3 @@ ): Promise<any> { | ||
async identityManagerRemoveService( | ||
{ | ||
did, | ||
id, | ||
options, | ||
}: { | ||
did: string | ||
id: string | ||
options?: any | ||
}, | ||
{ did, id, options }: IIdentityManagerRemoveServiceArgs, | ||
context: IAgentContext<IKeyManager>, | ||
@@ -212,0 +212,0 @@ ): Promise<any> { |
@@ -8,5 +8,26 @@ /** | ||
export * from './types' | ||
export { IdentityManager, IIdentityManager } from './identity-manager' | ||
export { KeyManager, IKeyManager } from './key-manager' | ||
export { MessageHandler, IHandleMessage } from './message-handler' | ||
export { | ||
IdentityManager, | ||
IIdentityManager, | ||
IIdentityManagerAddKeyArgs, | ||
IIdentityManagerAddServiceArgs, | ||
IIdentityManagerCreateIdentityArgs, | ||
IIdentityManagerDeleteIdentityArgs, | ||
IIdentityManagerGetIdentityArgs, | ||
IIdentityManagerGetOrCreateIdentityArgs, | ||
IIdentityManagerRemoveKeyArgs, | ||
IIdentityManagerRemoveServiceArgs, | ||
} from './identity-manager' | ||
export { | ||
KeyManager, | ||
IKeyManager, | ||
IKeyManagerCreateKeyArgs, | ||
IKeyManagerDecryptJWEArgs, | ||
IKeyManagerDeleteKeyArgs, | ||
IKeyManagerEncryptJWEArgs, | ||
IKeyManagerGetKeyArgs, | ||
IKeyManagerSignEthTXArgs, | ||
IKeyManagerSignJWTArgs, | ||
} from './key-manager' | ||
export { MessageHandler, IHandleMessage, IHandleMessageArgs } from './message-handler' | ||
export { Message } from './message' | ||
@@ -13,0 +34,0 @@ export { AbstractIdentityProvider } from './abstract/abstract-identity-provider' |
import { AbstractKeyStore } from './abstract/abstract-key-store' | ||
import { AbstractKeyManagementSystem } from './abstract/abstract-key-management-system' | ||
import { IKey, TKeyType, EcdsaSignature, IAgentPlugin, IPluginMethodMap } from './types' | ||
import { IKey, TKeyType, IAgentPlugin, IPluginMethodMap } from './types' | ||
export interface IKeyManagerCreateKeyArgs { | ||
type: TKeyType | ||
kms: string | ||
meta?: Record<string, any> | ||
} | ||
export interface IKeyManagerGetKeyArgs { | ||
kid: string | ||
} | ||
export interface IKeyManagerDeleteKeyArgs { | ||
kid: string | ||
} | ||
export interface IKeyManagerEncryptJWEArgs { | ||
kid: string | ||
to: Omit<IKey, 'kms'> | ||
data: string | ||
} | ||
export interface IKeyManagerDecryptJWEArgs { | ||
kid: string | ||
data: string | ||
} | ||
export interface IKeyManagerSignJWTArgs { | ||
kid: string | ||
data: string | ||
} | ||
export interface IKeyManagerSignEthTXArgs { | ||
kid: string | ||
transaction: object | ||
} | ||
export interface IKeyManager extends IPluginMethodMap { | ||
keyManagerCreateKey: (args: { type: TKeyType; kms: string; meta?: Record<string, any> }) => Promise<IKey> | ||
keyManagerGetKey: (args: { kid: string }) => Promise<IKey> | ||
keyManagerDeleteKey: (args: { kid: string }) => Promise<boolean> | ||
keyManagerImportKey: (args: IKey) => Promise<boolean> | ||
keyManagerEncryptJWE: (args: { kid: string; to: Omit<IKey, 'kms'>; data: string }) => Promise<string> | ||
keyManagerDecryptJWE: (args: { kid: string; data: string }) => Promise<string> | ||
keyManagerSignJWT: (args: { kid: string; data: string }) => Promise<EcdsaSignature | string> | ||
keyManagerSignEthTX: (args: { kid: string; transaction: object }) => Promise<string> | ||
keyManagerCreateKey(args: IKeyManagerCreateKeyArgs): Promise<IKey> | ||
keyManagerGetKey(args: IKeyManagerGetKeyArgs): Promise<IKey> | ||
keyManagerDeleteKey(args: IKeyManagerDeleteKeyArgs): Promise<boolean> | ||
keyManagerImportKey(args: IKey): Promise<boolean> | ||
keyManagerEncryptJWE(args: IKeyManagerEncryptJWEArgs): Promise<string> | ||
keyManagerDecryptJWE(args: IKeyManagerDecryptJWEArgs): Promise<string> | ||
keyManagerSignJWT(args: IKeyManagerSignJWTArgs): Promise<string> | ||
keyManagerSignEthTX(args: IKeyManagerSignEthTXArgs): Promise<string> | ||
} | ||
@@ -41,7 +70,3 @@ export class KeyManager implements IAgentPlugin { | ||
async keyManagerCreateKey(args: { | ||
type: TKeyType | ||
kms: string | ||
meta?: Record<string, any> | ||
}): Promise<IKey> { | ||
async keyManagerCreateKey(args: IKeyManagerCreateKeyArgs): Promise<IKey> { | ||
const kms = this.getKms(args.kms) | ||
@@ -57,7 +82,7 @@ const partialKey = await kms.createKey({ type: args.type, meta: args.meta }) | ||
async keyManagerGetKey({ kid }: { kid: string }): Promise<IKey> { | ||
async keyManagerGetKey({ kid }: IKeyManagerGetKeyArgs): Promise<IKey> { | ||
return this.store.get({ kid }) | ||
} | ||
async keyManagerDeleteKey({ kid }: { kid: string }): Promise<boolean> { | ||
async keyManagerDeleteKey({ kid }: IKeyManagerDeleteKeyArgs): Promise<boolean> { | ||
const key = await this.store.get({ kid }) | ||
@@ -73,3 +98,3 @@ const kms = this.getKms(key.kms) | ||
async keyManagerEncryptJWE({ kid, to, data }: { kid: string; to: IKey; data: string }): Promise<string> { | ||
async keyManagerEncryptJWE({ kid, to, data }: IKeyManagerEncryptJWEArgs): Promise<string> { | ||
const key = await this.store.get({ kid }) | ||
@@ -80,3 +105,3 @@ const kms = this.getKms(key.kms) | ||
async keyManagerDecryptJWE({ kid, data }: { kid: string; data: string }): Promise<string> { | ||
async keyManagerDecryptJWE({ kid, data }: IKeyManagerDecryptJWEArgs): Promise<string> { | ||
const key = await this.store.get({ kid }) | ||
@@ -87,3 +112,3 @@ const kms = this.getKms(key.kms) | ||
async keyManagerSignJWT({ kid, data }: { kid: string; data: string }): Promise<EcdsaSignature | string> { | ||
async keyManagerSignJWT({ kid, data }: IKeyManagerSignJWTArgs): Promise<string> { | ||
const key = await this.store.get({ kid }) | ||
@@ -94,3 +119,3 @@ const kms = this.getKms(key.kms) | ||
async keyManagerSignEthTX({ kid, transaction }: { kid: string; transaction: object }): Promise<string> { | ||
async keyManagerSignEthTX({ kid, transaction }: IKeyManagerSignEthTXArgs): Promise<string> { | ||
const key = await this.store.get({ kid }) | ||
@@ -97,0 +122,0 @@ const kms = this.getKms(key.kms) |
@@ -15,11 +15,10 @@ import { EventEmitter } from 'events' | ||
export interface IHandleMessageArgs { | ||
raw: string | ||
metaData?: IMetaData[] | ||
save?: boolean | ||
} | ||
export interface IHandleMessage extends IPluginMethodMap { | ||
handleMessage: ( | ||
args: { | ||
raw: string | ||
metaData?: IMetaData[] | ||
save?: boolean | ||
}, | ||
context: IAgentContext<IDataStore>, | ||
) => Promise<Message> | ||
handleMessage(args: IHandleMessageArgs, context: IAgentContext<IDataStore>): Promise<Message> | ||
} | ||
@@ -52,10 +51,3 @@ | ||
public async handleMessage( | ||
args: { | ||
raw: string | ||
metaData?: IMetaData[] | ||
save?: boolean | ||
}, | ||
context: IAgentContext<IDataStore>, | ||
): Promise<Message> { | ||
public async handleMessage(args: IHandleMessageArgs, context: IAgentContext<IDataStore>): Promise<Message> { | ||
const { raw, metaData, save } = args | ||
@@ -62,0 +54,0 @@ debug('%o', { raw, metaData, save }) |
@@ -35,9 +35,2 @@ import { DIDDocument } from 'did-resolver' | ||
// Todo make it a String | ||
export interface EcdsaSignature { | ||
r: string | ||
s: string | ||
recoveryParam?: number | ||
} | ||
export interface IMetaData { | ||
@@ -102,4 +95,30 @@ type: string | ||
/** | ||
* Input arguments for {@link IResolveDid.resolveDid} | ||
* | ||
* @public | ||
*/ | ||
export interface ResolveDidArgs { | ||
/** | ||
* DID URL | ||
* | ||
* @example | ||
* `did:web:uport.me` | ||
*/ | ||
didUrl: string | ||
} | ||
export interface IResolveDid extends IPluginMethodMap { | ||
resolveDid(args: { didUrl: string }): Promise<DIDDocument> | ||
/** | ||
* Resolves DID and returns DID Document | ||
* | ||
* @example | ||
* ```typescript | ||
* const doc = await agent.resolveDid({ didUrl: 'did:web:uport.me' }) | ||
* ``` | ||
* | ||
* @param args - Input arguments for resolving a DID | ||
* @public | ||
*/ | ||
resolveDid(args: ResolveDidArgs): Promise<DIDDocument> | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
163087
72
2292