@chillwhales/lsp29 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +51 -0
- package/dist/index.d.mts +1875 -0
- package/dist/index.d.ts +1875 -0
- package/dist/index.mjs +236 -0
- package/package.json +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Chillwhales contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# @chillwhales/lsp29
|
|
2
|
+
|
|
3
|
+
[](./LICENSE)
|
|
4
|
+
|
|
5
|
+
LSP29 Encrypted Assets — schemas, types, constants, and encode/decode utilities for storing and retrieving encrypted content on Universal Profiles.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @chillwhales/lsp29
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
> **Peer dependency:** This package requires [`viem`](https://viem.sh) ^2.0.0
|
|
14
|
+
>
|
|
15
|
+
> ```bash
|
|
16
|
+
> pnpm add viem
|
|
17
|
+
> ```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import {
|
|
23
|
+
computeLsp29MapKey,
|
|
24
|
+
computeLsp29ArrayIndexKey,
|
|
25
|
+
decodeLsp29Metadata,
|
|
26
|
+
} from "@chillwhales/lsp29";
|
|
27
|
+
|
|
28
|
+
// Compute the ERC725Y data key that maps a content ID to its array index
|
|
29
|
+
const mapKey = computeLsp29MapKey("premium-content");
|
|
30
|
+
// Use with getData() to look up the array index for this content
|
|
31
|
+
|
|
32
|
+
// Compute the array element key for a specific index
|
|
33
|
+
const elementKey = computeLsp29ArrayIndexKey(0);
|
|
34
|
+
// Use with getData() to retrieve the VerifiableURI at this index
|
|
35
|
+
|
|
36
|
+
// Decode and validate LSP29 metadata JSON (e.g. fetched from IPFS)
|
|
37
|
+
const jsonString = await fetch("ipfs://QmMetadata.../lsp29.json").then((r) => r.text());
|
|
38
|
+
const metadata = decodeLsp29Metadata(jsonString);
|
|
39
|
+
console.log(metadata.LSP29EncryptedAsset.title);
|
|
40
|
+
console.log(metadata.LSP29EncryptedAsset.encryption.provider);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
> **Spec:** See `LSP-29-EncryptedAssets.md` in the repository for the full specification.
|
|
44
|
+
|
|
45
|
+
## API
|
|
46
|
+
|
|
47
|
+
Types are exported and available in your editor via TypeScript IntelliSense.
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
[MIT](./LICENSE)
|