odyssey


License

License

MIT
Categories

Categories

Net
GroupId

GroupId

net.jtownson
ArtifactId

ArtifactId

odyssey_2.13
Last Version

Last Version

0.1.5
Release Date

Release Date

Type

Type

jar
Description

Description

odyssey
odyssey
Project URL

Project URL

https://github.com/jtownson/odyssey
Project Organization

Project Organization

odyssey
Source Code Management

Source Code Management

https://github.com/jtownson/odyssey

Download odyssey_2.13

How to add to project

<!-- https://jarcasting.com/artifacts/net.jtownson/odyssey_2.13/ -->
<dependency>
    <groupId>net.jtownson</groupId>
    <artifactId>odyssey_2.13</artifactId>
    <version>0.1.5</version>
</dependency>
// https://jarcasting.com/artifacts/net.jtownson/odyssey_2.13/
implementation 'net.jtownson:odyssey_2.13:0.1.5'
// https://jarcasting.com/artifacts/net.jtownson/odyssey_2.13/
implementation ("net.jtownson:odyssey_2.13:0.1.5")
'net.jtownson:odyssey_2.13:jar:0.1.5'
<dependency org="net.jtownson" name="odyssey_2.13" rev="0.1.5">
  <artifact name="odyssey_2.13" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.jtownson', module='odyssey_2.13', version='0.1.5')
)
libraryDependencies += "net.jtownson" % "odyssey_2.13" % "0.1.5"
[net.jtownson/odyssey_2.13 "0.1.5"]

Dependencies

compile (5)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.13.1
io.circe : circe-core_2.13 jar 0.12.3
io.circe : circe-generic_2.13 jar 0.12.3
io.circe : circe-parser_2.13 jar 0.12.3
com.github.scopt : scopt_2.13 jar 4.0.0-RC2

test (4)

Group / Artifact Type Version
org.bouncycastle : bcprov-jdk15on jar 1.62
org.bouncycastle : bcpkix-jdk15on jar 1.62
org.bitbucket.b_c : jose4j jar 0.7.0
org.scalatest : scalatest_2.13 jar 3.0.8

Project Modules

There are no modules declared in this project.

Odyssey

Odyssey is an implementation of the W3C verifiable credentials data model. It allows you to generate and parse/verify verifiable credentials.

The implementation is currently at an early stage and support is provided for the 'basic' w3c data model tests.

The library will generate and verify credentials using the JWTs signature scheme. It does not process embedded JSON-LD proofs (yet). More to come.

The w3c vc-test-suite is included as a submodule of this project. You can run the test suite against odyssey using the command sbt vctest.

Example usage

  import odyssey._
  import syntax._

  val (publicKeyRef, privateKey): (URI, PrivateKey) = KeyFoo.getKeyPair

  val vc = VC()
    .withAdditionalType("AddressCredential")
    .withAdditionalContext("https://www.w3.org/2018/credentials/examples/v1")
    .withId("https://www.postoffice.co.uk/addresses/1234")
    .withIssuer("https://www.postoffice.co.uk")
    .withIssuerAttributes("contact" -> "https://www.postoffice.co.uk/contact-us")
    .withIssuanceDate(LocalDate.of(2020, 1, 1).atStartOfDay())
    .withExpirationDate(LocalDate.of(2021, 1, 1).atStartOfDay())
    .withSubjectAttributes(
      "id" -> "did:ata:abc123",
      "name" -> "Her Majesty The Queen",
      "jobTitle" -> "Queen",
      "address" -> "Buckingham Palace, SW1A 1AA"
    )
    .withEs256Signature(publicKeyRef, privateKey)

  println(s"The public key reference for verification is $publicKeyRef")

  // To send it somewhere else, we will serialize
  // to JWS...
  val jws: String = vc.toJws.compactSerializion.futureValue

  println("Generated JWS for wire transfer: ")
  println(jws)

  // ... somewhere else, another app, another part of the system, we obtain the jws...
  val publicKeyResolver: PublicKeyResolver = (publicKeyRef: URI) =>
    Future.successful(KeyFoo.getPublicKeyFromRef(publicKeyRef))
  val verifier = new Es256Verifier(publicKeyResolver)

  val parseResult: VCDataModel = VCDataModel.fromJwsCompactSer(verifier, jws).futureValue

  println(s"Received dataset has a valid signature and decodes to the following dataset:")
  import net.jtownson.odyssey.impl.VCJsonCodec
  println(VCJsonCodec.vcJsonEncoder(parseResult).printWith(Printer.spaces2))

Project direction

The first steps for the project will be to fully support the credentials data model.

Next steps will be to provide better support for more signature and revocation schemes.

Building and Developing

Note, you need java 11.

Versions

Version
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0