@tinycloud/node-sdk 3.2.0-beta.5 → 3.2.0-beta.6
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/{WasmKeyProvider-D2gBxuiY.d.cts → WasmKeyProvider-C3NFgOmv.d.cts} +18 -4
- package/dist/{WasmKeyProvider-D2gBxuiY.d.ts → WasmKeyProvider-C3NFgOmv.d.ts} +18 -4
- package/dist/core.cjs +12 -8
- 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 +12 -8
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +34 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +33 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -898,11 +898,11 @@ interface ValidatedRuntimeDelegation {
|
|
|
898
898
|
readonly cid: string;
|
|
899
899
|
/** The authority object installed by the node runtime. */
|
|
900
900
|
readonly delegation: PortableDelegation;
|
|
901
|
-
/** Capabilities read from the signed compact UCAN attenuation. */
|
|
901
|
+
/** Capabilities read from the signed compact UCAN attenuation or SIWE ReCap. */
|
|
902
902
|
readonly effectivePermissions: readonly PermissionEntry[];
|
|
903
|
-
/** Expiry read from the signed compact UCAN payload. */
|
|
903
|
+
/** Expiry read from the signed compact UCAN payload or SIWE. */
|
|
904
904
|
readonly expiry: Date;
|
|
905
|
-
/** Audience read from the signed compact UCAN payload. */
|
|
905
|
+
/** Audience read from the signed compact UCAN payload or SIWE. */
|
|
906
906
|
readonly audience: string;
|
|
907
907
|
/** Host selected for, and used by, the runtime activation. */
|
|
908
908
|
readonly host: string;
|
|
@@ -982,6 +982,20 @@ declare function activateValidatedRuntimeDelegation(node: RuntimeDelegationActiv
|
|
|
982
982
|
* derived from signed bytes before `/delegate` is called.
|
|
983
983
|
*/
|
|
984
984
|
declare function activateCompactRuntimeDelegation(node: RuntimeDelegationActivator, input: CompactRuntimeDelegationInput): Promise<ValidatedRuntimeDelegation>;
|
|
985
|
+
/**
|
|
986
|
+
* Project an OpenKey signed-login delegation from the same verified CACAO
|
|
987
|
+
* authority used when the runtime activates and replays it.
|
|
988
|
+
*/
|
|
989
|
+
declare function siweRuntimeDelegation(node: RuntimeDelegationActivator, input: {
|
|
990
|
+
readonly authorization: string;
|
|
991
|
+
readonly cid: string;
|
|
992
|
+
readonly spaceId: string;
|
|
993
|
+
readonly ownerAddress: string;
|
|
994
|
+
readonly chainId: number;
|
|
995
|
+
readonly siwe: string;
|
|
996
|
+
readonly signature: string;
|
|
997
|
+
readonly host: string;
|
|
998
|
+
}): PortableDelegation;
|
|
985
999
|
/**
|
|
986
1000
|
* Turn a delegation REQUEST into a signed GRANT.
|
|
987
1001
|
*
|
|
@@ -2741,4 +2755,4 @@ declare class WasmKeyProvider implements KeyProvider {
|
|
|
2741
2755
|
*/
|
|
2742
2756
|
declare function createWasmKeyProvider(sessionManager: SessionManagerWithListing): WasmKeyProvider;
|
|
2743
2757
|
|
|
2744
|
-
export { ACCEPTED_MARKER_VERSIONS as A, BOOTSTRAP_COMPLETION_MARKER_KEY as B, type CompactRuntimeDelegationInput as C, type DelegateToOptions as D, type EnsureEncryptionNetworkOptions as E, FileSessionStorage as F, activateValidatedRuntimeDelegation as G, createWasmKeyProvider as H, InvalidRestoredSessionError as I, defaultSignStrategy as J, deserializeDelegation as K, grantAuthRequest as L, MemorySessionStorage as M, type NodeEventEmitterStrategy as N, type OwnerDelegationReceipt as O, type PortableDelegation as P, serializeDelegation as Q, RUNTIME_DELEGATION_REJECTIONS as R, type SecretPermissionHint as S, TinyCloudNode as T, type UnifiedOwnerRootInput as U, type ValidatedRuntimeDelegation as V, WasmKeyProvider as W, signedCompactUcanExpiry as X, type AuthDelegationArtifact as a, type AuthRequestArtifact as b, BOOTSTRAP_COMPLETION_MARKER_VERSION as c, type BootstrapCompletionMarker as d, type BootstrapWarning as e, type CreateOwnerDelegationParams as f, type DelegateToResult as g, DelegatedAccess as h, type DelegationAuthority as i, NodeUserAuthorization as j, type NodeUserAuthorizationConfig as k, type RestorableSession as l, type RuntimeDelegationActivator as m, RuntimeDelegationRejectedError as n, type RuntimeDelegationRejection as o, type RuntimePermissionGrantOptions as p, type SecretReadInput as q, type SecretReadResult as r, type SessionGrantProof as s, type SignStrategy as t, type TinyCloudNodeConfig as u, type UnifiedOwnerRootReceipt as v, UnsupportedSessionRestoreError as w, type VerifiedSessionGrant as x, type WasmKeyProviderConfig as y, activateCompactRuntimeDelegation as z };
|
|
2758
|
+
export { ACCEPTED_MARKER_VERSIONS as A, BOOTSTRAP_COMPLETION_MARKER_KEY as B, type CompactRuntimeDelegationInput as C, type DelegateToOptions as D, type EnsureEncryptionNetworkOptions as E, FileSessionStorage as F, activateValidatedRuntimeDelegation as G, createWasmKeyProvider as H, InvalidRestoredSessionError as I, defaultSignStrategy as J, deserializeDelegation as K, grantAuthRequest as L, MemorySessionStorage as M, type NodeEventEmitterStrategy as N, type OwnerDelegationReceipt as O, type PortableDelegation as P, serializeDelegation as Q, RUNTIME_DELEGATION_REJECTIONS as R, type SecretPermissionHint as S, TinyCloudNode as T, type UnifiedOwnerRootInput as U, type ValidatedRuntimeDelegation as V, WasmKeyProvider as W, signedCompactUcanExpiry as X, siweRuntimeDelegation as Y, type AuthDelegationArtifact as a, type AuthRequestArtifact as b, BOOTSTRAP_COMPLETION_MARKER_VERSION as c, type BootstrapCompletionMarker as d, type BootstrapWarning as e, type CreateOwnerDelegationParams as f, type DelegateToResult as g, DelegatedAccess as h, type DelegationAuthority as i, NodeUserAuthorization as j, type NodeUserAuthorizationConfig as k, type RestorableSession as l, type RuntimeDelegationActivator as m, RuntimeDelegationRejectedError as n, type RuntimeDelegationRejection as o, type RuntimePermissionGrantOptions as p, type SecretReadInput as q, type SecretReadResult as r, type SessionGrantProof as s, type SignStrategy as t, type TinyCloudNodeConfig as u, type UnifiedOwnerRootReceipt as v, UnsupportedSessionRestoreError as w, type VerifiedSessionGrant as x, type WasmKeyProviderConfig as y, activateCompactRuntimeDelegation as z };
|
|
@@ -898,11 +898,11 @@ interface ValidatedRuntimeDelegation {
|
|
|
898
898
|
readonly cid: string;
|
|
899
899
|
/** The authority object installed by the node runtime. */
|
|
900
900
|
readonly delegation: PortableDelegation;
|
|
901
|
-
/** Capabilities read from the signed compact UCAN attenuation. */
|
|
901
|
+
/** Capabilities read from the signed compact UCAN attenuation or SIWE ReCap. */
|
|
902
902
|
readonly effectivePermissions: readonly PermissionEntry[];
|
|
903
|
-
/** Expiry read from the signed compact UCAN payload. */
|
|
903
|
+
/** Expiry read from the signed compact UCAN payload or SIWE. */
|
|
904
904
|
readonly expiry: Date;
|
|
905
|
-
/** Audience read from the signed compact UCAN payload. */
|
|
905
|
+
/** Audience read from the signed compact UCAN payload or SIWE. */
|
|
906
906
|
readonly audience: string;
|
|
907
907
|
/** Host selected for, and used by, the runtime activation. */
|
|
908
908
|
readonly host: string;
|
|
@@ -982,6 +982,20 @@ declare function activateValidatedRuntimeDelegation(node: RuntimeDelegationActiv
|
|
|
982
982
|
* derived from signed bytes before `/delegate` is called.
|
|
983
983
|
*/
|
|
984
984
|
declare function activateCompactRuntimeDelegation(node: RuntimeDelegationActivator, input: CompactRuntimeDelegationInput): Promise<ValidatedRuntimeDelegation>;
|
|
985
|
+
/**
|
|
986
|
+
* Project an OpenKey signed-login delegation from the same verified CACAO
|
|
987
|
+
* authority used when the runtime activates and replays it.
|
|
988
|
+
*/
|
|
989
|
+
declare function siweRuntimeDelegation(node: RuntimeDelegationActivator, input: {
|
|
990
|
+
readonly authorization: string;
|
|
991
|
+
readonly cid: string;
|
|
992
|
+
readonly spaceId: string;
|
|
993
|
+
readonly ownerAddress: string;
|
|
994
|
+
readonly chainId: number;
|
|
995
|
+
readonly siwe: string;
|
|
996
|
+
readonly signature: string;
|
|
997
|
+
readonly host: string;
|
|
998
|
+
}): PortableDelegation;
|
|
985
999
|
/**
|
|
986
1000
|
* Turn a delegation REQUEST into a signed GRANT.
|
|
987
1001
|
*
|
|
@@ -2741,4 +2755,4 @@ declare class WasmKeyProvider implements KeyProvider {
|
|
|
2741
2755
|
*/
|
|
2742
2756
|
declare function createWasmKeyProvider(sessionManager: SessionManagerWithListing): WasmKeyProvider;
|
|
2743
2757
|
|
|
2744
|
-
export { ACCEPTED_MARKER_VERSIONS as A, BOOTSTRAP_COMPLETION_MARKER_KEY as B, type CompactRuntimeDelegationInput as C, type DelegateToOptions as D, type EnsureEncryptionNetworkOptions as E, FileSessionStorage as F, activateValidatedRuntimeDelegation as G, createWasmKeyProvider as H, InvalidRestoredSessionError as I, defaultSignStrategy as J, deserializeDelegation as K, grantAuthRequest as L, MemorySessionStorage as M, type NodeEventEmitterStrategy as N, type OwnerDelegationReceipt as O, type PortableDelegation as P, serializeDelegation as Q, RUNTIME_DELEGATION_REJECTIONS as R, type SecretPermissionHint as S, TinyCloudNode as T, type UnifiedOwnerRootInput as U, type ValidatedRuntimeDelegation as V, WasmKeyProvider as W, signedCompactUcanExpiry as X, type AuthDelegationArtifact as a, type AuthRequestArtifact as b, BOOTSTRAP_COMPLETION_MARKER_VERSION as c, type BootstrapCompletionMarker as d, type BootstrapWarning as e, type CreateOwnerDelegationParams as f, type DelegateToResult as g, DelegatedAccess as h, type DelegationAuthority as i, NodeUserAuthorization as j, type NodeUserAuthorizationConfig as k, type RestorableSession as l, type RuntimeDelegationActivator as m, RuntimeDelegationRejectedError as n, type RuntimeDelegationRejection as o, type RuntimePermissionGrantOptions as p, type SecretReadInput as q, type SecretReadResult as r, type SessionGrantProof as s, type SignStrategy as t, type TinyCloudNodeConfig as u, type UnifiedOwnerRootReceipt as v, UnsupportedSessionRestoreError as w, type VerifiedSessionGrant as x, type WasmKeyProviderConfig as y, activateCompactRuntimeDelegation as z };
|
|
2758
|
+
export { ACCEPTED_MARKER_VERSIONS as A, BOOTSTRAP_COMPLETION_MARKER_KEY as B, type CompactRuntimeDelegationInput as C, type DelegateToOptions as D, type EnsureEncryptionNetworkOptions as E, FileSessionStorage as F, activateValidatedRuntimeDelegation as G, createWasmKeyProvider as H, InvalidRestoredSessionError as I, defaultSignStrategy as J, deserializeDelegation as K, grantAuthRequest as L, MemorySessionStorage as M, type NodeEventEmitterStrategy as N, type OwnerDelegationReceipt as O, type PortableDelegation as P, serializeDelegation as Q, RUNTIME_DELEGATION_REJECTIONS as R, type SecretPermissionHint as S, TinyCloudNode as T, type UnifiedOwnerRootInput as U, type ValidatedRuntimeDelegation as V, WasmKeyProvider as W, signedCompactUcanExpiry as X, siweRuntimeDelegation as Y, type AuthDelegationArtifact as a, type AuthRequestArtifact as b, BOOTSTRAP_COMPLETION_MARKER_VERSION as c, type BootstrapCompletionMarker as d, type BootstrapWarning as e, type CreateOwnerDelegationParams as f, type DelegateToResult as g, DelegatedAccess as h, type DelegationAuthority as i, NodeUserAuthorization as j, type NodeUserAuthorizationConfig as k, type RestorableSession as l, type RuntimeDelegationActivator as m, RuntimeDelegationRejectedError as n, type RuntimeDelegationRejection as o, type RuntimePermissionGrantOptions as p, type SecretReadInput as q, type SecretReadResult as r, type SessionGrantProof as s, type SignStrategy as t, type TinyCloudNodeConfig as u, type UnifiedOwnerRootReceipt as v, UnsupportedSessionRestoreError as w, type VerifiedSessionGrant as x, type WasmKeyProviderConfig as y, activateCompactRuntimeDelegation as z };
|
package/dist/core.cjs
CHANGED
|
@@ -2408,18 +2408,25 @@ async function activateCompactRuntimeDelegation(node, input) {
|
|
|
2408
2408
|
throw new Error("Compact runtime delegation CID does not match authorization bytes.");
|
|
2409
2409
|
}
|
|
2410
2410
|
const signed = signedAuthorityFromCompactUcan(authorization);
|
|
2411
|
+
return activateValidatedRuntimeDelegation(
|
|
2412
|
+
node,
|
|
2413
|
+
portableFromSignedAuthority(cid, authorization, signed, input),
|
|
2414
|
+
{ host: input.host }
|
|
2415
|
+
);
|
|
2416
|
+
}
|
|
2417
|
+
function portableFromSignedAuthority(cid, authorization, signed, transport) {
|
|
2411
2418
|
const primary = signed.resources[0];
|
|
2412
2419
|
const signedSpace = signed.permissions.find(
|
|
2413
2420
|
(permission) => permission.service !== "tinycloud.encryption"
|
|
2414
2421
|
)?.space;
|
|
2415
|
-
|
|
2422
|
+
return {
|
|
2416
2423
|
cid,
|
|
2417
2424
|
delegationHeader: { Authorization: authorization },
|
|
2418
|
-
ownerAddress:
|
|
2419
|
-
chainId:
|
|
2425
|
+
ownerAddress: transport.ownerAddress,
|
|
2426
|
+
chainId: transport.chainId,
|
|
2420
2427
|
delegatorDID: signed.issuer,
|
|
2421
2428
|
authHeader: authorization,
|
|
2422
|
-
spaceId: signedSpace ?? primary.space,
|
|
2429
|
+
spaceId: signedSpace ?? transport.spaceId ?? primary.space,
|
|
2423
2430
|
path: primary.path,
|
|
2424
2431
|
actions: [...primary.actions],
|
|
2425
2432
|
...primary.caveats === void 0 ? {} : { caveats: primary.caveats },
|
|
@@ -2429,11 +2436,8 @@ async function activateCompactRuntimeDelegation(node, input) {
|
|
|
2429
2436
|
})),
|
|
2430
2437
|
expiry: new Date(signed.expiry),
|
|
2431
2438
|
delegateDID: signed.audience,
|
|
2432
|
-
host: normalizedHost(
|
|
2439
|
+
host: normalizedHost(transport.host)
|
|
2433
2440
|
};
|
|
2434
|
-
return activateValidatedRuntimeDelegation(node, delegation, {
|
|
2435
|
-
host: input.host
|
|
2436
|
-
});
|
|
2437
2441
|
}
|
|
2438
2442
|
function serializeDelegation(delegation) {
|
|
2439
2443
|
return JSON.stringify({
|