npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sicpa_open_source/didcomm-react-native

v0.0.21

Published

React Native wrapper for DIDComm v2

Downloads

17

Readme

DIDComm React Native

License

Basic DIDComm v2 support for React Native framework (Android and iOS).

Under the hood

This package is React Native wrapper using DIDComm JVM library for Android and DIDComm Swift for iOS. It contains native modules that are using native libraries API and exposes Javascript/Typescript API using React Native bridge.

Design documentation for complex parts of implementation can be found in docs folder.

Usage

Install from npm:

npm install @sicpa_open_source/didcomm-react-native

If you need to use this package in another RN library:

  • Please see: https://github.com/callstack/react-native-builder-bob#how-do-i-add-a-react-native-library-containing-native-code-as-a-dependency-in-my-library
  • Note that you need to add this package as end application dependency in order to make native modules work

Add following DIDComm resolvers initialization code to your App (it's a workaround that will be removed later):

import { NativeModules, NativeEventEmitter } from 'react-native'
import { useEffect } from 'react'
import { DIDCommResolversProxy } from "@sicpa_open_source/didcomm-react-native"

const { DIDCommResolversProxyModule } = NativeModules

export default function App() {

    useEffect(() => {
        const nativeEventEmitter = new NativeEventEmitter(DIDCommResolversProxyModule)
        DIDCommResolversProxy.start(nativeEventEmitter)
        return () => DIDCommResolversProxy.stop()
    },[])


    return ...
}

A general usage of the API is the following:

  • Sender Side:
    • Build a Message (plaintext, payload).
    • Convert a message to a DIDComm Message for further transporting by calling one of the following:
      • Message.pack_encrypted to build an Encrypted DIDComm message
      • Message.pack_signed to build a Signed DIDComm message
      • Message.pack_plaintext to build a Plaintext DIDComm message
  • Receiver side:
    • Call Message.unpack on receiver side that will decrypt the message, verify signature if needed and return a Message for further processing on the application level.

Run demo

Android

yarn bootstrap
yarn demo android

iOS

On Intel Mac:

yarn bootstrap
cd ./demo/ios && pod install && cd ./../..
yarn demo ios

On M1 Mac:

yarn bootstrap
cd ./demo/ios && arch -x86_64 pod install && cd ./../..
arch -x86_64 yarn demo ios

Publishing new version

Manually bump package version in package.json file. The package will be published automatically from main branch by GitHub Actions.

Common issues

Duplicate class errors related to com.google.crypto.tink

  • Error message:

    > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
    > Duplicate class com.google.crypto.tink.Aead found in modules jetified-tink-1.6.1 (com.google.crypto.tink:tink:1.6.1) and jetified-tink-android-1.5.0 (com.google.crypto.tink:tink-android:1.5.0)
     Duplicate class com.google.crypto.tink.BinaryKeysetReader found in modules jetified-tink-1.6.1 (com.google.crypto.tink:tink:1.6.1) and jetified-tink-android-1.5.0 (com.google.crypto.tink:tink-android:1.5.0)
     Duplicate class com.google.crypto.tink.BinaryKeysetWriter found in modules jetified-tink-1.6.1 (com.google.crypto.tink:tink:1.6.1) and jetified-tink-android-1.5.0 (com.google.crypto.tink:tink-android:1.5.0)
  • Solution: Exclude com.google.crypto.tink:tink module from library native package using gradle configuration

    implementation (project(":sicpa-dlab_didcomm-react-native")) {
        exclude(group: "com.google.crypto.tink", module: "tink")
    }