@tinycloud/node-sdk 2.11.0-beta.8 → 2.11.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/dist/{core-Bkptd8qZ.d.cts → core-Bq8TMY7Y.d.cts} +188 -8
- package/dist/{core-Bkptd8qZ.d.ts → core-Bq8TMY7Y.d.ts} +188 -8
- package/dist/core.cjs +675 -67
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +693 -75
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +752 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +85 -3
- package/dist/index.d.ts +85 -3
- package/dist/index.js +765 -76
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ISigner, Bytes, IWasmBindings, PersistedSessionProof, ISessionManager } from '@tinycloud/sdk-core';
|
|
1
|
+
import { ISigner, Bytes, CapabilityPresentationEnvelopeV1, IWasmBindings, PersistedSessionProof, ISessionManager } from '@tinycloud/sdk-core';
|
|
2
2
|
export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationPage, AccountDelegationQueryOptions, AccountDelegationRecord, AccountDelegationResource, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, AutoApproveSpaceCreationHandler, AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, CallbackStrategy, CanonicalAddress, CanonicalDecryptRequest, CanonicalJson, CanonicalParsedNetworkId, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, CaveatedDelegationUnsupportedError, ClientSession, ColumnInfo, ComposeManifestOptions, ComposedManifestRequest, CreateDelegationParams, DECRYPT_ACTION, DECRYPT_FACT_TYPE, DECRYPT_RESULT_TYPE, DEFAULT_ENCRYPTION_ALG, DEFAULT_KEY_VERSION, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DataVaultConfig, DataVaultService, DatabaseHandle, DecryptCapabilityProof, DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, DecryptTransport, DecryptTransportResponseError, DelegateReceivedShareParams, DelegatedShareAccess, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DelegationRevocationReceipt, DidCacheKeyOptions, DidEqualsOptions, DiscoverNetworkInput, DiscoveredNetwork, DiscoverySource, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, ENCRYPTION_NETWORK_URN_PREFIX, ENCRYPTION_SERVICE, ENCRYPTION_SERVICE_SHORT, ENVELOPE_VERSION, EncodedShareData, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionErrorInput, EncryptionService, EncryptionServiceConfig, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IENSResolver, IEncryptionService, IHooksService, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISecretsService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InlineEncryptedEnvelope, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, OwnerDelegationPermission, OwnerSharePolicyRegistrationReceipt, ParsedNetworkId, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PkhDidParts, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiveOptions, ReceiverKeyPair, ReceiverKeySigner, RegisterBatchSuccess, RegisterOwnerSharePolicyParams, ResolvedCapabilities, ResolvedDelegate, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, SecretPayload, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceSession, SessionExpiredError, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignInOptions, SignRequest, SignResponse, SignedReceiverKeyInput, SilentNotificationHandler, Space, SpaceAbilitiesMap, SpaceConfig, SpaceCreationContext, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StoredDelegationChain, SubscribeOptions, TableInfo, TelemetryConfig, TelemetryEventHandler, TinyCloud, TinyCloudConfig, TinyCloudDebugEnableOptions, TinyCloudDebugEvent, TinyCloudDebugLevel, TinyCloudDebugLogger, TinyCloudDebugTimer, TinyCloudSession, UnsupportedFeatureError, VAULT_PERMISSION_SERVICE, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultNetworkReadResult, VaultPublicSpaceKVActions, VaultPutOptions, VerifyDecryptResponseInput, VersionCheckError, ViewInfo, WasmVaultFunctions, WellKnownDescriptorFetcher, addressStorageKey, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, buildSpaceUri, canonicalHashHex, canonicalSignedResponse, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeEncryptionJson, canonicalizeNetworkId, canonicalizeSecretScope, checkDecryptInvocationInput, checkNodeInfo, clearTinyCloudDebugLogs, composeManifestRequest, createCapabilityKeyRegistry, createOpenKeyCallbackSigningStrategy, createSharingService, createSpaceService, createVaultCrypto, decryptEnvelopeWithKey, defaultSpaceCreationHandler, deriveSignedReceiverKey, didCacheKey, didEquals, disableTinyCloudDebug, discoverNetwork, enableTinyCloudDebug, encryptToNetwork, encryptionBase64Decode, encryptionBase64Encode, encryptionError, encryptionUtf8Decode, encryptionUtf8Encode, ensureNetworkUsableForDecrypt, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, generateRandomReceiverKey, getTinyCloudDebugLogs, hexDecode, hexEncode, installTinyCloudDebugGlobals, isCapabilitySubset, isEvmAddress, isNetworkId, loadManifest, makePkhSpaceId, makePublicSpaceId, networkDiscoveryKey, openWrappedKey, parseCanonicalNetworkId, parseExpiry, parseNetworkId, parsePkhDid, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, tinyCloudDebugLogger, validateEnvelope, validateManifest, verifyDecryptResponse } from '@tinycloud/sdk-core';
|
|
3
|
-
export { A as
|
|
3
|
+
export { A as ACCEPTED_MARKER_VERSIONS, a as AuthDelegationArtifact, b as AuthRequestArtifact, B as BOOTSTRAP_COMPLETION_MARKER_KEY, c as BOOTSTRAP_COMPLETION_MARKER_VERSION, d as BootstrapCompletionMarker, e as BootstrapWarning, C as CreateOwnerDelegationParams, D as DelegateToOptions, f as DelegateToResult, g as DelegatedAccess, h as DelegationAuthority, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, M as MemorySessionStorage, N as NodeEventEmitterStrategy, i as NodeUserAuthorization, j as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, R as RestorableSession, k as RuntimeDelegationActivator, l as RuntimePermissionGrantOptions, S as SecretPermissionHint, m as SecretReadInput, n as SecretReadResult, o as SignStrategy, T as TinyCloudNode, p as TinyCloudNodeConfig, U as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, q as WasmKeyProviderConfig, r as activateValidatedRuntimeDelegation, s as createWasmKeyProvider, t as defaultSignStrategy, u as deserializeDelegation, v as grantAuthRequest, w as serializeDelegation } from './core-Bq8TMY7Y.cjs';
|
|
4
4
|
import { invoke, invokeAny, computeCid, prepareSession, completeSessionSetup, ensureEip55, makeSpaceId, createDelegation, parseRecapFromSiwe, parseVerifiedRecapFromSiwe, generateHostSIWEMessage, siweToDelegationHeaders, protocolVersion, vault_encrypt, vault_decrypt, vault_derive_key, vault_x25519_from_seed, vault_x25519_dh, vault_random_bytes, vault_sha256 } from '@tinycloud/node-sdk-wasm';
|
|
5
5
|
import 'events';
|
|
6
6
|
import '@tinycloud/sdk-services';
|
|
@@ -51,6 +51,88 @@ declare class PrivateKeySigner implements ISigner {
|
|
|
51
51
|
signMessage(message: Bytes | string): Promise<string>;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Structural shape of the OpenKey SDK's `authorizeTinyCloud()` method.
|
|
56
|
+
* Callers pass any object that conforms to this shape — typically an
|
|
57
|
+
* `OpenKey` instance from `@openkey/sdk` — without either package
|
|
58
|
+
* needing to import from the other.
|
|
59
|
+
*/
|
|
60
|
+
interface OpenKeyAuthorizeTinyCloud {
|
|
61
|
+
authorizeTinyCloud(request: {
|
|
62
|
+
protocolVersion: 1;
|
|
63
|
+
siwe: string;
|
|
64
|
+
keyId?: string;
|
|
65
|
+
jwk?: Record<string, unknown>;
|
|
66
|
+
host?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Display-only presentation envelope. Forwarded to the OpenKey
|
|
69
|
+
* widget review UI. The envelope MUST NEVER expand authority — the
|
|
70
|
+
* ReCap payload remains the sole gate — and the widget/server
|
|
71
|
+
* validates and size-bounds it before use.
|
|
72
|
+
*/
|
|
73
|
+
presentation?: CapabilityPresentationEnvelopeV1;
|
|
74
|
+
}): Promise<{
|
|
75
|
+
protocolVersion: 1;
|
|
76
|
+
address: string;
|
|
77
|
+
signature: string;
|
|
78
|
+
signedMessage: string;
|
|
79
|
+
selectedActionKeys: string[];
|
|
80
|
+
permissions: Array<{
|
|
81
|
+
service: string;
|
|
82
|
+
space: string;
|
|
83
|
+
path: string;
|
|
84
|
+
actions: string[];
|
|
85
|
+
}>;
|
|
86
|
+
}>;
|
|
87
|
+
}
|
|
88
|
+
interface OpenKeyBridgeInput {
|
|
89
|
+
protocolVersion: 1;
|
|
90
|
+
siwe: string;
|
|
91
|
+
jwk: Record<string, unknown>;
|
|
92
|
+
host?: string;
|
|
93
|
+
/** Optional keyId hint the caller wants OpenKey to bind to. */
|
|
94
|
+
keyId?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Optional presentation envelope built by `NodeUserAuthorization`
|
|
97
|
+
* from its `_manifest`. Passed through to `authorizeTinyCloud` so the
|
|
98
|
+
* widget can render honest provenance labels and the OpenKey server
|
|
99
|
+
* can origin-bind the browser origin against the app's well-known
|
|
100
|
+
* manifest. Display-only.
|
|
101
|
+
*/
|
|
102
|
+
presentation?: CapabilityPresentationEnvelopeV1;
|
|
103
|
+
}
|
|
104
|
+
type NodeUserAuthorizationAuthorizeFn = (input: OpenKeyBridgeInput) => Promise<{
|
|
105
|
+
protocolVersion: 1;
|
|
106
|
+
address: string;
|
|
107
|
+
signature: string;
|
|
108
|
+
signedMessage: string;
|
|
109
|
+
selectedActionKeys: string[];
|
|
110
|
+
permissions: Array<{
|
|
111
|
+
service: string;
|
|
112
|
+
space: string;
|
|
113
|
+
path: string;
|
|
114
|
+
actions: string[];
|
|
115
|
+
}>;
|
|
116
|
+
}>;
|
|
117
|
+
/**
|
|
118
|
+
* Wire a concrete OpenKey-shaped SDK object into the `authorizeFn`
|
|
119
|
+
* `NodeUserAuthorization.signInWithOpenKey` expects. Rejects any
|
|
120
|
+
* response that does not carry the canonical rich-result shape so
|
|
121
|
+
* wire drift shows up at the bridge boundary rather than deep inside
|
|
122
|
+
* `signInWithOpenKeyResult`.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```ts
|
|
126
|
+
* import { OpenKey } from '@openkey/sdk';
|
|
127
|
+
* import { wireOpenKeyAuthorize } from '@tinycloud/node-sdk';
|
|
128
|
+
* const openkey = new OpenKey({ appName: 'my-app' });
|
|
129
|
+
* await openkey.connect();
|
|
130
|
+
* const authorize = wireOpenKeyAuthorize(openkey);
|
|
131
|
+
* const clientSession = await nodeAuth.signInWithOpenKey(authorize);
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
declare function wireOpenKeyAuthorize(openkey: OpenKeyAuthorizeTinyCloud): NodeUserAuthorizationAuthorizeFn;
|
|
135
|
+
|
|
54
136
|
/**
|
|
55
137
|
* NodeWasmBindings - Default IWasmBindings implementation for Node.js.
|
|
56
138
|
*
|
|
@@ -93,4 +175,4 @@ declare class NodeWasmBindings implements IWasmBindings {
|
|
|
93
175
|
createSessionManager(): ISessionManager;
|
|
94
176
|
}
|
|
95
177
|
|
|
96
|
-
export { NodeWasmBindings, PrivateKeySigner };
|
|
178
|
+
export { type NodeUserAuthorizationAuthorizeFn, NodeWasmBindings, type OpenKeyAuthorizeTinyCloud, type OpenKeyBridgeInput, PrivateKeySigner, wireOpenKeyAuthorize };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ISigner, Bytes, IWasmBindings, PersistedSessionProof, ISessionManager } from '@tinycloud/sdk-core';
|
|
1
|
+
import { ISigner, Bytes, CapabilityPresentationEnvelopeV1, IWasmBindings, PersistedSessionProof, ISessionManager } from '@tinycloud/sdk-core';
|
|
2
2
|
export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationPage, AccountDelegationQueryOptions, AccountDelegationRecord, AccountDelegationResource, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, AutoApproveSpaceCreationHandler, AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, CallbackStrategy, CanonicalAddress, CanonicalDecryptRequest, CanonicalJson, CanonicalParsedNetworkId, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, CaveatedDelegationUnsupportedError, ClientSession, ColumnInfo, ComposeManifestOptions, ComposedManifestRequest, CreateDelegationParams, DECRYPT_ACTION, DECRYPT_FACT_TYPE, DECRYPT_RESULT_TYPE, DEFAULT_ENCRYPTION_ALG, DEFAULT_KEY_VERSION, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DataVaultConfig, DataVaultService, DatabaseHandle, DecryptCapabilityProof, DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, DecryptTransport, DecryptTransportResponseError, DelegateReceivedShareParams, DelegatedShareAccess, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DelegationRevocationReceipt, DidCacheKeyOptions, DidEqualsOptions, DiscoverNetworkInput, DiscoveredNetwork, DiscoverySource, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, ENCRYPTION_NETWORK_URN_PREFIX, ENCRYPTION_SERVICE, ENCRYPTION_SERVICE_SHORT, ENVELOPE_VERSION, EncodedShareData, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionErrorInput, EncryptionService, EncryptionServiceConfig, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IENSResolver, IEncryptionService, IHooksService, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISecretsService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InlineEncryptedEnvelope, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, OwnerDelegationPermission, OwnerSharePolicyRegistrationReceipt, ParsedNetworkId, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PkhDidParts, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiveOptions, ReceiverKeyPair, ReceiverKeySigner, RegisterBatchSuccess, RegisterOwnerSharePolicyParams, ResolvedCapabilities, ResolvedDelegate, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, SecretPayload, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceSession, SessionExpiredError, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignInOptions, SignRequest, SignResponse, SignedReceiverKeyInput, SilentNotificationHandler, Space, SpaceAbilitiesMap, SpaceConfig, SpaceCreationContext, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StoredDelegationChain, SubscribeOptions, TableInfo, TelemetryConfig, TelemetryEventHandler, TinyCloud, TinyCloudConfig, TinyCloudDebugEnableOptions, TinyCloudDebugEvent, TinyCloudDebugLevel, TinyCloudDebugLogger, TinyCloudDebugTimer, TinyCloudSession, UnsupportedFeatureError, VAULT_PERMISSION_SERVICE, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultNetworkReadResult, VaultPublicSpaceKVActions, VaultPutOptions, VerifyDecryptResponseInput, VersionCheckError, ViewInfo, WasmVaultFunctions, WellKnownDescriptorFetcher, addressStorageKey, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, buildSpaceUri, canonicalHashHex, canonicalSignedResponse, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeEncryptionJson, canonicalizeNetworkId, canonicalizeSecretScope, checkDecryptInvocationInput, checkNodeInfo, clearTinyCloudDebugLogs, composeManifestRequest, createCapabilityKeyRegistry, createOpenKeyCallbackSigningStrategy, createSharingService, createSpaceService, createVaultCrypto, decryptEnvelopeWithKey, defaultSpaceCreationHandler, deriveSignedReceiverKey, didCacheKey, didEquals, disableTinyCloudDebug, discoverNetwork, enableTinyCloudDebug, encryptToNetwork, encryptionBase64Decode, encryptionBase64Encode, encryptionError, encryptionUtf8Decode, encryptionUtf8Encode, ensureNetworkUsableForDecrypt, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, generateRandomReceiverKey, getTinyCloudDebugLogs, hexDecode, hexEncode, installTinyCloudDebugGlobals, isCapabilitySubset, isEvmAddress, isNetworkId, loadManifest, makePkhSpaceId, makePublicSpaceId, networkDiscoveryKey, openWrappedKey, parseCanonicalNetworkId, parseExpiry, parseNetworkId, parsePkhDid, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, tinyCloudDebugLogger, validateEnvelope, validateManifest, verifyDecryptResponse } from '@tinycloud/sdk-core';
|
|
3
|
-
export { A as
|
|
3
|
+
export { A as ACCEPTED_MARKER_VERSIONS, a as AuthDelegationArtifact, b as AuthRequestArtifact, B as BOOTSTRAP_COMPLETION_MARKER_KEY, c as BOOTSTRAP_COMPLETION_MARKER_VERSION, d as BootstrapCompletionMarker, e as BootstrapWarning, C as CreateOwnerDelegationParams, D as DelegateToOptions, f as DelegateToResult, g as DelegatedAccess, h as DelegationAuthority, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, M as MemorySessionStorage, N as NodeEventEmitterStrategy, i as NodeUserAuthorization, j as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, R as RestorableSession, k as RuntimeDelegationActivator, l as RuntimePermissionGrantOptions, S as SecretPermissionHint, m as SecretReadInput, n as SecretReadResult, o as SignStrategy, T as TinyCloudNode, p as TinyCloudNodeConfig, U as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, q as WasmKeyProviderConfig, r as activateValidatedRuntimeDelegation, s as createWasmKeyProvider, t as defaultSignStrategy, u as deserializeDelegation, v as grantAuthRequest, w as serializeDelegation } from './core-Bq8TMY7Y.js';
|
|
4
4
|
import { invoke, invokeAny, computeCid, prepareSession, completeSessionSetup, ensureEip55, makeSpaceId, createDelegation, parseRecapFromSiwe, parseVerifiedRecapFromSiwe, generateHostSIWEMessage, siweToDelegationHeaders, protocolVersion, vault_encrypt, vault_decrypt, vault_derive_key, vault_x25519_from_seed, vault_x25519_dh, vault_random_bytes, vault_sha256 } from '@tinycloud/node-sdk-wasm';
|
|
5
5
|
import 'events';
|
|
6
6
|
import '@tinycloud/sdk-services';
|
|
@@ -51,6 +51,88 @@ declare class PrivateKeySigner implements ISigner {
|
|
|
51
51
|
signMessage(message: Bytes | string): Promise<string>;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Structural shape of the OpenKey SDK's `authorizeTinyCloud()` method.
|
|
56
|
+
* Callers pass any object that conforms to this shape — typically an
|
|
57
|
+
* `OpenKey` instance from `@openkey/sdk` — without either package
|
|
58
|
+
* needing to import from the other.
|
|
59
|
+
*/
|
|
60
|
+
interface OpenKeyAuthorizeTinyCloud {
|
|
61
|
+
authorizeTinyCloud(request: {
|
|
62
|
+
protocolVersion: 1;
|
|
63
|
+
siwe: string;
|
|
64
|
+
keyId?: string;
|
|
65
|
+
jwk?: Record<string, unknown>;
|
|
66
|
+
host?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Display-only presentation envelope. Forwarded to the OpenKey
|
|
69
|
+
* widget review UI. The envelope MUST NEVER expand authority — the
|
|
70
|
+
* ReCap payload remains the sole gate — and the widget/server
|
|
71
|
+
* validates and size-bounds it before use.
|
|
72
|
+
*/
|
|
73
|
+
presentation?: CapabilityPresentationEnvelopeV1;
|
|
74
|
+
}): Promise<{
|
|
75
|
+
protocolVersion: 1;
|
|
76
|
+
address: string;
|
|
77
|
+
signature: string;
|
|
78
|
+
signedMessage: string;
|
|
79
|
+
selectedActionKeys: string[];
|
|
80
|
+
permissions: Array<{
|
|
81
|
+
service: string;
|
|
82
|
+
space: string;
|
|
83
|
+
path: string;
|
|
84
|
+
actions: string[];
|
|
85
|
+
}>;
|
|
86
|
+
}>;
|
|
87
|
+
}
|
|
88
|
+
interface OpenKeyBridgeInput {
|
|
89
|
+
protocolVersion: 1;
|
|
90
|
+
siwe: string;
|
|
91
|
+
jwk: Record<string, unknown>;
|
|
92
|
+
host?: string;
|
|
93
|
+
/** Optional keyId hint the caller wants OpenKey to bind to. */
|
|
94
|
+
keyId?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Optional presentation envelope built by `NodeUserAuthorization`
|
|
97
|
+
* from its `_manifest`. Passed through to `authorizeTinyCloud` so the
|
|
98
|
+
* widget can render honest provenance labels and the OpenKey server
|
|
99
|
+
* can origin-bind the browser origin against the app's well-known
|
|
100
|
+
* manifest. Display-only.
|
|
101
|
+
*/
|
|
102
|
+
presentation?: CapabilityPresentationEnvelopeV1;
|
|
103
|
+
}
|
|
104
|
+
type NodeUserAuthorizationAuthorizeFn = (input: OpenKeyBridgeInput) => Promise<{
|
|
105
|
+
protocolVersion: 1;
|
|
106
|
+
address: string;
|
|
107
|
+
signature: string;
|
|
108
|
+
signedMessage: string;
|
|
109
|
+
selectedActionKeys: string[];
|
|
110
|
+
permissions: Array<{
|
|
111
|
+
service: string;
|
|
112
|
+
space: string;
|
|
113
|
+
path: string;
|
|
114
|
+
actions: string[];
|
|
115
|
+
}>;
|
|
116
|
+
}>;
|
|
117
|
+
/**
|
|
118
|
+
* Wire a concrete OpenKey-shaped SDK object into the `authorizeFn`
|
|
119
|
+
* `NodeUserAuthorization.signInWithOpenKey` expects. Rejects any
|
|
120
|
+
* response that does not carry the canonical rich-result shape so
|
|
121
|
+
* wire drift shows up at the bridge boundary rather than deep inside
|
|
122
|
+
* `signInWithOpenKeyResult`.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```ts
|
|
126
|
+
* import { OpenKey } from '@openkey/sdk';
|
|
127
|
+
* import { wireOpenKeyAuthorize } from '@tinycloud/node-sdk';
|
|
128
|
+
* const openkey = new OpenKey({ appName: 'my-app' });
|
|
129
|
+
* await openkey.connect();
|
|
130
|
+
* const authorize = wireOpenKeyAuthorize(openkey);
|
|
131
|
+
* const clientSession = await nodeAuth.signInWithOpenKey(authorize);
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
declare function wireOpenKeyAuthorize(openkey: OpenKeyAuthorizeTinyCloud): NodeUserAuthorizationAuthorizeFn;
|
|
135
|
+
|
|
54
136
|
/**
|
|
55
137
|
* NodeWasmBindings - Default IWasmBindings implementation for Node.js.
|
|
56
138
|
*
|
|
@@ -93,4 +175,4 @@ declare class NodeWasmBindings implements IWasmBindings {
|
|
|
93
175
|
createSessionManager(): ISessionManager;
|
|
94
176
|
}
|
|
95
177
|
|
|
96
|
-
export { NodeWasmBindings, PrivateKeySigner };
|
|
178
|
+
export { type NodeUserAuthorizationAuthorizeFn, NodeWasmBindings, type OpenKeyAuthorizeTinyCloud, type OpenKeyBridgeInput, PrivateKeySigner, wireOpenKeyAuthorize };
|