diff --git a/CHANGELOG.md b/CHANGELOG.md
index c3470add..89e6f506 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added
### Changed
+- Revert addition of @hc-spartan/holo-hash. Hashes were used inconsistently and lead to wrong types for return values.
### Fixed
### Removed
diff --git a/docs/client.actionhash.md b/docs/client.actionhash.md
new file mode 100644
index 00000000..9051ac62
--- /dev/null
+++ b/docs/client.actionhash.md
@@ -0,0 +1,14 @@
+
+
+[Home](./index.md) > [@holochain/client](./client.md) > [ActionHash](./client.actionhash.md)
+
+## ActionHash type
+
+
+**Signature:**
+
+```typescript
+export type ActionHash = HoloHash;
+```
+**References:** [HoloHash](./client.holohash.md)
+
diff --git a/docs/client.actionhashandsig.md b/docs/client.actionhashandsig.md
index 02adcfa0..a44a4686 100644
--- a/docs/client.actionhashandsig.md
+++ b/docs/client.actionhashandsig.md
@@ -11,5 +11,5 @@ Action hash with the signature of the action at that hash
```typescript
export type ActionHashAndSig = [ActionHash, Signature];
```
-**References:** [Signature](./client.signature.md)
+**References:** [ActionHash](./client.actionhash.md), [Signature](./client.signature.md)
diff --git a/docs/client.adminwebsocket.md b/docs/client.adminwebsocket.md
index d418e0e3..dbdc09aa 100644
--- a/docs/client.adminwebsocket.md
+++ b/docs/client.adminwebsocket.md
@@ -329,7 +329,7 @@ Get the DNA definition for the specified DNA hash.
-(cellId: [CellId](./client.cellid.md), functions: [GrantedFunctions](./client.grantedfunctions.md), signingKey: AgentPubKey) => Promise<[CapSecret](./client.capsecret.md)>
+(cellId: [CellId](./client.cellid.md), functions: [GrantedFunctions](./client.grantedfunctions.md), signingKey: [AgentPubKey](./client.agentpubkey.md)) => Promise<[CapSecret](./client.capsecret.md)>
|
diff --git a/docs/client.agentpubkey.md b/docs/client.agentpubkey.md
new file mode 100644
index 00000000..daa9c7e6
--- /dev/null
+++ b/docs/client.agentpubkey.md
@@ -0,0 +1,14 @@
+
+
+[Home](./index.md) > [@holochain/client](./client.md) > [AgentPubKey](./client.agentpubkey.md)
+
+## AgentPubKey type
+
+
+**Signature:**
+
+```typescript
+export type AgentPubKey = HoloHash;
+```
+**References:** [HoloHash](./client.holohash.md)
+
diff --git a/docs/client.agentvalidationpkg.md b/docs/client.agentvalidationpkg.md
index bbc42982..239121c3 100644
--- a/docs/client.agentvalidationpkg.md
+++ b/docs/client.agentvalidationpkg.md
@@ -61,7 +61,7 @@ number
|
-AgentPubKey
+[AgentPubKey](./client.agentpubkey.md)
|
@@ -95,7 +95,7 @@ any
|
-ActionHash
+[ActionHash](./client.actionhash.md)
|
diff --git a/docs/client.anydhthash.md b/docs/client.anydhthash.md
new file mode 100644
index 00000000..24827c35
--- /dev/null
+++ b/docs/client.anydhthash.md
@@ -0,0 +1,14 @@
+
+
+[Home](./index.md) > [@holochain/client](./client.md) > [AnyDhtHash](./client.anydhthash.md)
+
+## AnyDhtHash type
+
+
+**Signature:**
+
+```typescript
+export type AnyDhtHash = HoloHash;
+```
+**References:** [HoloHash](./client.holohash.md)
+
diff --git a/docs/client.anylinkablehash.md b/docs/client.anylinkablehash.md
new file mode 100644
index 00000000..7014892e
--- /dev/null
+++ b/docs/client.anylinkablehash.md
@@ -0,0 +1,14 @@
+
+
+[Home](./index.md) > [@holochain/client](./client.md) > [AnyLinkableHash](./client.anylinkablehash.md)
+
+## AnyLinkableHash type
+
+
+**Signature:**
+
+```typescript
+export type AnyLinkableHash = EntryHash | ActionHash | ExternalHash;
+```
+**References:** [EntryHash](./client.entryhash.md), [ActionHash](./client.actionhash.md), [ExternalHash](./client.externalhash.md)
+
diff --git a/docs/client.appclient.md b/docs/client.appclient.md
index cffc882d..8a068c94 100644
--- a/docs/client.appclient.md
+++ b/docs/client.appclient.md
@@ -61,7 +61,7 @@ Description
|
-AgentPubKey
+[AgentPubKey](./client.agentpubkey.md)
|
diff --git a/docs/client.appinfo.md b/docs/client.appinfo.md
index d71dd742..e405e746 100644
--- a/docs/client.appinfo.md
+++ b/docs/client.appinfo.md
@@ -15,5 +15,5 @@ export type AppInfo = {
status: InstalledAppInfoStatus;
};
```
-**References:** [InstalledAppId](./client.installedappid.md), [RoleName](./client.rolename.md), [CellInfo](./client.cellinfo.md), [InstalledAppInfoStatus](./client.installedappinfostatus.md)
+**References:** [AgentPubKey](./client.agentpubkey.md), [InstalledAppId](./client.installedappid.md), [RoleName](./client.rolename.md), [CellInfo](./client.cellinfo.md), [InstalledAppInfoStatus](./client.installedappinfostatus.md)
diff --git a/docs/client.appwebsocket.md b/docs/client.appwebsocket.md
index 43698df9..1b188f8f 100644
--- a/docs/client.appwebsocket.md
+++ b/docs/client.appwebsocket.md
@@ -105,7 +105,7 @@ _(Optional)_
|
-AgentPubKey
+[AgentPubKey](./client.agentpubkey.md)
|
diff --git a/docs/client.callzomerequestgeneric.md b/docs/client.callzomerequestgeneric.md
index 7edd6339..f7725c16 100644
--- a/docs/client.callzomerequestgeneric.md
+++ b/docs/client.callzomerequestgeneric.md
@@ -16,5 +16,5 @@ export type CallZomeRequestGeneric = {
provenance: AgentPubKey;
};
```
-**References:** [CellId](./client.cellid.md), [ZomeName](./client.zomename.md), [FunctionName](./client.functionname.md)
+**References:** [CellId](./client.cellid.md), [ZomeName](./client.zomename.md), [FunctionName](./client.functionname.md), [AgentPubKey](./client.agentpubkey.md)
diff --git a/docs/client.capaccess.md b/docs/client.capaccess.md
index af60ae55..373d47a0 100644
--- a/docs/client.capaccess.md
+++ b/docs/client.capaccess.md
@@ -19,5 +19,5 @@ export type CapAccess = [CapAccessType.Unrestricted] | {
};
};
```
-**References:** [CapAccessType.Unrestricted](./client.capaccesstype.md), [CapAccessType.Transferable](./client.capaccesstype.md), [CapSecret](./client.capsecret.md), [CapAccessType.Assigned](./client.capaccesstype.md)
+**References:** [CapAccessType.Unrestricted](./client.capaccesstype.md), [CapAccessType.Transferable](./client.capaccesstype.md), [CapSecret](./client.capsecret.md), [CapAccessType.Assigned](./client.capaccesstype.md), [AgentPubKey](./client.agentpubkey.md)
diff --git a/docs/client.capclaim.md b/docs/client.capclaim.md
index 891a47d1..376079e6 100644
--- a/docs/client.capclaim.md
+++ b/docs/client.capclaim.md
@@ -44,7 +44,7 @@ Description
|
-AgentPubKey
+[AgentPubKey](./client.agentpubkey.md)
|
diff --git a/docs/client.capgrant.md b/docs/client.capgrant.md
index 354e9ccb..fb4ae6b7 100644
--- a/docs/client.capgrant.md
+++ b/docs/client.capgrant.md
@@ -14,5 +14,5 @@ export type CapGrant = {
RemoteAgent: ZomeCallCapGrant;
};
```
-**References:** [ZomeCallCapGrant](./client.zomecallcapgrant.md)
+**References:** [AgentPubKey](./client.agentpubkey.md), [ZomeCallCapGrant](./client.zomecallcapgrant.md)
diff --git a/docs/client.cellid.md b/docs/client.cellid.md
index d50a526b..3c19a5c6 100644
--- a/docs/client.cellid.md
+++ b/docs/client.cellid.md
@@ -10,3 +10,5 @@
```typescript
export type CellId = [DnaHash, AgentPubKey];
```
+**References:** [DnaHash](./client.dnahash.md), [AgentPubKey](./client.agentpubkey.md)
+
diff --git a/docs/client.chainintegritywarrant.md b/docs/client.chainintegritywarrant.md
index 49758730..89dbe007 100644
--- a/docs/client.chainintegritywarrant.md
+++ b/docs/client.chainintegritywarrant.md
@@ -21,5 +21,5 @@ export type ChainIntegrityWarrant = {
};
};
```
-**References:** [ActionHashAndSig](./client.actionhashandsig.md), [ValidationType](./client.validationtype.md)
+**References:** [AgentPubKey](./client.agentpubkey.md), [ActionHashAndSig](./client.actionhashandsig.md), [ValidationType](./client.validationtype.md)
diff --git a/docs/client.clonedcell.md b/docs/client.clonedcell.md
index 7ff4f090..934b6257 100644
--- a/docs/client.clonedcell.md
+++ b/docs/client.clonedcell.md
@@ -129,7 +129,7 @@ string
|
-DnaHash
+[DnaHash](./client.dnahash.md)
|
diff --git a/docs/client.closechain.md b/docs/client.closechain.md
index d25454e7..a4852dfa 100644
--- a/docs/client.closechain.md
+++ b/docs/client.closechain.md
@@ -61,7 +61,7 @@ number
|
-AgentPubKey
+[AgentPubKey](./client.agentpubkey.md)
|
@@ -78,7 +78,7 @@ AgentPubKey
|
-DnaHash
+[DnaHash](./client.dnahash.md)
|
@@ -95,7 +95,7 @@ DnaHash
|
-ActionHash
+[ActionHash](./client.actionhash.md)
|
diff --git a/docs/client.countersigningagents.md b/docs/client.countersigningagents.md
index 424d30ba..8a6441cf 100644
--- a/docs/client.countersigningagents.md
+++ b/docs/client.countersigningagents.md
@@ -10,5 +10,5 @@
```typescript
export type CounterSigningAgents = Array<[AgentPubKey, Array]>;
```
-**References:** [Role](./client.role.md)
+**References:** [AgentPubKey](./client.agentpubkey.md), [Role](./client.role.md)
diff --git a/docs/client.countersigningagentstate.md b/docs/client.countersigningagentstate.md
index dc5121dd..08217a1c 100644
--- a/docs/client.countersigningagentstate.md
+++ b/docs/client.countersigningagentstate.md
@@ -78,7 +78,7 @@ number
|
-ActionHash
+[ActionHash](./client.actionhash.md)
|
diff --git a/docs/client.create.md b/docs/client.create.md
index d3cc2f97..13527d4c 100644
--- a/docs/client.create.md
+++ b/docs/client.create.md
@@ -61,7 +61,7 @@ number
|
-AgentPubKey
+[AgentPubKey](./client.agentpubkey.md)
|
@@ -78,7 +78,7 @@ AgentPubKey
|
-EntryHash
+[EntryHash](./client.entryhash.md)
|
@@ -112,7 +112,7 @@ EntryHash
|
-ActionHash
+[ActionHash](./client.actionhash.md)
|
diff --git a/docs/client.createlink.md b/docs/client.createlink.md
index a9c35896..d40f3330 100644
--- a/docs/client.createlink.md
+++ b/docs/client.createlink.md
@@ -61,7 +61,7 @@ number
|
-AgentPubKey
+[AgentPubKey](./client.agentpubkey.md)
|
@@ -78,7 +78,7 @@ AgentPubKey
|
-EntryHash
+[EntryHash](./client.entryhash.md)
|
@@ -112,7 +112,7 @@ EntryHash
|
-ActionHash
+[ActionHash](./client.actionhash.md)
|
@@ -146,7 +146,7 @@ ActionHash
|
-EntryHash
+[EntryHash](./client.entryhash.md)
|
diff --git a/docs/client.decodehashfrombase64.md b/docs/client.decodehashfrombase64.md
index cd024c45..425143a0 100644
--- a/docs/client.decodehashfrombase64.md
+++ b/docs/client.decodehashfrombase64.md
@@ -9,7 +9,7 @@ Decodes a Base64 encoded string to a byte array hash.
**Signature:**
```typescript
-export declare function decodeHashFromBase64(hash: string): HoloHash;
+export declare function decodeHashFromBase64(hash: HoloHashB64): HoloHash;
```
## Parameters
@@ -37,7 +37,7 @@ hash
|
-string
+[HoloHashB64](./client.holohashb64.md)
|
@@ -49,7 +49,7 @@ The Base64 encoded string to decode.
**Returns:**
-HoloHash
+[HoloHash](./client.holohash.md)
The hash in byte format.
diff --git a/docs/client.delete.md b/docs/client.delete.md
index 092bbfed..0836bd6e 100644
--- a/docs/client.delete.md
+++ b/docs/client.delete.md
@@ -61,7 +61,7 @@ number
|
-AgentPubKey
+[AgentPubKey](./client.agentpubkey.md)
|
@@ -78,7 +78,7 @@ AgentPubKey
|
-ActionHash
+[ActionHash](./client.actionhash.md)
|
@@ -95,7 +95,7 @@ ActionHash
|
-EntryHash
+[EntryHash](./client.entryhash.md)
|
@@ -112,7 +112,7 @@ EntryHash
|
-ActionHash
+[ActionHash](./client.actionhash.md)
|
diff --git a/docs/client.deletelink.md b/docs/client.deletelink.md
index e604ca52..91ffdcd4 100644
--- a/docs/client.deletelink.md
+++ b/docs/client.deletelink.md
@@ -61,7 +61,7 @@ number
|
-AgentPubKey
+[AgentPubKey](./client.agentpubkey.md)
|
@@ -78,7 +78,7 @@ AgentPubKey
|
-EntryHash
+[EntryHash](./client.entryhash.md)
|
@@ -95,7 +95,7 @@ EntryHash
|
-ActionHash
+[ActionHash](./client.actionhash.md)
|
@@ -112,7 +112,7 @@ ActionHash
|
-ActionHash
+[ActionHash](./client.actionhash.md)
|
diff --git a/docs/client.dna.md b/docs/client.dna.md
index c109c085..172f289a 100644
--- a/docs/client.dna.md
+++ b/docs/client.dna.md
@@ -44,7 +44,7 @@ Description
|
-AgentPubKey
+[AgentPubKey](./client.agentpubkey.md)
|
@@ -61,7 +61,7 @@ AgentPubKey
|
-DnaHash
+[DnaHash](./client.dnahash.md)
|
diff --git a/docs/client.dnahash.md b/docs/client.dnahash.md
new file mode 100644
index 00000000..c74e1f38
--- /dev/null
+++ b/docs/client.dnahash.md
@@ -0,0 +1,14 @@
+
+
+[Home](./index.md) > [@holochain/client](./client.md) > [DnaHash](./client.dnahash.md)
+
+## DnaHash type
+
+
+**Signature:**
+
+```typescript
+export type DnaHash = HoloHash;
+```
+**References:** [HoloHash](./client.holohash.md)
+
diff --git a/docs/client.dnasource.md b/docs/client.dnasource.md
index 36a19e96..1bde642e 100644
--- a/docs/client.dnasource.md
+++ b/docs/client.dnasource.md
@@ -16,5 +16,5 @@ export type DnaSource = {
bundle: DnaBundle;
};
```
-**References:** [DnaBundle](./client.dnabundle.md)
+**References:** [HoloHash](./client.holohash.md), [DnaBundle](./client.dnabundle.md)
diff --git a/docs/client.encodehashtobase64.md b/docs/client.encodehashtobase64.md
index ea454f7c..6ff4b444 100644
--- a/docs/client.encodehashtobase64.md
+++ b/docs/client.encodehashtobase64.md
@@ -9,7 +9,7 @@ Encode a byte array hash to a Base64 string.
**Signature:**
```typescript
-export declare function encodeHashToBase64(hash: Uint8Array): HoloHashB64;
+export declare function encodeHashToBase64(hash: HoloHash): HoloHashB64;
```
## Parameters
@@ -37,7 +37,7 @@ hash
|
-Uint8Array
+[HoloHash](./client.holohash.md)
|
diff --git a/docs/client.entry.md b/docs/client.entry.md
index 1c97f1eb..46a064b2 100644
--- a/docs/client.entry.md
+++ b/docs/client.entry.md
@@ -10,5 +10,5 @@
```typescript
export type Entry = EntryContent<"Agent", AgentPubKey> | EntryContent<"App", Uint8Array> | EntryContent<"CounterSign", [CounterSigningSessionData, Uint8Array]> | EntryContent<"CapGrant", ZomeCallCapGrant> | EntryContent<"CapClaim", CapClaim>;
```
-**References:** [EntryContent](./client.entrycontent.md), [CounterSigningSessionData](./client.countersigningsessiondata.md), [ZomeCallCapGrant](./client.zomecallcapgrant.md), [CapClaim](./client.capclaim.md)
+**References:** [EntryContent](./client.entrycontent.md), [AgentPubKey](./client.agentpubkey.md), [CounterSigningSessionData](./client.countersigningsessiondata.md), [ZomeCallCapGrant](./client.zomecallcapgrant.md), [CapClaim](./client.capclaim.md)
diff --git a/docs/client.entryhash.md b/docs/client.entryhash.md
new file mode 100644
index 00000000..92f5f5f3
--- /dev/null
+++ b/docs/client.entryhash.md
@@ -0,0 +1,14 @@
+
+
+[Home](./index.md) > [@holochain/client](./client.md) > [EntryHash](./client.entryhash.md)
+
+## EntryHash type
+
+
+**Signature:**
+
+```typescript
+export type EntryHash = HoloHash;
+```
+**References:** [HoloHash](./client.holohash.md)
+
diff --git a/docs/client.externalhash.md b/docs/client.externalhash.md
new file mode 100644
index 00000000..c2314646
--- /dev/null
+++ b/docs/client.externalhash.md
@@ -0,0 +1,14 @@
+
+
+[Home](./index.md) > [@holochain/client](./client.md) > [ExternalHash](./client.externalhash.md)
+
+## ExternalHash type
+
+
+**Signature:**
+
+```typescript
+export type ExternalHash = HoloHash;
+```
+**References:** [HoloHash](./client.holohash.md)
+
diff --git a/docs/client.fakeactionhash.md b/docs/client.fakeactionhash.md
index d9e130be..3e386491 100644
--- a/docs/client.fakeactionhash.md
+++ b/docs/client.fakeactionhash.md
@@ -49,7 +49,7 @@ _(Optional)_ Optionally specify a byte to repeat for all core 32 bytes. If undef
**Returns:**
-Promise<ActionHash>
+Promise<[ActionHash](./client.actionhash.md)>
-An instance of ActionHash.
+An [ActionHash](./client.actionhash.md).
diff --git a/docs/client.fakeagentpubkey.md b/docs/client.fakeagentpubkey.md
index 170f6244..6cfdb761 100644
--- a/docs/client.fakeagentpubkey.md
+++ b/docs/client.fakeagentpubkey.md
@@ -49,7 +49,7 @@ _(Optional)_ Optionally specify a byte to repeat for all core 32 bytes. If undef
**Returns:**
-Promise<AgentPubKey>
+Promise<[AgentPubKey](./client.agentpubkey.md)>
-An instance ofAgentPubKey.
+An [AgentPubKey](./client.agentpubkey.md).
diff --git a/docs/client.fakednahash.md b/docs/client.fakednahash.md
index e6f928e7..97e5a502 100644
--- a/docs/client.fakednahash.md
+++ b/docs/client.fakednahash.md
@@ -49,7 +49,7 @@ _(Optional)_ Optionally specify a byte to repeat for all core 32 bytes. If undef
**Returns:**
-Promise<DnaHash>
+Promise<[DnaHash](./client.dnahash.md)>
-A instance of DnaHash.
+A [DnaHash](./client.dnahash.md).
diff --git a/docs/client.fakeentryhash.md b/docs/client.fakeentryhash.md
index 257851dc..0ac79738 100644
--- a/docs/client.fakeentryhash.md
+++ b/docs/client.fakeentryhash.md
@@ -51,7 +51,7 @@ _(Optional)_ Optionally specify a byte to repeat for all core 32 bytes. If undef
**Returns:**
-Promise<EntryHash>
+Promise<[EntryHash](./client.entryhash.md)>
-An instance of EntryHash.
+An [EntryHash](./client.entryhash.md).
diff --git a/docs/client.generateagentpubkeyresponse.md b/docs/client.generateagentpubkeyresponse.md
index 36d43d8c..fcac18e2 100644
--- a/docs/client.generateagentpubkeyresponse.md
+++ b/docs/client.generateagentpubkeyresponse.md
@@ -10,3 +10,5 @@
```typescript
export type GenerateAgentPubKeyResponse = AgentPubKey;
```
+**References:** [AgentPubKey](./client.agentpubkey.md)
+
diff --git a/docs/client.generatesigningkeypair.md b/docs/client.generatesigningkeypair.md
index c47309a6..42e18010 100644
--- a/docs/client.generatesigningkeypair.md
+++ b/docs/client.generatesigningkeypair.md
@@ -9,14 +9,47 @@ Generates a key pair for signing zome calls.
**Signature:**
```typescript
-generateSigningKeyPair: () => Promise<[
- KeyPair,
- AgentPubKey
-]>
+generateSigningKeyPair: (agentPubKey?: AgentPubKey) => Promise<[KeyPair, AgentPubKey]>
```
+
+## Parameters
+
+
+
+Parameter
+
+
+ |
+
+Type
+
+
+ |
+
+Description
+
+
+ |
+
+
+agentPubKey
+
+
+ |
+
+[AgentPubKey](./client.agentpubkey.md)
+
+
+ |
+
+_(Optional)_ The agent pub key to take 4 last bytes (= DHT location) from (optional).
+
+
+ |
+
**Returns:**
-Promise<\[ KeyPair, AgentPubKey \]>
+Promise<\[KeyPair, [AgentPubKey](./client.agentpubkey.md)\]>
The signing key pair and an agent pub key based on the public key.
diff --git a/docs/client.getdnadefinitionrequest.md b/docs/client.getdnadefinitionrequest.md
index 8d9f850c..c91d6b68 100644
--- a/docs/client.getdnadefinitionrequest.md
+++ b/docs/client.getdnadefinitionrequest.md
@@ -10,3 +10,5 @@
```typescript
export type GetDnaDefinitionRequest = DnaHash;
```
+**References:** [DnaHash](./client.dnahash.md)
+
diff --git a/docs/client.hashfrom32andtype.md b/docs/client.hashfrom32andtype.md
index 2402ebc6..9135e11b 100644
--- a/docs/client.hashfrom32andtype.md
+++ b/docs/client.hashfrom32andtype.md
@@ -11,7 +11,7 @@ From https://github.com/holochain/holochain/blob/develop/crates/holo\_hash/src/h
**Signature:**
```typescript
-export declare function hashFrom32AndType(hashCore: Uint8Array, hashType: "Agent" | "Entry" | "Dna" | "Action" | "External"): Uint8Array;
+export declare function hashFrom32AndType(hashCore: AgentPubKey | EntryHash | ActionHash, hashType: "Agent" | "Entry" | "Dna" | "Action" | "External"): Uint8Array;
```
## Parameters
@@ -39,7 +39,7 @@ hashCore
|
-Uint8Array
+[AgentPubKey](./client.agentpubkey.md) \| [EntryHash](./client.entryhash.md) \| [ActionHash](./client.actionhash.md)
|
diff --git a/docs/client.holohash.md b/docs/client.holohash.md
new file mode 100644
index 00000000..b7b8655f
--- /dev/null
+++ b/docs/client.holohash.md
@@ -0,0 +1,12 @@
+
+
+[Home](./index.md) > [@holochain/client](./client.md) > [HoloHash](./client.holohash.md)
+
+## HoloHash type
+
+
+**Signature:**
+
+```typescript
+export type HoloHash = Uint8Array;
+```
diff --git a/docs/client.holohashed.md b/docs/client.holohashed.md
index c1b3fda7..7d3c5f5d 100644
--- a/docs/client.holohashed.md
+++ b/docs/client.holohashed.md
@@ -61,7 +61,7 @@ T
|
-HoloHash
+[HoloHash](./client.holohash.md)
|
diff --git a/docs/client.initzomescomplete.md b/docs/client.initzomescomplete.md
index c4d34cf3..c1019121 100644
--- a/docs/client.initzomescomplete.md
+++ b/docs/client.initzomescomplete.md
@@ -61,7 +61,7 @@ number
|
-AgentPubKey
+[AgentPubKey](./client.agentpubkey.md)
|
@@ -78,7 +78,7 @@ AgentPubKey
|
-ActionHash
+[ActionHash](./client.actionhash.md)
|
diff --git a/docs/client.installappdnapayload.md b/docs/client.installappdnapayload.md
index 7188e484..f4e96e1e 100644
--- a/docs/client.installappdnapayload.md
+++ b/docs/client.installappdnapayload.md
@@ -14,5 +14,5 @@ export type InstallAppDnaPayload = {
membrane_proof?: MembraneProof;
};
```
-**References:** [RoleName](./client.rolename.md), [MembraneProof](./client.membraneproof.md)
+**References:** [HoloHash](./client.holohash.md), [RoleName](./client.rolename.md), [MembraneProof](./client.membraneproof.md)
diff --git a/docs/client.installapprequest.md b/docs/client.installapprequest.md
index 7857ef40..adfa1e22 100644
--- a/docs/client.installapprequest.md
+++ b/docs/client.installapprequest.md
@@ -16,5 +16,5 @@ export type InstallAppRequest = {
ignore_genesis_failure?: boolean;
} & AppBundleSource;
```
-**References:** [InstalledAppId](./client.installedappid.md), [MemproofMap](./client.memproofmap.md), [NetworkSeed](./client.networkseed.md), [AppBundleSource](./client.appbundlesource.md)
+**References:** [AgentPubKey](./client.agentpubkey.md), [InstalledAppId](./client.installedappid.md), [MemproofMap](./client.memproofmap.md), [NetworkSeed](./client.networkseed.md), [AppBundleSource](./client.appbundlesource.md)
diff --git a/docs/client.link.md b/docs/client.link.md
index ae4df227..5c6f4b76 100644
--- a/docs/client.link.md
+++ b/docs/client.link.md
@@ -44,7 +44,7 @@ Description
|
-AgentPubKey
+[AgentPubKey](./client.agentpubkey.md)
|
@@ -61,7 +61,7 @@ AgentPubKey
|
-AnyLinkableHash
+[AnyLinkableHash](./client.anylinkablehash.md)
|
@@ -78,7 +78,7 @@ AnyLinkableHash
|
-ActionHash
+[ActionHash](./client.actionhash.md)
|
@@ -129,7 +129,7 @@ Uint8Array
|
-AnyLinkableHash
+[AnyLinkableHash](./client.anylinkablehash.md)
|
diff --git a/docs/client.md b/docs/client.md
index 9bb8bee2..6d87eb08 100644
--- a/docs/client.md
+++ b/docs/client.md
@@ -259,7 +259,7 @@ From https://github.com/holochain/holochain/blob/develop/crates/holo\_hash/src/h
|
-[generateSigningKeyPair()](./client.generatesigningkeypair.md)
+[generateSigningKeyPair(agentPubKey)](./client.generatesigningkeypair.md)
|
@@ -1162,6 +1162,16 @@ Description
+ |
+
+
+[ActionHash](./client.actionhash.md)
+
+
+ |
+
+
+
|
@@ -1244,6 +1254,16 @@ Action hash with the signature of the action at that hash
This type is meant to be opaque
+ |
+
+
+[AgentPubKey](./client.agentpubkey.md)
+
+
+ |
+
+
+
|
@@ -1254,6 +1274,16 @@ This type is meant to be opaque
+ |
+
+
+[AnyDhtHash](./client.anydhthash.md)
+
+
+ |
+
+
+
|
@@ -1264,6 +1294,16 @@ This type is meant to be opaque
+ |
+
+
+[AnyLinkableHash](./client.anylinkablehash.md)
+
+
+ |
+
+
+
|
@@ -1694,6 +1734,16 @@ This type is meant to be opaque
+ |
+
+
+[DnaHash](./client.dnahash.md)
+
+
+ |
+
+
+
|
@@ -1904,6 +1954,16 @@ This type is meant to be opaque
+ |
+
+
+[EntryHash](./client.entryhash.md)
+
+
+ |
+
+
+
|
@@ -1934,6 +1994,16 @@ This type is meant to be opaque
+ |
+
+
+[ExternalHash](./client.externalhash.md)
+
+
+ |
+
+
+
|
@@ -2024,6 +2094,16 @@ This type is meant to be opaque
+ |
+
+
+[HoloHash](./client.holohash.md)
+
+
+ |
+
+
+
|
@@ -2635,6 +2715,16 @@ An internal link type index within the DNA, from 0 to 255.
+ |
+
+
+[WasmHash](./client.wasmhash.md)
+
+
+ |
+
+
+
|
diff --git a/docs/client.networkinforequest.md b/docs/client.networkinforequest.md
index 51491980..e899f041 100644
--- a/docs/client.networkinforequest.md
+++ b/docs/client.networkinforequest.md
@@ -44,7 +44,7 @@ Description
|
-AgentPubKey
+[AgentPubKey](./client.agentpubkey.md)
|
@@ -63,7 +63,7 @@ The calling agent
|
-DnaHash\[\]
+[DnaHash](./client.dnahash.md)\[\]
|
diff --git a/docs/client.openchain.md b/docs/client.openchain.md
index e953854f..6f222486 100644
--- a/docs/client.openchain.md
+++ b/docs/client.openchain.md
@@ -61,7 +61,7 @@ number
|
-AgentPubKey
+[AgentPubKey](./client.agentpubkey.md)
|
@@ -78,7 +78,7 @@ AgentPubKey
|
-ActionHash
+[ActionHash](./client.actionhash.md)
|
@@ -95,7 +95,7 @@ ActionHash
|
-DnaHash
+[DnaHash](./client.dnahash.md)
|
diff --git a/docs/client.p2pagentsdump.md b/docs/client.p2pagentsdump.md
index ea8753c7..8af9f99b 100644
--- a/docs/client.p2pagentsdump.md
+++ b/docs/client.p2pagentsdump.md
@@ -82,7 +82,7 @@ The info of this agent's cell.
|
-\[AgentPubKey, [KitsuneAgent](./client.kitsuneagent.md)\] \| undefined
+\[[AgentPubKey](./client.agentpubkey.md), [KitsuneAgent](./client.kitsuneagent.md)\] \| undefined
|
@@ -101,7 +101,7 @@ The agent as \[`AgentPubKey`\] and \[`kitsune_p2p::KitsuneAgent`
|
-\[DnaHash, [KitsuneSpace](./client.kitsunespace.md)\] \| undefined
+\[[DnaHash](./client.dnahash.md), [KitsuneSpace](./client.kitsunespace.md)\] \| undefined
|
diff --git a/docs/client.preflightrequest.md b/docs/client.preflightrequest.md
index e15a6e18..8994ed5b 100644
--- a/docs/client.preflightrequest.md
+++ b/docs/client.preflightrequest.md
@@ -61,7 +61,7 @@ Description
|
-EntryHash
+[EntryHash](./client.entryhash.md)
|
diff --git a/docs/client.registerdnaresponse.md b/docs/client.registerdnaresponse.md
index 273b4335..c1f0eb28 100644
--- a/docs/client.registerdnaresponse.md
+++ b/docs/client.registerdnaresponse.md
@@ -10,3 +10,5 @@
```typescript
export type RegisterDnaResponse = HoloHash;
```
+**References:** [HoloHash](./client.holohash.md)
+
diff --git a/docs/client.signingcredentials.md b/docs/client.signingcredentials.md
index def2a1a2..318cf00a 100644
--- a/docs/client.signingcredentials.md
+++ b/docs/client.signingcredentials.md
@@ -78,7 +78,7 @@ KeyPair
|
-AgentPubKey
+[AgentPubKey](./client.agentpubkey.md)
|
diff --git a/docs/client.slicecore32.md b/docs/client.slicecore32.md
index 3f991eb7..2cf9cc97 100644
--- a/docs/client.slicecore32.md
+++ b/docs/client.slicecore32.md
@@ -11,7 +11,7 @@ From https://github.com/holochain/holochain/blob/develop/crates/holo\_hash/src/h
**Signature:**
```typescript
-export declare function sliceCore32(hash: HoloHash | Uint8Array): Uint8Array;
+export declare function sliceCore32(hash: AgentPubKey | EntryHash | ActionHash): Uint8Array;
```
## Parameters
@@ -39,7 +39,7 @@ hash
|
-HoloHash \| Uint8Array
+[AgentPubKey](./client.agentpubkey.md) \| [EntryHash](./client.entryhash.md) \| [ActionHash](./client.actionhash.md)
|
diff --git a/docs/client.slicedhtlocation.md b/docs/client.slicedhtlocation.md
index 6ff574a2..36ba2bd0 100644
--- a/docs/client.slicedhtlocation.md
+++ b/docs/client.slicedhtlocation.md
@@ -11,7 +11,7 @@ From https://github.com/holochain/holochain/blob/develop/crates/holo\_hash/src/h
**Signature:**
```typescript
-export declare function sliceDhtLocation(hash: HoloHash | Uint8Array): Uint8Array;
+export declare function sliceDhtLocation(hash: AgentPubKey | EntryHash | ActionHash): Uint8Array;
```
## Parameters
@@ -39,7 +39,7 @@ hash
|
-HoloHash \| Uint8Array
+[AgentPubKey](./client.agentpubkey.md) \| [EntryHash](./client.entryhash.md) \| [ActionHash](./client.actionhash.md)
|
diff --git a/docs/client.slicehashtype.md b/docs/client.slicehashtype.md
index c1563657..d345e70a 100644
--- a/docs/client.slicehashtype.md
+++ b/docs/client.slicehashtype.md
@@ -11,7 +11,7 @@ From https://github.com/holochain/holochain/blob/develop/crates/holo\_hash/src/h
**Signature:**
```typescript
-export declare function sliceHashType(hash: HoloHash | Uint8Array): Uint8Array;
+export declare function sliceHashType(hash: AgentPubKey | EntryHash | ActionHash): Uint8Array;
```
## Parameters
@@ -39,7 +39,7 @@ hash
|
-HoloHash \| Uint8Array
+[AgentPubKey](./client.agentpubkey.md) \| [EntryHash](./client.entryhash.md) \| [ActionHash](./client.actionhash.md)
|
diff --git a/docs/client.sourcechainjsonrecord.md b/docs/client.sourcechainjsonrecord.md
index 18deb9e1..3988adb6 100644
--- a/docs/client.sourcechainjsonrecord.md
+++ b/docs/client.sourcechainjsonrecord.md
@@ -44,7 +44,7 @@ Description
|
-ActionHash
+[ActionHash](./client.actionhash.md)
|
diff --git a/docs/client.stemcell.md b/docs/client.stemcell.md
index 3094232c..d0e30d13 100644
--- a/docs/client.stemcell.md
+++ b/docs/client.stemcell.md
@@ -61,7 +61,7 @@ Description
|
-DnaHash
+[DnaHash](./client.dnahash.md)
|
diff --git a/docs/client.update.md b/docs/client.update.md
index b691c591..87f829e2 100644
--- a/docs/client.update.md
+++ b/docs/client.update.md
@@ -61,7 +61,7 @@ number
|
-AgentPubKey
+[AgentPubKey](./client.agentpubkey.md)
|
@@ -78,7 +78,7 @@ AgentPubKey
|
-EntryHash
+[EntryHash](./client.entryhash.md)
|
@@ -112,7 +112,7 @@ EntryHash
|
-ActionHash
+[ActionHash](./client.actionhash.md)
|
@@ -129,7 +129,7 @@ ActionHash
|
-EntryHash
+[EntryHash](./client.entryhash.md)
|
@@ -146,7 +146,7 @@ EntryHash
|
-ActionHash
+[ActionHash](./client.actionhash.md)
|
diff --git a/docs/client.updatebase.md b/docs/client.updatebase.md
index 993cd8d8..c77e0208 100644
--- a/docs/client.updatebase.md
+++ b/docs/client.updatebase.md
@@ -61,7 +61,7 @@ Description
|
-ActionHash
+[ActionHash](./client.actionhash.md)
|
@@ -78,7 +78,7 @@ ActionHash
|
-EntryHash
+[EntryHash](./client.entryhash.md)
|
diff --git a/docs/client.updatecoordinatorsrequest.md b/docs/client.updatecoordinatorsrequest.md
index 48da8241..a46a8a77 100644
--- a/docs/client.updatecoordinatorsrequest.md
+++ b/docs/client.updatecoordinatorsrequest.md
@@ -12,5 +12,5 @@ export type UpdateCoordinatorsRequest = {
dna_hash: DnaHash;
} & CoordinatorSource;
```
-**References:** [CoordinatorSource](./client.coordinatorsource.md)
+**References:** [DnaHash](./client.dnahash.md), [CoordinatorSource](./client.coordinatorsource.md)
diff --git a/docs/client.warrantop.md b/docs/client.warrantop.md
index 6ae46f60..e9dfe0a7 100644
--- a/docs/client.warrantop.md
+++ b/docs/client.warrantop.md
@@ -44,7 +44,7 @@ Description
|
-AgentPubKey
+[AgentPubKey](./client.agentpubkey.md)
|
diff --git a/docs/client.wasmcode.md b/docs/client.wasmcode.md
index 8623a751..ca8d0aa7 100644
--- a/docs/client.wasmcode.md
+++ b/docs/client.wasmcode.md
@@ -12,3 +12,5 @@ export type WasmCode = [HoloHash, {
code: Array;
}];
```
+**References:** [HoloHash](./client.holohash.md)
+
diff --git a/docs/client.wasmhash.md b/docs/client.wasmhash.md
new file mode 100644
index 00000000..99bec9ea
--- /dev/null
+++ b/docs/client.wasmhash.md
@@ -0,0 +1,14 @@
+
+
+[Home](./index.md) > [@holochain/client](./client.md) > [WasmHash](./client.wasmhash.md)
+
+## WasmHash type
+
+
+**Signature:**
+
+```typescript
+export type WasmHash = HoloHash;
+```
+**References:** [HoloHash](./client.holohash.md)
+
diff --git a/docs/client.zomedefinition.md b/docs/client.zomedefinition.md
index e12f65e2..ea0f7665 100644
--- a/docs/client.zomedefinition.md
+++ b/docs/client.zomedefinition.md
@@ -16,5 +16,5 @@ export type ZomeDefinition = [
}
];
```
-**References:** [ZomeName](./client.zomename.md)
+**References:** [ZomeName](./client.zomename.md), [WasmHash](./client.wasmhash.md)
diff --git a/docs/client.zomes.md b/docs/client.zomes.md
index 16a2cceb..a5d4c20a 100644
--- a/docs/client.zomes.md
+++ b/docs/client.zomes.md
@@ -12,3 +12,5 @@ export type Zomes = Array<[string, {
wasm_hash: Array;
}]>;
```
+**References:** [HoloHash](./client.holohash.md)
+
diff --git a/package-lock.json b/package-lock.json
index 95c91a44..2bd7a2aa 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12,7 +12,6 @@
"@bitgo/blake2b": "^3.2.4",
"@holochain/serialization": "^0.1.0-beta-rc.3",
"@msgpack/msgpack": "^2.8.0",
- "@spartan-hc/holo-hash": "^0.7.0",
"emittery": "^1.0.1",
"isomorphic-ws": "^5.0.0",
"js-base64": "^3.7.5",
@@ -827,14 +826,6 @@
"string-argv": "~0.3.1"
}
},
- "node_modules/@spartan-hc/holo-hash": {
- "version": "0.7.0",
- "resolved": "https://registry.npmjs.org/@spartan-hc/holo-hash/-/holo-hash-0.7.0.tgz",
- "integrity": "sha512-RtA+OXiteatppEvpGQ0WvAUf+MA5TLa/C8ota5S41W0xmKQfe9IQ9n/hTFRd0tBG4eYXfnz65TDDR1q3VIVOTw==",
- "dependencies": {
- "@whi/xor-digest": "^0.1.0"
- }
- },
"node_modules/@types/argparse": {
"version": "1.0.38",
"resolved": "https://registry.npmjs.org/@types/argparse/-/argparse-1.0.38.tgz",
@@ -1105,11 +1096,6 @@
"integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==",
"dev": true
},
- "node_modules/@whi/xor-digest": {
- "version": "0.1.0",
- "resolved": "https://registry.npmjs.org/@whi/xor-digest/-/xor-digest-0.1.0.tgz",
- "integrity": "sha512-FKPxyYK79TIxkVHmXnyJ4IljW+5sc+HX2hxMu5+UxlN0p1vOOdwFagDOhONC4ILysm1bXhvF4cPsTGSmlTKenQ=="
- },
"node_modules/acorn": {
"version": "8.12.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz",
diff --git a/package.json b/package.json
index 4da52124..34ab95fb 100644
--- a/package.json
+++ b/package.json
@@ -45,7 +45,6 @@
"@bitgo/blake2b": "^3.2.4",
"@holochain/serialization": "^0.1.0-beta-rc.3",
"@msgpack/msgpack": "^2.8.0",
- "@spartan-hc/holo-hash": "^0.7.0",
"emittery": "^1.0.1",
"isomorphic-ws": "^5.0.0",
"js-base64": "^3.7.5",
diff --git a/src/api/zome-call-signing.ts b/src/api/zome-call-signing.ts
index ddfaa0df..7987fbc0 100644
--- a/src/api/zome-call-signing.ts
+++ b/src/api/zome-call-signing.ts
@@ -1,7 +1,6 @@
import _sodium, { type KeyPair } from "libsodium-wrappers";
import type { CapSecret } from "../hdk/capabilities.js";
-import type { CellId } from "../types.js";
-import { AgentPubKey } from "../types.js";
+import type { AgentPubKey, CellId } from "../types.js";
import { encodeHashToBase64 } from "../utils/base64.js";
/**
@@ -55,17 +54,22 @@ export const setSigningCredentials = (
/**
* Generates a key pair for signing zome calls.
*
+ * @param agentPubKey - The agent pub key to take 4 last bytes (= DHT location)
+ * from (optional).
* @returns The signing key pair and an agent pub key based on the public key.
*
* @public
*/
-export const generateSigningKeyPair: () => Promise<
- [KeyPair, AgentPubKey]
-> = async () => {
+export const generateSigningKeyPair: (
+ agentPubKey?: AgentPubKey
+) => Promise<[KeyPair, AgentPubKey]> = async (agentPubKey?: AgentPubKey) => {
await _sodium.ready;
const sodium = _sodium;
const keyPair = sodium.crypto_sign_keypair();
- const signingKey = new AgentPubKey(keyPair.publicKey);
+ const locationBytes = agentPubKey ? agentPubKey.subarray(35) : [0, 0, 0, 0];
+ const signingKey = new Uint8Array(
+ [132, 32, 36].concat(...keyPair.publicKey).concat(...locationBytes)
+ );
return [keyPair, signingKey];
};
diff --git a/src/hdk/link.ts b/src/hdk/link.ts
index ec750a10..28de5dd9 100644
--- a/src/hdk/link.ts
+++ b/src/hdk/link.ts
@@ -4,9 +4,13 @@ import {
EntryHash,
ExternalHash,
Timestamp,
- AnyLinkableHash,
} from "../types.js";
+/**
+ * @public
+ */
+export type AnyLinkableHash = EntryHash | ActionHash | ExternalHash;
+
/**
* An internal zome index within the DNA, from 0 to 255.
*
diff --git a/src/types.ts b/src/types.ts
index 93b160c8..fdd75064 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -1,29 +1,35 @@
-import {
- HoloHash,
- AgentPubKey,
- DnaHash,
- WasmHash,
- EntryHash,
- ActionHash,
- AnyDhtHash,
- AnyLinkableHash,
- ExternalHash,
-} from "@spartan-hc/holo-hash";
-
/**
* @public
*/
-export {
- HoloHash,
- AgentPubKey,
- DnaHash,
- WasmHash,
- EntryHash,
- ActionHash,
- AnyDhtHash,
- AnyLinkableHash,
- ExternalHash,
-};
+export type HoloHash = Uint8Array; // length 39
+/**
+ * @public
+ */
+export type AgentPubKey = HoloHash;
+/**
+ * @public
+ */
+export type DnaHash = HoloHash;
+/**
+ * @public
+ */
+export type WasmHash = HoloHash;
+/**
+ * @public
+ */
+export type EntryHash = HoloHash;
+/**
+ * @public
+ */
+export type ActionHash = HoloHash;
+/**
+ * @public
+ */
+export type AnyDhtHash = HoloHash;
+/**
+ * @public
+ */
+export type ExternalHash = HoloHash;
/**
* @public
diff --git a/src/utils/base64.ts b/src/utils/base64.ts
index d2061f62..959230bd 100644
--- a/src/utils/base64.ts
+++ b/src/utils/base64.ts
@@ -1,6 +1,5 @@
import { Base64 } from "js-base64";
-import { HoloHashB64 } from "../types.js";
-import { HoloHash } from "@spartan-hc/holo-hash";
+import { HoloHash, HoloHashB64 } from "../types.js";
/**
* Decodes a Base64 encoded string to a byte array hash.
@@ -10,8 +9,8 @@ import { HoloHash } from "@spartan-hc/holo-hash";
*
* @public
*/
-export function decodeHashFromBase64(hash: string): HoloHash {
- return new HoloHash(hash);
+export function decodeHashFromBase64(hash: HoloHashB64): HoloHash {
+ return Base64.toUint8Array(hash.slice(1));
}
/**
@@ -22,6 +21,6 @@ export function decodeHashFromBase64(hash: string): HoloHash {
*
* @public
*/
-export function encodeHashToBase64(hash: Uint8Array): HoloHashB64 {
- return String(new HoloHash(hash));
+export function encodeHashToBase64(hash: HoloHash): HoloHashB64 {
+ return `u${Base64.fromUint8Array(hash, true)}`;
}
diff --git a/src/utils/fake-hash.ts b/src/utils/fake-hash.ts
index b568559e..40e48374 100644
--- a/src/utils/fake-hash.ts
+++ b/src/utils/fake-hash.ts
@@ -1,6 +1,22 @@
import { range } from "lodash-es";
import { randomByteArray } from "../api/zome-call-signing.js";
import { DnaHash, ActionHash, AgentPubKey, EntryHash } from "../types.js";
+import { dhtLocationFrom32 } from "./hash-parts.js";
+
+async function fakeValidHash(
+ prefix: number[],
+ coreByte: number | undefined
+): Promise {
+ 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)]) as T;
+}
/**
* Generate a valid hash of a non-existing entry.
@@ -8,70 +24,54 @@ import { DnaHash, ActionHash, AgentPubKey, EntryHash } from "../types.js";
* From https://github.com/holochain/holochain/blob/develop/crates/holo_hash/src/hash_type/primitive.rs
*
* @param coreByte - Optionally specify a byte to repeat for all core 32 bytes. If undefined will generate random core 32 bytes.
- * @returns An instance of EntryHash.
+ * @returns An {@link EntryHash}.
*
* @public
*/
export async function fakeEntryHash(
coreByte: number | undefined = undefined
): Promise {
- return new EntryHash(
- coreByte
- ? Uint8Array.from(range(0, 32).map(() => coreByte))
- : await randomByteArray(32)
- );
+ return fakeValidHash([0x84, 0x21, 0x24], coreByte);
}
/**
* 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 instance ofAgentPubKey.
+ * @returns An {@link AgentPubKey}.
*
* @public
*/
export async function fakeAgentPubKey(
coreByte: number | undefined = undefined
): Promise {
- return new AgentPubKey(
- coreByte
- ? Uint8Array.from(range(0, 32).map(() => coreByte))
- : await randomByteArray(32)
- );
+ return fakeValidHash([0x84, 0x20, 0x24], coreByte);
}
/**
* 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 instance of ActionHash.
+ * @returns An {@link ActionHash}.
*
* @public
*/
export async function fakeActionHash(
coreByte: number | undefined = undefined
): Promise {
- return new ActionHash(
- coreByte
- ? Uint8Array.from(range(0, 32).map(() => coreByte))
- : await randomByteArray(32)
- );
+ return fakeValidHash([0x84, 0x29, 0x24], coreByte);
}
/**
* 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 instance of DnaHash.
+ * @returns A {@link DnaHash}.
*
* @public
*/
export async function fakeDnaHash(
coreByte: number | undefined = undefined
): Promise {
- return new DnaHash(
- coreByte
- ? Uint8Array.from(range(0, 32).map(() => coreByte))
- : await randomByteArray(32)
- );
+ return fakeValidHash([0x84, 0x2d, 0x24], coreByte);
}
diff --git a/src/utils/hash-parts.ts b/src/utils/hash-parts.ts
index 233b2a70..7d8bc03a 100644
--- a/src/utils/hash-parts.ts
+++ b/src/utils/hash-parts.ts
@@ -1,5 +1,5 @@
+import { ActionHash, AgentPubKey, EntryHash } from "../types.js";
import blake2b from "@bitgo/blake2b";
-import { HoloHash } from "../types.js";
const HASH_TYPE_START = 0;
const HASH_TYPE_BYTE_LENGTH = 3;
@@ -31,9 +31,10 @@ export const HASH_TYPE_PREFIX = {
*
* @public
*/
-export function sliceHashType(hash: HoloHash | Uint8Array): Uint8Array {
- if (!(hash instanceof HoloHash)) hash = new HoloHash(hash);
- return (hash as HoloHash).getPrefix();
+export function sliceHashType(
+ hash: AgentPubKey | EntryHash | ActionHash
+): Uint8Array {
+ return Uint8Array.from(hash.slice(0, 3));
}
/**
@@ -46,11 +47,12 @@ export function sliceHashType(hash: HoloHash | Uint8Array): Uint8Array {
*
* @public
*/
-export function sliceCore32(hash: HoloHash | Uint8Array): Uint8Array {
- if (!(hash instanceof HoloHash)) hash = new HoloHash(hash);
+export function sliceCore32(
+ hash: AgentPubKey | EntryHash | ActionHash
+): Uint8Array {
const start = HASH_TYPE_START + HASH_TYPE_BYTE_LENGTH;
const end = start + CORE_HASH_BYTE_LENGTH;
- return (hash as HoloHash).bytes(start, end);
+ return Uint8Array.from(hash.slice(start, end));
}
/**
@@ -63,11 +65,12 @@ export function sliceCore32(hash: HoloHash | Uint8Array): Uint8Array {
*
* @public
*/
-export function sliceDhtLocation(hash: HoloHash | Uint8Array): Uint8Array {
- if (hash instanceof Uint8Array) hash = new HoloHash(hash);
+export function sliceDhtLocation(
+ hash: AgentPubKey | EntryHash | ActionHash
+): Uint8Array {
const start = HASH_TYPE_START + HASH_TYPE_BYTE_LENGTH + CORE_HASH_BYTE_LENGTH;
const end = start + DHT_LOCATION_BYTE_LENGTH;
- return (hash as HoloHash).bytes(start, end);
+ return Uint8Array.from(hash.slice(start, end));
}
/**
@@ -107,10 +110,12 @@ export function dhtLocationFrom32(hashCore: Uint8Array): Uint8Array {
* @public
*/
export function hashFrom32AndType(
- hashCore: Uint8Array,
+ hashCore: AgentPubKey | EntryHash | ActionHash,
hashType: "Agent" | "Entry" | "Dna" | "Action" | "External"
): Uint8Array {
- return new HoloHash(hashCore).toType(
- hashType === "Agent" ? "AgentPubKey" : hashType + "Hash"
- );
+ return Uint8Array.from([
+ ...HASH_TYPE_PREFIX[hashType],
+ ...hashCore,
+ ...dhtLocationFrom32(hashCore),
+ ]);
}
diff --git a/test/e2e/index.ts b/test/e2e/index.ts
index 916b3b13..b5a5015c 100644
--- a/test/e2e/index.ts
+++ b/test/e2e/index.ts
@@ -583,13 +583,15 @@ test(
);
test(
- "generated signing key",
+ "generated signing key has same location bytes as original agent pub key",
withConductor(ADMIN_PORT, async (t) => {
- const [, signingKey] = await generateSigningKeyPair();
- t.assert(
- signingKey?.constructor.name === "AgentPubKey",
- "expected an AgentPubKey"
- );
+ const admin = await AdminWebsocket.connect({
+ url: ADMIN_WS_URL,
+ wsClientOptions: { origin: "client-test-admin" },
+ });
+ const agent = await admin.generateAgentPubKey();
+ const [, signingKey] = await generateSigningKeyPair(agent);
+ t.deepEqual(signingKey.subarray(35), Uint8Array.from(agent.subarray(35)));
})
);
diff --git a/test/e2e/utils.ts b/test/e2e/utils.ts
index 33c89149..637d2862 100644
--- a/test/e2e/utils.ts
+++ b/test/e2e/utils.ts
@@ -211,7 +211,7 @@ test("sliceDhtLocation, sliceCore32, sliceHashType extract components of a hash"
const dhtLocation = sliceDhtLocation(fakeHash);
t.deepEqual(
- fakeHash.bytes(),
+ fakeHash,
Uint8Array.from([...prefix, ...hash, ...dhtLocation]),
"extracted hash type, core hash, and dht location components of a hash concat back into the original hash"
);
@@ -222,7 +222,7 @@ test("hashFrom32AndType generates valid hash with type and 32 core bytes", async
const fullHash = hashFrom32AndType(core, "Agent");
t.deepEqual(
- fullHash.bytes(),
+ fullHash,
Uint8Array.from([
132, 32, 36, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 126, 207, 206, 190,
|