-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Timo Glastra <[email protected]>
- Loading branch information
1 parent
d630a07
commit 30d7cca
Showing
9 changed files
with
281 additions
and
255 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 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,36 +1,3 @@ | ||
import { OpenId4VciCredentialOfferPayload } from "@credo-ts/openid4vc"; | ||
import { agent } from "./agent"; | ||
|
||
interface OfferSessionMetadata { | ||
export interface OfferSessionMetadata { | ||
issuerDidMethod: string; | ||
} | ||
|
||
export async function setOfferSessionMetadata( | ||
offer: OpenId4VciCredentialOfferPayload, | ||
metadata: OfferSessionMetadata | ||
) { | ||
const preAuthorizedCode = offer.grants?.[ | ||
"urn:ietf:params:oauth:grant-type:pre-authorized_code" | ||
]?.["pre-authorized_code"] as string; | ||
|
||
const offerSession = await agent.modules.openId4VcIssuer.config | ||
.getCredentialOfferSessionStateManager(agent.context) | ||
.get(preAuthorizedCode); | ||
|
||
// FIXME: there needs to be a better way to set the issuerDid | ||
offerSession!.credentialDataSupplierInput = metadata; | ||
} | ||
|
||
export async function getOfferSessionMetadata( | ||
offer: OpenId4VciCredentialOfferPayload | ||
) { | ||
const preAuthorizedCode = offer.grants?.[ | ||
"urn:ietf:params:oauth:grant-type:pre-authorized_code" | ||
]?.["pre-authorized_code"] as string; | ||
|
||
const offerSession = await agent.modules.openId4VcIssuer.config | ||
.getCredentialOfferSessionStateManager(agent.context) | ||
.get(preAuthorizedCode); | ||
|
||
return offerSession?.credentialDataSupplierInput as OfferSessionMetadata; | ||
} |
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
Oops, something went wrong.