Skip to content

Commit

Permalink
Updating to Hab and Manager to properly support random key generation (
Browse files Browse the repository at this point in the history
…#589)

Signed-off-by: pfeairheller <[email protected]>
  • Loading branch information
pfeairheller authored Oct 26, 2023
1 parent 5fc7f29 commit 3a82ede
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
15 changes: 14 additions & 1 deletion src/keri/app/habbing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2099,7 +2099,8 @@ def __init__(self, **kwa):

def make(self, *, secrecies=None, iridx=0, code=coring.MtrDex.Blake3_256, dcode=coring.MtrDex.Blake3_256,
icode=coring.MtrDex.Ed25519_Seed, transferable=True, isith=None, icount=1, nsith=None, ncount=None,
toad=None, wits=None, delpre=None, estOnly=False, DnD=False, hidden=False, data=None):
toad=None, wits=None, delpre=None, estOnly=False, DnD=False, hidden=False, data=None, algo=None,
salt=None, tier=None):
"""
Finish setting up or making Hab from parameters includes inception.
Assumes injected dependencies were already setup.
Expand Down Expand Up @@ -2133,6 +2134,10 @@ def make(self, *, secrecies=None, iridx=0, code=coring.MtrDex.Blake3_256, dcode=
hidden (bool): A hidden Hab is not included in the list of Habs.
data (list | None): seal dicts
algo is str key creation algorithm code
salt(str): qb64 salt for randomization when salty algorithm used
tier(str): is str security criticality tier code when using salty algorithm
"""
if not (self.ks.opened and self.db.opened and self.cf.opened):
Expand Down Expand Up @@ -2164,6 +2169,9 @@ def make(self, *, secrecies=None, iridx=0, code=coring.MtrDex.Blake3_256, dcode=
stem=stem,
transferable=transferable,
dcode=dcode,
algo=algo,
salt=salt,
tier=tier,
temp=self.temp)

serder = super(Hab, self).make(isith=isith,
Expand Down Expand Up @@ -2208,6 +2216,11 @@ def make(self, *, secrecies=None, iridx=0, code=coring.MtrDex.Blake3_256, dcode=

self.inited = True

@property
def algo(self):
pp = self.ks.prms.get(self.pre)
return pp.algo

def rotate(self, *, isith=None, nsith=None, ncount=None, toad=None, cuts=None, adds=None,
data=None, **kwargs):
"""
Expand Down
7 changes: 4 additions & 3 deletions src/keri/app/keeping.py
Original file line number Diff line number Diff line change
Expand Up @@ -1010,15 +1010,16 @@ def incept(self, icodes=None, icount=1, icode=coring.MtrDex.Ed25519_Seed,
transferable=transferable, temp=temp)
digers = [coring.Diger(ser=signer.verfer.qb64b, code=dcode) for signer in nsigners]


# Secret to encrypt here
pp = PrePrm(pidx=pidx,
algo=algo,
salt=(creator.salt if not self.encrypter
else self.encrypter.encrypt(ser=creator.salt).qb64),
stem=creator.stem,
tier=creator.tier)

if creator.salt:
pp.salt = (creator.salt if not self.encrypter
else self.encrypter.encrypt(ser=creator.salt).qb64)

dt = helping.nowIso8601()
ps = PreSit(
new=PubLot(pubs=[verfer.qb64 for verfer in verfers],
Expand Down

0 comments on commit 3a82ede

Please sign in to comment.