-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #245 from Sphereon-Opensource/develop
New release
- Loading branch information
Showing
241 changed files
with
16,154 additions
and
7,529 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "@sphereon/sphereon-sdk.workspace", | ||
"private": true, | ||
"version": "0.28.0", | ||
"version": "0.30.0", | ||
"description": "Sphereon SSI SDK (Workspace)", | ||
"repository": "[email protected]:Sphereon-Opensource/SSI-SDK.git", | ||
"author": "Sphereon <[email protected]>", | ||
|
@@ -113,10 +113,8 @@ | |
"@veramo/url-handler": "4.2.0", | ||
"@sphereon/ssi-types": "workspace:*", | ||
"@sphereon/ssi-sdk.core": "workspace:*", | ||
"@sphereon/oid4vci-common": "0.15.1-next.9", | ||
"@sphereon/oid4vci-client": "0.15.1-next.9", | ||
"@sphereon/oid4vci-issuer": "0.15.1-next.9", | ||
"@sphereon/pex": "^4.0.1", | ||
"@sphereon/pex": "5.0.0-unstable.8", | ||
"@sphereon/pex-models": "^2.3.1", | ||
"@noble/hashes": "1.2.0", | ||
"debug": "^4.3.5", | ||
"did-jwt": "6.11.6", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { | ||
IAgentContext, | ||
ICredentialVerifier, | ||
IDataStore, | ||
IDataStoreORM, | ||
IDIDManager, | ||
IKeyManager, | ||
IPluginMethodMap, | ||
IResolver, | ||
ICredentialIssuer, | ||
ICredentialStatusVerifier, | ||
} from '@veramo/core' | ||
|
||
/** | ||
* Allows to get a type agent context plugin methods based on provided or inferred types and at least one method for these plugin(s) | ||
* @param context Tje agent context to check against | ||
* @param requiredMethod One or more method the plugin provides, so we can check availability and thus plugin presence | ||
*/ | ||
export function contextHasPlugin<Plugins extends IPluginMethodMap>( | ||
context: IAgentContext<any>, | ||
requiredMethod: string | string[], | ||
): context is IAgentContext<Plugins> { | ||
const methods = Array.isArray(requiredMethod) ? requiredMethod : [requiredMethod] | ||
const allMethods = context.agent.availableMethods() | ||
return methods.every((method) => allMethods.includes(method)) | ||
} | ||
|
||
/** | ||
* The below methods are convenience methods to directly get the appropriate context after calling the respective method | ||
* | ||
* @param context | ||
*/ | ||
|
||
export function contextHasKeyManager(context: IAgentContext<IPluginMethodMap>): context is IAgentContext<IKeyManager> { | ||
return contextHasPlugin(context, 'keyManagerGet') | ||
} | ||
|
||
export function contextHasDidManager(context: IAgentContext<IPluginMethodMap>): context is IAgentContext<IResolver & IDIDManager> { | ||
return contextHasPlugin(context, 'didManagerGet') // IResolver is always required for IDIDManager | ||
} | ||
|
||
export function contextHasDidResolver(context: IAgentContext<IPluginMethodMap>): context is IAgentContext<IResolver> { | ||
return contextHasPlugin(context, 'resolveDid') // IResolver is always required for IDIDManager | ||
} | ||
|
||
export function contextHasCredentialIssuer(context: IAgentContext<IPluginMethodMap>): context is IAgentContext<ICredentialIssuer> { | ||
return contextHasPlugin(context, ['createVerifiableCredential', 'createVerifiablePresentation']) // W3C Credential issuer | ||
} | ||
|
||
export function contextHasCredentialVerifier(context: IAgentContext<IPluginMethodMap>): context is IAgentContext<ICredentialVerifier> { | ||
return contextHasPlugin(context, ['verifyCredential', 'verifyPresentation']) // W3c Credential Verifier | ||
} | ||
|
||
export function contextHasCredentialStatusVerifier(context: IAgentContext<IPluginMethodMap>): context is IAgentContext<ICredentialStatusVerifier> { | ||
return contextHasPlugin(context, ['checkCredentialStatus']) // W3c Credential status Verifier | ||
} | ||
|
||
export function contextHasDataStore(context: IAgentContext<IPluginMethodMap>): context is IAgentContext<IDataStore> { | ||
return contextHasPlugin(context, ['dataStoreGetVerifiableCredential', 'dataStoreGetVerifiablePresentation']) | ||
} | ||
|
||
export function contextHasDataStoreORM(context: IAgentContext<IPluginMethodMap>): context is IAgentContext<IDataStoreORM> { | ||
return contextHasPlugin(context, ['dataStoreORMGetVerifiableCredentials', 'dataStoreORMGetVerifiablePresentations']) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.