-
Notifications
You must be signed in to change notification settings - Fork 12
feat: create web server identity token #52
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
Conversation
@maliroteh-sf For now I went with your idea on handling the error case with config file. All of your comments are addressed. If @khawkins have another idea we can take care of it in this PR or in a later one. As long as you're not blocked. |
Can we rebase against |
211963d
to
dba95d4
Compare
return Promise.resolve(undefined); | ||
} | ||
|
||
public static async writeIdentityToken(token: string): Promise<void> { |
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.
This method could be private
but when I do that I won't be able to stub it in the unit test.
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.
I think it is ok to leave it public
.... it is a function in a utility library that could be on use in the future
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.
I would however update the method signature to take an optional config
param in addition to the token.
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.
@maliroteh-sf I didn't add optional config
in "write" because now we need to deal separate "configs" depending on "writing" to or "reading" from sf
's configuration. Making config
optional and delegate that responsibility to the called is certainly an approach that could have been taken. But with given inflexibility with Config
's APIs and their shortcomings I think the safest way for now for us is to encapsulate the different configs(Config
and ConfigAggregator
) in respective "write" and "read" methods.
src/shared/identityUtils.ts
Outdated
const config = await LightningDevConfig.create({ | ||
isGlobal: false, | ||
}); | ||
await config.read(); |
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.
I would update the method signature to take an optional config
param so that we don't have to re-read the config if it was already read before. Then you can check to see if config
param was passed in or not and if not only then proceed with these lines. This way we can reduce disk access/read
Co-authored-by: Abdulsattar Mohammed <abdulsattarmohammed@salesforce.com>
What does this PR do?
Created a class that generates 256-bit, CSPRNG-generated identity token associated with the local dev server. After the token is created it is saved in the file,
config.json
, which is a filesf
CLI saves configuration in by default.I have purposely omitted for now to call the method
IdentityUtils.updateConfigWithIdentityToken()
from any command until it finds an appropriate place to be called.Created a class that generates 256-bit, CSPRNG-generated identity token associated with the local dev server. After the token is created it is saved in the file,lwr.config.json
, if it exists.I have purposely omitted for now to call the methodIdentityUtils.createIdentityToken()
from any command since there is nolwr.config.json
created anywhere yet.What issues does this PR fix or reference?
@W-15818521@