-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add nonce to store and refactor types
- Loading branch information
Showing
8 changed files
with
77 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
export type TransactionRequest = { | ||
nonce: string; | ||
presentation_definition: PresentationDefinition; | ||
type: string; | ||
response_mode: string; | ||
} | ||
|
||
type PresentationDefinition = { | ||
id: string; | ||
input_descriptors: InputDescriptor[]; | ||
} | ||
|
||
type InputDescriptor = { | ||
id: string; | ||
name: string; | ||
purpose: string; | ||
format: Format; | ||
constraints: Constraint; | ||
} | ||
|
||
type Format = { | ||
mso_mdoc: { | ||
alg: string[]; | ||
}; | ||
} | ||
|
||
type Constraint = { | ||
fields: Field[]; | ||
} | ||
|
||
type Field = { | ||
path: string[]; | ||
intent_to_retain: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import type { TransactionResponse } from "~/models/TransactionResponse"; | ||
|
||
export interface TransactionStore extends TransactionResponse { | ||
nonce: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
import { defineStore } from 'pinia' | ||
import type {PresentationResponse} from "~/models/PresentationResponse"; | ||
import type {TransactionStore} from "~/models/TransactionStore"; | ||
|
||
|
||
export const useSessionStore = defineStore('session', { | ||
state: () => ({ | ||
clientId: null as string | null, | ||
presentationId: null as string | null, | ||
requestUri: null as string | null, | ||
nonce: null as string | null, | ||
}), | ||
actions: { | ||
setPresentationResponse(response: PresentationResponse) { | ||
this.clientId = response.client_id | ||
this.presentationId = response.presentation_id | ||
this.requestUri = response.request_uri | ||
setPresentationStore(data: TransactionStore) { | ||
this.clientId = data.client_id | ||
this.presentationId = data.presentation_id | ||
this.requestUri = data.request_uri | ||
this.nonce = data.nonce | ||
}, | ||
$reset() { | ||
this.clientId = null | ||
this.presentationId = null | ||
this.requestUri = null | ||
this.nonce = null | ||
} | ||
} | ||
}, | ||
persist: true, | ||
}) |