Io.write_cred: def of cswap-bend-cli@0.1.0.0 Import: import cswap-bend-cli@0.1.0.0/store/io.bend as Io Lines 118-124 of cswap-bend-cli@0.1.0.0/store/io.bend: https://jend.leeeet.dev/read.txt?path=cswap-bend-cli@0.1.0.0/store/io.bend&start_line=118&end_line=124 import Base import cswap-bend-cli@0.1.0.0/b64.bend as B64 import cswap-bend-cli@0.1.0.0/act.bend as Act import cswap-bend-cli@0.1.0.0/store/base.bend as SBase # Store a slot's credential (0600). The generation it replaces is kept as # `.enc.prev` when it was readable and different. def write_cred(+root: String, +slot: String, +email: String, +creds: String) -> Act.of(Unit): do ActM: +cur : String <- read_cred(root, slot, email) keep_prev(SBase.nonempty(cur) && SBase.not_(String.eq(cur, creds)), root, slot, email, cur) write_secret(SBase.enc_path(root, slot, email), B64.encode(creds)) Uses (14): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.eq https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Unit https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/act.bend&name=of https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/b64.bend&name=encode https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/store/base.bend&name=enc_path https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/store/base.bend&name=nonempty https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/store/base.bend&name=not_ https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/store/io.bend&name=ActM https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/store/io.bend&name=ActM.bind https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/store/io.bend&name=keep_prev https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/store/io.bend&name=read_cred https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/store/io.bend&name=write_secret