pact icon indicating copy to clipboard operation
pact copied to clipboard

Decentralized Principal Namespaces

Open sirlensalot opened this issue 3 years ago • 1 comments

Allow namespaces to be freely created and administered by naming them using the hash of the principal of the initial admin guard for the namespace.

The following repl example shows what a namespace name might look like for the admin (and user) namespace guard:

pact> (env-data { 'my-keyset: ["key"] })
"Setting transaction data"
pact> (let* ((ks (read-keyset 'my-keyset)) (ns (hash (create-principal ks)))) (define-namespace ns ks ks))
"Namespace defined: mCCzD77_vJKG2a_G8_fx3-I4gzIVbkWpVGqtRlxAcPY"

Once created, the namespace operates as normal, administrated by the admin guard.

sirlensalot avatar Jun 25 '22 17:06 sirlensalot

So a hash here is suboptimal, since namespaces (and identifiers in general) cannot start with a number, and there's no gaurantee that a hash is going to start with a letter. a solution to this imo is to just do a replace on the principal, swapping : for a character of our chase (proposing #), so that the principal becomes the namespace, and the resulting namespace name is human readable (or at least verifiable as belonging to some principal). This does come with a caveat tho: it'd only work reasonably well with w and k principals due to the existence of namespaced keysets ruining the party for r, which now reference fully qualified keyset names and therefore are invalid as namespace names.

The syntax seems to work:

w:mY3234343veryBoringH4sh:keys-all

and

k:oTh3rV3ryBor1ngH4sh

Become namespaces named

w#mY3234343veryBoringH4sh#keys-all

and

k#oTh3rV3ryBor1ngH4sh

Which are valid as namespaces.

emilypi avatar Aug 25 '22 19:08 emilypi