-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update multiformats, add JWS utilities, update deps #1
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, been looking forward to using the new multiformats libs.
Can you bump the package version to 1.0?
Should we wait with merging this until the jest issue has been resolved?
} | ||
|
||
export function decodeCleartext(b: Uint8Array): Record<string, any> { | ||
return decodeIdentityCID(unpadCIDBytes(b)) | ||
return decodeIdentityCID(CID.decodeFirst(b)[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, this seems like a new useful thing :)
### toJWSPayload(payload: EncodedPayload | CID): string | ||
Transform an `EnvodedPayload` (from `encodePayload()`) or a CID into a JWS string for use with `createJWS()` in [did-jwt](https://github.com/decentralized-identity/did-jwt). The string form is simply the Base64url encoded form of the CID's byte representation. | ||
|
||
### toJWSStrings(jose: any): string[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunate that you need this method. Ideally did-jwt
should support the General encoding, that the ´jose` object here has, out of the box!
if (!cid) { | ||
throw new Error('Payload must be an EncodedPayload or a CID') | ||
} | ||
return base64url.encode(cid.bytes).slice(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does base64url.encode
return multibase and that's why we slice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, and there's no easy way to get to the plain base64 encoder (yet—this has annoyed me on a few occasions so I think I might go and do something about it)
version bumped, typos fixed
No, I went down the rabbit hole on that one and the dependency chain of things that need to be resolved is deep and unlikely to be resolved any time soon unfortunately. A large collection of users are having to work around some of the Jest problems so maybe pressure will increase to find a more speedy resolution but for now it's on hold. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
|
breaking because
encodeIdentityCID()
is async nowWill follow up with a PR to jd-dag-jose that couples with (and uses) this and discuss over there.
Custom Jest resolver is pending fix being tracked @ jestjs/jest#9771