@spacehq/sdk > UserStorage > shareViaPublicKey
UserStorage.shareViaPublicKey() method
shareViaPublicKey shares specified files to users who owns the specified public keys.
Signature:
shareViaPublicKey(request: ShareViaPublicKeyRequest): Promise<ShareViaPublicKeyResponse>;
Parameters
Parameter | Type | Description |
---|---|---|
request | ShareViaPublicKeyRequest |
Returns:
Promise<ShareViaPublicKeyResponse>
Example
const result = await spaceStorage.shareViaPublicKey({
publicKeys: [{
id: 'user@email.com', // or any identifier for the user
pk: 'user-pk-hex-or-multibase', // optional, omit if user doesn't exist yet, it would generate temp access key
}],
paths: [{
bucket: 'personal',
path: '/file/path/here'
}],
});