Skip to content

idpass/react-native-vc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

f00612f · Jun 8, 2022

History

8 Commits
Jan 12, 2022
Jan 12, 2022
Jan 12, 2022
Jan 12, 2022
Jan 12, 2022
Jan 12, 2022
Jan 12, 2022
Jan 12, 2022
Jan 12, 2022
Jan 12, 2022
Jan 12, 2022
Jan 12, 2022
Jan 12, 2022
Jun 8, 2022
Jan 12, 2022
Jan 12, 2022
Jan 12, 2022
Jan 12, 2022
Jan 12, 2022

Repository files navigation

react-native-vc

React Native component to verify the signature of a JWT string representation of a Verifiable Credential.

Installation

npm install react-native-vc

Usage

import { verifySignature } from "react-native-vc";

// ...

const isValid = verifySignature(jwtStr);

See complete React Native sample in https://github.com/idpass/react-native-vc/tree/main/example/src

How to construct the JWT string from a Verifiable Credential (VC) in JSON format

With an existing sample VC stored as a file, do:

const fs = require('fs')
const vc = fs.readFileSync('filename.json')
const vcJson = JSON.parse(vc)
var parts = vcJson.event.data.proof.signature.split('.')
const jwtStr = parts[0] + '.' + vcJson.event.data.credential + '.' + parts[2]

// Then verify the signature of jwtStr
var isValid = verifySignature(jwtStr) 

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT