@holochain/client
Advanced tools
Comparing version 0.11.10 to 0.11.11
@@ -56,3 +56,3 @@ import { getLauncherEnvironment } from "../../environments/launcher.js"; | ||
grantSigningKey = async (cellId, functions, signingKey) => { | ||
const capSecret = randomCapSecret(); | ||
const capSecret = await randomCapSecret(); | ||
await this.grantZomeCallCapability({ | ||
@@ -59,0 +59,0 @@ cell_id: cellId, |
@@ -74,3 +74,3 @@ import { hashZomeCall } from "@holochain/serialization"; | ||
payload: encode(request.payload), | ||
nonce: randomNonce(), | ||
nonce: await randomNonce(), | ||
expires_at: getNonceExpiration(), | ||
@@ -77,0 +77,0 @@ }; |
@@ -33,5 +33,5 @@ import nacl from "tweetnacl"; | ||
]; | ||
export declare const randomCapSecret: () => CapSecret; | ||
export declare const randomNonce: () => Nonce256Bit; | ||
export declare const randomByteArray: (length: number) => Uint8Array; | ||
export declare const randomCapSecret: () => Promise<CapSecret>; | ||
export declare const randomNonce: () => Promise<Nonce256Bit>; | ||
export declare const randomByteArray: (length: number) => Promise<Uint8Array>; | ||
export declare const getNonceExpiration: () => number; |
@@ -1,2 +0,1 @@ | ||
import crypto from "crypto"; | ||
import nacl from "tweetnacl"; | ||
@@ -36,4 +35,4 @@ import { encodeHashToBase64 } from "../utils/base64.js"; | ||
export const randomCapSecret = () => randomByteArray(64); | ||
export const randomNonce = () => randomByteArray(32); | ||
export const randomByteArray = (length) => { | ||
export const randomNonce = async () => randomByteArray(32); | ||
export const randomByteArray = async (length) => { | ||
if (typeof window !== "undefined" && | ||
@@ -45,2 +44,3 @@ "crypto" in window && | ||
else { | ||
const crypto = await import("node:crypto"); | ||
return new Uint8Array(crypto.randomBytes(length)); | ||
@@ -47,0 +47,0 @@ } |
@@ -14,3 +14,3 @@ import { invoke } from "@tauri-apps/api/tauri"; | ||
payload: Array.from(encode(request.payload)), | ||
nonce: Array.from(randomNonce()), | ||
nonce: Array.from(await randomNonce()), | ||
expires_at: getNonceExpiration(), | ||
@@ -17,0 +17,0 @@ }; |
import { ActionHash, AgentPubKey, EntryHash } from "../types.js"; | ||
/** From https://github.com/holochain/holochain/blob/develop/crates/holo_hash/src/hash_type/primitive.rs */ | ||
export declare function fakeEntryHash(): EntryHash; | ||
export declare function fakeAgentPubKey(): AgentPubKey; | ||
export declare function fakeActionHash(): ActionHash; | ||
export declare function fakeEntryHash(): Promise<EntryHash>; | ||
export declare function fakeAgentPubKey(): Promise<AgentPubKey>; | ||
export declare function fakeActionHash(): Promise<ActionHash>; |
import { randomByteArray } from "../api/zome-call-signing.js"; | ||
/** From https://github.com/holochain/holochain/blob/develop/crates/holo_hash/src/hash_type/primitive.rs */ | ||
export function fakeEntryHash() { | ||
return new Uint8Array([0x84, 0x21, 0x24, ...randomByteArray(36)]); | ||
export async function fakeEntryHash() { | ||
const randomBytes = await randomByteArray(36); | ||
return new Uint8Array([0x84, 0x21, 0x24, ...randomBytes]); | ||
} | ||
export function fakeAgentPubKey() { | ||
return new Uint8Array([0x84, 0x20, 0x24, ...randomByteArray(36)]); | ||
export async function fakeAgentPubKey() { | ||
const randomBytes = await randomByteArray(36); | ||
return new Uint8Array([0x84, 0x20, 0x24, ...randomBytes]); | ||
} | ||
export function fakeActionHash() { | ||
return new Uint8Array([0x84, 0x29, 0x24, ...randomByteArray(36)]); | ||
export async function fakeActionHash() { | ||
const randomBytes = await randomByteArray(36); | ||
return new Uint8Array([0x84, 0x29, 0x24, ...randomBytes]); | ||
} | ||
//# sourceMappingURL=fake-hash.js.map |
{ | ||
"name": "@holochain/client", | ||
"version": "0.11.10", | ||
"version": "0.11.11", | ||
"description": "A JavaScript client for the Holochain Conductor API", | ||
@@ -5,0 +5,0 @@ "author": "Holochain Foundation <info@holochain.org> (http://holochain.org)", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104771
1799