diff --git a/testing.yml b/alice.yml similarity index 89% rename from testing.yml rename to alice.yml index 9f4c1728b..b0e0caed1 100644 --- a/testing.yml +++ b/alice.yml @@ -1,3 +1,22 @@ +server: + hostname: localhost + port: 3332 + schemaPath: /open-api.json + apiBasePath: /agent + apiDocsPath: /api-docs + defaultIdentity: + create: true + messagingServiceEndpoint: /messaging + publicProfileServiceEndpoint: /public-profile + publicName: Alice + publicPicture: https://picsum.photos/200 + ngrok: + connect: true + subdomain: alice-did + region: eu + # exposedMethods: + # - resolveDid + # - dataStoreORMGetIdentities constants: secretKey: 29739248cad1bd1a0fc4d9b75cd4d2990de535baf5caadfdf8d8f86664aa830c databaseFile: ./database.sqlite @@ -115,10 +134,10 @@ agent: - $require: daf-typeorm#DataStore $args: - $ref: /dbConnection - # - $require: daf-typeorm#DataStoreORM - # $args: - # - $ref: /dbConnection - # - $ref: /messageHandler + - $require: daf-typeorm#DataStoreORM + $args: + - $ref: /dbConnection + - $ref: /messageHandler - $require: daf-did-comm#DIDComm - $require: daf-w3c#CredentialIssuer - $require: daf-selective-disclosure#SelectiveDisclosure diff --git a/docs/api/daf-rest.md b/docs/api/daf-rest.md index bd01a69d8..5e2277ea9 100644 --- a/docs/api/daf-rest.md +++ b/docs/api/daf-rest.md @@ -4,7 +4,7 @@ ## daf-rest package -Provides a [plugin](./daf-rest.agentrestclient.md) for the [Agent](./daf-core.agent.md) that can proxy method execution over HTTPS using +Provides a [plugin](./daf-rest.agentrestclient.md) for the [Agent](./daf-core.agent.md) that can proxy method execution over HTTPS ## Classes diff --git a/docs/api/daf-typeorm.datastoreorm.md b/docs/api/daf-typeorm.datastoreorm.md index 2c25863cf..eac2a48e7 100644 --- a/docs/api/daf-typeorm.datastoreorm.md +++ b/docs/api/daf-typeorm.datastoreorm.md @@ -22,7 +22,7 @@ export declare class DataStoreORM implements IAgentPlugin | Property | Modifiers | Type | Description | | --- | --- | --- | --- | | [methods](./daf-typeorm.datastoreorm.methods.md) | | [IDataStoreORM](./daf-typeorm.idatastoreorm.md) | | -| [schema](./daf-typeorm.datastoreorm.schema.md) | | { components: { schemas: { FindIdentitiesArgs: { $ref: string; }; "FindArgs-TIdentitiesColumns": { type: string; properties: { where: { type: string; items: { $ref: string; }; }; order: { type: string; items: { $ref: string; }; }; take: { type: string; }; skip: { type: string; }; }; }; "Where-TIdentitiesColumns": { type: string; properties: { column: { $ref: string; }; value: { type: string; items: { type: string; }; }; not: { type: string; }; op: { type: string; enum: string\[\]; }; }; required: string\[\]; }; TIdentitiesColumns: { type: string; enum: string\[\]; }; "Order-TIdentitiesColumns": { type: string; properties: { column: { $ref: string; }; direction: { type: string; enum: string\[\]; }; }; required: string\[\]; }; IIdentity: { type: string; properties: { did: { type: string; description: string; }; alias: { type: string; description: string; }; provider: { type: string; description: string; }; controllerKeyId: { type: string; description: string; }; keys: { type: string; items: { $ref: string; }; description: string; }; services: { type: string; items: { $ref: string; }; description: string; }; }; required: string\[\]; description: string; }; IKey: { type: string; properties: { kid: { type: string; description: string; }; kms: { type: string; description: string; }; type: { $ref: string; description: string; }; publicKeyHex: { type: string; description: string; }; privateKeyHex: { type: string; description: string; }; meta: { anyOf: { type: string; }\[\]; description: string; }; }; required: string\[\]; description: string; }; TKeyType: { type: string; enum: string\[\]; description: string; }; IService: { type: string; properties: { id: { type: string; description: string; }; type: { type: string; description: string; }; serviceEndpoint: { type: string; description: string; }; description: { type: string; description: string; }; }; required: string\[\]; description: string; }; FindMessagesArgs: { $ref: string; }; "FindArgs-TMessageColumns": { type: string; properties: { where: { type: string; items: { $ref: string; }; }; order: { type: string; items: { $ref: string; }; }; take: { type: string; }; skip: { type: string; }; }; }; "Where-TMessageColumns": { type: string; properties: { column: { $ref: string; }; value: { type: string; items: { type: string; }; }; not: { type: string; }; op: { type: string; enum: string\[\]; }; }; required: string\[\]; }; TMessageColumns: { type: string; enum: string\[\]; }; "Order-TMessageColumns": { type: string; properties: { column: { $ref: string; }; direction: { type: string; enum: string\[\]; }; }; required: string\[\]; }; IMessage: { type: string; properties: { id: { type: string; description: string; }; type: { type: string; description: string; }; createdAt: { type: string; description: string; }; expiresAt: { type: string; description: string; }; threadId: { type: string; description: string; }; raw: { type: string; description: string; }; data: { anyOf: { type: string; }\[\]; description: string; }; replyTo: { type: string; items: { type: string; }; description: string; }; replyUrl: { type: string; description: string; }; from: { type: string; description: string; }; to: { type: string; description: string; }; metaData: { anyOf: ({ type: string; items: { $ref: string; }; } \| { type: string; items?: undefined; })\[\]; description: string; }; credentials: { type: string; items: { $ref: string; }; description: string; }; presentations: { type: string; items: { $ref: string; }; description: string; }; }; required: string\[\]; description: string; }; IMetaData: { type: string; properties: { type: { type: string; description: string; }; value: { type: string; description: string; }; }; required: string\[\]; description: string; }; VerifiableCredential: { type: string; properties: { "@context": { type: string; items: { type: string; }; }; id: { type: string; }; type: { type: string; items: { type: string; }; }; issuer: { type: string; properties: { id: { type: string; }; }; required: string\[\]; }; issuanceDate: { type: string; }; expirationDate: { type: string; }; credentialSubject: { type: string; properties: { id: { type: string; }; }; }; credentialStatus: { type: string; properties: { id: { type: string; }; type: { type: string; }; }; required: string\[\]; }; proof: { type: string; properties: { type: { type: string; }; }; }; }; required: string\[\]; description: string; }; VerifiablePresentation: { type: string; properties: { id: { type: string; }; holder: { type: string; }; issuanceDate: { type: string; }; expirationDate: { type: string; }; "@context": { type: string; items: { type: string; }; }; type: { type: string; items: { type: string; }; }; verifier: { type: string; items: { type: string; }; }; verifiableCredential: { type: string; items: { $ref: string; }; }; proof: { type: string; properties: { type: { type: string; }; }; }; }; required: string\[\]; description: string; }; FindCredentialsArgs: { $ref: string; }; "FindArgs-TCredentialColumns": { type: string; properties: { where: { type: string; items: { $ref: string; }; }; order: { type: string; items: { $ref: string; }; }; take: { type: string; }; skip: { type: string; }; }; }; "Where-TCredentialColumns": { type: string; properties: { column: { $ref: string; }; value: { type: string; items: { type: string; }; }; not: { type: string; }; op: { type: string; enum: string\[\]; }; }; required: string\[\]; }; TCredentialColumns: { type: string; enum: string\[\]; }; "Order-TCredentialColumns": { type: string; properties: { column: { $ref: string; }; direction: { type: string; enum: string\[\]; }; }; required: string\[\]; }; UniqueVerifiableCredential: { type: string; properties: { hash: { type: string; }; verifiableCredential: { $ref: string; }; }; required: string\[\]; }; FindClaimsArgs: { $ref: string; }; "FindArgs-TClaimsColumns": { type: string; properties: { where: { type: string; items: { $ref: string; }; }; order: { type: string; items: { $ref: string; }; }; take: { type: string; }; skip: { type: string; }; }; }; "Where-TClaimsColumns": { type: string; properties: { column: { $ref: string; }; value: { type: string; items: { type: string; }; }; not: { type: string; }; op: { type: string; enum: string\[\]; }; }; required: string\[\]; }; TClaimsColumns: { type: string; enum: string\[\]; }; "Order-TClaimsColumns": { type: string; properties: { column: { $ref: string; }; direction: { type: string; enum: string\[\]; }; }; required: string\[\]; }; FindPresentationsArgs: { $ref: string; }; "FindArgs-TPresentationColumns": { type: string; properties: { where: { type: string; items: { $ref: string; }; }; order: { type: string; items: { $ref: string; }; }; take: { type: string; }; skip: { type: string; }; }; }; "Where-TPresentationColumns": { type: string; properties: { column: { $ref: string; }; value: { type: string; items: { type: string; }; }; not: { type: string; }; op: { type: string; enum: string\[\]; }; }; required: string\[\]; }; TPresentationColumns: { type: string; enum: string\[\]; }; "Order-TPresentationColumns": { type: string; properties: { column: { $ref: string; }; direction: { type: string; enum: string\[\]; }; }; required: string\[\]; }; UniqueVerifiablePresentation: { type: string; properties: { hash: { type: string; }; verifiablePresentation: { $ref: string; }; }; required: string\[\]; }; }; methods: { dataStoreORMGetIdentities: { description: string; arguments: { $ref: string; }; returnType: { type: string; items: { $ref: string; }; }; }; dataStoreORMGetIdentitiesCount: { description: string; arguments: { $ref: string; }; returnType: { type: string; }; }; dataStoreORMGetMessages: { description: string; arguments: { $ref: string; }; returnType: { type: string; items: { $ref: string; }; }; }; dataStoreORMGetMessagesCount: { description: string; arguments: { $ref: string; }; returnType: { type: string; }; }; dataStoreORMGetVerifiableCredentials: { description: string; arguments: { $ref: string; }; returnType: { type: string; items: { $ref: string; }; }; }; dataStoreORMGetVerifiableCredentialsByClaims: { description: string; arguments: { $ref: string; }; returnType: { type: string; items: { $ref: string; }; }; }; dataStoreORMGetVerifiableCredentialsByClaimsCount: { description: string; arguments: { $ref: string; }; returnType: { type: string; }; }; dataStoreORMGetVerifiableCredentialsCount: { description: string; arguments: { $ref: string; }; returnType: { type: string; }; }; dataStoreORMGetVerifiablePresentations: { description: string; arguments: { $ref: string; }; returnType: { type: string; items: { $ref: string; }; }; }; dataStoreORMGetVerifiablePresentationsCount: { description: string; arguments: { $ref: string; }; returnType: { type: string; }; }; }; }; } | | +| [schema](./daf-typeorm.datastoreorm.schema.md) | | { components: { schemas: { FindIdentitiesArgs: { $ref: string; }; "FindArgs-TIdentitiesColumns": { type: string; properties: { where: { type: string; items: { $ref: string; }; }; order: { type: string; items: { $ref: string; }; }; take: { type: string; }; skip: { type: string; }; }; }; "Where-TIdentitiesColumns": { type: string; properties: { column: { $ref: string; }; value: { type: string; items: { type: string; }; }; not: { type: string; }; op: { type: string; enum: string\[\]; }; }; required: string\[\]; }; TIdentitiesColumns: { type: string; enum: string\[\]; }; "Order-TIdentitiesColumns": { type: string; properties: { column: { $ref: string; }; direction: { type: string; enum: string\[\]; }; }; required: string\[\]; }; PartialIdentity: { type: string; properties: { did: { type: string; description: string; }; alias: { type: string; description: string; }; provider: { type: string; description: string; }; controllerKeyId: { type: string; description: string; }; keys: { type: string; items: { $ref: string; }; description: string; }; services: { type: string; items: { $ref: string; }; description: string; }; }; }; IKey: { type: string; properties: { kid: { type: string; description: string; }; kms: { type: string; description: string; }; type: { $ref: string; description: string; }; publicKeyHex: { type: string; description: string; }; privateKeyHex: { type: string; description: string; }; meta: { anyOf: { type: string; }\[\]; description: string; }; }; required: string\[\]; description: string; }; TKeyType: { type: string; enum: string\[\]; description: string; }; IService: { type: string; properties: { id: { type: string; description: string; }; type: { type: string; description: string; }; serviceEndpoint: { type: string; description: string; }; description: { type: string; description: string; }; }; required: string\[\]; description: string; }; FindMessagesArgs: { $ref: string; }; "FindArgs-TMessageColumns": { type: string; properties: { where: { type: string; items: { $ref: string; }; }; order: { type: string; items: { $ref: string; }; }; take: { type: string; }; skip: { type: string; }; }; }; "Where-TMessageColumns": { type: string; properties: { column: { $ref: string; }; value: { type: string; items: { type: string; }; }; not: { type: string; }; op: { type: string; enum: string\[\]; }; }; required: string\[\]; }; TMessageColumns: { type: string; enum: string\[\]; }; "Order-TMessageColumns": { type: string; properties: { column: { $ref: string; }; direction: { type: string; enum: string\[\]; }; }; required: string\[\]; }; IMessage: { type: string; properties: { id: { type: string; description: string; }; type: { type: string; description: string; }; createdAt: { type: string; description: string; }; expiresAt: { type: string; description: string; }; threadId: { type: string; description: string; }; raw: { type: string; description: string; }; data: { anyOf: { type: string; }\[\]; description: string; }; replyTo: { type: string; items: { type: string; }; description: string; }; replyUrl: { type: string; description: string; }; from: { type: string; description: string; }; to: { type: string; description: string; }; metaData: { anyOf: ({ type: string; items: { $ref: string; }; } \| { type: string; items?: undefined; })\[\]; description: string; }; credentials: { type: string; items: { $ref: string; }; description: string; }; presentations: { type: string; items: { $ref: string; }; description: string; }; }; required: string\[\]; description: string; }; IMetaData: { type: string; properties: { type: { type: string; description: string; }; value: { type: string; description: string; }; }; required: string\[\]; description: string; }; VerifiableCredential: { type: string; properties: { "@context": { type: string; items: { type: string; }; }; id: { type: string; }; type: { type: string; items: { type: string; }; }; issuer: { type: string; properties: { id: { type: string; }; }; required: string\[\]; }; issuanceDate: { type: string; }; expirationDate: { type: string; }; credentialSubject: { type: string; properties: { id: { type: string; }; }; }; credentialStatus: { type: string; properties: { id: { type: string; }; type: { type: string; }; }; required: string\[\]; }; proof: { type: string; properties: { type: { type: string; }; }; }; }; required: string\[\]; description: string; }; VerifiablePresentation: { type: string; properties: { id: { type: string; }; holder: { type: string; }; issuanceDate: { type: string; }; expirationDate: { type: string; }; "@context": { type: string; items: { type: string; }; }; type: { type: string; items: { type: string; }; }; verifier: { type: string; items: { type: string; }; }; verifiableCredential: { type: string; items: { $ref: string; }; }; proof: { type: string; properties: { type: { type: string; }; }; }; }; required: string\[\]; description: string; }; FindCredentialsArgs: { $ref: string; }; "FindArgs-TCredentialColumns": { type: string; properties: { where: { type: string; items: { $ref: string; }; }; order: { type: string; items: { $ref: string; }; }; take: { type: string; }; skip: { type: string; }; }; }; "Where-TCredentialColumns": { type: string; properties: { column: { $ref: string; }; value: { type: string; items: { type: string; }; }; not: { type: string; }; op: { type: string; enum: string\[\]; }; }; required: string\[\]; }; TCredentialColumns: { type: string; enum: string\[\]; }; "Order-TCredentialColumns": { type: string; properties: { column: { $ref: string; }; direction: { type: string; enum: string\[\]; }; }; required: string\[\]; }; UniqueVerifiableCredential: { type: string; properties: { hash: { type: string; }; verifiableCredential: { $ref: string; }; }; required: string\[\]; }; FindClaimsArgs: { $ref: string; }; "FindArgs-TClaimsColumns": { type: string; properties: { where: { type: string; items: { $ref: string; }; }; order: { type: string; items: { $ref: string; }; }; take: { type: string; }; skip: { type: string; }; }; }; "Where-TClaimsColumns": { type: string; properties: { column: { $ref: string; }; value: { type: string; items: { type: string; }; }; not: { type: string; }; op: { type: string; enum: string\[\]; }; }; required: string\[\]; }; TClaimsColumns: { type: string; enum: string\[\]; }; "Order-TClaimsColumns": { type: string; properties: { column: { $ref: string; }; direction: { type: string; enum: string\[\]; }; }; required: string\[\]; }; FindPresentationsArgs: { $ref: string; }; "FindArgs-TPresentationColumns": { type: string; properties: { where: { type: string; items: { $ref: string; }; }; order: { type: string; items: { $ref: string; }; }; take: { type: string; }; skip: { type: string; }; }; }; "Where-TPresentationColumns": { type: string; properties: { column: { $ref: string; }; value: { type: string; items: { type: string; }; }; not: { type: string; }; op: { type: string; enum: string\[\]; }; }; required: string\[\]; }; TPresentationColumns: { type: string; enum: string\[\]; }; "Order-TPresentationColumns": { type: string; properties: { column: { $ref: string; }; direction: { type: string; enum: string\[\]; }; }; required: string\[\]; }; UniqueVerifiablePresentation: { type: string; properties: { hash: { type: string; }; verifiablePresentation: { $ref: string; }; }; required: string\[\]; }; }; methods: { dataStoreORMGetIdentities: { description: string; arguments: { $ref: string; }; returnType: { type: string; items: { $ref: string; }; }; }; dataStoreORMGetIdentitiesCount: { description: string; arguments: { $ref: string; }; returnType: { type: string; }; }; dataStoreORMGetMessages: { description: string; arguments: { $ref: string; }; returnType: { type: string; items: { $ref: string; }; }; }; dataStoreORMGetMessagesCount: { description: string; arguments: { $ref: string; }; returnType: { type: string; }; }; dataStoreORMGetVerifiableCredentials: { description: string; arguments: { $ref: string; }; returnType: { type: string; items: { $ref: string; }; }; }; dataStoreORMGetVerifiableCredentialsByClaims: { description: string; arguments: { $ref: string; }; returnType: { type: string; items: { $ref: string; }; }; }; dataStoreORMGetVerifiableCredentialsByClaimsCount: { description: string; arguments: { $ref: string; }; returnType: { type: string; }; }; dataStoreORMGetVerifiableCredentialsCount: { description: string; arguments: { $ref: string; }; returnType: { type: string; }; }; dataStoreORMGetVerifiablePresentations: { description: string; arguments: { $ref: string; }; returnType: { type: string; items: { $ref: string; }; }; }; dataStoreORMGetVerifiablePresentationsCount: { description: string; arguments: { $ref: string; }; returnType: { type: string; }; }; }; }; } | | ## Methods diff --git a/docs/api/daf-typeorm.datastoreorm.schema.md b/docs/api/daf-typeorm.datastoreorm.schema.md index 30b1e7299..fad51d201 100644 --- a/docs/api/daf-typeorm.datastoreorm.schema.md +++ b/docs/api/daf-typeorm.datastoreorm.schema.md @@ -75,7 +75,7 @@ readonly schema: { }; required: string[]; }; - IIdentity: { + PartialIdentity: { type: string; properties: { did: { @@ -109,8 +109,6 @@ readonly schema: { description: string; }; }; - required: string[]; - description: string; }; IKey: { type: string; diff --git a/docs/api/index.md b/docs/api/index.md index 3c28bbf09..cd68bceb8 100644 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -19,7 +19,7 @@ | [daf-message-handler](./daf-message-handler.md) | Provides a [plugin](./daf-message-handler.messagehandler.md) for the [Agent](./daf-core.agent.md) that implements [IMessageHandler](./daf-core.imessagehandler.md) interface | | [daf-resolver](./daf-resolver.md) | Provides a [plugin](./daf-resolver.dafresolver.md) for the [Agent](./daf-core.agent.md) that implements [IResolver](./daf-core.iresolver.md) interface | | [daf-resolver-universal](./daf-resolver-universal.md) | Provides a [plugin](./daf-resolver-universal.dafuniversalresolver.md) for the [Agent](./daf-core.agent.md) that implements [IResolver](./daf-core.iresolver.md) interface. Uses external "universal" resolver | -| [daf-rest](./daf-rest.md) | Provides a [plugin](./daf-rest.agentrestclient.md) for the [Agent](./daf-core.agent.md) that can proxy method execution over HTTPS using | +| [daf-rest](./daf-rest.md) | Provides a [plugin](./daf-rest.agentrestclient.md) for the [Agent](./daf-core.agent.md) that can proxy method execution over HTTPS | | [daf-selective-disclosure](./daf-selective-disclosure.md) | Provides a [plugin](./daf-selective-disclosure.iselectivedisclosure.md) for the [Agent](./daf-core.agent.md) that implements [SelectiveDisclosure](./daf-selective-disclosure.selectivedisclosure.md) interface. Provides a [plugin](./daf-selective-disclosure.sdrmessagehandler.md) for the [MessageHandler](./daf-message-handler.messagehandler.md) that detects Selective Disclosure Request in a message | | [daf-typeorm](./daf-typeorm.md) | [TypeORM](https://typeorm.io/) backed plugins. [Agent](./daf-core.agent.md) [plugin](./daf-typeorm.datastore.md) that implements [IDataStore](./daf-core.idatastore.md) interface. [Agent](./daf-core.agent.md) [plugin](./daf-typeorm.datastoreorm.md) that implements [IDataStoreORM](./daf-typeorm.idatastoreorm.md) interface. Provides [KeyStore](./daf-typeorm.keystore.md) for [KeyManager](./daf-key-manager.keymanager.md) and [IdentityStore](./daf-typeorm.identitystore.md) for [IdentityManager](./daf-identity-manager.identitymanager.md) | | [daf-url](./daf-url.md) | Provides a [plugin](./daf-url.urlmessagehandler.md) for the [MessageHandler](./daf-message-handler.messagehandler.md) that finds a standard URL in a raw message | diff --git a/packages/daf-cli/default/config.yml b/packages/daf-cli/default/config.yml index 492ba7733..512232eee 100644 --- a/packages/daf-cli/default/config.yml +++ b/packages/daf-cli/default/config.yml @@ -1,3 +1,22 @@ +server: + hostname: localhost + port: 3332 + schemaPath: /open-api.json + apiBasePath: /agent + apiDocsPath: /api-docs + defaultIdentity: + create: true + messagingServiceEndpoint: /messaging + publicProfileServiceEndpoint: /public-profile + publicName: Alice + publicPicture: https://picsum.photos/200 + ngrok: + connect: true + # subdomain: alice-did + # region: eu + # exposedMethods: + # - resolveDid + # - dataStoreORMGetIdentities constants: secretKey: 29739248cad1bd1a0fc4d9b75cd4d2990de535baf5caadfdf8d8f86664aa830c databaseFile: ./database.sqlite diff --git a/packages/daf-cli/src/server.ts b/packages/daf-cli/src/server.ts index a5f06d920..44f9cee89 100644 --- a/packages/daf-cli/src/server.ts +++ b/packages/daf-cli/src/server.ts @@ -5,55 +5,32 @@ import parse from 'url-parse' import { AgentRouter } from 'daf-express' import { getOpenApiSchema } from 'daf-rest' import swaggerUi from "swagger-ui-express"; -import { getAgent } from './setup' +import { getAgent, getConfig } from './setup' program .command('server') .description('Launch OpenAPI server') - .option('--port ', 'Port', '3332') - .option('--hostname ', 'Server hostname', 'localhost') - .option('--ngrok', 'Open ngrok tunnel') - .option('--ngrokSubdomain ', 'ngrok subdomain') - .option('--ngrokRegion ', 'ngrok region') - .option('--createDefaultIdentity ', 'Should the agent create default web did', true) - .option('--messagingServiceEndpoint ', 'Path of the messaging service endpoint', '/messaging') - .option( - '--publicProfileServiceEndpoint ', - 'Path of the public profile service endpoint', - '/public-profile', - ) - .option('--publicName ', 'Public name', 'Service') - .option('--publicPicture ', 'Public picture', 'https://picsum.photos/200') - .option( - '--exposedMethods ', - 'Comma separated list of exposed agent methods (example: "resolveDid,handleMessage")', - ) - .action(async (options) => { + .action(async () => { const app = express() const agent = getAgent(program.config) + const { server: options } = getConfig(program.config) const exposedMethods = options.exposedMethods - ? options.exposedMethods.split(',') + ? options.exposedMethods : agent.availableMethods() - const basePath = '/agent' + const apiBasePath = options.apiBasePath const agentRouter = AgentRouter({ - basePath, + basePath: apiBasePath, getAgentForRequest: async (req) => agent, exposedMethods, serveSchema: true, }) - app.use(basePath, agentRouter) + app.use(apiBasePath, agentRouter) + - app.use( - "/api-docs", - swaggerUi.serve, - swaggerUi.setup( - getOpenApiSchema(agent, basePath, exposedMethods) - ) - ); app.listen(options.port, async () => { console.log(`🚀 Agent server ready at http://localhost:${options.port}`) @@ -64,23 +41,40 @@ program let baseUrl = 'http://' + hostname + ':' + options.port - if (options.ngrok) { + if (options.ngrok?.connect) { baseUrl = await ngrok.connect({ addr: options.port, - subdomain: options.ngrokSubdomain, - region: options.ngrokRegion, + subdomain: options.ngrok.subdomain, + region: options.ngrok.region, }) hostname = parse(baseUrl).hostname } - if (options.createDefaultIdentity) { + const openApiSchema = getOpenApiSchema(agent, apiBasePath, exposedMethods) + openApiSchema.servers = [ + { url: baseUrl } + ] + + app.use( + options.apiDocsPath, + swaggerUi.serve, + swaggerUi.setup(openApiSchema) + ) + console.log('📖 API Documentation', baseUrl + options.apiDocsPath) + + app.get(options.schemaPath, (req, res) => { res.json(openApiSchema) }) + + + console.log('🗺 OpenAPI schema', baseUrl + options.schemaPath) + + if (options.defaultIdentity.create) { let serverIdentity = await agent.identityManagerGetOrCreateIdentity({ provider: 'did:web', alias: hostname, }) console.log('🆔', serverIdentity.did) - const messagingServiceEndpoint = 'https://' + hostname + options.messagingServiceEndpoint + const messagingServiceEndpoint = baseUrl + options.defaultIdentity.messagingServiceEndpoint await agent.identityManagerAddService({ did: serverIdentity.did, @@ -93,7 +87,7 @@ program }) console.log('📨 Messaging endpoint', messagingServiceEndpoint) - app.post(options.messagingServiceEndpoint, express.text({ type: '*/*' }), async (req, res) => { + app.post(options.defaultIdentity.messagingServiceEndpoint, express.text({ type: '*/*' }), async (req, res) => { try { const message = await agent.handleMessage({ raw: req.body, save: true }) console.log('Received message', message.type, message.id) @@ -104,7 +98,7 @@ program } }) - const publicProfileServiceEndpoint = 'https://' + hostname + options.publicProfileServiceEndpoint + const publicProfileServiceEndpoint = baseUrl + options.defaultIdentity.publicProfileServiceEndpoint await agent.identityManagerAddService({ did: serverIdentity.did, @@ -117,7 +111,7 @@ program }) console.log('🌍 Public Profile', publicProfileServiceEndpoint) - app.get(options.publicProfileServiceEndpoint, async (req, res) => { + app.get(options.defaultIdentity.publicProfileServiceEndpoint, async (req, res) => { try { const nameCredential = await agent.createVerifiableCredential({ credential: { @@ -127,7 +121,7 @@ program issuanceDate: new Date().toISOString(), credentialSubject: { id: serverIdentity.did, - name: options.publicName, + name: options.defaultIdentity.publicName, }, }, proofFormat: 'jwt', @@ -141,7 +135,7 @@ program issuanceDate: new Date().toISOString(), credentialSubject: { id: serverIdentity.did, - picture: options.publicPicture, + picture: options.defaultIdentity.publicPicture, }, }, proofFormat: 'jwt', @@ -195,6 +189,16 @@ program res.json(didDoc) }) console.log('📋 DID Document ' + baseUrl + didDocEndpoint) + + app.get('/', (req, res) => { + const links = [ + { label: "API Docs", url: options.apiDocsPath}, + { label: "API Schema", url: options.apiBasePath}, + ] + + const html = `DID Agent${links.map(l=>`${l.label}`).join('
')}` + res.send(html) + }) } }) }) diff --git a/packages/daf-cli/src/setup.ts b/packages/daf-cli/src/setup.ts index 60b19218d..1f6fb6232 100644 --- a/packages/daf-cli/src/setup.ts +++ b/packages/daf-cli/src/setup.ts @@ -7,13 +7,13 @@ import { ISelectiveDisclosure } from 'daf-selective-disclosure' import { IDIDComm } from 'daf-did-comm' import { IDataStoreORM } from 'daf-typeorm' const fs = require('fs') -const { dirname } = require('path') +const { dirname, resolve } = require('path') import { createAgentFromConfig } from './lib/agentCreator' -const defaultConfig = process.env.HOME + '/.daf/config.yml' +const defaultConfig = './agent.yml' program.option('--config ', 'Configuration file', defaultConfig) -const getConfig = (fileName: string): object => { +export const getConfig = (fileName: string): any => { if (!fs.existsSync(dirname(fileName))) { fs.mkdirSync(dirname(fileName)) } diff --git a/packages/daf-core/src/agent.ts b/packages/daf-core/src/agent.ts index c0aac25af..527e6562d 100644 --- a/packages/daf-core/src/agent.ts +++ b/packages/daf-core/src/agent.ts @@ -1,5 +1,6 @@ import { IAgent, IPluginMethodMap, IAgentPlugin, TAgent, IAgentPluginSchema } from './types/IAgent' import { validateArguments, validateReturnType } from './validator' +import ValidationErrorSchema from './schemas/ValidationError' import Debug from 'debug' /** @@ -97,7 +98,9 @@ export class Agent implements IAgent { this.schema = { components: { - schemas: {}, + schemas: { + ...ValidationErrorSchema.components.schemas + }, methods: {} } } diff --git a/packages/daf-core/src/schemas/ValidationError.ts b/packages/daf-core/src/schemas/ValidationError.ts new file mode 100644 index 000000000..f346670e9 --- /dev/null +++ b/packages/daf-core/src/schemas/ValidationError.ts @@ -0,0 +1,39 @@ +export default { + "components": { + "schemas": { + "ValidationError": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Error name" + }, + "method": { + "type": "string", + "description": "Method" + }, + "message": { + "type": "string", + "description": "Error message" + }, + "path": { + "type": "string", + "description": "Error path" + }, + "code": { + "type": "string", + "description": "Error code" + }, + "description": { + "type": "string", + "description": "Error description" + }, + }, + "required": [ + "didUrl" + ], + "description": "Agent method arguments validation error" + } + } + } +} \ No newline at end of file diff --git a/packages/daf-express/src/index.ts b/packages/daf-express/src/index.ts index b7e4d85fe..14b7ad9d3 100644 --- a/packages/daf-express/src/index.ts +++ b/packages/daf-express/src/index.ts @@ -82,6 +82,7 @@ export const AgentRouter = (options: AgentRouterOptions): Router => { res.status(400).json({ name: 'ValidationError', message: e.message, + method: e.method, path: e.path, code: e.code, description: e.description diff --git a/packages/daf-rest/api/daf-rest.api.json b/packages/daf-rest/api/daf-rest.api.json index 76c506423..2967feb87 100644 --- a/packages/daf-rest/api/daf-rest.api.json +++ b/packages/daf-rest/api/daf-rest.api.json @@ -7,7 +7,7 @@ }, "kind": "Package", "canonicalReference": "daf-rest!", - "docComment": "/**\n * Provides a {@link daf-rest#AgentRestClient | plugin} for the {@link daf-core#Agent} that can proxy method execution over HTTPS using {@link daf-rest#openApiSchema | OpenAPI}\n *\n * @packageDocumentation\n */\n", + "docComment": "/**\n * Provides a {@link daf-rest#AgentRestClient | plugin} for the {@link daf-core#Agent} that can proxy method execution over HTTPS\n *\n * @packageDocumentation\n */\n", "name": "daf-rest", "members": [ { diff --git a/packages/daf-rest/src/index.ts b/packages/daf-rest/src/index.ts index 7827e2a01..2ab167112 100644 --- a/packages/daf-rest/src/index.ts +++ b/packages/daf-rest/src/index.ts @@ -1,58 +1,7 @@ /** - * Provides a {@link daf-rest#AgentRestClient | plugin} for the {@link daf-core#Agent} that can proxy method execution over HTTPS using {@link daf-rest#openApiSchema | OpenAPI} + * Provides a {@link daf-rest#AgentRestClient | plugin} for the {@link daf-core#Agent} that can proxy method execution over HTTPS * * @packageDocumentation */ -import { IAgent } from 'daf-core' -import { OpenAPIV3 } from 'openapi-types' export { AgentRestClient } from './client' - -export const getOpenApiSchema = (agent: IAgent, basePath: string, exposedMethods: Array): OpenAPIV3.Document => { - const agentSchema = agent.getSchema() - - const paths: OpenAPIV3.PathsObject = {} - - const schemas = {} - - for (const method of exposedMethods) { - const pathItemObject: OpenAPIV3.PathItemObject = { - post: { - operationId: method, - description: agentSchema.components.methods[method].description, - requestBody: { - content: { - 'application/json': { - schema: agentSchema.components.methods[method].arguments - } - } - }, - responses: { - 200: { - // TODO returnType description - description: agentSchema.components.methods[method].description, - content: { - 'application/json': { - schema: agentSchema.components.methods[method].returnType - } - } - } - } - } - } - paths[basePath + '/' + method] = pathItemObject - } - - const openApi: OpenAPIV3.Document = { - openapi: "3.0.0", - info: { - title: "DAF OpenAPI", - version: "" - }, - components:{ - schemas: agent.getSchema().components.schemas - }, - paths - } - - return openApi -} +export { getOpenApiSchema } from './openApi' \ No newline at end of file diff --git a/packages/daf-rest/src/openApi.ts b/packages/daf-rest/src/openApi.ts new file mode 100644 index 000000000..56c230004 --- /dev/null +++ b/packages/daf-rest/src/openApi.ts @@ -0,0 +1,60 @@ +import { OpenAPIV3 } from 'openapi-types' +import { IAgent } from 'daf-core' + +export const getOpenApiSchema = (agent: IAgent, basePath: string, exposedMethods: Array): OpenAPIV3.Document => { + const agentSchema = agent.getSchema() + + const paths: OpenAPIV3.PathsObject = {} + + const schemas = {} + + for (const method of exposedMethods) { + const pathItemObject: OpenAPIV3.PathItemObject = { + post: { + operationId: method, + description: agentSchema.components.methods[method].description, + requestBody: { + content: { + 'application/json': { + schema: agentSchema.components.methods[method].arguments + } + } + }, + responses: { + 200: { + // TODO returnType description + description: agentSchema.components.methods[method].description, + content: { + 'application/json; charset=utf-8': { + schema: agentSchema.components.methods[method].returnType + } + } + }, + 400: { + description: "Validation error", + content: { + 'application/json; charset=utf-8': { + schema: agentSchema.components.schemas.ValidationError + } + } + } + } + } + } + paths[basePath + '/' + method] = pathItemObject + } + + const openApi: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { + title: "DID Agent", + version: "" + }, + components:{ + schemas: agent.getSchema().components.schemas + }, + paths + } + + return openApi +} diff --git a/packages/daf-typeorm/api/daf-typeorm.api.json b/packages/daf-typeorm/api/daf-typeorm.api.json index 766db1a83..c7ceb2758 100644 --- a/packages/daf-typeorm/api/daf-typeorm.api.json +++ b/packages/daf-typeorm/api/daf-typeorm.api.json @@ -2129,7 +2129,7 @@ }, { "kind": "Content", - "text": "{\n components: {\n schemas: {\n FindIdentitiesArgs: {\n $ref: string;\n };\n \"FindArgs-TIdentitiesColumns\": {\n type: string;\n properties: {\n where: {\n type: string;\n items: {\n $ref: string;\n };\n };\n order: {\n type: string;\n items: {\n $ref: string;\n };\n };\n take: {\n type: string;\n };\n skip: {\n type: string;\n };\n };\n };\n \"Where-TIdentitiesColumns\": {\n type: string;\n properties: {\n column: {\n $ref: string;\n };\n value: {\n type: string;\n items: {\n type: string;\n };\n };\n not: {\n type: string;\n };\n op: {\n type: string;\n enum: string[];\n };\n };\n required: string[];\n };\n TIdentitiesColumns: {\n type: string;\n enum: string[];\n };\n \"Order-TIdentitiesColumns\": {\n type: string;\n properties: {\n column: {\n $ref: string;\n };\n direction: {\n type: string;\n enum: string[];\n };\n };\n required: string[];\n };\n IIdentity: {\n type: string;\n properties: {\n did: {\n type: string;\n description: string;\n };\n alias: {\n type: string;\n description: string;\n };\n provider: {\n type: string;\n description: string;\n };\n controllerKeyId: {\n type: string;\n description: string;\n };\n keys: {\n type: string;\n items: {\n $ref: string;\n };\n description: string;\n };\n services: {\n type: string;\n items: {\n $ref: string;\n };\n description: string;\n };\n };\n required: string[];\n description: string;\n };\n IKey: {\n type: string;\n properties: {\n kid: {\n type: string;\n description: string;\n };\n kms: {\n type: string;\n description: string;\n };\n type: {\n $ref: string;\n description: string;\n };\n publicKeyHex: {\n type: string;\n description: string;\n };\n privateKeyHex: {\n type: string;\n description: string;\n };\n meta: {\n anyOf: {\n type: string;\n }[];\n description: string;\n };\n };\n required: string[];\n description: string;\n };\n TKeyType: {\n type: string;\n enum: string[];\n description: string;\n };\n IService: {\n type: string;\n properties: {\n id: {\n type: string;\n description: string;\n };\n type: {\n type: string;\n description: string;\n };\n serviceEndpoint: {\n type: string;\n description: string;\n };\n description: {\n type: string;\n description: string;\n };\n };\n required: string[];\n description: string;\n };\n FindMessagesArgs: {\n $ref: string;\n };\n \"FindArgs-TMessageColumns\": {\n type: string;\n properties: {\n where: {\n type: string;\n items: {\n $ref: string;\n };\n };\n order: {\n type: string;\n items: {\n $ref: string;\n };\n };\n take: {\n type: string;\n };\n skip: {\n type: string;\n };\n };\n };\n \"Where-TMessageColumns\": {\n type: string;\n properties: {\n column: {\n $ref: string;\n };\n value: {\n type: string;\n items: {\n type: string;\n };\n };\n not: {\n type: string;\n };\n op: {\n type: string;\n enum: string[];\n };\n };\n required: string[];\n };\n TMessageColumns: {\n type: string;\n enum: string[];\n };\n \"Order-TMessageColumns\": {\n type: string;\n properties: {\n column: {\n $ref: string;\n };\n direction: {\n type: string;\n enum: string[];\n };\n };\n required: string[];\n };\n IMessage: {\n type: string;\n properties: {\n id: {\n type: string;\n description: string;\n };\n type: {\n type: string;\n description: string;\n };\n createdAt: {\n type: string;\n description: string;\n };\n expiresAt: {\n type: string;\n description: string;\n };\n threadId: {\n type: string;\n description: string;\n };\n raw: {\n type: string;\n description: string;\n };\n data: {\n anyOf: {\n type: string;\n }[];\n description: string;\n };\n replyTo: {\n type: string;\n items: {\n type: string;\n };\n description: string;\n };\n replyUrl: {\n type: string;\n description: string;\n };\n from: {\n type: string;\n description: string;\n };\n to: {\n type: string;\n description: string;\n };\n metaData: {\n anyOf: ({\n type: string;\n items: {\n $ref: string;\n };\n } | {\n type: string;\n items?: undefined;\n })[];\n description: string;\n };\n credentials: {\n type: string;\n items: {\n $ref: string;\n };\n description: string;\n };\n presentations: {\n type: string;\n items: {\n $ref: string;\n };\n description: string;\n };\n };\n required: string[];\n description: string;\n };\n IMetaData: {\n type: string;\n properties: {\n type: {\n type: string;\n description: string;\n };\n value: {\n type: string;\n description: string;\n };\n };\n required: string[];\n description: string;\n };\n VerifiableCredential: {\n type: string;\n properties: {\n \"@context\": {\n type: string;\n items: {\n type: string;\n };\n };\n id: {\n type: string;\n };\n type: {\n type: string;\n items: {\n type: string;\n };\n };\n issuer: {\n type: string;\n properties: {\n id: {\n type: string;\n };\n };\n required: string[];\n };\n issuanceDate: {\n type: string;\n };\n expirationDate: {\n type: string;\n };\n credentialSubject: {\n type: string;\n properties: {\n id: {\n type: string;\n };\n };\n };\n credentialStatus: {\n type: string;\n properties: {\n id: {\n type: string;\n };\n type: {\n type: string;\n };\n };\n required: string[];\n };\n proof: {\n type: string;\n properties: {\n type: {\n type: string;\n };\n };\n };\n };\n required: string[];\n description: string;\n };\n VerifiablePresentation: {\n type: string;\n properties: {\n id: {\n type: string;\n };\n holder: {\n type: string;\n };\n issuanceDate: {\n type: string;\n };\n expirationDate: {\n type: string;\n };\n \"@context\": {\n type: string;\n items: {\n type: string;\n };\n };\n type: {\n type: string;\n items: {\n type: string;\n };\n };\n verifier: {\n type: string;\n items: {\n type: string;\n };\n };\n verifiableCredential: {\n type: string;\n items: {\n $ref: string;\n };\n };\n proof: {\n type: string;\n properties: {\n type: {\n type: string;\n };\n };\n };\n };\n required: string[];\n description: string;\n };\n FindCredentialsArgs: {\n $ref: string;\n };\n \"FindArgs-TCredentialColumns\": {\n type: string;\n properties: {\n where: {\n type: string;\n items: {\n $ref: string;\n };\n };\n order: {\n type: string;\n items: {\n $ref: string;\n };\n };\n take: {\n type: string;\n };\n skip: {\n type: string;\n };\n };\n };\n \"Where-TCredentialColumns\": {\n type: string;\n properties: {\n column: {\n $ref: string;\n };\n value: {\n type: string;\n items: {\n type: string;\n };\n };\n not: {\n type: string;\n };\n op: {\n type: string;\n enum: string[];\n };\n };\n required: string[];\n };\n TCredentialColumns: {\n type: string;\n enum: string[];\n };\n \"Order-TCredentialColumns\": {\n type: string;\n properties: {\n column: {\n $ref: string;\n };\n direction: {\n type: string;\n enum: string[];\n };\n };\n required: string[];\n };\n UniqueVerifiableCredential: {\n type: string;\n properties: {\n hash: {\n type: string;\n };\n verifiableCredential: {\n $ref: string;\n };\n };\n required: string[];\n };\n FindClaimsArgs: {\n $ref: string;\n };\n \"FindArgs-TClaimsColumns\": {\n type: string;\n properties: {\n where: {\n type: string;\n items: {\n $ref: string;\n };\n };\n order: {\n type: string;\n items: {\n $ref: string;\n };\n };\n take: {\n type: string;\n };\n skip: {\n type: string;\n };\n };\n };\n \"Where-TClaimsColumns\": {\n type: string;\n properties: {\n column: {\n $ref: string;\n };\n value: {\n type: string;\n items: {\n type: string;\n };\n };\n not: {\n type: string;\n };\n op: {\n type: string;\n enum: string[];\n };\n };\n required: string[];\n };\n TClaimsColumns: {\n type: string;\n enum: string[];\n };\n \"Order-TClaimsColumns\": {\n type: string;\n properties: {\n column: {\n $ref: string;\n };\n direction: {\n type: string;\n enum: string[];\n };\n };\n required: string[];\n };\n FindPresentationsArgs: {\n $ref: string;\n };\n \"FindArgs-TPresentationColumns\": {\n type: string;\n properties: {\n where: {\n type: string;\n items: {\n $ref: string;\n };\n };\n order: {\n type: string;\n items: {\n $ref: string;\n };\n };\n take: {\n type: string;\n };\n skip: {\n type: string;\n };\n };\n };\n \"Where-TPresentationColumns\": {\n type: string;\n properties: {\n column: {\n $ref: string;\n };\n value: {\n type: string;\n items: {\n type: string;\n };\n };\n not: {\n type: string;\n };\n op: {\n type: string;\n enum: string[];\n };\n };\n required: string[];\n };\n TPresentationColumns: {\n type: string;\n enum: string[];\n };\n \"Order-TPresentationColumns\": {\n type: string;\n properties: {\n column: {\n $ref: string;\n };\n direction: {\n type: string;\n enum: string[];\n };\n };\n required: string[];\n };\n UniqueVerifiablePresentation: {\n type: string;\n properties: {\n hash: {\n type: string;\n };\n verifiablePresentation: {\n $ref: string;\n };\n };\n required: string[];\n };\n };\n methods: {\n dataStoreORMGetIdentities: {\n description: string;\n arguments: {\n $ref: string;\n };\n returnType: {\n type: string;\n items: {\n $ref: string;\n };\n };\n };\n dataStoreORMGetIdentitiesCount: {\n description: string;\n arguments: {\n $ref: string;\n };\n returnType: {\n type: string;\n };\n };\n dataStoreORMGetMessages: {\n description: string;\n arguments: {\n $ref: string;\n };\n returnType: {\n type: string;\n items: {\n $ref: string;\n };\n };\n };\n dataStoreORMGetMessagesCount: {\n description: string;\n arguments: {\n $ref: string;\n };\n returnType: {\n type: string;\n };\n };\n dataStoreORMGetVerifiableCredentials: {\n description: string;\n arguments: {\n $ref: string;\n };\n returnType: {\n type: string;\n items: {\n $ref: string;\n };\n };\n };\n dataStoreORMGetVerifiableCredentialsByClaims: {\n description: string;\n arguments: {\n $ref: string;\n };\n returnType: {\n type: string;\n items: {\n $ref: string;\n };\n };\n };\n dataStoreORMGetVerifiableCredentialsByClaimsCount: {\n description: string;\n arguments: {\n $ref: string;\n };\n returnType: {\n type: string;\n };\n };\n dataStoreORMGetVerifiableCredentialsCount: {\n description: string;\n arguments: {\n $ref: string;\n };\n returnType: {\n type: string;\n };\n };\n dataStoreORMGetVerifiablePresentations: {\n description: string;\n arguments: {\n $ref: string;\n };\n returnType: {\n type: string;\n items: {\n $ref: string;\n };\n };\n };\n dataStoreORMGetVerifiablePresentationsCount: {\n description: string;\n arguments: {\n $ref: string;\n };\n returnType: {\n type: string;\n };\n };\n };\n };\n }" + "text": "{\n components: {\n schemas: {\n FindIdentitiesArgs: {\n $ref: string;\n };\n \"FindArgs-TIdentitiesColumns\": {\n type: string;\n properties: {\n where: {\n type: string;\n items: {\n $ref: string;\n };\n };\n order: {\n type: string;\n items: {\n $ref: string;\n };\n };\n take: {\n type: string;\n };\n skip: {\n type: string;\n };\n };\n };\n \"Where-TIdentitiesColumns\": {\n type: string;\n properties: {\n column: {\n $ref: string;\n };\n value: {\n type: string;\n items: {\n type: string;\n };\n };\n not: {\n type: string;\n };\n op: {\n type: string;\n enum: string[];\n };\n };\n required: string[];\n };\n TIdentitiesColumns: {\n type: string;\n enum: string[];\n };\n \"Order-TIdentitiesColumns\": {\n type: string;\n properties: {\n column: {\n $ref: string;\n };\n direction: {\n type: string;\n enum: string[];\n };\n };\n required: string[];\n };\n PartialIdentity: {\n type: string;\n properties: {\n did: {\n type: string;\n description: string;\n };\n alias: {\n type: string;\n description: string;\n };\n provider: {\n type: string;\n description: string;\n };\n controllerKeyId: {\n type: string;\n description: string;\n };\n keys: {\n type: string;\n items: {\n $ref: string;\n };\n description: string;\n };\n services: {\n type: string;\n items: {\n $ref: string;\n };\n description: string;\n };\n };\n };\n IKey: {\n type: string;\n properties: {\n kid: {\n type: string;\n description: string;\n };\n kms: {\n type: string;\n description: string;\n };\n type: {\n $ref: string;\n description: string;\n };\n publicKeyHex: {\n type: string;\n description: string;\n };\n privateKeyHex: {\n type: string;\n description: string;\n };\n meta: {\n anyOf: {\n type: string;\n }[];\n description: string;\n };\n };\n required: string[];\n description: string;\n };\n TKeyType: {\n type: string;\n enum: string[];\n description: string;\n };\n IService: {\n type: string;\n properties: {\n id: {\n type: string;\n description: string;\n };\n type: {\n type: string;\n description: string;\n };\n serviceEndpoint: {\n type: string;\n description: string;\n };\n description: {\n type: string;\n description: string;\n };\n };\n required: string[];\n description: string;\n };\n FindMessagesArgs: {\n $ref: string;\n };\n \"FindArgs-TMessageColumns\": {\n type: string;\n properties: {\n where: {\n type: string;\n items: {\n $ref: string;\n };\n };\n order: {\n type: string;\n items: {\n $ref: string;\n };\n };\n take: {\n type: string;\n };\n skip: {\n type: string;\n };\n };\n };\n \"Where-TMessageColumns\": {\n type: string;\n properties: {\n column: {\n $ref: string;\n };\n value: {\n type: string;\n items: {\n type: string;\n };\n };\n not: {\n type: string;\n };\n op: {\n type: string;\n enum: string[];\n };\n };\n required: string[];\n };\n TMessageColumns: {\n type: string;\n enum: string[];\n };\n \"Order-TMessageColumns\": {\n type: string;\n properties: {\n column: {\n $ref: string;\n };\n direction: {\n type: string;\n enum: string[];\n };\n };\n required: string[];\n };\n IMessage: {\n type: string;\n properties: {\n id: {\n type: string;\n description: string;\n };\n type: {\n type: string;\n description: string;\n };\n createdAt: {\n type: string;\n description: string;\n };\n expiresAt: {\n type: string;\n description: string;\n };\n threadId: {\n type: string;\n description: string;\n };\n raw: {\n type: string;\n description: string;\n };\n data: {\n anyOf: {\n type: string;\n }[];\n description: string;\n };\n replyTo: {\n type: string;\n items: {\n type: string;\n };\n description: string;\n };\n replyUrl: {\n type: string;\n description: string;\n };\n from: {\n type: string;\n description: string;\n };\n to: {\n type: string;\n description: string;\n };\n metaData: {\n anyOf: ({\n type: string;\n items: {\n $ref: string;\n };\n } | {\n type: string;\n items?: undefined;\n })[];\n description: string;\n };\n credentials: {\n type: string;\n items: {\n $ref: string;\n };\n description: string;\n };\n presentations: {\n type: string;\n items: {\n $ref: string;\n };\n description: string;\n };\n };\n required: string[];\n description: string;\n };\n IMetaData: {\n type: string;\n properties: {\n type: {\n type: string;\n description: string;\n };\n value: {\n type: string;\n description: string;\n };\n };\n required: string[];\n description: string;\n };\n VerifiableCredential: {\n type: string;\n properties: {\n \"@context\": {\n type: string;\n items: {\n type: string;\n };\n };\n id: {\n type: string;\n };\n type: {\n type: string;\n items: {\n type: string;\n };\n };\n issuer: {\n type: string;\n properties: {\n id: {\n type: string;\n };\n };\n required: string[];\n };\n issuanceDate: {\n type: string;\n };\n expirationDate: {\n type: string;\n };\n credentialSubject: {\n type: string;\n properties: {\n id: {\n type: string;\n };\n };\n };\n credentialStatus: {\n type: string;\n properties: {\n id: {\n type: string;\n };\n type: {\n type: string;\n };\n };\n required: string[];\n };\n proof: {\n type: string;\n properties: {\n type: {\n type: string;\n };\n };\n };\n };\n required: string[];\n description: string;\n };\n VerifiablePresentation: {\n type: string;\n properties: {\n id: {\n type: string;\n };\n holder: {\n type: string;\n };\n issuanceDate: {\n type: string;\n };\n expirationDate: {\n type: string;\n };\n \"@context\": {\n type: string;\n items: {\n type: string;\n };\n };\n type: {\n type: string;\n items: {\n type: string;\n };\n };\n verifier: {\n type: string;\n items: {\n type: string;\n };\n };\n verifiableCredential: {\n type: string;\n items: {\n $ref: string;\n };\n };\n proof: {\n type: string;\n properties: {\n type: {\n type: string;\n };\n };\n };\n };\n required: string[];\n description: string;\n };\n FindCredentialsArgs: {\n $ref: string;\n };\n \"FindArgs-TCredentialColumns\": {\n type: string;\n properties: {\n where: {\n type: string;\n items: {\n $ref: string;\n };\n };\n order: {\n type: string;\n items: {\n $ref: string;\n };\n };\n take: {\n type: string;\n };\n skip: {\n type: string;\n };\n };\n };\n \"Where-TCredentialColumns\": {\n type: string;\n properties: {\n column: {\n $ref: string;\n };\n value: {\n type: string;\n items: {\n type: string;\n };\n };\n not: {\n type: string;\n };\n op: {\n type: string;\n enum: string[];\n };\n };\n required: string[];\n };\n TCredentialColumns: {\n type: string;\n enum: string[];\n };\n \"Order-TCredentialColumns\": {\n type: string;\n properties: {\n column: {\n $ref: string;\n };\n direction: {\n type: string;\n enum: string[];\n };\n };\n required: string[];\n };\n UniqueVerifiableCredential: {\n type: string;\n properties: {\n hash: {\n type: string;\n };\n verifiableCredential: {\n $ref: string;\n };\n };\n required: string[];\n };\n FindClaimsArgs: {\n $ref: string;\n };\n \"FindArgs-TClaimsColumns\": {\n type: string;\n properties: {\n where: {\n type: string;\n items: {\n $ref: string;\n };\n };\n order: {\n type: string;\n items: {\n $ref: string;\n };\n };\n take: {\n type: string;\n };\n skip: {\n type: string;\n };\n };\n };\n \"Where-TClaimsColumns\": {\n type: string;\n properties: {\n column: {\n $ref: string;\n };\n value: {\n type: string;\n items: {\n type: string;\n };\n };\n not: {\n type: string;\n };\n op: {\n type: string;\n enum: string[];\n };\n };\n required: string[];\n };\n TClaimsColumns: {\n type: string;\n enum: string[];\n };\n \"Order-TClaimsColumns\": {\n type: string;\n properties: {\n column: {\n $ref: string;\n };\n direction: {\n type: string;\n enum: string[];\n };\n };\n required: string[];\n };\n FindPresentationsArgs: {\n $ref: string;\n };\n \"FindArgs-TPresentationColumns\": {\n type: string;\n properties: {\n where: {\n type: string;\n items: {\n $ref: string;\n };\n };\n order: {\n type: string;\n items: {\n $ref: string;\n };\n };\n take: {\n type: string;\n };\n skip: {\n type: string;\n };\n };\n };\n \"Where-TPresentationColumns\": {\n type: string;\n properties: {\n column: {\n $ref: string;\n };\n value: {\n type: string;\n items: {\n type: string;\n };\n };\n not: {\n type: string;\n };\n op: {\n type: string;\n enum: string[];\n };\n };\n required: string[];\n };\n TPresentationColumns: {\n type: string;\n enum: string[];\n };\n \"Order-TPresentationColumns\": {\n type: string;\n properties: {\n column: {\n $ref: string;\n };\n direction: {\n type: string;\n enum: string[];\n };\n };\n required: string[];\n };\n UniqueVerifiablePresentation: {\n type: string;\n properties: {\n hash: {\n type: string;\n };\n verifiablePresentation: {\n $ref: string;\n };\n };\n required: string[];\n };\n };\n methods: {\n dataStoreORMGetIdentities: {\n description: string;\n arguments: {\n $ref: string;\n };\n returnType: {\n type: string;\n items: {\n $ref: string;\n };\n };\n };\n dataStoreORMGetIdentitiesCount: {\n description: string;\n arguments: {\n $ref: string;\n };\n returnType: {\n type: string;\n };\n };\n dataStoreORMGetMessages: {\n description: string;\n arguments: {\n $ref: string;\n };\n returnType: {\n type: string;\n items: {\n $ref: string;\n };\n };\n };\n dataStoreORMGetMessagesCount: {\n description: string;\n arguments: {\n $ref: string;\n };\n returnType: {\n type: string;\n };\n };\n dataStoreORMGetVerifiableCredentials: {\n description: string;\n arguments: {\n $ref: string;\n };\n returnType: {\n type: string;\n items: {\n $ref: string;\n };\n };\n };\n dataStoreORMGetVerifiableCredentialsByClaims: {\n description: string;\n arguments: {\n $ref: string;\n };\n returnType: {\n type: string;\n items: {\n $ref: string;\n };\n };\n };\n dataStoreORMGetVerifiableCredentialsByClaimsCount: {\n description: string;\n arguments: {\n $ref: string;\n };\n returnType: {\n type: string;\n };\n };\n dataStoreORMGetVerifiableCredentialsCount: {\n description: string;\n arguments: {\n $ref: string;\n };\n returnType: {\n type: string;\n };\n };\n dataStoreORMGetVerifiablePresentations: {\n description: string;\n arguments: {\n $ref: string;\n };\n returnType: {\n type: string;\n items: {\n $ref: string;\n };\n };\n };\n dataStoreORMGetVerifiablePresentationsCount: {\n description: string;\n arguments: {\n $ref: string;\n };\n returnType: {\n type: string;\n };\n };\n };\n };\n }" }, { "kind": "Content", diff --git a/packages/daf-typeorm/api/daf-typeorm.api.md b/packages/daf-typeorm/api/daf-typeorm.api.md index ff7e15622..809e733a9 100644 --- a/packages/daf-typeorm/api/daf-typeorm.api.md +++ b/packages/daf-typeorm/api/daf-typeorm.api.md @@ -539,7 +539,7 @@ export class DataStoreORM implements IAgentPlugin { }; required: string[]; }; - IIdentity: { + PartialIdentity: { type: string; properties: { did: { @@ -573,8 +573,6 @@ export class DataStoreORM implements IAgentPlugin { description: string; }; }; - required: string[]; - description: string; }; IKey: { type: string;