-
Notifications
You must be signed in to change notification settings - Fork 1
Change VerifiablePresentation to TokenContentVerifiablePresentation #993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Milena-Czierlinski
merged 7 commits into
release/openid4vc
from
verifiable-presentation-token-content
Mar 12, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
35c2fa2
refactor: make VerifiablePresentation to TokenContentVerifiablePresen…
Milena-Czierlinski 098f019
test: adjust expected type of token content
Milena-Czierlinski 83c8718
test: app-runtime test
Milena-Czierlinski d9f4915
chore: re-add TokenContentVerifiablePresentation
Milena-Czierlinski 38ec012
chore: type
Milena-Czierlinski a684ae0
refactor: add ProprietaryAttributeValue to barrel file
Milena-Czierlinski 25d1b84
Merge branch 'release/openid4vc' into verifiable-presentation-token-c…
Milena-Czierlinski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
69 changes: 0 additions & 69 deletions
69
packages/content/src/attributes/types/VerifiablePresentation.ts
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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
57 changes: 57 additions & 0 deletions
57
packages/content/src/tokens/TokenContentVerifiablePresentation.ts
This file contains hidden or 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,57 @@ | ||
| import { ISerializable, Serializable, serialize, type, validate } from "@js-soft/ts-serval"; | ||
| import { ContentJSON } from "../ContentJSON"; | ||
| import { PROPRIETARY_ATTRIBUTE_MAX_DESCRIPTION_LENGTH } from "../attributes"; | ||
|
|
||
| export interface TokenContentVerifiablePresentationJSON extends ContentJSON { | ||
Magnus-Kuhn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "@type": "TokenContentVerifiablePresentation"; | ||
| value: string | Record<string, any>; | ||
| type: string; | ||
| displayInformation?: Record<string, any>[]; | ||
| } | ||
|
|
||
| export interface ITokenContentVerifiablePresentation extends ISerializable { | ||
| value: string | Record<string, any>; | ||
| type: string; | ||
| displayInformation?: Record<string, any>[]; | ||
| } | ||
|
|
||
| @type("TokenContentVerifiablePresentation") | ||
| export class TokenContentVerifiablePresentation extends Serializable implements ITokenContentVerifiablePresentation { | ||
| @serialize({ any: true }) | ||
| @validate({ customValidator: validateValue }) | ||
| public value: string | Record<string, any>; | ||
|
|
||
| @serialize() | ||
| @validate({ nullable: true }) | ||
| public type: string; | ||
|
|
||
| @serialize() | ||
| @validate({ nullable: true, max: PROPRIETARY_ATTRIBUTE_MAX_DESCRIPTION_LENGTH }) | ||
| public displayInformation?: Record<string, any>[]; | ||
|
|
||
| public static from(value: ITokenContentVerifiablePresentation | Omit<TokenContentVerifiablePresentationJSON, "@type">): TokenContentVerifiablePresentation { | ||
| return this.fromAny(value); | ||
| } | ||
|
|
||
| public override toJSON(verbose?: boolean | undefined, serializeAsString?: boolean | undefined): TokenContentVerifiablePresentationJSON { | ||
| return super.toJSON(verbose, serializeAsString) as TokenContentVerifiablePresentationJSON; | ||
| } | ||
| } | ||
|
|
||
| function validateValue(value: any) { | ||
| try { | ||
| const string = JSON.stringify(value); | ||
| // the length corresponds to 50MB - maybe this needs to be restricted further in the future | ||
| if (string.length > 52428800) { | ||
| return "stringified value must not be longer than 52428800 characters"; | ||
| } | ||
| } catch (e) { | ||
| if (e instanceof SyntaxError) { | ||
| return "must be a valid JSON object"; | ||
| } | ||
|
|
||
| return "could not validate value"; | ||
| } | ||
|
|
||
| return undefined; | ||
| } | ||
This file contains hidden or 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 @@ | ||
| export * from "./TokenContentVerifiablePresentation"; |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.