Skip to main content
Version: next

@unirep/core

Classes

Type Aliases

Attestation

Ƭ Attestation: Object

Type to be used with a deployed Unirep contract object

Type declaration

NameType
changebigint
fieldIndexnumber

Defined in

packages/core/src/DataSchema.ts:26


SchemaField

Ƭ SchemaField: Object

Type describing each field in the user-defined schema. Schema field type must be a uint.

caution

Replacement field must be uint205

Example

const schema: SchemaField = {
name: 'posRep', // field name
type: 'uint64', // uint*
updatedBy: 'sum', // either update by adding or replacing user data
}

Type declaration

NameType
namestring
typestring
updateBy"sum" | "replace"

Defined in

packages/core/src/DataSchema.ts:17

Variables

schema

Const schema: TableData[]

UniRep needs to persist data in order to construct state and make proofs. To do this we use a generic database wrapper called anondb. This wrapper has support for desktop environment databases like SQLite, as well as the IndexedDB browser database.

@unirep/core ships a schema that should be used with the database. This schema can be extended by adding additional collections for application specific data storage.

See

http://developer.unirep.io/docs/core-api/schema

Example

import { schema } from '@unirep/core'
import { SQLiteConnector } from 'anondb/node'
import { IndexedDBConnector } from 'anondb/web'
// in nodejs
const db_mem = await SQLiteConnector.create(schema, ':memory:')
const db_storage = await SQLiteConnector.create(schema, 'db.sqlite')
// in browser
const db_browser = await IndexedDBConnector.create(schema)

Defined in

packages/core/src/schema.ts:144


userSchema

Const userSchema: TableData[]

UniRep needs to persist data in order to construct state and make proofs. To do this we use a generic database wrapper called anondb. This wrapper has support for desktop environment databases like SQLite, as well as the IndexedDB browser database.

@unirep/core ships a schema that should be used with the database. The user schema extends from a synchronizer schema, which securely stores private user data, including personal information and the latest transitioned epoch.

See

http://developer.unirep.io/docs/core-api/user-schema

Example

import { userSchema } from '@unirep/core'
import { SQLiteConnector } from 'anondb/node'
import { IndexedDBConnector } from 'anondb/web'
// in nodejs
const db_mem = await SQLiteConnector.create(userSchema, ':memory:')
const db_storage = await SQLiteConnector.create(userSchema, 'db.sqlite')
// in browser
const db_browser = await IndexedDBConnector.create(userSchema)

Defined in

packages/core/src/userSchema.ts:53