-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support receiving JFF JWT credential
Signed-off-by: Timo Glastra <[email protected]>
- Loading branch information
1 parent
0015e6f
commit 6c8bdd1
Showing
6 changed files
with
208 additions
and
72 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
.yarn/patches/@aries-framework-core-npm-0.4.1-bf3ca88ff9.patch
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,50 @@ | ||
diff --git a/build/modules/vc/models/credential/W3cCredential.js b/build/modules/vc/models/credential/W3cCredential.js | ||
index 0c03676b24f394c7b48e9b41d8101a576c94484b..d5b1ff8847721223e5bb486eb4716d790a849013 100644 | ||
--- a/build/modules/vc/models/credential/W3cCredential.js | ||
+++ b/build/modules/vc/models/credential/W3cCredential.js | ||
@@ -68,16 +68,37 @@ class W3cCredential { | ||
return utils_1.JsonTransformer.fromJSON(json, W3cCredential); | ||
} | ||
} | ||
-__decorate([ | ||
- (0, class_transformer_1.Expose)({ name: '@context' }), | ||
+__decorate( | ||
+ [ | ||
+ (0, class_transformer_1.Expose)({ name: "@context" }), | ||
(0, validators_2.IsCredentialJsonLdContext)(), | ||
- __metadata("design:type", Array) | ||
-], W3cCredential.prototype, "context", void 0); | ||
-__decorate([ | ||
+ // FIXME: credentials issued by MATTR in JWT format use a string value for the @context | ||
+ // The spec requires it to be an array. | ||
+ // See: https://jfflabs.slack.com/archives/C05FTNY6GH2/p1695650296840639?thread_ts=1695648357.864189&cid=C05FTNY6GH2 | ||
+ (0, class_transformer_1.Transform)(({ type, value }) => { | ||
+ if (type !== class_transformer_1.TransformationType.PLAIN_TO_CLASS) | ||
+ return value; | ||
+ if (Array.isArray(value)) return value; | ||
+ if (typeof value === "string") return [value]; | ||
+ }), | ||
+ __metadata("design:type", Array), | ||
+ ], | ||
+ W3cCredential.prototype, | ||
+ "context", | ||
+ void 0 | ||
+); | ||
+__decorate( | ||
+ [ | ||
(0, class_validator_1.IsOptional)(), | ||
- (0, validators_1.IsUri)(), | ||
- __metadata("design:type", String) | ||
-], W3cCredential.prototype, "id", void 0); | ||
+ // FIXME: credential issued by MATTR launchpad uses an UUID as the `jti`, which is not a valid URI | ||
+ // See: https://jfflabs.slack.com/archives/C05FTNY6GH2/p1695648357864189 | ||
+ // (0, validators_1.IsUri)(), | ||
+ __metadata("design:type", String), | ||
+ ], | ||
+ W3cCredential.prototype, | ||
+ "id", | ||
+ void 0 | ||
+); | ||
__decorate([ | ||
IsCredentialType(), | ||
__metadata("design:type", Array) |
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 |
---|---|---|
|
@@ -42,6 +42,7 @@ | |
"@cosmjs/utils": "npm:@cosmjs-rn/utils@^0.27.1", | ||
"@cosmjs/proto-signing": "npm:@cosmjs-rn/proto-signing@^0.27.1", | ||
"@cosmjs/crypto": "npm:@cosmjs-rn/crypto@^0.27.1", | ||
"@aries-framework/[email protected]": "patch:@aries-framework/core@npm%3A0.4.1#./.yarn/patches/@aries-framework-core-npm-0.4.1-bf3ca88ff9.patch", | ||
"@sphereon/[email protected]": "patch:@sphereon/did-auth-siop@npm%3A0.3.2-unstable.0#./.yarn/patches/@sphereon-did-auth-siop-npm-0.3.2-unstable.0-6a34120d09.patch" | ||
}, | ||
"dependencies": { | ||
|
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
Oops, something went wrong.