mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-21 03:55:27 +00:00
Allow supplying keypair when creating mutable dirs
This commit is contained in:
parent
dd568ab6f4
commit
9c2362853d
@ -1125,8 +1125,18 @@ class _Client(node.Node, pollmixin.PollMixin):
|
||||
# may get an opaque node if there were any problems.
|
||||
return self.nodemaker.create_from_cap(write_uri, read_uri, deep_immutable=deep_immutable, name=name)
|
||||
|
||||
def create_dirnode(self, initial_children=None, version=None):
|
||||
d = self.nodemaker.create_new_mutable_directory(initial_children, version=version)
|
||||
def create_dirnode(
|
||||
self,
|
||||
initial_children=None,
|
||||
version=None,
|
||||
*,
|
||||
unique_keypair: tuple[rsa.PublicKey, rsa.PrivateKey] | None = None
|
||||
):
|
||||
d = self.nodemaker.create_new_mutable_directory(
|
||||
initial_children,
|
||||
version=version,
|
||||
keypair=unique_keypair,
|
||||
)
|
||||
return d
|
||||
|
||||
def create_immutable_dirnode(self, children, convergence=None):
|
||||
|
@ -135,7 +135,13 @@ class NodeMaker(object):
|
||||
d.addCallback(lambda res: n)
|
||||
return d
|
||||
|
||||
def create_new_mutable_directory(self, initial_children=None, version=None):
|
||||
def create_new_mutable_directory(
|
||||
self,
|
||||
initial_children=None,
|
||||
version=None,
|
||||
*,
|
||||
keypair: tuple[PublicKey, PrivateKey] | None = None,
|
||||
):
|
||||
if initial_children is None:
|
||||
initial_children = {}
|
||||
for (name, (node, metadata)) in initial_children.items():
|
||||
@ -145,7 +151,8 @@ class NodeMaker(object):
|
||||
d = self.create_mutable_file(lambda n:
|
||||
MutableData(pack_children(initial_children,
|
||||
n.get_writekey())),
|
||||
version=version)
|
||||
version=version,
|
||||
keypair=keypair)
|
||||
d.addCallback(self._create_dirnode)
|
||||
return d
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user