| 
						
						
							
								
							
						
						
					 | 
					@ -74,7 +74,8 @@ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import { Options, Vue } from "vue-class-component"; | 
					 | 
					 | 
					import { Options, Vue } from "vue-class-component"; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import { AppString } from "@/constants/app"; | 
					 | 
					 | 
					import { AppString } from "@/constants/app"; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import { db } from "../db"; | 
					 | 
					 | 
					import { db } from "../db"; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					import { accessToken } from "@/libs/crypto"; | 
					 | 
					 | 
					import { accessToken, sign } from "@/libs/crypto"; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import * as didJwt from 'did-jwt' | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					@Options({ | 
					 | 
					 | 
					@Options({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  components: {}, | 
					 | 
					 | 
					  components: {}, | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -95,20 +96,31 @@ export default class NewEditProjectView extends Vue { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      const address = identity.did; | 
					 | 
					 | 
					      const address = identity.did; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      const vcClaim = { | 
					 | 
					 | 
					      const vcClaim = { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        "@context": "https://schema.org", | 
					 | 
					 | 
					        "@context": "https://schema.org", | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        "@type": "Plan", | 
					 | 
					 | 
					        "@type": "PlanAction", | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        identifier: address, | 
					 | 
					 | 
					        identifier: address, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        name: this.projectName, | 
					 | 
					 | 
					        name: this.projectName, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        description: this.description, | 
					 | 
					 | 
					        description: this.description, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      }; | 
					 | 
					 | 
					      }; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					      const jwt = ""; | 
					 | 
					 | 
					      const vcPayload = { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					      const payload = JSON.stringify({ jwtEncoded: jwt}); | 
					 | 
					 | 
					        sub: "PlanAction", | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        vc: { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          '@context': ['https://www.w3.org/2018/credentials/v1'], | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          type: ['VerifiableCredential'], | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          credentialSubject: vcClaim, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      }; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      const signer = await sign(identity.keys[0].privateKeyHex); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      const alg = undefined; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      const vcJwt: string = await didJwt.createJWT(vcClaim,{ alg, issuer: identity, signer }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      const payload = JSON.stringify({ jwtEncoded: vcJwt}); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      const endorserApiServer = AppString.DEFAULT_ENDORSER_API_SERVER; | 
					 | 
					 | 
					      const endorserApiServer = AppString.DEFAULT_ENDORSER_API_SERVER; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      const url = endorserApiServer + "/api/claim"; | 
					 | 
					 | 
					      const url = endorserApiServer + "/api/claim"; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					      const token = await accessToken(identity) | 
					 | 
					 | 
					      const token = await accessToken(identity); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					      const headers = { | 
					 | 
					 | 
					      const headers = { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        'Content-Type': 'application/json', | 
					 | 
					 | 
					        'Content-Type': 'application/json', | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        'Uport-Push-Token': token | 
					 | 
					 | 
					        'Authorization': "Bearer " + token | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					      } | 
					 | 
					 | 
					      }; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      try { | 
					 | 
					 | 
					      try { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        let resp = await this.axios.post(url, payload, { headers }); | 
					 | 
					 | 
					        let resp = await this.axios.post(url, payload, { headers }); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |