.NET Core implementation of Linked Data Proofs. This includes complete set of feature for the below specifications:
- Linked Data Proofs 1.0
- Authorization Capabilities for Linked Data v0.3
- Decentralized Identifiers (DIDs) v1.0
- Verifiable Credentials Data Model 1.0
Using Nuget, the following packages are available
- LinkedDataProofs
- LinkedDataProofs.Bbs
- LinkedDataProofs.Zcaps
To understand different use case, the best place is to explore the tests found under Tests directory.
To create new linked data proof, use the static methods in the LdSignatures
class.
// an example document to sign
var document = JObject.Parse(@"{
'id': 'Alice'
}");
// signer key
var key = Ed25519VerificationKey2018.Generate();
// create proof
var signedDocument = await LdSignatures.SignAsync(
document,
new ProofOptions
{
Suite = new Ed25519Signature2018
{
Signer = key,
VerificationMethod = key.Id
},
Purpose = new AssertionMethodPurpose()
});
This will create a proof and return the fully signed document
{
"id": "Alice",
"proof": {
"type": "Ed25519Signature2018",
"created": "2021-02-28T22:43:43",
"verificationMethod": "#key-1",
"proofPurpose": "assertionMethod",
"jws": "eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..P8VSTUDCxaSHztIbFEGkwqn+KAbEQwGxvhNsqxgnCNJ/BnP7PDTJffHcielev2D7nRP9QK1wdXbkJvMmvumQCQ=="
}
}
To verify a proof, use the LdSignatures.VerifyAsync
method with the input document and the required suite.
var verifyResult = await LdSignatures.VerifyAsync(
signedDocument,
new ProofOptions
{
Suite = new Ed25519Signature2018(),
Purpose = new AssertionMethodPurpose()
});