CCF
Loading...
Searching...
No Matches
did.h
Go to the documentation of this file.
1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the Apache 2.0 License.
3#pragma once
4
5#include "ccf/crypto/jwk.h"
6#include "ccf/ds/json.h"
7
8#include <string>
9#include <vector>
10
11namespace ccf::did
12{
13 // From https://www.w3.org/TR/did-core.
14 // Note that the types defined in this file do not exhaustively cover
15 // all fields and types from the spec.
17 {
18 std::string id;
19 std::string type;
20 std::string controller;
21 std::optional<nlohmann::json> public_key_jwk = std::nullopt;
22
23 bool operator==(const DIDDocumentVerificationMethod&) const = default;
24 };
27 DIDDocumentVerificationMethod, id, type, controller);
29 DIDDocumentVerificationMethod, public_key_jwk, "publicKeyJwk");
30
32 {
33 std::string id;
34 std::string context;
35 std::string type;
36 std::vector<DIDDocumentVerificationMethod> verification_method = {};
37 nlohmann::json assertion_method = {};
38
39 bool operator==(const DIDDocument&) const = default;
40 };
45 context,
46 "@context",
47 type,
48 "type",
49 verification_method,
50 "verificationMethod",
51 assertion_method,
52 "assertionMethod");
53}
#define DECLARE_JSON_REQUIRED_FIELDS(TYPE,...)
Definition json.h:712
#define DECLARE_JSON_OPTIONAL_FIELDS_WITH_RENAMES(TYPE,...)
Definition json.h:807
#define DECLARE_JSON_TYPE_WITH_OPTIONAL_FIELDS(TYPE)
Definition json.h:688
Definition did.h:12
std::optional< nlohmann::json > public_key_jwk
Definition did.h:21
std::string controller
Definition did.h:20
std::string id
Definition did.h:18
bool operator==(const DIDDocumentVerificationMethod &) const =default
std::string type
Definition did.h:19
Definition did.h:32
bool operator==(const DIDDocument &) const =default
std::string type
Definition did.h:35
std::string id
Definition did.h:33
std::vector< DIDDocumentVerificationMethod > verification_method
Definition did.h:36
std::string context
Definition did.h:34
nlohmann::json assertion_method
Definition did.h:37