You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The hmacIdCanonize primitive allows for a labelMap to be passed as an alternative to an hmac -- and it internally uses a custom canonize function. We should expose the custom canonize function and have it take an asynchronous label mapping function.
We could then build a simple helper canonize primitive that just takes a labelMap that is used instead of the hmacIdCanonize one -- and that can be reused with any labelMap.
We should also ensure that the approach passes the normalized dataset (or minimally the canonicalIdMap) to the label mapping function such that a function could be written that considers the total number of blank nodes. Such a function would be useful to SD schemes that want to make HMAC'd bnode labels map to a smaller namespace (rather than using the whole digest). An example would be:
// closure has an HMAC, can be auto-provided by or passed// to another primitive function that does this common behaviorconsthmac=createHmac();letlabelMap;asyncfunctionlabelMapper({label, canonicalIdMap}){// init labelMap if not initialized yetif(!labelMap){// hmac all labels in `canonicalIdMap`consthmacs=awaitPromise.all([[...canonicalIdMap.values()].map(label=>({label,signature: awaithmac.sign(label)}))]);// sort based on signature...// deal with base64url encoding either before or after// sort considering tradeoffs of implementation ease// vs. efficiencyhmacs.sort(comparator);// fill `labelMap` in orderlabelMap=newMap();hmacs.forEach(({label},i)=>labelMap.set(label,`b${i}`));}returnlabelMap.get(label);}
The text was updated successfully, but these errors were encountered:
The
hmacIdCanonize
primitive allows for alabelMap
to be passed as an alternative to an hmac -- and it internally uses a custom canonize function. We should expose the custom canonize function and have it take an asynchronous label mapping function.We could then build a simple helper canonize primitive that just takes a
labelMap
that is used instead of thehmacIdCanonize
one -- and that can be reused with anylabelMap
.We should also ensure that the approach passes the normalized dataset (or minimally the
canonicalIdMap
) to the label mapping function such that a function could be written that considers the total number of blank nodes. Such a function would be useful to SD schemes that want to make HMAC'd bnode labels map to a smaller namespace (rather than using the whole digest). An example would be:The text was updated successfully, but these errors were encountered: