From 144a2d1710b7f439273b0ac16fe4fe575e454ea0 Mon Sep 17 00:00:00 2001 From: Ilya Date: Fri, 12 Jan 2024 17:55:26 +0200 Subject: [PATCH] Support display method (#86) * support display service for w3c * add JSONLDSchemaIden3DisplayMethod constant --- verifiable/constants.go | 6 ++++++ verifiable/credential.go | 1 + verifiable/displayMethod.go | 8 ++++++++ 3 files changed, 15 insertions(+) create mode 100644 verifiable/displayMethod.go diff --git a/verifiable/constants.go b/verifiable/constants.go index 191dbbb..b2c93af 100644 --- a/verifiable/constants.go +++ b/verifiable/constants.go @@ -12,6 +12,9 @@ const ( // JSONLDSchemaW3CCredential2018 is a schema for context with VerifiableCredential type JSONLDSchemaW3CCredential2018 = "https://www.w3.org/2018/credentials/v1" + // JSONLDSchemaW3CCredential2020 is a schema for context with Display method type + JSONLDSchemaIden3DisplayMethod = "https://schema.iden3.io/core/jsonld/displayMethod.jsonld" + // SparseMerkleTreeProof is CredentialStatusType for standard MTP result handlers SparseMerkleTreeProof CredentialStatusType = "SparseMerkleTreeProof" @@ -75,4 +78,7 @@ const ( // Iden3RefreshService2023 is the type of refresh service Iden3RefreshService2023 RefreshServiceType = "Iden3RefreshService2023" + + // Iden3BasicDisplayMethodV1 is the type fof basic display method + Iden3BasicDisplayMethodV1 DisplayMethodType = "Iden3BasicDisplayMethodV1" ) diff --git a/verifiable/credential.go b/verifiable/credential.go index 8088845..1e10499 100644 --- a/verifiable/credential.go +++ b/verifiable/credential.go @@ -26,6 +26,7 @@ type W3CCredential struct { CredentialSchema CredentialSchema `json:"credentialSchema"` Proof CredentialProofs `json:"proof,omitempty"` RefreshService *RefreshService `json:"refreshService,omitempty"` + DisplayMethod *DisplayMethod `json:"displayMethod,omitempty"` } // Merklize merklizes verifiable credential diff --git a/verifiable/displayMethod.go b/verifiable/displayMethod.go new file mode 100644 index 0000000..534a5d0 --- /dev/null +++ b/verifiable/displayMethod.go @@ -0,0 +1,8 @@ +package verifiable + +type DisplayMethodType string + +type DisplayMethod struct { + ID string `json:"id"` + Type DisplayMethodType `json:"type"` +}