Skip to content

Commit

Permalink
feat: GraphQL w3c
Browse files Browse the repository at this point in the history
  • Loading branch information
simonas-notcat authored and mirceanis committed Sep 7, 2020
1 parent 10d31cc commit 967b916
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/daf-graphql/src/base-type-def.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ scalar Object
scalar Date
scalar VerifiablePresentation
scalar VerifiableCredential
scalar Presentation
scalar Credential
type Message {
id: ID!
Expand Down
2 changes: 2 additions & 0 deletions packages/daf-graphql/src/methods/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import { IAgentGraphQLMethod } from '../types'
import identityManager from './identity-manager'
import resolver from './resolver'
import messageHandler from './message-handler'
import w3c from './w3c'

export const supportedMethods: Record<string, IAgentGraphQLMethod> = {
...identityManager,
...resolver,
...messageHandler,
...w3c,
}
38 changes: 38 additions & 0 deletions packages/daf-graphql/src/methods/w3c.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { IAgentGraphQLMethod } from '../types'

export const createVerifiableCredential: IAgentGraphQLMethod = {
type: 'Mutation',
query: `
mutation createVerifiableCredential($credential: Credential!, $proofFormat: String, $save: Boolean) {
createVerifiableCredential(credential: $credential, proofFormat: $proofFormat, save: $save)
}
`,
typeDef: `
extend type Mutation {
createVerifiableCredential(credential: Credential!, proofFormat: String, save: Boolean): VerifiableCredential
}
`,
}

export const createVerifiablePresentation: IAgentGraphQLMethod = {
type: 'Mutation',
query: `
mutation createVerifiablePresentation($presentation: Presentation!, $proofFormat: String, $save: Boolean) {
createVerifiablePresentation(presentation: $presentation, proofFormat: $proofFormat, save: $save)
}
`,
typeDef: `
extend type Mutation {
createVerifiablePresentation(presentation: Presentation!, proofFormat: String, save: Boolean): VerifiableCredential
}
`,
}

export const supportedMethods: Record<string, IAgentGraphQLMethod> = {
createVerifiableCredential,
createVerifiablePresentation,
}

export default supportedMethods

0 comments on commit 967b916

Please sign in to comment.