decentralized-identity / veramo

A JavaScript Framework for Verifiable Data
https://veramo.io
Apache License 2.0
444 stars 133 forks source link

Remove method namespaces from API #265

Closed simonas-notcat closed 3 years ago

simonas-notcat commented 4 years ago

Current

agent.createSelectiveDisclosureRequest
agent.createVerifiableCredential
agent.createVerifiablePresentation
agent.dataStoreGetMessage
agent.dataStoreGetVerifiableCredential
agent.dataStoreGetVerifiablePresentation
agent.dataStoreORMGetIdentities
agent.dataStoreORMGetIdentitiesCount
agent.dataStoreORMGetMessages
agent.dataStoreORMGetMessagesCount
agent.dataStoreORMGetVerifiableCredentials
agent.dataStoreORMGetVerifiableCredentialsByClaims
agent.dataStoreORMGetVerifiableCredentialsByClaimsCount
agent.dataStoreORMGetVerifiableCredentialsCount
agent.dataStoreORMGetVerifiablePresentations
agent.dataStoreORMGetVerifiablePresentationsCount
agent.dataStoreSaveMessage
agent.dataStoreSaveVerifiableCredential
agent.dataStoreSaveVerifiablePresentation
agent.dataStoreSaveVerifiablePresentation
agent.getVerifiableCredentialsForSdr
agent.handleMessage
agent.identityManagerAddKey
agent.identityManagerAddService
agent.identityManagerCreateIdentity
agent.identityManagerDeleteIdentity
agent.identityManagerGetIdentities
agent.identityManagerGetIdentity
agent.identityManagerGetOrCreateIdentity
agent.identityManagerGetProviders
agent.identityManagerImportIdentity
agent.identityManagerRemoveKey
agent.identityManagerRemoveService
agent.keyManagerCreateKey
agent.keyManagerDecryptJWE
agent.keyManagerDeleteKey
agent.keyManagerEncryptJWE
agent.keyManagerGetKey
agent.keyManagerGetKeyManagementSystems
agent.keyManagerImportKey
agent.keyManagerSignEthTX
agent.keyManagerSignJWT
agent.resolveDid
agent.sendMessageDIDCommAlpha1
agent.validatePresentationAgainstSdr

Proposed

agent.createIdentifier
agent.createKey
agent.createSelectiveDisclosureRequest
agent.createVerifiableCredential
agent.createVerifiablePresentation
agent.decryptJWE
agent.deleteIdentifier
agent.deleteKey
agent.encryptJWE
agent.getIdentifier
agent.getIdentifierProviders
agent.getIdentifiers
agent.getIdentifiers
agent.getIdentifiersCount
agent.getKey
agent.getKeyManagementSystems
agent.getMessage
agent.getMessages
agent.getMessagesCount
agent.getOrCreateIdentifier
agent.getVerifiableCredential
agent.getVerifiableCredentials
agent.getVerifiableCredentialsByClaims
agent.getVerifiableCredentialsByClaimsCount
agent.getVerifiableCredentialsCount
agent.getVerifiableCredentialsForSdr
agent.getVerifiablePresentation
agent.getVerifiablePresentations
agent.getVerifiablePresentationsCount
agent.handleMessage
agent.identifierAddKey
agent.identifierAddService
agent.identifierRemoveKey
agent.identifierRemoveService
agent.importIdentifier
agent.importKey
agent.resolveIdentifier
agent.saveMessage
agent.saveVerifiableCredential
agent.saveVerifiablePresentation
agent.saveVerifiablePresentation
agent.sendMessageDIDCommAlpha1
agent.signEthTX
agent.signJWT
agent.validatePresentationAgainstSdr
simonas-notcat commented 4 years ago
Current Proposed
agent.keyManagerGetKeyManagementSystems agent.getKeyManagementSystems
agent.keyManagerCreateKey agent.createKey
agent.keyManagerGetKey agent.getKey
agent.keyManagerDeleteKey agent.deleteKey
agent.keyManagerImportKey agent.importKey
agent.keyManagerEncryptJWE agent.encryptJWE
agent.keyManagerDecryptJWE agent.decryptJWE
agent.keyManagerSignJWT agent.signJWT
agent.keyManagerSignEthTX agent.signEthTX
agent.identityManagerGetProviders agent.getIdentifierProviders
agent.identityManagerGetIdentities agent.getIdentifiers
agent.identityManagerGetIdentity agent.getIdentifier
agent.identityManagerCreateIdentity agent.createIdentifier
agent.identityManagerGetOrCreateIdentity agent.getOrCreateIdentifier
agent.identityManagerImportIdentity agent.importIdentifier
agent.identityManagerDeleteIdentity agent.deleteIdentifier
agent.identityManagerAddKey agent.identifierAddKey
agent.identityManagerRemoveKey agent.identifierRemoveKey
agent.identityManagerAddService agent.identifierAddService
agent.identityManagerRemoveService agent.identifierRemoveService
agent.resolveDid agent.resolveIdentifier
agent.dataStoreSaveMessage agent.saveMessage
agent.dataStoreSaveVerifiableCredential agent.saveVerifiableCredential
agent.dataStoreSaveVerifiablePresentation agent.saveVerifiablePresentation
agent.dataStoreGetMessage agent.getMessage
agent.dataStoreGetVerifiableCredential agent.getVerifiableCredential
agent.dataStoreSaveVerifiablePresentation agent.saveVerifiablePresentation
agent.dataStoreGetVerifiablePresentation agent.getVerifiablePresentation
agent.dataStoreORMGetIdentities agent.getIdentifiers
agent.dataStoreORMGetIdentitiesCount agent.getIdentifiersCount
agent.dataStoreORMGetMessages agent.getMessages
agent.dataStoreORMGetMessagesCount agent.getMessagesCount
agent.dataStoreORMGetVerifiableCredentialsByClaims agent.getVerifiableCredentialsByClaims
agent.dataStoreORMGetVerifiableCredentialsByClaimsCount agent.getVerifiableCredentialsByClaimsCount
agent.dataStoreORMGetVerifiableCredentials agent.getVerifiableCredentials
agent.dataStoreORMGetVerifiableCredentialsCount agent.getVerifiableCredentialsCount
agent.dataStoreORMGetVerifiablePresentations agent.getVerifiablePresentations
agent.dataStoreORMGetVerifiablePresentationsCount agent.getVerifiablePresentationsCount
agent.handleMessage agent.handleMessage
agent.sendMessageDIDCommAlpha1 agent.sendMessageDIDCommAlpha1
agent.createVerifiablePresentation agent.createVerifiablePresentation
agent.createVerifiableCredential agent.createVerifiableCredential
agent.createSelectiveDisclosureRequest agent.createSelectiveDisclosureRequest
agent.getVerifiableCredentialsForSdr agent.getVerifiableCredentialsForSdr
agent.validatePresentationAgainstSdr agent.validatePresentationAgainstSdr
awoie commented 4 years ago

One general comment would be that I liked the prefix because it indicated the layering but if the layering is not so strict (i.e. no logical grouping) anymore, then I guess it makes sense to remove those prefixes.

@simonas-notcat a few questions:

mirceanis commented 4 years ago

I agree with @awoie but I think a regrouping of methods makes sense. Right now, namespacing is still required since we already have conflicts when simply removing the prefixes:

old new
agent.identityManagerGetIdentities agent.getIdentifiers
agent.dataStoreORMGetIdentities agent.getIdentifiers

I think it's worth moving away from the current internal layer namespaces to a more logical layering. Some logical layers that I'm spotting are:

mirceanis commented 3 years ago

there are many moving parts here, let's revisit this after we've figured out how to work with LD-credentials, data storage and query and maybe some more didcomm requirements too