@arcadiasystems/morse-sdk 0.2.0 → 0.4.0
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/CHANGELOG.md +117 -0
- package/dist/codecs.d.ts +3 -7
- package/dist/codecs.d.ts.map +1 -1
- package/dist/codecs.js +3 -11
- package/dist/codecs.js.map +1 -1
- package/dist/config.d.ts +11 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +14 -3
- package/dist/config.js.map +1 -1
- package/dist/errors.d.ts +2 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.format.js +1 -2
- package/dist/errors.format.js.map +1 -1
- package/dist/errors.js +29 -27
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/ops/index.d.ts +2 -3
- package/dist/ops/index.d.ts.map +1 -1
- package/dist/ops/index.js +2 -3
- package/dist/ops/index.js.map +1 -1
- package/dist/ops/recipient-file-from-bytes.d.ts +123 -0
- package/dist/ops/recipient-file-from-bytes.d.ts.map +1 -0
- package/dist/ops/recipient-file-from-bytes.js +142 -0
- package/dist/ops/recipient-file-from-bytes.js.map +1 -0
- package/dist/ops/recipient-file.d.ts +114 -0
- package/dist/ops/recipient-file.d.ts.map +1 -0
- package/dist/ops/recipient-file.js +151 -0
- package/dist/ops/recipient-file.js.map +1 -0
- package/dist/ptb/recipient-file.d.ts +82 -0
- package/dist/ptb/recipient-file.d.ts.map +1 -0
- package/dist/ptb/recipient-file.js +148 -0
- package/dist/ptb/recipient-file.js.map +1 -0
- package/dist/read/index.d.ts +2 -1
- package/dist/read/index.d.ts.map +1 -1
- package/dist/read/index.js +2 -1
- package/dist/read/index.js.map +1 -1
- package/dist/read/recipient-file-events.d.ts +65 -0
- package/dist/read/recipient-file-events.d.ts.map +1 -0
- package/dist/read/recipient-file-events.js +172 -0
- package/dist/read/recipient-file-events.js.map +1 -0
- package/dist/read/recipient-files-reader.d.ts +27 -0
- package/dist/read/recipient-files-reader.d.ts.map +1 -0
- package/dist/read/recipient-files-reader.js +170 -0
- package/dist/read/recipient-files-reader.js.map +1 -0
- package/dist/seal/adapter.d.ts +20 -19
- package/dist/seal/adapter.d.ts.map +1 -1
- package/dist/seal/adapter.js +9 -3
- package/dist/seal/adapter.js.map +1 -1
- package/dist/seal/default-adapter.d.ts +5 -5
- package/dist/seal/default-adapter.d.ts.map +1 -1
- package/dist/seal/default-adapter.js +13 -22
- package/dist/seal/default-adapter.js.map +1 -1
- package/dist/seal/index.d.ts +2 -2
- package/dist/seal/index.d.ts.map +1 -1
- package/dist/seal/index.js +1 -1
- package/dist/seal/index.js.map +1 -1
- package/dist/seal/recipient-file-identity.d.ts +53 -0
- package/dist/seal/recipient-file-identity.d.ts.map +1 -0
- package/dist/seal/recipient-file-identity.js +87 -0
- package/dist/seal/recipient-file-identity.js.map +1 -0
- package/dist/types.d.ts +60 -31
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/wallets/keypair-adapter.d.ts.map +1 -1
- package/dist/wallets/keypair-adapter.js +1 -2
- package/dist/wallets/keypair-adapter.js.map +1 -1
- package/package.json +1 -1
- package/dist/ops/allowlist.d.ts +0 -79
- package/dist/ops/allowlist.d.ts.map +0 -1
- package/dist/ops/allowlist.js +0 -122
- package/dist/ops/allowlist.js.map +0 -1
- package/dist/ops/file-from-bytes.d.ts +0 -84
- package/dist/ops/file-from-bytes.d.ts.map +0 -1
- package/dist/ops/file-from-bytes.js +0 -133
- package/dist/ops/file-from-bytes.js.map +0 -1
- package/dist/ops/file.d.ts +0 -88
- package/dist/ops/file.d.ts.map +0 -1
- package/dist/ops/file.js +0 -142
- package/dist/ops/file.js.map +0 -1
- package/dist/ptb/allowlist.d.ts +0 -65
- package/dist/ptb/allowlist.d.ts.map +0 -1
- package/dist/ptb/allowlist.js +0 -75
- package/dist/ptb/allowlist.js.map +0 -1
- package/dist/ptb/file.d.ts +0 -58
- package/dist/ptb/file.d.ts.map +0 -1
- package/dist/ptb/file.js +0 -108
- package/dist/ptb/file.js.map +0 -1
- package/dist/read/files-reader.d.ts +0 -59
- package/dist/read/files-reader.d.ts.map +0 -1
- package/dist/read/files-reader.js +0 -247
- package/dist/read/files-reader.js.map +0 -1
- package/dist/seal/allowlist-identity.d.ts +0 -36
- package/dist/seal/allowlist-identity.d.ts.map +0 -1
- package/dist/seal/allowlist-identity.js +0 -81
- package/dist/seal/allowlist-identity.js.map +0 -1
package/dist/ptb/file.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PTB builders for `file` module Move calls. Internal to the SDK;
|
|
3
|
-
* `ops/file.ts` composes these into single atomic transactions.
|
|
4
|
-
*/
|
|
5
|
-
/** Canonical Sui clock shared object id. The `file::new_*` calls take it as input. */
|
|
6
|
-
const SUI_CLOCK_OBJECT_ID = "0x6";
|
|
7
|
-
/**
|
|
8
|
-
* Add a `file::new_encrypted_file` call. Returns the new EncryptedFile as the
|
|
9
|
-
* first result. The caller must follow with `share_file` to make it accessible
|
|
10
|
-
* from any wallet.
|
|
11
|
-
*/
|
|
12
|
-
export function buildNewEncryptedFile(tx, args) {
|
|
13
|
-
const blobIdBytes = walrusBlobIdToBytes(args.blobId);
|
|
14
|
-
return tx.moveCall({
|
|
15
|
-
target: `${args.packageId}::file::new_encrypted_file`,
|
|
16
|
-
arguments: [
|
|
17
|
-
tx.pure.vector("u8", Array.from(blobIdBytes)),
|
|
18
|
-
optionSomeId(tx, args.blobObjectId),
|
|
19
|
-
tx.pure.string(args.name),
|
|
20
|
-
tx.pure.string(args.contentType),
|
|
21
|
-
tx.pure.u64(args.size),
|
|
22
|
-
tx.pure.address(args.allowlistId),
|
|
23
|
-
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
24
|
-
],
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Add a `file::new_public_file` call. Returns the new EncryptedFile (the
|
|
29
|
-
* `encrypted` flag is false). Follow with `share_file`.
|
|
30
|
-
*/
|
|
31
|
-
export function buildNewPublicFile(tx, args) {
|
|
32
|
-
const blobIdBytes = walrusBlobIdToBytes(args.blobId);
|
|
33
|
-
return tx.moveCall({
|
|
34
|
-
target: `${args.packageId}::file::new_public_file`,
|
|
35
|
-
arguments: [
|
|
36
|
-
tx.pure.vector("u8", Array.from(blobIdBytes)),
|
|
37
|
-
optionSomeId(tx, args.blobObjectId),
|
|
38
|
-
tx.pure.string(args.name),
|
|
39
|
-
tx.pure.string(args.contentType),
|
|
40
|
-
tx.pure.u64(args.size),
|
|
41
|
-
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
42
|
-
],
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
export function buildShareFile(tx, args) {
|
|
46
|
-
return tx.moveCall({
|
|
47
|
-
target: `${args.packageId}::file::share_file`,
|
|
48
|
-
arguments: [args.file],
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
export function buildUpdateFileMetadata(tx, args) {
|
|
52
|
-
return tx.moveCall({
|
|
53
|
-
target: `${args.packageId}::file::update_metadata`,
|
|
54
|
-
arguments: [
|
|
55
|
-
tx.object(args.fileId),
|
|
56
|
-
tx.pure.string(args.name),
|
|
57
|
-
tx.pure.string(args.contentType),
|
|
58
|
-
],
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
export function buildTransferFileOwnership(tx, args) {
|
|
62
|
-
return tx.moveCall({
|
|
63
|
-
target: `${args.packageId}::file::transfer_ownership`,
|
|
64
|
-
arguments: [tx.object(args.fileId), tx.pure.address(args.newOwner)],
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
export function buildDeleteFile(tx, args) {
|
|
68
|
-
return tx.moveCall({
|
|
69
|
-
target: `${args.packageId}::file::delete_file`,
|
|
70
|
-
arguments: [tx.object(args.fileId)],
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Walrus blob IDs are 43-char URL-safe base64 strings carrying a 32-byte
|
|
75
|
-
* content digest. The Move layer stores them as `vector<u8>`; we decode the
|
|
76
|
-
* 32 bytes here for the PTB so on-chain reads match what Walrus returns.
|
|
77
|
-
*/
|
|
78
|
-
function walrusBlobIdToBytes(blobId) {
|
|
79
|
-
const base64 = blobId
|
|
80
|
-
.replace(/-/g, "+")
|
|
81
|
-
.replace(/_/g, "/");
|
|
82
|
-
const padded = base64 + "=".repeat((4 - (base64.length % 4)) % 4);
|
|
83
|
-
const binary = atob(padded);
|
|
84
|
-
const out = new Uint8Array(binary.length);
|
|
85
|
-
for (let i = 0; i < binary.length; i += 1) {
|
|
86
|
-
out[i] = binary.charCodeAt(i);
|
|
87
|
-
}
|
|
88
|
-
return out;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Build a Move `Option<ID>` argument. Sui's PTB layer does not have a native
|
|
92
|
-
* Option builder, so we go through the std::option helpers.
|
|
93
|
-
*/
|
|
94
|
-
function optionSomeId(tx, value) {
|
|
95
|
-
if (value === undefined) {
|
|
96
|
-
return tx.moveCall({
|
|
97
|
-
target: "0x1::option::none",
|
|
98
|
-
typeArguments: ["0x2::object::ID"],
|
|
99
|
-
arguments: [],
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
return tx.moveCall({
|
|
103
|
-
target: "0x1::option::some",
|
|
104
|
-
typeArguments: ["0x2::object::ID"],
|
|
105
|
-
arguments: [tx.pure.id(value)],
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=file.js.map
|
package/dist/ptb/file.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/ptb/file.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiBH,sFAAsF;AACtF,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAYlC;;;;GAIG;AACH,MAAM,U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-1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RPC-backed reader for the allowlist + file modules. EncryptedFile objects
|
|
3
|
-
* are shared (every successful create_*_file flow calls share_file), so
|
|
4
|
-
* "list files owned by an address" is not exposed at the RPC layer — there
|
|
5
|
-
* is no on-chain owner field for `listOwnedObjects` to filter on. Listing
|
|
6
|
-
* accessible files requires event-based indexing; a future indexer-backed
|
|
7
|
-
* implementation will expose it through this same interface.
|
|
8
|
-
*/
|
|
9
|
-
import type { ObjectReader } from "../clients.js";
|
|
10
|
-
import type { Allowlist, AllowlistCap, AllowlistId, EncryptedFile, EncryptedFileId, PackageId, SuiAddress } from "../types.js";
|
|
11
|
-
/** Result of a single page of `listAllowlistCapsOwnedBy`. */
|
|
12
|
-
export interface AllowlistCapListPage {
|
|
13
|
-
readonly results: readonly AllowlistCap[];
|
|
14
|
-
readonly nextCursor: string | null;
|
|
15
|
-
}
|
|
16
|
-
/** Options for paginated list calls in `FilesReader`. */
|
|
17
|
-
export interface FilesListOptions {
|
|
18
|
-
readonly limit?: number;
|
|
19
|
-
readonly cursor?: string;
|
|
20
|
-
readonly signal?: AbortSignal;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Read-only access to the files domain: Allowlist objects, EncryptedFile
|
|
24
|
-
* metadata records, and the AllowlistCaps owned by a given address.
|
|
25
|
-
*
|
|
26
|
-
* Notably absent: there is no `listEncryptedFilesOwnedBy(address)` because
|
|
27
|
-
* EncryptedFile is a shared object with no on-chain owner field; `address`
|
|
28
|
-
* cannot index into anything. List the AllowlistCaps an address holds
|
|
29
|
-
* (admin access), then fetch each cap's `allowlistId` and inspect the
|
|
30
|
-
* allowlist's `members` set, or subscribe to the contract's events.
|
|
31
|
-
*/
|
|
32
|
-
export interface FilesReader {
|
|
33
|
-
getAllowlist(id: AllowlistId, signal?: AbortSignal): Promise<Allowlist>;
|
|
34
|
-
getEncryptedFile(id: EncryptedFileId, signal?: AbortSignal): Promise<EncryptedFile>;
|
|
35
|
-
listAllowlistCapsOwnedBy(address: SuiAddress, options?: FilesListOptions): Promise<AllowlistCapListPage>;
|
|
36
|
-
}
|
|
37
|
-
export declare class RpcFilesReader implements FilesReader {
|
|
38
|
-
private readonly client;
|
|
39
|
-
private readonly typePackageId;
|
|
40
|
-
constructor(client: ObjectReader, typePackageId: PackageId);
|
|
41
|
-
/**
|
|
42
|
-
* Build a reader from a morse package config. Uses `packageId` (the
|
|
43
|
-
* current published-at) for type filters because the allowlist + file
|
|
44
|
-
* modules were introduced in the v2 upgrade — Sui identifies a type by
|
|
45
|
-
* the package id where it was DEFINED, not by the package's genesis
|
|
46
|
-
* original-id. This differs from `RpcPublicationReader`, which uses
|
|
47
|
-
* `originalPackageId` because publication / collection / entry were
|
|
48
|
-
* defined in v1.
|
|
49
|
-
*/
|
|
50
|
-
static fromMorseConfig(config: {
|
|
51
|
-
packageId: PackageId;
|
|
52
|
-
originalPackageId?: PackageId;
|
|
53
|
-
}, client: ObjectReader): RpcFilesReader;
|
|
54
|
-
getAllowlist(id: AllowlistId, signal?: AbortSignal): Promise<Allowlist>;
|
|
55
|
-
getEncryptedFile(id: EncryptedFileId, signal?: AbortSignal): Promise<EncryptedFile>;
|
|
56
|
-
listAllowlistCapsOwnedBy(address: SuiAddress, options?: FilesListOptions): Promise<AllowlistCapListPage>;
|
|
57
|
-
private callClient;
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=files-reader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"files-reader.d.ts","sourceRoot":"","sources":["../../src/read/files-reader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAUlD,OAAO,KAAK,EACX,SAAS,EACT,YAAY,EACZ,WAAW,EACX,aAAa,EACb,eAAe,EACf,SAAS,EACT,UAAU,EACV,MAAM,aAAa,CAAC;AAIrB,6DAA6D;AAC7D,MAAM,WAA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AC7B,OAAO,EAAE,UAAU,EACnB,OAAO,GAAE,gBAAqB,GAC5B,OAAO,CAAC,oBAAoB,CAAC;YAkBlB,UAAU;CAaxB"}
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RPC-backed reader for the allowlist + file modules. EncryptedFile objects
|
|
3
|
-
* are shared (every successful create_*_file flow calls share_file), so
|
|
4
|
-
* "list files owned by an address" is not exposed at the RPC layer — there
|
|
5
|
-
* is no on-chain owner field for `listOwnedObjects` to filter on. Listing
|
|
6
|
-
* accessible files requires event-based indexing; a future indexer-backed
|
|
7
|
-
* implementation will expose it through this same interface.
|
|
8
|
-
*/
|
|
9
|
-
import { toAllowlistCapId, toAllowlistId, toBlobObjectId, toEncryptedFileId, toSuiAddress, toWalrusBlobId, } from "../codecs.js";
|
|
10
|
-
import { NotFoundError, TransportError, ValidationError } from "../errors.js";
|
|
11
|
-
const DEFAULT_PAGE_LIMIT = 50;
|
|
12
|
-
export class RpcFilesReader {
|
|
13
|
-
client;
|
|
14
|
-
typePackageId;
|
|
15
|
-
constructor(client, typePackageId) {
|
|
16
|
-
this.client = client;
|
|
17
|
-
this.typePackageId = typePackageId;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Build a reader from a morse package config. Uses `packageId` (the
|
|
21
|
-
* current published-at) for type filters because the allowlist + file
|
|
22
|
-
* modules were introduced in the v2 upgrade — Sui identifies a type by
|
|
23
|
-
* the package id where it was DEFINED, not by the package's genesis
|
|
24
|
-
* original-id. This differs from `RpcPublicationReader`, which uses
|
|
25
|
-
* `originalPackageId` because publication / collection / entry were
|
|
26
|
-
* defined in v1.
|
|
27
|
-
*/
|
|
28
|
-
static fromMorseConfig(config, client) {
|
|
29
|
-
return new RpcFilesReader(client, config.packageId);
|
|
30
|
-
}
|
|
31
|
-
async getAllowlist(id, signal) {
|
|
32
|
-
const validated = toAllowlistId(id);
|
|
33
|
-
let response;
|
|
34
|
-
try {
|
|
35
|
-
response = await this.callClient("getObject", () => this.client.getObject({
|
|
36
|
-
objectId: validated,
|
|
37
|
-
include: { json: true },
|
|
38
|
-
...(signal === undefined ? {} : { signal }),
|
|
39
|
-
}));
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
if (error instanceof TransportError &&
|
|
43
|
-
isObjectNotFoundError(error.cause, validated)) {
|
|
44
|
-
throw new NotFoundError("allowlist", validated, {
|
|
45
|
-
cause: error.cause,
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
throw error;
|
|
49
|
-
}
|
|
50
|
-
const object = response.object;
|
|
51
|
-
if (!object) {
|
|
52
|
-
throw new NotFoundError("allowlist", validated);
|
|
53
|
-
}
|
|
54
|
-
return parseAllowlist(object);
|
|
55
|
-
}
|
|
56
|
-
async getEncryptedFile(id, signal) {
|
|
57
|
-
const validated = toEncryptedFileId(id);
|
|
58
|
-
let response;
|
|
59
|
-
try {
|
|
60
|
-
response = await this.callClient("getObject", () => this.client.getObject({
|
|
61
|
-
objectId: validated,
|
|
62
|
-
include: { json: true },
|
|
63
|
-
...(signal === undefined ? {} : { signal }),
|
|
64
|
-
}));
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
if (error instanceof TransportError &&
|
|
68
|
-
isObjectNotFoundError(error.cause, validated)) {
|
|
69
|
-
throw new NotFoundError("encrypted-file", validated, {
|
|
70
|
-
cause: error.cause,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
throw error;
|
|
74
|
-
}
|
|
75
|
-
const object = response.object;
|
|
76
|
-
if (!object) {
|
|
77
|
-
throw new NotFoundError("encrypted-file", validated);
|
|
78
|
-
}
|
|
79
|
-
return parseEncryptedFile(object);
|
|
80
|
-
}
|
|
81
|
-
async listAllowlistCapsOwnedBy(address, options = {}) {
|
|
82
|
-
const validated = toSuiAddress(address);
|
|
83
|
-
const { limit = DEFAULT_PAGE_LIMIT, cursor, signal } = options;
|
|
84
|
-
const capType = `${this.typePackageId}::allowlist::Cap`;
|
|
85
|
-
const response = await this.callClient("listOwnedObjects", () => this.client.listOwnedObjects({
|
|
86
|
-
owner: validated,
|
|
87
|
-
type: capType,
|
|
88
|
-
limit,
|
|
89
|
-
cursor: cursor ?? null,
|
|
90
|
-
include: { json: true },
|
|
91
|
-
...(signal === undefined ? {} : { signal }),
|
|
92
|
-
}));
|
|
93
|
-
const results = response.objects.map((object) => parseAllowlistCap(object));
|
|
94
|
-
return { results, nextCursor: response.cursor };
|
|
95
|
-
}
|
|
96
|
-
async callClient(operation, call) {
|
|
97
|
-
try {
|
|
98
|
-
return await call();
|
|
99
|
-
}
|
|
100
|
-
catch (cause) {
|
|
101
|
-
throw new TransportError(`${operation} failed`, {
|
|
102
|
-
cause,
|
|
103
|
-
operation: `sui.${operation}`,
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
function parseAllowlist(object) {
|
|
109
|
-
const json = object.json;
|
|
110
|
-
if (!json || typeof json !== "object") {
|
|
111
|
-
throw new NotFoundError("allowlist", object.objectId);
|
|
112
|
-
}
|
|
113
|
-
const record = json;
|
|
114
|
-
const name = readString(record, "name", "allowlist.name");
|
|
115
|
-
const members = readMembers(record);
|
|
116
|
-
return {
|
|
117
|
-
id: toAllowlistId(object.objectId),
|
|
118
|
-
name,
|
|
119
|
-
members,
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
function parseAllowlistCap(object) {
|
|
123
|
-
const json = object.json;
|
|
124
|
-
if (!json || typeof json !== "object") {
|
|
125
|
-
throw new NotFoundError("allowlist", object.objectId);
|
|
126
|
-
}
|
|
127
|
-
const record = json;
|
|
128
|
-
const allowlistIdField = record.allowlist_id;
|
|
129
|
-
if (typeof allowlistIdField !== "string") {
|
|
130
|
-
throw new ValidationError("allowlist::Cap.allowlist_id missing or not a string", "cap.allowlist_id");
|
|
131
|
-
}
|
|
132
|
-
return {
|
|
133
|
-
id: toAllowlistCapId(object.objectId),
|
|
134
|
-
allowlistId: toAllowlistId(allowlistIdField),
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
function parseEncryptedFile(object) {
|
|
138
|
-
const json = object.json;
|
|
139
|
-
if (!json || typeof json !== "object") {
|
|
140
|
-
throw new NotFoundError("encrypted-file", object.objectId);
|
|
141
|
-
}
|
|
142
|
-
const record = json;
|
|
143
|
-
const owner = toSuiAddress(readString(record, "owner", "file.owner"));
|
|
144
|
-
// Sui gRPC serializes vector<u8> either as a base64 string (standard JSON
|
|
145
|
-
// representation) or as a number array (older RPC variants). Accept both.
|
|
146
|
-
const blobId = toWalrusBlobId(parseBlobIdField(record.blob_id));
|
|
147
|
-
const blobObjectId = readOptionalString(record, "blob_object_id");
|
|
148
|
-
const name = readString(record, "name", "file.name");
|
|
149
|
-
const contentType = readString(record, "content_type", "file.content_type");
|
|
150
|
-
const size = readSafeIntFromBig(record, "size", "file.size");
|
|
151
|
-
const encrypted = record.encrypted === true;
|
|
152
|
-
const allowlistIdRaw = readOptionalString(record, "allowlist_id");
|
|
153
|
-
const createdAtMs = readSafeIntFromBig(record, "created_at_ms", "file.created_at_ms");
|
|
154
|
-
return {
|
|
155
|
-
id: toEncryptedFileId(object.objectId),
|
|
156
|
-
owner,
|
|
157
|
-
blobId,
|
|
158
|
-
blobObjectId: blobObjectId === null ? null : toBlobObjectId(blobObjectId),
|
|
159
|
-
name,
|
|
160
|
-
contentType,
|
|
161
|
-
size,
|
|
162
|
-
encrypted,
|
|
163
|
-
allowlistId: allowlistIdRaw === null ? null : toAllowlistId(allowlistIdRaw),
|
|
164
|
-
createdAtMs,
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
function readMembers(record) {
|
|
168
|
-
const raw = record.members;
|
|
169
|
-
if (!raw || typeof raw !== "object") {
|
|
170
|
-
return [];
|
|
171
|
-
}
|
|
172
|
-
const contents = raw.contents;
|
|
173
|
-
if (!Array.isArray(contents)) {
|
|
174
|
-
return [];
|
|
175
|
-
}
|
|
176
|
-
const out = [];
|
|
177
|
-
for (const entry of contents) {
|
|
178
|
-
if (typeof entry === "string") {
|
|
179
|
-
out.push(toSuiAddress(entry));
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return out;
|
|
183
|
-
}
|
|
184
|
-
function readString(record, field, errorField) {
|
|
185
|
-
const value = record[field];
|
|
186
|
-
if (typeof value !== "string") {
|
|
187
|
-
throw new ValidationError(`${errorField} missing or not a string`, errorField);
|
|
188
|
-
}
|
|
189
|
-
return value;
|
|
190
|
-
}
|
|
191
|
-
function readOptionalString(record, field) {
|
|
192
|
-
const value = record[field];
|
|
193
|
-
if (value === null || value === undefined) {
|
|
194
|
-
return null;
|
|
195
|
-
}
|
|
196
|
-
return typeof value === "string" ? value : null;
|
|
197
|
-
}
|
|
198
|
-
function readSafeIntFromBig(record, field, errorField) {
|
|
199
|
-
const value = record[field];
|
|
200
|
-
if (typeof value !== "string" && typeof value !== "number") {
|
|
201
|
-
throw new ValidationError(`${errorField} missing or not a number`, errorField);
|
|
202
|
-
}
|
|
203
|
-
const big = BigInt(value);
|
|
204
|
-
if (big > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
205
|
-
throw new ValidationError(`${errorField} exceeds Number.MAX_SAFE_INTEGER`, errorField);
|
|
206
|
-
}
|
|
207
|
-
return Number(big);
|
|
208
|
-
}
|
|
209
|
-
function bytesArrayToBase64Url(bytes) {
|
|
210
|
-
let binary = "";
|
|
211
|
-
for (const byte of bytes) {
|
|
212
|
-
binary += String.fromCharCode(byte);
|
|
213
|
-
}
|
|
214
|
-
const b64 = btoa(binary);
|
|
215
|
-
return b64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Sui gRPC may serialize `vector<u8>` as:
|
|
219
|
-
* - a base64 string (standard JSON encoding)
|
|
220
|
-
* - a base64URL string (some RPC variants)
|
|
221
|
-
* - an array of numbers (older variants, or when the field is small)
|
|
222
|
-
* Return the URL-safe-base64 form Walrus uses for blob ids regardless of input shape.
|
|
223
|
-
*/
|
|
224
|
-
function parseBlobIdField(raw) {
|
|
225
|
-
if (Array.isArray(raw)) {
|
|
226
|
-
return bytesArrayToBase64Url(raw);
|
|
227
|
-
}
|
|
228
|
-
if (typeof raw !== "string") {
|
|
229
|
-
throw new ValidationError("file.blob_id must be a byte array or base64 string", "file.blob_id");
|
|
230
|
-
}
|
|
231
|
-
// Already URL-safe? Strip padding and return.
|
|
232
|
-
if (/^[A-Za-z0-9_-]+={0,2}$/.test(raw)) {
|
|
233
|
-
return raw.replace(/=+$/g, "");
|
|
234
|
-
}
|
|
235
|
-
// Standard base64 with + and / — convert to URL-safe.
|
|
236
|
-
if (/^[A-Za-z0-9+/]+={0,2}$/.test(raw)) {
|
|
237
|
-
return raw.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
|
|
238
|
-
}
|
|
239
|
-
throw new ValidationError("file.blob_id is not a recognized base64 string", "file.blob_id");
|
|
240
|
-
}
|
|
241
|
-
function isObjectNotFoundError(cause, _objectId) {
|
|
242
|
-
if (!(cause instanceof Error)) {
|
|
243
|
-
return false;
|
|
244
|
-
}
|
|
245
|
-
return /not found|NotFound|object.*not.*exist/i.test(cause.message);
|
|
246
|
-
}
|
|
247
|
-
//# sourceMappingURL=files-reader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"files-reader.js","sourceRoot":"","sources":["../../src/read/files-reader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,EACN,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,cAAc,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAW9E,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAqC9B,MAAM,OAAO,cAAc;IAER;IACA;IAFlB,YACkB,MAAoB,EACpB,aAAwB;QAD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,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACxE,CAAC;IACD,MAAM,IAAI,eAAe,CACxB,gDAAgD,EAChD,cAAc,CACd,CAAC;AACH,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAc,EAAE,SAAiB;IAC/D,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,wCAAwC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Seal identity (`SealId`) construction and inspection for the allowlist policy.
|
|
3
|
-
* The Move layer (`allowlist::seal_approve`) enforces the byte format, so both
|
|
4
|
-
* encode and decode here must match the contract byte-for-byte.
|
|
5
|
-
*
|
|
6
|
-
* Layout: `allowlist_id(32) || policy_tag(u8=2) || nonce(>=1)`. Total length
|
|
7
|
-
* must be > 33 bytes (`allowlist::ESealInvalidId` otherwise).
|
|
8
|
-
*
|
|
9
|
-
* Distinct from the publisher policy (`publisher-identity.ts`) by policy tag
|
|
10
|
-
* (allowlist=2, publisher=1) so both can coexist in the same package without
|
|
11
|
-
* identity collisions.
|
|
12
|
-
*/
|
|
13
|
-
import { type AllowlistId, type SealId, SealPolicyTag } from "../types.js";
|
|
14
|
-
/** Structured view of an allowlist Seal identity. */
|
|
15
|
-
export interface AllowlistSealIdParts {
|
|
16
|
-
readonly allowlistId: AllowlistId;
|
|
17
|
-
readonly policyTag: SealPolicyTag;
|
|
18
|
-
readonly nonce: Uint8Array;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Build an allowlist-policy Seal identity. The nonce must be at least 1 byte
|
|
22
|
-
* (the Move contract's `id.length() > 33` invariant); nonces of 16 random
|
|
23
|
-
* bytes are typical.
|
|
24
|
-
*
|
|
25
|
-
* @throws {ValidationError} If `allowlistId` is not a 0x-prefixed 64-char
|
|
26
|
-
* hex string, or `nonce` is shorter than 1 byte.
|
|
27
|
-
*/
|
|
28
|
-
export declare function buildAllowlistSealId(allowlistId: AllowlistId, nonce: Uint8Array): SealId;
|
|
29
|
-
/**
|
|
30
|
-
* Decode the structural fields of an allowlist Seal identity. The brand
|
|
31
|
-
* guarantees the byte layout, so this never throws on a properly-built
|
|
32
|
-
* identity. Throws `ValidationError` if the bytes carry a different policy
|
|
33
|
-
* tag (e.g. publisher) — use `decodePublisherSealId` for those.
|
|
34
|
-
*/
|
|
35
|
-
export declare function decodeAllowlistSealId(id: SealId): AllowlistSealIdParts;
|
|
36
|
-
//# sourceMappingURL=allowlist-identity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"allowlist-identity.d.ts","sourceRoot":"","sources":["../../src/seal/allowlist-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAO3E,qDAAqD;AACrD,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CACnC,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,UAAU,GACf,MAAM,CAaR;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,MAAM,GAAG,oBAAoB,CAetE"}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Seal identity (`SealId`) construction and inspection for the allowlist policy.
|
|
3
|
-
* The Move layer (`allowlist::seal_approve`) enforces the byte format, so both
|
|
4
|
-
* encode and decode here must match the contract byte-for-byte.
|
|
5
|
-
*
|
|
6
|
-
* Layout: `allowlist_id(32) || policy_tag(u8=2) || nonce(>=1)`. Total length
|
|
7
|
-
* must be > 33 bytes (`allowlist::ESealInvalidId` otherwise).
|
|
8
|
-
*
|
|
9
|
-
* Distinct from the publisher policy (`publisher-identity.ts`) by policy tag
|
|
10
|
-
* (allowlist=2, publisher=1) so both can coexist in the same package without
|
|
11
|
-
* identity collisions.
|
|
12
|
-
*/
|
|
13
|
-
import { ValidationError } from "../errors.js";
|
|
14
|
-
import { SealPolicyTag } from "../types.js";
|
|
15
|
-
const ALLOWLIST_ID_BYTES = 32;
|
|
16
|
-
const POLICY_TAG_OFFSET = ALLOWLIST_ID_BYTES;
|
|
17
|
-
const NONCE_OFFSET = POLICY_TAG_OFFSET + 1;
|
|
18
|
-
const MIN_NONCE_BYTES = 1;
|
|
19
|
-
/**
|
|
20
|
-
* Build an allowlist-policy Seal identity. The nonce must be at least 1 byte
|
|
21
|
-
* (the Move contract's `id.length() > 33` invariant); nonces of 16 random
|
|
22
|
-
* bytes are typical.
|
|
23
|
-
*
|
|
24
|
-
* @throws {ValidationError} If `allowlistId` is not a 0x-prefixed 64-char
|
|
25
|
-
* hex string, or `nonce` is shorter than 1 byte.
|
|
26
|
-
*/
|
|
27
|
-
export function buildAllowlistSealId(allowlistId, nonce) {
|
|
28
|
-
if (nonce.length < MIN_NONCE_BYTES) {
|
|
29
|
-
throw new ValidationError(`Seal nonce must be at least ${MIN_NONCE_BYTES} byte(s), got ${nonce.length}`, "nonce");
|
|
30
|
-
}
|
|
31
|
-
const prefix = allowlistIdToBytes(allowlistId);
|
|
32
|
-
const out = new Uint8Array(ALLOWLIST_ID_BYTES + 1 + nonce.length);
|
|
33
|
-
out.set(prefix, 0);
|
|
34
|
-
out[POLICY_TAG_OFFSET] = SealPolicyTag.Allowlist;
|
|
35
|
-
out.set(nonce, NONCE_OFFSET);
|
|
36
|
-
return out;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Decode the structural fields of an allowlist Seal identity. The brand
|
|
40
|
-
* guarantees the byte layout, so this never throws on a properly-built
|
|
41
|
-
* identity. Throws `ValidationError` if the bytes carry a different policy
|
|
42
|
-
* tag (e.g. publisher) — use `decodePublisherSealId` for those.
|
|
43
|
-
*/
|
|
44
|
-
export function decodeAllowlistSealId(id) {
|
|
45
|
-
const prefix = id.subarray(0, ALLOWLIST_ID_BYTES);
|
|
46
|
-
const policyTagByte = id[POLICY_TAG_OFFSET] ?? 0;
|
|
47
|
-
if (policyTagByte !== SealPolicyTag.Allowlist) {
|
|
48
|
-
throw new ValidationError(`Seal identity has policy tag ${policyTagByte}, expected ${SealPolicyTag.Allowlist} (Allowlist). Use decodePublisherSealId for publisher-policy identities.`, "policyTag");
|
|
49
|
-
}
|
|
50
|
-
const nonce = id.slice(NONCE_OFFSET);
|
|
51
|
-
return {
|
|
52
|
-
allowlistId: bytesToAllowlistId(prefix),
|
|
53
|
-
policyTag: SealPolicyTag.Allowlist,
|
|
54
|
-
nonce,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
function allowlistIdToBytes(value) {
|
|
58
|
-
const stripped = value.startsWith("0x")
|
|
59
|
-
? value.slice(2)
|
|
60
|
-
: value;
|
|
61
|
-
if (stripped.length > ALLOWLIST_ID_BYTES * 2) {
|
|
62
|
-
throw new ValidationError(`AllowlistId exceeds ${ALLOWLIST_ID_BYTES} bytes`, "allowlistId");
|
|
63
|
-
}
|
|
64
|
-
const padded = stripped.padStart(ALLOWLIST_ID_BYTES * 2, "0");
|
|
65
|
-
if (!/^[0-9a-f]+$/i.test(padded)) {
|
|
66
|
-
throw new ValidationError(`AllowlistId is not valid hex: ${value}`, "allowlistId");
|
|
67
|
-
}
|
|
68
|
-
const out = new Uint8Array(ALLOWLIST_ID_BYTES);
|
|
69
|
-
for (let i = 0; i < ALLOWLIST_ID_BYTES; i += 1) {
|
|
70
|
-
out[i] = Number.parseInt(padded.slice(i * 2, i * 2 + 2), 16);
|
|
71
|
-
}
|
|
72
|
-
return out;
|
|
73
|
-
}
|
|
74
|
-
function bytesToAllowlistId(bytes) {
|
|
75
|
-
let hex = "";
|
|
76
|
-
for (const byte of bytes) {
|
|
77
|
-
hex += byte.toString(16).padStart(2, "0");
|
|
78
|
-
}
|
|
79
|
-
return `0x${hex}`;
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=allowlist-identity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"allowlist-identity.js","sourceRoot":"","sources":["../../src/seal/allowlist-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAiC,aAAa,EAAE,MAAM,aAAa,CAAC;AAE3E,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAC7C,MAAM,YAAY,GAAG,iBAAiB,GAAG,CAAC,CAAC;AAC3C,MAAM,eAAe,GAAG,CAAC,CAAC;AAS1B;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CACnC,WAAwB,EACxB,KAAiB;IAEjB,IAAI,KAAK,CAAC,MAAM,GAAG,eAAe,EAAE,CAAC;QACpC,MAAM,IAAI,eAAe,CACxB,+BAA+B,eAAe,iBAAiB,KAAK,CAAC,MAAM,EAAE,EAC7E,OAAO,CACP,CAAC;IACH,CAAC;IACD,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAC/C,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,kBAAkB,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAClE,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACnB,GAAG,CAAC,iBAAiB,CAAC,GAAG,aAAa,CAAC,SAAS,CAAC;IACjD,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IAC7B,OAAO,GAAa,CAAC;AACtB,CAAC;A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