-
Notifications
You must be signed in to change notification settings - Fork 24
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
User creation and authentication #25
Conversation
Nice this looks really good 👍
We should still allow byte operations in the So yeah in summary:
And this should be good to go 👍 For future reference, if you have to really dig into the internals like this: const signed = await operator.signBytes(
utils.strToArrBuf(`${encodedHeader}.${encodedPayload}`, 8),
ks.writeKey.privateKey,
ks.cfg.hashAlg
) then it probably means either:
these libraries are made by us & primarily for us, so if something seems clunky, ping me and we can change it at the library level 👌 |
function jwtAlgorithm(cryptoSystem: CryptoSystem): string | null { | ||
switch (cryptoSystem) { | ||
case CryptoSystem.ECC: return 'Ed25519'; | ||
case CryptoSystem.RSA: return 'RS256'; |
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.
@dholms I just did this instead of adding this isRSA
and isECC
methods. Is that ok?
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.
Yes that's great 👍
Except... WebCrypto doesn't support Ed25519, it uses NIST Curves (P-256, P-384, P-521). Sooo if we want to support those, we'll need to figure out magic bytes & what not for them on the server...
We may want to have CryptoSystem.ECC
return null
until we get that set up server-side. The ts-sdk always generates RSA keys unless the user overrides it
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.
Ohhh ok, woops. I assumed ECC was the same as ED 😅 Yeah, we should discuss this later. In the meantime, will remove the ecc/ed stuff.
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 too many acronyms, it's all so confusing 😅
ED is a type of ECC. But multiformats are supposed to be completely self-describing so each ECC curve needs it's own ✨ magic bytes ✨
} | ||
|
||
removeSyncHook(hook: SyncHook): Array<SyncHook> { | ||
return this.syncHooks.filter(h => h !== hook) | ||
} |
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.
Added hooks here ☝️
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.
Adds the following functions:
createAccount
didJWT
didKey
isUsernameAvailable
updateRoot