@tinycloudlabs/web-sdk 0.2.1 → 1.0.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/LICENSE.md +320 -0
- package/dist/625.index.js +1 -0
- package/dist/authorization/WebSpaceCreationHandler.d.ts +40 -0
- package/dist/authorization/WebSpaceCreationHandler.d.ts.map +1 -0
- package/dist/authorization/WebUserAuthorization.d.ts +295 -0
- package/dist/authorization/WebUserAuthorization.d.ts.map +1 -0
- package/dist/authorization/index.d.ts +12 -0
- package/dist/authorization/index.d.ts.map +1 -0
- package/dist/delegation.d.ts +85 -0
- package/dist/delegation.d.ts.map +1 -0
- package/dist/index.d.ts +12 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/modules/Storage/index.d.ts +1 -2
- package/dist/modules/Storage/index.d.ts.map +1 -1
- package/dist/modules/Storage/tinycloud/KVServiceAdapter.d.ts +24 -0
- package/dist/modules/Storage/tinycloud/KVServiceAdapter.d.ts.map +1 -0
- package/dist/modules/Storage/tinycloud/index.d.ts +1 -4
- package/dist/modules/Storage/tinycloud/index.d.ts.map +1 -1
- package/dist/modules/Storage/tinycloud/module.d.ts +1 -1
- package/dist/modules/Storage/tinycloud/types.d.ts +7 -9
- package/dist/modules/Storage/tinycloud/types.d.ts.map +1 -1
- package/dist/modules/Storage/tinycloud/types.schema.d.ts +159 -0
- package/dist/modules/Storage/tinycloud/types.schema.d.ts.map +1 -0
- package/dist/modules/UserAuthorization.d.ts +191 -58
- package/dist/modules/UserAuthorization.d.ts.map +1 -1
- package/dist/modules/WasmInitializer.d.ts +26 -0
- package/dist/modules/WasmInitializer.d.ts.map +1 -0
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.d.ts.map +1 -1
- package/dist/modules/keys/WasmKeyProvider.d.ts +126 -0
- package/dist/modules/keys/WasmKeyProvider.d.ts.map +1 -0
- package/dist/modules/keys/index.d.ts +7 -0
- package/dist/modules/keys/index.d.ts.map +1 -0
- package/dist/modules/registry/Registry.d.ts +59 -0
- package/dist/modules/registry/Registry.d.ts.map +1 -0
- package/dist/modules/tcw.d.ts +649 -53
- package/dist/modules/tcw.d.ts.map +1 -1
- package/dist/notifications/ModalManager.d.ts +6 -3
- package/dist/notifications/ModalManager.d.ts.map +1 -1
- package/dist/notifications/NodeSelectionModal.d.ts +29 -0
- package/dist/notifications/NodeSelectionModal.d.ts.map +1 -0
- package/dist/notifications/{OrbitCreationModal.d.ts → SpaceCreationModal.d.ts} +8 -8
- package/dist/notifications/{OrbitCreationModal.d.ts.map → SpaceCreationModal.d.ts.map} +1 -1
- package/dist/notifications/index.d.ts +3 -2
- package/dist/notifications/index.d.ts.map +1 -1
- package/dist/notifications/types.schema.d.ts +224 -0
- package/dist/notifications/types.schema.d.ts.map +1 -0
- package/dist/utils/debug.d.ts +9 -0
- package/dist/utils/debug.d.ts.map +1 -0
- package/dist/utils/multiaddr.d.ts +36 -0
- package/dist/utils/multiaddr.d.ts.map +1 -0
- package/package.json +14 -6
- package/dist/modules/Storage/TinyCloudStorage.d.ts +0 -182
- package/dist/modules/Storage/TinyCloudStorage.d.ts.map +0 -1
- package/dist/modules/Storage/interfaces.d.ts +0 -119
- package/dist/modules/Storage/interfaces.d.ts.map +0 -1
- package/dist/modules/Storage/tinycloud/authenticator.d.ts +0 -12
- package/dist/modules/Storage/tinycloud/authenticator.d.ts.map +0 -1
- package/dist/modules/Storage/tinycloud/capabilities.d.ts +0 -25
- package/dist/modules/Storage/tinycloud/capabilities.d.ts.map +0 -1
- package/dist/modules/Storage/tinycloud/kv.d.ts +0 -18
- package/dist/modules/Storage/tinycloud/kv.d.ts.map +0 -1
- package/dist/modules/Storage/tinycloud/orbit.d.ts +0 -167
- package/dist/modules/Storage/tinycloud/orbit.d.ts.map +0 -1
- package/dist/modules/Storage/tinycloud/tinycloud.d.ts +0 -43
- package/dist/modules/Storage/tinycloud/tinycloud.d.ts.map +0 -1
- package/dist/modules/Storage/tinycloud/walletProvider.d.ts +0 -19
- package/dist/modules/Storage/tinycloud/walletProvider.d.ts.map +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web-sdk authorization module.
|
|
3
|
+
*
|
|
4
|
+
* Provides WebUserAuthorization implementing the node-sdk architecture
|
|
5
|
+
* with browser-specific features like wallet popups and modal confirmations.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
export { WebUserAuthorization, WebUserAuthorizationConfig, WebSignStrategy, WalletPopupStrategy, defaultWebSignStrategy, } from "./WebUserAuthorization";
|
|
10
|
+
export { ModalSpaceCreationHandler, defaultWebSpaceCreationHandler, } from "./WebSpaceCreationHandler";
|
|
11
|
+
export { SignStrategy, SignRequest, SignResponse, SignCallback, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, EventEmitterStrategy, defaultSignStrategy, ISpaceCreationHandler, SpaceCreationContext, AutoApproveSpaceCreationHandler, defaultSpaceCreationHandler, } from "@tinycloudlabs/sdk-core";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/authorization/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,eAAe,EACf,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,yBAAyB,EACzB,8BAA8B,GAC/B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,+BAA+B,EAC/B,2BAA2B,GAC5B,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delegation types and utilities for web-sdk.
|
|
3
|
+
*
|
|
4
|
+
* These types are compatible with node-sdk's delegation system,
|
|
5
|
+
* allowing delegations to be exchanged between platforms.
|
|
6
|
+
*/
|
|
7
|
+
import { Delegation, TinyCloudSession, IKVService } from "@tinycloudlabs/sdk-core";
|
|
8
|
+
/**
|
|
9
|
+
* A portable delegation that can be transported between users.
|
|
10
|
+
* Extends the base Delegation type with fields required for transport.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* PortableDelegation adds transport fields to Delegation:
|
|
14
|
+
* - `delegationHeader`: Structured authorization header for API calls
|
|
15
|
+
* - `ownerAddress`: Space owner's address for session creation
|
|
16
|
+
* - `chainId`: Chain ID for session creation
|
|
17
|
+
* - `host`: Optional server URL
|
|
18
|
+
*/
|
|
19
|
+
export interface PortableDelegation extends Omit<Delegation, "isRevoked"> {
|
|
20
|
+
/** The authorization header for this delegation (structured format) */
|
|
21
|
+
delegationHeader: {
|
|
22
|
+
Authorization: string;
|
|
23
|
+
};
|
|
24
|
+
/** The address of the space owner */
|
|
25
|
+
ownerAddress: string;
|
|
26
|
+
/** The chain ID */
|
|
27
|
+
chainId: number;
|
|
28
|
+
/** TinyCloud server URL where this delegation was created */
|
|
29
|
+
host?: string;
|
|
30
|
+
/** Whether the recipient is prevented from creating sub-delegations */
|
|
31
|
+
disableSubDelegation?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Serialize a PortableDelegation for transport (e.g., over network).
|
|
35
|
+
*/
|
|
36
|
+
export declare function serializeDelegation(delegation: PortableDelegation): string;
|
|
37
|
+
/**
|
|
38
|
+
* Deserialize a PortableDelegation from transport.
|
|
39
|
+
* Handles both new format (cid) and legacy format (delegationCid).
|
|
40
|
+
*/
|
|
41
|
+
export declare function deserializeDelegation(data: string): PortableDelegation;
|
|
42
|
+
/**
|
|
43
|
+
* Provides access to a space via a received delegation.
|
|
44
|
+
*
|
|
45
|
+
* This is returned by TinyCloudWeb.useDelegation() and provides
|
|
46
|
+
* KV operations on the delegated space.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* // Receive a delegation from another user
|
|
51
|
+
* const delegation = deserializeDelegation(receivedData);
|
|
52
|
+
*
|
|
53
|
+
* // Use the delegation
|
|
54
|
+
* const access = await tcw.useDelegation(delegation);
|
|
55
|
+
*
|
|
56
|
+
* // Perform KV operations on the delegated space
|
|
57
|
+
* const data = await access.kv.get("shared/document.json");
|
|
58
|
+
* await access.kv.put("shared/notes.txt", "Hello!");
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare class DelegatedAccess {
|
|
62
|
+
private session;
|
|
63
|
+
private _delegation;
|
|
64
|
+
private host;
|
|
65
|
+
private _serviceContext;
|
|
66
|
+
private _kv;
|
|
67
|
+
constructor(session: TinyCloudSession, delegation: PortableDelegation, host: string);
|
|
68
|
+
/**
|
|
69
|
+
* Get the delegation this access was created from.
|
|
70
|
+
*/
|
|
71
|
+
get delegation(): PortableDelegation;
|
|
72
|
+
/**
|
|
73
|
+
* The space ID this access is for.
|
|
74
|
+
*/
|
|
75
|
+
get spaceId(): string;
|
|
76
|
+
/**
|
|
77
|
+
* The path this access is scoped to.
|
|
78
|
+
*/
|
|
79
|
+
get path(): string;
|
|
80
|
+
/**
|
|
81
|
+
* KV operations on the delegated space.
|
|
82
|
+
*/
|
|
83
|
+
get kv(): IKVService;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=delegation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegation.d.ts","sourceRoot":"","sources":["../src/delegation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,UAAU,EACV,gBAAgB,EAEhB,UAAU,EAIX,MAAM,yBAAyB,CAAC;AAGjC;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC;IACvE,uEAAuE;IACvE,gBAAgB,EAAE;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;IAE5C,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAC;IAErB,mBAAmB;IACnB,OAAO,EAAE,MAAM,CAAC;IAEhB,6DAA6D;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,uEAAuE;IACvE,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,kBAAkB,GAAG,MAAM,CAK1E;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAStE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,OAAO,CAAmB;IAClC,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,eAAe,CAAiB;IACxC,OAAO,CAAC,GAAG,CAAY;gBAGrB,OAAO,EAAE,gBAAgB,EACzB,UAAU,EAAE,kBAAkB,EAC9B,IAAI,EAAE,MAAM;IA+Bd;;OAEG;IACH,IAAI,UAAU,IAAI,kBAAkB,CAEnC;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;OAEG;IACH,IAAI,EAAE,IAAI,UAAU,CAEnB;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export { TinyCloudWeb, Config, ShareReceiveResult } from './modules/tcw';
|
|
2
|
+
export { UserAuthorization, IUserAuthorization } from './modules/UserAuthorization';
|
|
3
|
+
export { WebUserAuthorization, WebUserAuthorizationConfig, WebSignStrategy, WalletPopupStrategy, defaultWebSignStrategy, ModalSpaceCreationHandler, defaultWebSpaceCreationHandler, } from './authorization';
|
|
4
|
+
export { SignStrategy, SignRequest, SignResponse, SignCallback, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, EventEmitterStrategy, defaultSignStrategy, ISpaceCreationHandler, SpaceCreationContext, AutoApproveSpaceCreationHandler, defaultSpaceCreationHandler, } from '@tinycloudlabs/sdk-core';
|
|
4
5
|
export * from '@tinycloudlabs/web-core/client';
|
|
5
6
|
export * from '@tinycloudlabs/web-core';
|
|
6
|
-
export {
|
|
7
|
-
/** @deprecated use TCWClientConfig field instead */
|
|
8
|
-
TCWClientConfig as TCWConfig,
|
|
9
|
-
/** @deprecated use TCWClientProviders field instead */
|
|
10
|
-
TCWClientProviders as TCWProviders,
|
|
11
|
-
/** @deprecated use TCWClientSession field instead */
|
|
12
|
-
TCWClientSession as TCWSession, } from '@tinycloudlabs/web-core/client';
|
|
13
7
|
export { SiweMessage } from 'siwe';
|
|
8
|
+
export { TinyCloud, ISigner, ISessionStorage, IUserAuthorization as ICoreUserAuthorization, PersistedSessionData, SiweConfig, PartialSiweMessage, } from '@tinycloudlabs/sdk-core';
|
|
9
|
+
export { IKVService, KVService, KVResponse, PrefixedKVService, IPrefixedKVService, } from '@tinycloudlabs/sdk-core';
|
|
10
|
+
export { DelegationManager, DelegationManagerConfig, Delegation, CreateDelegationParams, DelegationChain, DelegationApiResponse, DelegationResult, DelegationError, DelegationErrorCodes, DelegationErrorCode, SharingService, createSharingService, ISharingService, SharingServiceConfig, EncodedShareData, ReceiveOptions, ShareAccess, JWK, KeyType, KeyInfo, CapabilityEntry, DelegationRecord, DelegationChainV2, DelegationDirection, DelegationFilters, SpaceOwnership, SpaceInfo, ShareSchema, ShareLink, ShareLinkData, IngestOptions, GenerateShareParams, } from '@tinycloudlabs/sdk-core';
|
|
11
|
+
export { CapabilityKeyRegistry, ICapabilityKeyRegistry, createCapabilityKeyRegistry, StoredDelegationChain, CapabilityKeyRegistryErrorCodes, CapabilityKeyRegistryErrorCode, } from '@tinycloudlabs/sdk-core';
|
|
12
|
+
export { SpaceService, ISpaceService, SpaceServiceConfig, SpaceErrorCodes, SpaceErrorCode, createSpaceService, parseSpaceUri, buildSpaceUri, Space, ISpace, SpaceConfig, ISpaceScopedDelegations, ISpaceScopedSharing, } from '@tinycloudlabs/sdk-core';
|
|
13
|
+
export { ProtocolMismatchError, VersionCheckError, checkNodeVersion, } from '@tinycloudlabs/sdk-core';
|
|
14
|
+
export { createKVService } from './modules/Storage/tinycloud/KVServiceAdapter';
|
|
15
|
+
export { PortableDelegation, DelegatedAccess, serializeDelegation, deserializeDelegation, } from './delegation';
|
|
14
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAKzE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAKpF,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACtB,yBAAyB,EACzB,8BAA8B,GAC/B,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,+BAA+B,EAC/B,2BAA2B,GAC5B,MAAM,yBAAyB,CAAC;AAKjC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;A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