Wrapper for Nodejs and React Native around Anoncreds RS
This library requires (and has been tested extensively with) Node.js version 18.x. Newer versions might also work, but they have not been tested.
yarn add @hyperledger/anoncreds-nodejs
# or
yarn add @hyperledger/anoncreds-react-nativeYou can import all types and classes from the @hyperledger/anoncreds-nodejs or @hyperledger/anoncreds-react-native library:
import { Schema } from '@hyperledger/anoncreds-nodejs'
const schema = Schema.create({
name: 'test',
version: '1.0',
issuerId: 'mock:uri',
attributeNames: ['name', 'age', 'address']
})
// JSON representation
const schemaJson = schema.toJson()
// This can be used as a deconstructor to clear the internal reference to
// the anoncreds object
schema.handle.clear()Note: If you want to use this library in a cross-platform environment you need to import methods from the
@hyperledger/anoncreds-sharedpackage instead. This is a platform independent package that allows to register the native bindings. The@hyperledger/anoncreds-nodejspackage uses this package under the hood. See the Anoncreds Shared README for documentation on how to use this package.
The JavaScript wrapper is versioned independently from the native bindings. The following table shows the compatibility between the different versions:
| Anoncreds | JavaScript Wrapper |
|---|---|
| v0.2.x | v0.3.x |