-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add function to extract types from credential request
- Loading branch information
Showing
3 changed files
with
11 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
import { CredentialRequestV1_0_11 } from '../types'; | ||
|
||
export function getIssuerStateAndPreAuthCode(credentialRequest: CredentialRequestV1_0_11) { | ||
console.log('nothing yet: ' + credentialRequest); | ||
export function getTypesFromRequest(credentialRequest: CredentialRequestV1_0_11, opts?: { filterVerifiableCredential: boolean }) { | ||
const types = 'types' in credentialRequest ? credentialRequest.types : credentialRequest.credential_definition.types; | ||
if (!types || types.length === 0) { | ||
throw Error('Could not deduce types from credential request'); | ||
} | ||
if (opts?.filterVerifiableCredential) { | ||
return types.filter((type) => type !== 'VerifiableCredential'); | ||
} | ||
return types; | ||
} |
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,3 +1,4 @@ | ||
export * from './CredentialRequestUtil'; | ||
export * from './CredentialOfferUtil'; | ||
export * from './Encoding'; | ||
export * from './TypeConversionUtils'; |
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