{"id":18187965,"url":"https://github.com/alterx/gundb-expo-sqlite-adapter","last_synced_at":"2025-04-02T03:31:26.140Z","repository":{"id":57096884,"uuid":"398624070","full_name":"alterx/gundb-expo-sqlite-adapter","owner":"alterx","description":"An adapter that implements the RAD interface and writes to SQLite (expo-sqlite)","archived":false,"fork":false,"pushed_at":"2022-07-21T17:00:08.000Z","size":56,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-16T08:11:33.280Z","etag":null,"topics":["expo","expo-sqlite","gundb","sqlite"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alterx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-21T17:55:41.000Z","updated_at":"2024-03-22T05:19:47.000Z","dependencies_parsed_at":"2022-08-20T16:50:30.857Z","dependency_job_id":null,"html_url":"https://github.com/alterx/gundb-expo-sqlite-adapter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alterx%2Fgundb-expo-sqlite-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alterx%2Fgundb-expo-sqlite-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alterx%2Fgundb-expo-sqlite-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alterx%2Fgundb-expo-sqlite-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alterx","download_url":"https://codeload.github.com/alterx/gundb-expo-sqlite-adapter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246750895,"owners_count":20827800,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["expo","expo-sqlite","gundb","sqlite"],"created_at":"2024-11-03T02:04:12.059Z","updated_at":"2025-04-02T03:31:25.712Z","avatar_url":"https://github.com/alterx.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GunDB Expo SQLite Adapter\n\nThis is an adapter that implements the RAD interface and writes to SQLite (expo-sqlite)\n\n## Installing\n\nUse `pnpm`, `npm` or `yarn` to install the dependencies:\n\n```\n$ npm i @altrx/gundb-expo-sqlite-adapter\n```\n\n### Basic Usage:\n\nSee full example [here](https://github.com/alterx/gundb-expo-sqlite)\n\n```jsx harmony\nimport React, { useEffect, useState } from 'react';\nimport { StyleSheet, Text, TextInput, View, Button } from 'react-native';\nimport Constants from 'expo-constants';\nimport * as SQLite from 'expo-sqlite';\n\nimport WebviewCrypto from 'react-native-webview-crypto';\nimport { registerRootComponent } from 'expo';\n\nimport 'gun/lib/mobile'; // most important!\nimport Gun from 'gun/gun';\nimport SEA from 'gun/sea';\nimport 'gun/lib/promise';\nimport 'gun/lib/radix';\nimport 'gun/lib/radisk';\nimport 'gun/lib/store';\nimport { makeStoreAdapter } from '@altrx/gundb-expo-sqlite-adapter';\n\nmakeStoreAdapter(Gun);\nconst gun = new Gun({\n  localStorage: false,\n  radisk: true,\n  sqlite: {\n    SQLite,\n    databaseName: 'todo.db',\n    onOpen: () =\u003e {\n      console.log('DB OPENED');\n    },\n    onError: (err) =\u003e {\n      console.log('ERROR');\n    },\n    onReady: (err) =\u003e {\n      console.log('READY');\n    },\n  },\n});\n\nconst node = gun.get('hello');\n\nexport default function App() {\n  const [name, setName] = useState('');\n\n  useEffect(() =\u003e {\n    node.once((data, key) =\u003e {\n      let name = data?.name;\n      setName(name);\n    });\n\n    async function doWork() {\n      const workTest = await SEA.work('test', null, null, {\n        name: 'SHA-256',\n        encode: 'hex',\n      });\n      console.log(workTest);\n      const pair = await SEA.pair();\n      const other = await SEA.pair();\n      const msg = await SEA.sign('I wrote this message! You did not.', pair);\n      const test = await SEA.verify(msg, pair.pub); // message gets printed\n      const test2 = await SEA.verify(msg, other.pub); // error\n      console.log('No message', test2);\n      console.log('Message', test);\n\n      gun.on('auth', () =\u003e {\n        console.log('authenticated with keypair');\n      });\n\n      const namespace = gun.user();\n      namespace.auth(pair);\n    }\n    doWork();\n  }, []);\n\n  return (\n    \u003cView style={styles.container}\u003e\n      \u003cText style={styles.welcome}\u003eHello {name}\u003c/Text\u003e\n      \u003cWebviewCrypto /\u003e\n      \u003cView style={styles.flexRow}\u003e\n        \u003cTextInput\n          value={name}\n          onChangeText={(value) =\u003e setName(value)}\n          style={styles.input}\n        /\u003e\n      \u003c/View\u003e\n      \u003cButton\n        title=\"Save\"\n        onPress={() =\u003e {\n          node.put({ name });\n          setName(name);\n        }}\n      /\u003e\n    \u003c/View\u003e\n  );\n}\n\nconst styles = StyleSheet.create({\n  container: {\n    backgroundColor: '#fff',\n    flex: 1,\n    paddingTop: Constants.statusBarHeight,\n  },\n  welcome: {\n    fontSize: 20,\n    fontWeight: 'bold',\n    textAlign: 'center',\n  },\n  flexRow: {\n    flexDirection: 'row',\n  },\n  input: {\n    borderColor: '#4630eb',\n    borderRadius: 4,\n    borderWidth: 1,\n    flex: 1,\n    height: 48,\n    margin: 16,\n    padding: 8,\n  },\n});\n\nregisterRootComponent(App);\n\n```\n\n## License\n\nLicensed under [MIT](https://github.com/alterx/gundb-expo-sqlite-adapter/blob/master/LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falterx%2Fgundb-expo-sqlite-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falterx%2Fgundb-expo-sqlite-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falterx%2Fgundb-expo-sqlite-adapter/lists"}