Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4 from mich3lang3lo/main
Browse files Browse the repository at this point in the history
feat: make credential cool
  • Loading branch information
mrcnk authored Apr 14, 2024
2 parents b33fd90 + 25bd953 commit c2b3928
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 11 deletions.
8 changes: 5 additions & 3 deletions src/App.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { writable } from "svelte/store";
import { constructPaymentTx } from "./lib/tx";
import { exampleCredential } from "./credentials/mock_credential";
import { createMockCredential } from "./credentials/mock_credential";
import { onMount } from "svelte";
export const messageToSign = writable<string>("Message to sign");
Expand Down Expand Up @@ -103,11 +103,13 @@
});
};
const setCredentialState = async () => {
const account = getAccounts()
const credential = createMockCredential(account[0])
const response = await window.mina.request({
method: "mina_setState",
params: {
objectName: "exampleCredential",
object: exampleCredential,
objectName: "Pallad Mock Credential",
object: credential,
},
});
console.log(response);
Expand Down
46 changes: 38 additions & 8 deletions src/credentials/mock_credential.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,57 @@
export const mockCredential = {
export const createMockCredential = (publicKey) => {
return {
'@context': ['https://www.w3.org/2018/credentials/v1'],
id: 'http://example.edu/credentials/3732',
type: ['VerifiableCredential', 'UniversityDegreeCredential'],
issuer: 'University of Example',
issuanceDate: '2010-01-01T00:00:00Z',
type: ['VerifiableCredential', 'UniversityDegreeCredential', 'AstronautCredential'],
issuer: 'University of Palladia',
issuanceDate: '2024-04-14T00:00:00Z',
credentialSubject: {
id: 'did:mina:B62qjsV6WQwTeEWrNrRRBP6VaaLvQhwWTnFi4WP4LQjGvpfZEumXzxb',
id: `did:mina:${publicKey}`,
degree: {
type: 'BachelorDegree',
name: 'Bachelor of Science and Arts'
}
},
astronautTraining: {
basicTrainingCompleted: true,
advancedTraining: ['Spacewalks', 'Robotic Operations', 'Piloting Spacecraft'],
missionsParticipated: [
{
missionName: 'Artemis IV',
role: 'Mission Specialist',
year: 2024
},
{
missionName: 'Palladia Space Station Maintenance Mission',
role: 'Lead Engineer',
year: 2024
}
]
},
microgravityExperiments: [
{
experimentName: 'Protein Crystal Growth',
description: 'Experiment to study the growth of protein crystals in microgravity conditions.',
outcomes: 'Successfully identified three potential new drug candidates.'
},
{
experimentName: 'Fluid Dynamics Experiment',
description: 'Analysis of fluid behavior in microgravity to improve models used in Palladia\'s climate science.',
outcomes: 'Provided valuable data to refine Palladia\'s climate models.'
}
]
},
proof: {
type: 'Kimchi',
created: '2023-09-19T12:40:16Z',
created: '2024-04-14T12:40:16Z',
proof: {
publicInput: ['0'],
publicOutput: ['1'],
maxProofsVerified: 0,
proof: 'KChzdGF0ZW1...SkpKSkp'
}
}
}
};
};

export const exampleCredential = {
"@context": [
Expand Down

0 comments on commit c2b3928

Please sign in to comment.