Socket
Socket
Sign inDemoInstall

@holochain/client

Package Overview
Dependencies
Maintainers
13
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@holochain/client - npm Package Compare versions

Comparing version 0.16.6 to 0.16.7

lib/utils/hash-parts.d.ts

12

lib/utils/fake-hash.d.ts

@@ -7,2 +7,3 @@ import { DnaHash, ActionHash, AgentPubKey, EntryHash } from "../types.js";

*
* @param coreByte - Optionally specify a byte to repeat for all core 32 bytes. If undefined will generate random core 32 bytes.
* @returns An {@link EntryHash}.

@@ -12,6 +13,7 @@ *

*/
export declare function fakeEntryHash(): Promise<EntryHash>;
export declare function fakeEntryHash(coreByte?: number | undefined): Promise<EntryHash>;
/**
* Generate a valid agent key of a non-existing agent.
*
* @param coreByte - Optionally specify a byte to repeat for all core 32 bytes. If undefined will generate random core 32 bytes.
* @returns An {@link AgentPubKey}.

@@ -21,6 +23,7 @@ *

*/
export declare function fakeAgentPubKey(): Promise<AgentPubKey>;
export declare function fakeAgentPubKey(coreByte?: number | undefined): Promise<AgentPubKey>;
/**
* Generate a valid hash of a non-existing action.
*
* @param coreByte - Optionally specify a byte to repeat for all core 32 bytes. If undefined will generate random core 32 bytes.
* @returns An {@link ActionHash}.

@@ -30,6 +33,7 @@ *

*/
export declare function fakeActionHash(): Promise<ActionHash>;
export declare function fakeActionHash(coreByte?: number | undefined): Promise<ActionHash>;
/**
* Generate a valid hash of a non-existing DNA.
*
* @param coreByte - Optionally specify a byte to repeat for all core 32 bytes. If undefined will generate random core 32 bytes.
* @returns A {@link DnaHash}.

@@ -39,2 +43,2 @@ *

*/
export declare function fakeDnaHash(): Promise<DnaHash>;
export declare function fakeDnaHash(coreByte?: number | undefined): Promise<DnaHash>;

@@ -0,2 +1,15 @@

import { range } from "lodash-es";
import { randomByteArray } from "../api/zome-call-signing.js";
import { dhtLocationFrom32 } from "./hash-parts.js";
async function fakeValidHash(prefix, coreByte) {
let core;
if (coreByte === undefined) {
core = await randomByteArray(32);
}
else {
core = Uint8Array.from(range(0, 32).map(() => coreByte));
}
const checksum = dhtLocationFrom32(core);
return new Uint8Array([...prefix, ...core, ...Array.from(checksum)]);
}
/**

@@ -7,2 +20,3 @@ * Generate a valid hash of a non-existing entry.

*
* @param coreByte - Optionally specify a byte to repeat for all core 32 bytes. If undefined will generate random core 32 bytes.
* @returns An {@link EntryHash}.

@@ -12,5 +26,4 @@ *

*/
export async function fakeEntryHash() {
const randomBytes = await randomByteArray(36);
return new Uint8Array([0x84, 0x21, 0x24, ...randomBytes]);
export async function fakeEntryHash(coreByte = undefined) {
return fakeValidHash([0x84, 0x21, 0x24], coreByte);
}

@@ -20,2 +33,3 @@ /**

*
* @param coreByte - Optionally specify a byte to repeat for all core 32 bytes. If undefined will generate random core 32 bytes.
* @returns An {@link AgentPubKey}.

@@ -25,5 +39,4 @@ *

*/
export async function fakeAgentPubKey() {
const randomBytes = await randomByteArray(36);
return new Uint8Array([0x84, 0x20, 0x24, ...randomBytes]);
export async function fakeAgentPubKey(coreByte = undefined) {
return fakeValidHash([0x84, 0x20, 0x24], coreByte);
}

@@ -33,2 +46,3 @@ /**

*
* @param coreByte - Optionally specify a byte to repeat for all core 32 bytes. If undefined will generate random core 32 bytes.
* @returns An {@link ActionHash}.

@@ -38,5 +52,4 @@ *

*/
export async function fakeActionHash() {
const randomBytes = await randomByteArray(36);
return new Uint8Array([0x84, 0x29, 0x24, ...randomBytes]);
export async function fakeActionHash(coreByte = undefined) {
return fakeValidHash([0x84, 0x29, 0x24], coreByte);
}

@@ -46,2 +59,3 @@ /**

*
* @param coreByte - Optionally specify a byte to repeat for all core 32 bytes. If undefined will generate random core 32 bytes.
* @returns A {@link DnaHash}.

@@ -51,5 +65,4 @@ *

*/
export async function fakeDnaHash() {
const randomBytes = await randomByteArray(36);
return new Uint8Array([0x84, 0x2d, 0x24, ...randomBytes]);
export async function fakeDnaHash(coreByte = undefined) {
return fakeValidHash([0x84, 0x2d, 0x24], coreByte);
}
export * from "./base64.js";
export * from "./fake-hash.js";
export * from "./hash-parts.js";
export * from "./base64.js";
export * from "./fake-hash.js";
export * from "./hash-parts.js";
{
"name": "@holochain/client",
"version": "0.16.6",
"version": "0.16.7",
"description": "A JavaScript client for the Holochain Conductor API",

@@ -36,2 +36,3 @@ "author": "Holochain Foundation <info@holochain.org> (http://holochain.org)",

"test:app-agent": "RUST_LOG=error RUST_BACKTRACE=1 node --loader ts-node/esm test/e2e/app-agent-websocket.ts",
"test:utils": "RUST_LOG=error RUST_BACKTRACE=1 node --loader ts-node/esm test/e2e/utils.ts",
"test": "RUST_LOG=error RUST_BACKTRACE=1 node --loader ts-node/esm test/index.ts",

@@ -43,2 +44,3 @@ "build:lib": "rimraf ./lib && tsc -p tsconfig.build.json",

"dependencies": {
"@bitgo/blake2b": "^3.2.4",
"@holochain/serialization": "^0.1.0-beta-rc.3",

@@ -45,0 +47,0 @@ "@msgpack/msgpack": "^2.8.0",

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