Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/msporny/pfps-ldp-example
https://github.com/msporny/pfps-ldp-example
Last synced: 2 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/msporny/pfps-ldp-example
- Owner: msporny
- License: bsd-3-clause
- Created: 2021-05-27T01:28:16.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-05-30T21:37:44.000Z (over 3 years ago)
- Last Synced: 2024-11-09T05:39:15.287Z (about 2 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# An Example of LDP for PFPS
This is an artisanal example of Linked Data Proofs for PFPS.
# Quickstart
```
npm i
node index.js
```# Usage
To sign a Linked Data document in a way consistent with https://w3c-ccg.github.io/ld-proofs/#proof-algorithm do the following:
1. Modify `unsignedData` in index.js to be a valid JSON-LD document ensuring the @context is valid for the data being signed (e.g., all terms defined).
2. If you want to modify the signing key, modify `mockKeyPair2020` in `mock-data.js`.
3. Set `controller` in `mock-data.js` to a URI that identifies the controller (aka owner) of the key material.
4. Set `suite.date` to a valid ISO8601 datetime.To verify, pass the `signedData` to `jsigs.verify` and print the result, which will contain a variety of verified information.
## Example Output
```
-------------- UNSIGNED DATA ---------------
{
"@context": {
"title": "https://schema.org#title"
},
"title": "Hello world!"
}-------------- NQUADS ---------------
_:b0 "Hello world!" .-------------- CANONICALIZED NQUADS ---------------
_:c14n0 "Hello world!" .-------------- SIGN ---------------
{
"@context": [
{
"title": "https://schema.org#title"
},
"https://w3id.org/security/suites/ed25519-2020/v1"
],
"title": "Hello world!",
"proof": {
"type": "Ed25519Signature2020",
"created": "2021-05-29T19:23:24Z",
"verificationMethod": "https://pfps.example/issuer#z6MkjLrk3gKS2nnkeWcmcxiZPGskmesDpuwRBorgHxUXfxnG",
"proofPurpose": "assertionMethod",
"proofValue": "z4oey5q2M3XKaxup3tmzN4DRFTLVqpLMweBrSxMY2xHX5XTYVQeVbY8nQAVHMrXFkXJpmEcqdoDwLWxaqA3Q1geV6"
}
}-------------- CANONICALIZED SIGNED NQUADS ---------------
_:c14n0 "2021-05-29T19:23:24Z"^^ _:c14n2 .
_:c14n0 _:c14n2 .
_:c14n0 _:c14n2 .
_:c14n0 "z4oey5q2M3XKaxup3tmzN4DRFTLVqpLMweBrSxMY2xHX5XTYVQeVbY8nQAVHMrXFkXJpmEcqdoDwLWxaqA3Q1geV6"^^ _:c14n2 .
_:c14n0 _:c14n2 .
_:c14n1 "Hello world!" .
_:c14n1 _:c14n2 .-------------- VERIFY ---------------
{
"verified": true,
"results": [
{
"proof": {
"@context": [
{
"title": "https://schema.org#title"
},
"https://w3id.org/security/suites/ed25519-2020/v1"
],
"type": "Ed25519Signature2020",
"created": "2021-05-29T19:23:24Z",
"verificationMethod": "https://pfps.example/issuer#z6MkjLrk3gKS2nnkeWcmcxiZPGskmesDpuwRBorgHxUXfxnG",
"proofPurpose": "assertionMethod",
"proofValue": "z4oey5q2M3XKaxup3tmzN4DRFTLVqpLMweBrSxMY2xHX5XTYVQeVbY8nQAVHMrXFkXJpmEcqdoDwLWxaqA3Q1geV6"
},
"verified": true,
"purposeResult": {
"valid": true,
"controller": {
"@context": "https://w3id.org/security/v2",
"id": "https://pfps.example/issuer",
"assertionMethod": [
"https://pfps.example/issuer#z6MkjLrk3gKS2nnkeWcmcxiZPGskmesDpuwRBorgHxUXfxnG"
]
}
}
}
]
}
```