diff --git a/examples/id-hub/README.md b/examples/id-hub/README.md index 8a5ff33a8..479f849dc 100644 --- a/examples/id-hub/README.md +++ b/examples/id-hub/README.md @@ -1,8 +1,9 @@ -# Server +# ID Hub example ``` -npm i -npm start +yarn +yarn build +yarn start ``` ## Queries @@ -35,12 +36,37 @@ presentation ``` mutation newMsg { - saveNewMessage(raw: "eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NkstUiJ9.eyJpYXQiOjE1ODQ2MTkzOTksImF1ZCI6ImRpZDp3ZWI6dXBvcnQubWUiLCJ0YWciOiIiLCJ2cCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjA -xOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVQcmVzZW50YXRpb24iXSwidmVyaWZpYWJsZUNyZWRlbnRpYWwiOlsiZXlKMGVYQWlPaUpLVjFRaUxDSmhiR2NpT2lKRlV6STFOa3N0VWlKOS5leUpwWVhR -aU9qRTFPRFEyTVRZd05qRXNJbk4xWWlJNkltUnBaRHBsZEdoeU9uSnBibXRsWW5rNk1IZ3hZek00Tm1RMU5UQXlOVFppTVRka09UQTRaRFkyTkRNMk1qUTNaR0psTXpVeFl6UXpaV1JqSWl3aWRtTWlPbnNpUUdOdmJuUmxlSFFpT2xzaWFIUjBjSE02THk5M2QzY3Vkek11YjNKbkx6SXdNVGd2WTNKbFpHVnVkR2xoYkhNdmRqRWlYU3dpZEhsd1pTSTZXeUpXWlhKcFptbGhZbXhsUTNKbFpHVnVkR2xoYkNKZExDSmpjbVZrWlc1MGFXRnNVM1ZpYW1WamRDSTZleUp1WVcxbElqb2lRV3hwWTJVaWZYMHNJbWx6Y3lJNkltUnBaRHBsZEdoeU9uSnBibXRsWW5rNk1IZ3pOR1UwWWpSbU16VXhNakl3TUdVNE5HVmtaR0l3TldNeU5UTXhNV0kzWmpVNE5HWTNPRFV6SW4wLmZYWV9nU1BEbk1YY1gyUm9LMEpzYUs4c0ljSllsc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taR0l3TldNeU5UTXhNV0kzWmpVNE5HWTNPRFV6SW4wLmZYWV9nU1BEbk1YY1gyUm9LMEpzYUs4c0ljSllscnBlb0dKeFRDMXhNdWw2N0lyVURyMWNYRVZyZGJ0V3h2Zmo5aGw0endRd0NDWTFFSXd1UlB4Z01RRSJdfSwiaXNzIjoiZGlkOmV0aHI6cmlua2VieToweDFjMzg2ZDU1MDI1NmIxN2Q5MDhkNjY0MzYyNDdkYmUzNTFjNDNlZGMifQ.HnZyQIqV9d2saNDo6a72jlplWuVGVLJe4ff30MIpr6bcgobW4gHEGnc-AXaPPOSH1ErYz2xor1oxq3TTWhyS7wE") { id type data } } ``` + +Selective Disclosure Request + +``` +mutation newMsg { + saveNewMessage(raw: "eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NkstUiJ9.eyJpYXQiOjE1ODQ2MzI5ODEsInR5cGUiOiJzZHIiLCJjbGFpbXMiOlt7ImlzcyI6W10sImVzc2VudGlhbCI6dHJ1ZSwiY2xhaW1UeXBlIjoibmFtZSIsInJlYXNvbiI6IldlIG5lZWQgdGhpcyB0byBjb21wbHkgd2l0aCBsb2NhbCBsYXcifV0sImlzcyI6ImRpZDpldGhyOnJpbmtlYnk6MHgxMTdmZDNkNjBlNDQyMjA2Yzc0ZmI4MGM5Y2YzY2FiN2UxYzkyNjY0In0.7PEmiZMlv8UXXNDcuLzQRsz0CL2U-T5tZCuRJhXuIC80nnjS0l44nMmqFQdRnINrw1Kg688Wv51mdKTvPifPrgE") { + id + type + data + } +} +``` + +Claims + +``` +query claims { + claims { + type + value + credential { + issuer {did} + subject {did} + } + } +} +``` diff --git a/examples/id-hub/src/index.ts b/examples/id-hub/src/index.ts index ed8535550..4dc631043 100644 --- a/examples/id-hub/src/index.ts +++ b/examples/id-hub/src/index.ts @@ -40,7 +40,8 @@ const server = new ApolloServer({ }) core.on(Daf.EventTypes.savedMessage, async (message: Daf.Message) => { - // Add your business logic + // Add your business logic here + console.log(message) }) const main = async () => { @@ -48,7 +49,7 @@ const main = async () => { type: 'sqlite', database: './database.sqlite', synchronize: true, - logging: true, + logging: false, entities: [...Daf.Entities], }) diff --git a/examples/id-hub/yarn.lock b/examples/id-hub/yarn.lock index 2da639361..a3b9ac8dd 100644 --- a/examples/id-hub/yarn.lock +++ b/examples/id-hub/yarn.lock @@ -861,54 +861,34 @@ cross-fetch@^3.0.4: node-fetch "2.6.0" whatwg-fetch "3.0.0" -daf-core@../../packages/daf-core: - version "3.1.3" - dependencies: - blakejs "^1.1.0" - debug "^4.1.1" - events "^3.0.0" - typeorm "^0.2.24" - -daf-core@^3.1.3, daf-core@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/daf-core/-/daf-core-3.2.0.tgz#00355383b8ddf11d3c0fc13884cca4c165b39780" - integrity sha512-s3zjyMhZYDV36CIGfM+lj0ZhPawS1CYT5EObq7z0W68SXABAxw703PzSNNtFGU41vWGPFH+c7cJNJnWiop7/Xg== +daf-core@../../packages/daf-core, daf-core@^3.4.0: + version "3.4.0" dependencies: blakejs "^1.1.0" debug "^4.1.1" events "^3.0.0" typeorm "^0.2.24" -daf-data-store@^3.1.4: - version "3.2.0" - resolved "https://registry.yarnpkg.com/daf-data-store/-/daf-data-store-3.2.0.tgz#05a746f9d7c12a281912959f9744b21fe2243148" - integrity sha512-mqRNhVvPqBvjahOAdKAN8zJDYJI87RHCHKA00bAegQjZyjvL1RmwHh+/Fj9xCxPcbM5CmozRN7jdEonmw0CGQg== +daf-data-store@^3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/daf-data-store/-/daf-data-store-3.4.0.tgz#97a693ce8bd35b1a81e43890458ea0aae9f942c7" + integrity sha512-gYDzSVljlnAfJcxRVWuVbRSzfL2V61vmQLSJ/EV3SxZLSQZGWyUFT7Kk8Nwv5LIhcZuDMEOd81uj1Tw4snuJDg== dependencies: blakejs "^1.1.0" - daf-core "^3.2.0" + daf-core "^3.4.0" debug "^4.1.1" sql-bricks-sqlite "^0.1.0" daf-debug@../../packages/daf-debug: - version "3.1.3" - dependencies: - daf-core "^3.1.3" - debug "^4.1.1" - -daf-did-jwt@../../packages/daf-did-jwt: - version "3.1.3" + version "3.4.0" dependencies: - daf-core "^3.1.3" + daf-core "^3.4.0" debug "^4.1.1" - did-jwt "^4.0.0" - did-resolver "^1.1.0" -daf-did-jwt@^3.1.3: - version "3.2.0" - resolved "https://registry.yarnpkg.com/daf-did-jwt/-/daf-did-jwt-3.2.0.tgz#0f195bd6f47a37078479c21b5426aa63849a3853" - integrity sha512-ZWVZDh3CrlNf1uL0MIK+bsi/+jFk+qe2EImnHbkglHttJk5r7K0sOW9oVDc0mgUH0IQcPFCOI6F0fjaEgnNrdg== +daf-did-jwt@../../packages/daf-did-jwt, daf-did-jwt@^3.4.0: + version "3.4.0" dependencies: - daf-core "^3.2.0" + daf-core "^3.4.0" debug "^4.1.1" did-jwt "^4.0.0" did-resolver "^1.1.0" @@ -923,21 +903,21 @@ daf-resolver@../../packages/daf-resolver: web-did-resolver "^1.2.0" daf-selective-disclosure@../../packages/daf-selective-disclosure: - version "3.1.4" + version "3.4.0" dependencies: blakejs "^1.1.0" - daf-core "^3.1.3" - daf-data-store "^3.1.4" - daf-did-jwt "^3.1.3" + daf-core "^3.4.0" + daf-data-store "^3.4.0" + daf-did-jwt "^3.4.0" debug "^4.1.1" did-jwt "^4.0.0" daf-w3c@../../packages/daf-w3c: - version "3.1.3" + version "3.4.0" dependencies: blakejs "^1.1.0" - daf-core "^3.1.3" - daf-did-jwt "^3.1.3" + daf-core "^3.4.0" + daf-did-jwt "^3.4.0" debug "^4.1.1" did-jwt-vc "^0.1.3" did-resolver "^1.1.0" diff --git a/packages/daf-core/src/core.ts b/packages/daf-core/src/core.ts index cdc607d62..1b81de354 100644 --- a/packages/daf-core/src/core.ts +++ b/packages/daf-core/src/core.ts @@ -120,7 +120,7 @@ export class Core extends EventEmitter { ) await message.save() debug('Emitting event', EventTypes.savedMessage) - this.emit(EventTypes.validatedMessage, message) + this.emit(EventTypes.savedMessage, message) return message } catch (error) { this.emit(EventTypes.error, error)