Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cardcore/client

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cardcore/client - npm Package Compare versions

Comparing version 0.0.1-1f746c46 to 0.0.1-3ec581c3

dist/client-poll.js

49

dist/client-actions.js

@@ -12,2 +12,16 @@ "use strict";

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _clientPoll = require("./client-poll");
Object.keys(_clientPoll).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _clientPoll[key];
}
});
});
var _game = require("@cardcore/game");

@@ -17,3 +31,3 @@

var _ssbKeys = require("ssb-keys");
var _ssbKeys = require("@streamplace/ssb-keys");

@@ -208,6 +222,37 @@ var _ssbKeys2 = _interopRequireDefault(_ssbKeys);

var CLIENT_GENERATE_IDENTITY = exports.CLIENT_GENERATE_IDENTITY = "CLIENT_GENERATE_IDENTITY";
var CARDCORE_IDENTITY = "CARDCORE_IDENTITY";
var clientGenerateIdentity = exports.clientGenerateIdentity = function clientGenerateIdentity() {
var storage = void 0;
if ((typeof localStorage === "undefined" ? "undefined" : _typeof(localStorage)) === "object") {
storage = localStorage;
} else {
// noop i guess? idk this only happens in jsdom?
storage = {
getItem: function getItem() {
return null;
},
setItem: function setItem() {
return null;
},
removeItem: function removeItem() {
return null;
}
};
}
var keys = void 0;
if (storage.getItem(CARDCORE_IDENTITY)) {
try {
keys = JSON.parse(storage.getItem(CARDCORE_IDENTITY));
} catch (e) {
console.error("error parsing cardcore identity, clearing", e);
storage.removeItem(CARDCORE_IDENTITY);
}
}
if (!keys) {
keys = _ssbKeys2.default.generate();
storage.setItem(CARDCORE_IDENTITY, JSON.stringify(keys));
}
return {
type: CLIENT_GENERATE_IDENTITY,
keys: _ssbKeys2.default.generate()
keys: keys
};

@@ -214,0 +259,0 @@ };

@@ -29,3 +29,4 @@ "use strict";

keys: {},
started: false
started: false,
loadingState: true
};

@@ -83,2 +84,14 @@

if (action.type === clientActions.CLIENT_LOAD_STATE_START) {
return Object.assign({}, state, {
loadingState: true
});
}
if (action.type === clientActions.CLIENT_LOAD_STATE_DONE || action.type === actions.CREATE_GAME) {
return Object.assign({}, state, {
loadingState: false
});
}
if (action.type === actions.PLAY_CREATURE) {

@@ -85,0 +98,0 @@ return Object.assign({}, state, {

7

package.json
{
"name": "@cardcore/client",
"version": "0.0.1-1f746c46",
"version": "0.0.1-3ec581c3",
"description": "streamcards client",

@@ -13,3 +13,6 @@ "main": "dist/index.js",

},
"gitHead": "1f746c46c9911e36a1e9be89edf6da902e8ff20f"
"dependencies": {
"@streamplace/ssb-keys": "^7.0.16"
},
"gitHead": "3ec581c3f6f424e67d96dac06f7bcf5f3eb6f200"
}
import { playCreature } from "@cardcore/game";
import { traverseSecret, target as targetHelper } from "@cardcore/util";
import ssbKeys from "ssb-keys";
import ssbKeys from "@streamplace/ssb-keys";
export * from "./client-poll";
/**

@@ -109,6 +112,31 @@ * This file should contain web-specific actions extranious to the game state

export const CLIENT_GENERATE_IDENTITY = "CLIENT_GENERATE_IDENTITY";
const CARDCORE_IDENTITY = "CARDCORE_IDENTITY";
export const clientGenerateIdentity = () => {
let storage;
if (typeof localStorage === "object") {
storage = localStorage;
} else {
// noop i guess? idk this only happens in jsdom?
storage = {
getItem: () => null,
setItem: () => null,
removeItem: () => null
};
}
let keys;
if (storage.getItem(CARDCORE_IDENTITY)) {
try {
keys = JSON.parse(storage.getItem(CARDCORE_IDENTITY));
} catch (e) {
console.error("error parsing cardcore identity, clearing", e);
storage.removeItem(CARDCORE_IDENTITY);
}
}
if (!keys) {
keys = ssbKeys.generate();
storage.setItem(CARDCORE_IDENTITY, JSON.stringify(keys));
}
return {
type: CLIENT_GENERATE_IDENTITY,
keys: ssbKeys.generate()
keys
};

@@ -115,0 +143,0 @@ };

@@ -11,3 +11,4 @@ import * as actions from "@cardcore/game";

keys: {},
started: false
started: false,
loadingState: true
};

@@ -69,2 +70,19 @@

if (action.type === clientActions.CLIENT_LOAD_STATE_START) {
return {
...state,
loadingState: true
};
}
if (
action.type === clientActions.CLIENT_LOAD_STATE_DONE ||
action.type === actions.CREATE_GAME
) {
return {
...state,
loadingState: false
};
}
if (action.type === actions.PLAY_CREATURE) {

@@ -71,0 +89,0 @@ return {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc