Skip to content

Commit

Permalink
feat(MultiSign): register context before issuance
Browse files Browse the repository at this point in the history
  • Loading branch information
lemoustachiste committed Jun 22, 2022
1 parent f8022b0 commit d7e1a6b
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ dist/*
build/*
node_modules/*

!data/context

requirements.txt
.idea/*
*.ini*
Expand Down
9 changes: 8 additions & 1 deletion cert_issuer/normalization_handler.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
from cert_schema import normalize_jsonld
import json
import os
from cert_schema import normalize_jsonld, extend_preloaded_context

BASE_DIR = os.path.abspath(os.path.dirname(__file__))


class JSONLDHandler:
@staticmethod
def normalize_to_utf8(certificate_json):
with open(os.path.join(BASE_DIR, '../data/context/ed25519.v1.json')) as context_file:
context_data = json.load(context_file)
extend_preloaded_context('https://w3id.org/security/suites/ed25519-2020/v1', context_data)
normalized = normalize_jsonld(certificate_json, detect_unmapped_fields=False)
return normalized.encode('utf-8')
93 changes: 93 additions & 0 deletions data/context/ed25519.v1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"@context": {
"id": "@id",
"type": "@type",
"@protected": true,
"proof": {
"@id": "https://w3id.org/security#proof",
"@type": "@id",
"@container": "@graph"
},
"Ed25519VerificationKey2020": {
"@id": "https://w3id.org/security#Ed25519VerificationKey2020",
"@context": {
"@protected": true,
"id": "@id",
"type": "@type",
"controller": {
"@id": "https://w3id.org/security#controller",
"@type": "@id"
},
"revoked": {
"@id": "https://w3id.org/security#revoked",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
},
"publicKeyMultibase": {
"@id": "https://w3id.org/security#publicKeyMultibase",
"@type": "https://w3id.org/security#multibase"
}
}
},
"Ed25519Signature2020": {
"@id": "https://w3id.org/security#Ed25519Signature2020",
"@context": {
"@protected": true,
"id": "@id",
"type": "@type",
"challenge": "https://w3id.org/security#challenge",
"created": {
"@id": "http://purl.org/dc/terms/created",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
},
"domain": "https://w3id.org/security#domain",
"expires": {
"@id": "https://w3id.org/security#expiration",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
},
"nonce": "https://w3id.org/security#nonce",
"proofPurpose": {
"@id": "https://w3id.org/security#proofPurpose",
"@type": "@vocab",
"@context": {
"@protected": true,
"id": "@id",
"type": "@type",
"assertionMethod": {
"@id": "https://w3id.org/security#assertionMethod",
"@type": "@id",
"@container": "@set"
},
"authentication": {
"@id": "https://w3id.org/security#authenticationMethod",
"@type": "@id",
"@container": "@set"
},
"capabilityInvocation": {
"@id": "https://w3id.org/security#capabilityInvocationMethod",
"@type": "@id",
"@container": "@set"
},
"capabilityDelegation": {
"@id": "https://w3id.org/security#capabilityDelegationMethod",
"@type": "@id",
"@container": "@set"
},
"keyAgreement": {
"@id": "https://w3id.org/security#keyAgreementMethod",
"@type": "@id",
"@container": "@set"
}
}
},
"proofValue": {
"@id": "https://w3id.org/security#proofValue",
"@type": "https://w3id.org/security#multibase"
},
"verificationMethod": {
"@id": "https://w3id.org/security#verificationMethod",
"@type": "@id"
}
}
}
}
}

0 comments on commit d7e1a6b

Please sign in to comment.