Code Monkey home page Code Monkey logo

sdk's Introduction

Trinsic SDK

Status

Production

Dart .NET Go Java Python Rust TypeScript

Development / Build

Dart .NET Go Java Python Rust TypeScript

Library is available for use with different languages

Go Java Nuget npm PyPI Rust Swift

Introduction

Welcome to Trinsic, the proof-of-anything platform. We are the leading developer platform for implementing verifiable credentials and decentralized identifiers - emerging web standards for building next-gen digital identity systems.

Learn how to issue and verify universally-accepted digital credentials so that anywhere people go online or in-person, they can simply tap their phone, prove who they are, and get what they need.

Getting Started

Check our documentation to learn about Trinsic, work through a basic implementation, plan a full integration, and learn about our tools you can use.

Example Implementations

Check out our dedicated repository with various examples and use cases for different platforms and languages.

Available SDKs

Updating Proto-Generated Files

There is a python script which does the proto file generation for all languages (except dotnet and rust) in the devops folder. dotnet and rust are handled well by their respective build systems. You will need all language-specific plugins configured on your machine.

Stats

Alt

sdk's People

Contributors

artemijspavlovs avatar chiarapaskulin avatar d1str0 avatar dependabot[bot] avatar dududko avatar fundthmcalculus avatar geel9 avatar github-actions[bot] avatar hmac512 avatar janpieterz avatar jovicakuzmanoski avatar kandarej avatar lanceattrinsic avatar lucasamonrc avatar mdbe avatar mewmba avatar michaeldboyd avatar michaeledwardblack avatar renovate[bot] avatar rileyphughes avatar romanlevin avatar sethjback avatar srehorn avatar steventcramer avatar tmarkovski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sdk's Issues

Python SDK

Objective

Expand support of Okapi and Trinsic SDK for Python.

Solution

This port should leverage the Okapi stack and gRPC tools for Python as the foundation of the library. The effort required can be roughly separated in two phases:

  • Python support for Okapi
  • Python support for Trinsic SDK

The library should follow naming guidelines established by existing libraries, but in a way that's idiomatic to Python.

Tracking Effort

  • Python wrapper for Okapi - this wrapper should deliver functionality that will allow Okapi to be used in Python on any platform. Initial work has been started using the old library name "didcomm-grpc". Okapi uses Protobuf as data contract for the the FFI layer, but does not use any gRPC functionality. This library will invoke existing native library built in Rust.
    • Basic Unit tests - generate key, sign message, etc. trinsic-id/okapi#50
    • Build Pipeline - provide GH action that builds and run the tests trinsic-id/okapi#53
    • Package Publishing - GH action that publishes packages to PyPI. This action should be a separate job in the exist build pipeline. It should trigger from a release event (already setup) and use the build native libraries (windows, linux, macos) to provide support for all platforms
  • Trinsic SDK - leverages Okapi as main dependency and builds support for profile management and gRPC service invocation.
    • Basic unit tests - these tests should be runnable manually against a running ecosystem stack. Currently, we run the locally against localhost, but soon we will be able to run the tests as part of CI. For this purpose, tests should be parametrized and accept Ecosystem Server URL.
    • Build Pipeline - provide GH action that builds and run the tests
    • Package Publishing - GH action that publishes packages to PyPI.
  • Release github action to deploy to PyPI.

Credentials and Proofs are returned from CLI wrapped in "json" : "JsonStruct": {...}

The issue and generate-proofcommands that wrap the returned json objects for signed credentials and generated proofs in "json": "JsonStruct": {...}. Because of this new data model, if a user inserts the vaccination-certificate-signed.json directly into their wallet without first editing the json, the generate-proof command will throw an error unless the signed credential is first manually taken out of the json objects it's wrapped by.

Loom video of repro steps: https://www.loom.com/share/836992da7801493ba0186018be66641e

Example of output of issue command:

"json": {
    "JsonStruct": {
      "proof": {
        "type": "BbsBlsSignature2020",
        "created": "2021-11-21T21:10:46Z",
        "verificationMethod": "did:key:z5TcFNEkpGAHjoJydEGLXKgkzXgJdFGtUKHwNKNmi8xwnd8sAmfFGnLoyhy5EG1v9Y9Y5rV9cKHdTDzm4ozQ32iS5znt5vx5FqtwRKTX8at2x1ZKHMfsEME9jT62k4g1dPPmW3R71s7pqkPQMG9dScv65escSv3Ki8fG3HSmZ4JQrbSGjNRLG5nGc1pBqvUmxXVbhzWfT#zUC74ou5VcpG4Mag9t6iU9Cpt1T3X7WnHzxefd9QYeBhsD5qT7HREjrLNfTjQCed2QuiN7M1HJW1x6ynrxhnxgHytW9375xJ8MuyGyyxJAVCxbCGQPZ5LVWtKmZtZJNP55hPGDo",
        "proofPurpose": "assertionMethod",
        "proofValue": "hNDZ2Pp/CS4cBW1bpNZa1FybVxPAGIRjy4i1oRhAVFsEIq82GNxuJXK96iMsBOahGcP2ZgEemW1VF+KqxBWAmf3NVI+Jl5/iisnWjfeUKA0mxmR4aV6eZW6dLqwQ3OW45LwoClX3ERVPXjryOuDEJg=="
      },
      "issuer": "did:key:zUC724vuGvHpnCGFG1qqpXb81SiBLu3KLSqVzenwEZNPoY35i2Bscb8DLaVwHvRFs6F2NkNNXRcPWvqnPDUd9ukdjLkjZd3u9zzL4wDZDUpkPAatLDGLEYVo8kkAzuAKJQMr7N2",
      "type": [
        "VaccinationCertificate",
        "VerifiableCredential"
      ],
      "description": "COVID-19 Vaccination Certificate",
      "issuanceDate": "2019-12-03T12:19:52Z",
      "@context": [
        "https://www.w3.org/2018/credentials/v1",
        "https://w3id.org/vaccination/v1",
        "https://w3id.org/security/bbs/v1"
      ],
      "credentialSubject": {
        "batchNumber": "1183738569",
        "countryOfVaccination": "US",
        "type": "VaccinationEvent",
        "id": "urn:uuid:c53e70f8-ce9a-4576-8744-e5f85c20a743"
      },
      "name": "COVID-19 Vaccination Certificate",
      "expirationDate": "2029-12-03T12:19:52Z",
      "id": "urn:uvci:af5vshde843jf831j128fj"
    }
  }
}

Example of output from generate-proof command

{
  "json": {
    "JsonStruct": {
      "credentialSubject": {
        "id": "urn:uuid:c53e70f8-ce9a-4576-8744-e5f85c20a743",
        "countryOfVaccination": "US",
        "type": "VaccinationEvent",
        "batchNumber": "1183738569"
      },
      "id": "urn:uvci:af5vshde843jf831j128fj",
      "@context": [
        "https://www.w3.org/2018/credentials/v1",
        "https://w3id.org/vaccination/v1",
        "https://w3id.org/security/bbs/v1"
      ],
      "proof": {
        "verificationMethod": "did:key:z5TcFNEkpGAHjoJydEGLXKgkzXgJdFGtUKHwNKNmi8xwnd8sAmfFGnLoyhy5EG1v9Y9Y5rV9cKHdTDzm4ozQ32iS5znt5vx5FqtwRKTX8at2x1ZKHMfsEME9jT62k4g1dPPmW3R71s7pqkPQMG9dScv65escSv3Ki8fG3HSmZ4JQrbSGjNRLG5nGc1pBqvUmxXVbhzWfT#zUC74ou5VcpG4Mag9t6iU9Cpt1T3X7WnHzxefd9QYeBhsD5qT7HREjrLNfTjQCed2QuiN7M1HJW1x6ynrxhnxgHytW9375xJ8MuyGyyxJAVCxbCGQPZ5LVWtKmZtZJNP55hPGDo",
        "nonce": "7XacY2OnNJTEncXRc0eWHG4qChwaFNA/VamhzvZ73mbTQVu8h/FKQ44v2kei9s5Ca+8=",
        "type": "BbsBlsSignatureProof2020",
        "created": "2021-11-21T21:10:46Z",
        "proofPurpose": "assertionMethod",
        "proofValue": "AA9Of4QhOXGFDNWP3Ty+oDKDJUKxDOjo+oqvD4mOQ+RiTn8T3JROwtOpksfqDi7c4L12VowE3yGJPzRjZvo11gDA4XcqDp3PmxVd3Nmbergu+U3fberVR7M1fUaQPyIqiQPL9aUHlBhcX219a795+GLyQFKh1nHEOS3rSfaXBi0E4llxKdauo/ST1JEaMB2rW/VbygAAAHSXzUu/auqtTatF7qKILH5T+7DkjmaqG0EZ3RF5fsq36vGAQ7FSfRT220D9xBEOipgAAAACbViLwIv62Qk0zSeXz2xFt8vDIdB14nl3U/z46x5YLwhEju3JL2xuMxkqMBrneLQ4ts8vJR9eIK9ItfSC0ZG9b4NTE/meAKbXUNMTaFF5b/aC0u1R0/CC8i8O2YMh3aFLq+OlfhlETdtHxD/TtWaGUgAAAAZz3IrNTpUKV9Ae6wE+TKDHHtqfMI0cSXDDh/EgG0HwXh6vidOHQsarqYGv9PqRHL73E7PzglAVzuAMN4anpyplBPDGJ5vfcXtzb/3k4uTpAnM0jZ1tn87BC/MwoDVzeu5jmkk2wUvC1NpFTy2DQl2uX6WCH8qgskHW0qEIXBFKQGEOSfdl2fh5iDxixdk8Rf1b1bh98b4j6g026PS74iw8C1tghnAgLB3fSaOpJMZnHcSDb1FAWvKO9hj/YQgNhxo="
      },
      "issuer": "did:key:zUC724vuGvHpnCGFG1qqpXb81SiBLu3KLSqVzenwEZNPoY35i2Bscb8DLaVwHvRFs6F2NkNNXRcPWvqnPDUd9ukdjLkjZd3u9zzL4wDZDUpkPAatLDGLEYVo8kkAzuAKJQMr7N2",
      "type": [
        "VaccinationCertificate",
        "VerifiableCredential"
      ]
    }
  }
} 

Expected Behavior
Credentials and Proofs are returned as the top level json object

Add missing CLI calls

  • All the credential template calls are missing from the CLI
  • the register-egf call is also missing

Use production endpoints as default in SDK

Updates required for all SDK

  • Change default endpoint to prod.trinsic.cloud:443 with TLS support
    • Node
    • Browser
    • Python #184
    • Go #200
    • NET
    • Swift
    • Java #187
    • Android - covered by Java already
    • Ruby

Additionally, it is recommended that SDKs take a configuration object/struct/map with fields to override defaults. The fields required with this effort are:

  • endpoint - the gRPC endpoint to use in format server:port. If required by the SDK, it should be reformatted internally to https://server:port.
  • use_tls - boolean indicating if TLS should be used. Default value is true`

Android Onboarding

  • Sample application link sdk-examples repo
  • How to download okapi native binaries
  • Walkthrough of server and okapi

CLI --profile-default doesn't work

  • --profile-default doesn't seem to be implemented. A new profile, when set with the command, doesn't change the default in config.toml

Github Action & Package for Go

We need a build and test action for golang services.

  • Release go okapi
  • ?Package the okapi binaries? - NO, readme tells how to download
  • ?Automatic download via python script (since golang is compiled)? - out of scope
  • Unit test
  • Release go services

SDK Delivery

Deliver SDKs in all possible languages - this ticket should be an epic

Fix bug reported by Roman Levin

Discussion in slack channel.
https://app.slack.com/client/T01KP3XHJ68/C02C05JQC3Y/thread/C02C05JQC3Y-1632222814.003700

package main
​
import (
	"fmt"
​
	sdk "github.com/trinsic-id/sdk/go/proto"
	trinsic "github.com/trinsic-id/sdk/go/services"
)
​
const serviceAddress = "http://trinsic-staging.centralus.azurecontainer.io:5000/"
​
func main() {
	walletService, err := trinsic.CreateWalletService(serviceAddress, nil)
	if err != nil {
		panic(err)
	}
	fmt.Printf("%+v\n", walletService)
	wallet, err := walletService.CreateWallet("")
	if err != nil {
		fmt.Printf("%+v\n", err)
	} else {
		fmt.Printf("%+v\n", wallet)
	}
	providerService, err := trinsic.CreateProviderService(serviceAddress, nil)
	if err != nil {
		panic(err)
	}
	inviteResponse, err := providerService.InviteParticipant(&sdk.InviteRequest{
		Participant: sdk.ParticipantType_participant_type_individual,
		Description: "I dunno",
		ContactMethod: &sdk.InviteRequest_Email{
			Email: "[email protected]",
		},
	})
	if err != nil {
		panic(err)
	}
	fmt.Printf("%+v\n", inviteResponse)
}

CLI Packages

  • Package Support
    • Homebrew for Mac
    • Chocolatey for Windows
    • Cargo for Rustup
    • (descoped) apt-get for Linux

Java Onboarding

As a new user I can

  • Follow steps to download a sample Android application with Trinsic's SDK added and get it running #220
  • Follow steps on how to add Trinsic's java SDK to my Maven and/or Gradle toolchain in my project
  • Follow steps to run a demo application that goes through the walkthrough

Go SDK WalletService when using multiple wallets

A question about the intended use pattern of WalletService in the Go SDK. In a multi-wallet environment, a single WalletService is not thread-safe because in the below case

thread1:
  service.SetProfile(profileA)
  service.IssueCredential(documentA)
thread2:
  service.SetProfile(profileB)
  service.IssueCredential(documentB)

we can’t guarantee that each document is signed by the intended wallet.

In general this is an unusual pattern in Go, but assuming that’s necessary, the obvious solution is to create a WalletService for each wallet we’re working with.

However, from what I can see, each call to CreateWalletService creates a new gRPC connection, unless an existing *grpc.ClientConn is passed in. Creating a connection for each wallet object is not a great idea because it’s going to be very easy to reach a connection limit somewhere.

Is the intended use-pattern here to create a single *grpc.ClientConn and pass it to every call of CreateWalletService ?

Is there a reason why WalletService doesn’t take a WalletProfile for each API call? That would avoid the issue.

Also, under the hood, CreateChannelIfNeeded uses context.Background() (by calling grpc.Dial instead of accepting a context from the user and using grpc.DialContext which I’m not sure is a good idea in a library.

Node sdk does not get built before publishing to npm

Describe the bug
npm sdk not building before getting released to npm.

To Reproduce
Steps to reproduce the behavior:

  1. mkdir test-npm && cd test-npm; npm init && npm i @trinsic/trinsic
  2. add const trinsic = require('@trinsic/trinsic'); to the top of the index.js
  3. npm run
    notice how the module does not get imported. Inspecting the node_module shows that there is no ./dist directory
    image

Expected behavior
build before publishing. successfully import
SDK (or CLI) you are using

  • SDK: node

Additional context
Add any other context about the problem here or remove this section

Parse url with IP Addresses correctly

Describe the bug
#156
Fails on http://20.75.134.127:80
We should allow parsing of IP addresses, not error out. We should still warn if we don't provide an explicit port.

Golang better error handling

We need to handle golang errors better than just system panic for everything. Most will not be recoverable errors, but we should still allow the client to gracefully handle it.

  • Okapi
  • Services

Generic error is thrown when trying to create a wallet with a security code from an invitation

A generic error is thrown when trying to create a wallet with a security code from an invitation. I do receive the email with the same security code that is also in the inviteResponse.InvitationId. I have tried with the same provider wallet and also with a new provider wallet.

To Reproduce
Steps to reproduce the behavior:
image
image

Expected behavior
The wallet should be created for the user that has been invited without an error.

SDK (or CLI) you are using

  • SDK: .NET
  • Version: 1.0.1
  • OS: Windows

Python SDK Documentation

Python - @michaeldboyd

  • By Sept 20th - Documentation - update existing documentation with snippets, walkthrough additions and anything specific to Python that users should be directed #125
  • By Sept 20th - Samples - provide basic usage for working with wallet and managing profiles. Use citizenship or vaccination vocabulary for sample credentials to work with. #125
  • By Sept 20th - Reference server in Python
  • Repl.it example

Complete resources for SDK

C#

  • repl.it app for demos
  • Dogfood of C#
  • Feedback on reference section
    JS
  • reference app
  • Dogfood of Javascript

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.