Skip to content

Commit 9fb2fc5

Browse files
HashWarlockgitbook-bot
authored andcommitted
GITBOOK-116: Add WapoJS Functions
1 parent 847f0b0 commit 9fb2fc5

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
## Tech Specs
7979

8080
* [🥷 AI Agent Contract](tech-specs/ai-agent-contract/README.md)
81+
* [WapoJS Functions](tech-specs/ai-agent-contract/wapojs-functions.md)
8182
* [Phala Agent Gateway](tech-specs/ai-agent-contract/phala-agent-gateway.md)
8283
* [✅ Multi-Proof and Verifiable Compute](tech-specs/multi-proof-and-verifiable-compute/README.md)
8384
* [Why Multi-Proof and How We Can Help](tech-specs/multi-proof-and-verifiable-compute/why-multi-proof-and-how-we-can-help.md)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# WapoJS Functions
2+
3+
Here is a list of the available functions for developers to utilize when building on the AI Agent Contract.
4+
5+
```typescript
6+
/**
7+
* Derives a secret key from a salt. The same app with the same salt on the same worker will always
8+
* derive the same secret. However, the same app with the same salt on different workers will derive
9+
* different secrets.
10+
*/
11+
deriveSecret(salt: Uint8Array | string): Uint8Array;
12+
13+
/**
14+
* Hashes a message using the specified algorithm.
15+
* @param algrithm - The name of the hash algorithm to use.
16+
* Supported values are "blake2b128", "blake2b256", "blake2b512", "sha256", "keccak256"
17+
* @param message - The message to hash, either as a Uint8Array or a string.
18+
*/
19+
hash(algrithm: 'blake2b128' | 'blake2b256' | 'blake2b512' | 'sha256' | 'keccak256', message: Uint8Array | string): Uint8Array;
20+
21+
/**
22+
* Non-cryptographic hashing, current only supported wyhash64 64-bit hash. Non-cryptographic algorithms
23+
* are optimized for speed of computation over collision-resistance or seurity.
24+
*
25+
* @param algrithm - The name of the hash algorithm to use.
26+
* Supported values are "wyhash64"
27+
* @param message - The message to hash, either as a Uint8Array or a string.
28+
*/
29+
nonCryptographicHash(algrithm: 'wyhash64', message: Uint8Array | string): Uint8Array;
30+
31+
/**
32+
* Concatenates multiple Uint8Array objects into a single Uint8Array.
33+
*
34+
* @param arrays - The arrays to concatenate.
35+
*/
36+
concatU8a(arrays: Uint8Array[]): Uint8Array;
37+
```

0 commit comments

Comments
 (0)