-
Notifications
You must be signed in to change notification settings - Fork 28
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
feat: add did contexts #712
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 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,196 @@ | ||
/** | ||
* Copyright (c) 2018-2023, BOTLabs GmbH. | ||
* | ||
* This source code is licensed under the BSD 4-Clause "Original" license | ||
* found in the LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
/** | ||
* IPFS URL identifying a JSON-LD context file describing terms used in DID documents of the KILT method that are not defined in the W3C DID core context. | ||
* Should be the second entry in the ordered set of contexts after [[W3C_DID_CONTEXT_URL]] in the JSON-LD representation of a KILT DID document. | ||
*/ | ||
export const KILT_DID_CONTEXT_URL = | ||
'ipfs://QmU7QkuTCPz7NmD5bD7Z7mQVz2UsSPaEK58B5sYnjnPRNW' | ||
/** | ||
* URL identifying the JSON-LD context file that is part of the W3C DID core specifications describing the terms defined by the core data model. | ||
* Must be the first entry in the ordered set of contexts in a JSON-LD representation of a DID document. | ||
* See https://www.w3.org/TR/did-core/#json-ld. | ||
*/ | ||
export const W3C_DID_CONTEXT_URL = 'https://www.w3.org/ns/did/v1' | ||
/** | ||
* URL identifying a JSON-LD context file proposed by the W3C Credentials Community Group defining a number of terms which are used in verification methods on KILT DID documents. | ||
* See https://w3c-ccg.github.io/security-vocab/. | ||
* This document is extended by the context file available under the [[KILT_DID_CONTEXT_URL]]. | ||
*/ | ||
export const W3C_SECURITY_CONTEXT_URI = 'https://w3id.org/security/v2' | ||
/** | ||
* An object containing static copies of JSON-LD context files relevant to KILT DID documents, of the form <context URL> -> context. | ||
* These context definitions are not supposed to change; therefore, a cached version can (and should) be used to avoid unexpected changes in definitions. | ||
*/ | ||
export const DID_CONTEXTS = { | ||
[KILT_DID_CONTEXT_URL]: { | ||
'@context': [ | ||
W3C_SECURITY_CONTEXT_URI, | ||
{ | ||
'@protected': true, | ||
KiltPublishedCredentialCollectionV1: | ||
'https://github.com/KILTprotocol/spec-KiltPublishedCredentialCollectionV1', | ||
Sr25519VerificationKey2020: | ||
'https://github.com/KILTprotocol/spec-kilt-did#sr25519', | ||
}, | ||
], | ||
}, | ||
[W3C_DID_CONTEXT_URL]: { | ||
'@context': { | ||
'@protected': true, | ||
id: '@id', | ||
type: '@type', | ||
|
||
alsoKnownAs: { | ||
'@id': 'https://www.w3.org/ns/activitystreams#alsoKnownAs', | ||
'@type': '@id', | ||
}, | ||
assertionMethod: { | ||
'@id': 'https://w3id.org/security#assertionMethod', | ||
'@type': '@id', | ||
'@container': '@set', | ||
}, | ||
authentication: { | ||
'@id': 'https://w3id.org/security#authenticationMethod', | ||
'@type': '@id', | ||
'@container': '@set', | ||
}, | ||
capabilityDelegation: { | ||
'@id': 'https://w3id.org/security#capabilityDelegationMethod', | ||
'@type': '@id', | ||
'@container': '@set', | ||
}, | ||
capabilityInvocation: { | ||
'@id': 'https://w3id.org/security#capabilityInvocationMethod', | ||
'@type': '@id', | ||
'@container': '@set', | ||
}, | ||
controller: { | ||
'@id': 'https://w3id.org/security#controller', | ||
'@type': '@id', | ||
}, | ||
keyAgreement: { | ||
'@id': 'https://w3id.org/security#keyAgreementMethod', | ||
'@type': '@id', | ||
'@container': '@set', | ||
}, | ||
service: { | ||
'@id': 'https://www.w3.org/ns/did#service', | ||
'@type': '@id', | ||
'@context': { | ||
'@protected': true, | ||
id: '@id', | ||
type: '@type', | ||
serviceEndpoint: { | ||
'@id': 'https://www.w3.org/ns/did#serviceEndpoint', | ||
'@type': '@id', | ||
}, | ||
}, | ||
}, | ||
verificationMethod: { | ||
'@id': 'https://w3id.org/security#verificationMethod', | ||
'@type': '@id', | ||
}, | ||
}, | ||
}, | ||
[W3C_SECURITY_CONTEXT_URI]: { | ||
'@context': [ | ||
{ | ||
'@version': 1.1, | ||
}, | ||
'https://w3id.org/security/v1', | ||
{ | ||
AesKeyWrappingKey2019: 'sec:AesKeyWrappingKey2019', | ||
DeleteKeyOperation: 'sec:DeleteKeyOperation', | ||
DeriveSecretOperation: 'sec:DeriveSecretOperation', | ||
EcdsaSecp256k1Signature2019: 'sec:EcdsaSecp256k1Signature2019', | ||
EcdsaSecp256r1Signature2019: 'sec:EcdsaSecp256r1Signature2019', | ||
EcdsaSecp256k1VerificationKey2019: | ||
'sec:EcdsaSecp256k1VerificationKey2019', | ||
EcdsaSecp256r1VerificationKey2019: | ||
'sec:EcdsaSecp256r1VerificationKey2019', | ||
Ed25519Signature2018: 'sec:Ed25519Signature2018', | ||
Ed25519VerificationKey2018: 'sec:Ed25519VerificationKey2018', | ||
EquihashProof2018: 'sec:EquihashProof2018', | ||
ExportKeyOperation: 'sec:ExportKeyOperation', | ||
GenerateKeyOperation: 'sec:GenerateKeyOperation', | ||
KmsOperation: 'sec:KmsOperation', | ||
RevokeKeyOperation: 'sec:RevokeKeyOperation', | ||
RsaSignature2018: 'sec:RsaSignature2018', | ||
RsaVerificationKey2018: 'sec:RsaVerificationKey2018', | ||
Sha256HmacKey2019: 'sec:Sha256HmacKey2019', | ||
SignOperation: 'sec:SignOperation', | ||
UnwrapKeyOperation: 'sec:UnwrapKeyOperation', | ||
VerifyOperation: 'sec:VerifyOperation', | ||
WrapKeyOperation: 'sec:WrapKeyOperation', | ||
X25519KeyAgreementKey2019: 'sec:X25519KeyAgreementKey2019', | ||
|
||
allowedAction: 'sec:allowedAction', | ||
assertionMethod: { | ||
'@id': 'sec:assertionMethod', | ||
'@type': '@id', | ||
'@container': '@set', | ||
}, | ||
authentication: { | ||
'@id': 'sec:authenticationMethod', | ||
'@type': '@id', | ||
'@container': '@set', | ||
}, | ||
capability: { '@id': 'sec:capability', '@type': '@id' }, | ||
capabilityAction: 'sec:capabilityAction', | ||
capabilityChain: { | ||
'@id': 'sec:capabilityChain', | ||
'@type': '@id', | ||
'@container': '@list', | ||
}, | ||
capabilityDelegation: { | ||
'@id': 'sec:capabilityDelegationMethod', | ||
'@type': '@id', | ||
'@container': '@set', | ||
}, | ||
capabilityInvocation: { | ||
'@id': 'sec:capabilityInvocationMethod', | ||
'@type': '@id', | ||
'@container': '@set', | ||
}, | ||
caveat: { '@id': 'sec:caveat', '@type': '@id', '@container': '@set' }, | ||
challenge: 'sec:challenge', | ||
ciphertext: 'sec:ciphertext', | ||
controller: { '@id': 'sec:controller', '@type': '@id' }, | ||
delegator: { '@id': 'sec:delegator', '@type': '@id' }, | ||
equihashParameterK: { | ||
'@id': 'sec:equihashParameterK', | ||
'@type': 'xsd:integer', | ||
}, | ||
equihashParameterN: { | ||
'@id': 'sec:equihashParameterN', | ||
'@type': 'xsd:integer', | ||
}, | ||
invocationTarget: { '@id': 'sec:invocationTarget', '@type': '@id' }, | ||
invoker: { '@id': 'sec:invoker', '@type': '@id' }, | ||
jws: 'sec:jws', | ||
keyAgreement: { | ||
'@id': 'sec:keyAgreementMethod', | ||
'@type': '@id', | ||
'@container': '@set', | ||
}, | ||
kmsModule: { '@id': 'sec:kmsModule' }, | ||
parentCapability: { '@id': 'sec:parentCapability', '@type': '@id' }, | ||
plaintext: 'sec:plaintext', | ||
proof: { '@id': 'sec:proof', '@type': '@id', '@container': '@graph' }, | ||
proofPurpose: { '@id': 'sec:proofPurpose', '@type': '@vocab' }, | ||
proofValue: 'sec:proofValue', | ||
referenceId: 'sec:referenceId', | ||
unwrappedKey: 'sec:unwrappedKey', | ||
verificationMethod: { '@id': 'sec:verificationMethod', '@type': '@id' }, | ||
verifyData: 'sec:verifyData', | ||
wrappedKey: 'sec:wrappedKey', | ||
}, | ||
], | ||
}, | ||
} |
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
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 |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
*/ | ||
|
||
export * from './DidDocumentExporter.js' | ||
export * from './DidContexts.js' |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also a URL tho, right? What about renaming them all to URI? Since the IPFS link is definitely not a URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually I think I wanted to name it "URL" bc last thing I heard was that the distinction IRI / URI / URL is being abandoned in favour of calling everything "URL". Why is an ipfs link not a URL? It does resolve and thus let you locate a resource, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I know, URL is only used for web resources.