Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const dataApiFactory = (accountMock: IAccountMock) => {
const time = () => new Date(Gun.state());
const rootGun: IGunInstance = new Gun({
localStorage: false,
radix: true,
});
const gun = rootGun.get('test');
// const account = gun.user();
const account: IGunAccountInstance = {
create(
username: string,
password: string,
callback?: (data: { wait?: boolean; err?: string; ok?: number; pub: string }) => void,
) {
return this;
},
auth(
export const dataApiFactory = (config: IApiOptions) => {
const { peers, rootdb } = config;
const time = () => new Date(Gun.state());
const rootGun: IGunInstance = new Gun({
peers,
});
const gun = rootGun.get(rootdb);
let account = rootGun.user();
const { encrypt, decrypt, work } = Gun.SEA;
// testing purposes
// @ts-ignore
window.gun = gun;
// @ts-ignore
window.user = account;
const context: IContext = {
import { NgModule, Injectable } from '@angular/core';
import Gun from 'gun/gun';
@Injectable()
export class GunDb {
readonly gun = Gun(location.origin + '/gun');
}
import { NgModule, Injectable } from '@angular/core';
import Gun from 'gun/gun';
@Injectable()
export class GunDb {
readonly gun = Gun(location.origin + '/gun');
}