File tree Expand file tree Collapse file tree
languages/typescript/packages/stack Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " @cipherstash/stack " : patch
3+ ---
4+
5+ Fix the README's OIDC federation example, which passed the ` Result ` from ` OidcFederationStrategy.create() ` straight to ` config.authStrategy ` and failed in ` Encryption() ` with ` opts.strategy.getToken is missing ` .
6+ It now unwraps the ` Result ` and passes ` strategy.data ` , and so does the ` LockContext ` JSDoc example.
Original file line number Diff line number Diff line change @@ -121,10 +121,14 @@ const client = await Encryption({ schemas: [users] });
121121// strategy serves every user. (On this native entry the client calls getJwt
122122// from a background task, so a request read from AsyncLocalStorage is not
123123// visible there yet — pass it in, or build the client per request; see
124- // cipherstash/stack#1065.)
124+ // cipherstash/stack#1065.) create() returns a Result: unwrap it and pass the
125+ // strategy itself, not the Result envelope.
126+ const strategy = OidcFederationStrategy .create (workspaceCrn , () => getUserJwt (req ));
127+ if (strategy .failure ) throw new Error (strategy .failure .error .message );
128+
125129const client = await Encryption ({
126130 schemas: [users ],
127- config: { authStrategy: OidcFederationStrategy . create ( workspaceCrn , () => getUserJwt ( req )) },
131+ config: { authStrategy: strategy . data },
128132});
129133```
130134
Original file line number Diff line number Diff line change @@ -121,10 +121,14 @@ const client = await Encryption({ schemas: [users] });
121121// strategy serves every user. (On this native entry the client calls getJwt
122122// from a background task, so a request read from AsyncLocalStorage is not
123123// visible there yet — pass it in, or build the client per request; see
124- // cipherstash/stack#1065.)
124+ // cipherstash/stack#1065.) create() returns a Result: unwrap it and pass the
125+ // strategy itself, not the Result envelope.
126+ const strategy = OidcFederationStrategy .create (workspaceCrn , () => getUserJwt (req ));
127+ if (strategy .failure ) throw new Error (strategy .failure .error .message );
128+
125129const client = await Encryption ({
126130 schemas: [users ],
127- config: { authStrategy: OidcFederationStrategy . create ( workspaceCrn , () => getUserJwt ( req )) },
131+ config: { authStrategy: strategy . data },
128132});
129133```
130134
Original file line number Diff line number Diff line change @@ -186,10 +186,14 @@ export function resolveLockContext(input: LockContextInput): Context {
186186 * import { OidcFederationStrategy } from "@cipherstash/auth"
187187 *
188188 * // Authenticate the client as the end user (replaces the old identify() flow).
189+ * // `create()` returns a `Result` — unwrap it before passing the strategy.
190+ * const strategy = OidcFederationStrategy.create(workspaceCrn, () => getJwt())
191+ * if (strategy.failure) throw new Error(strategy.failure.error.message)
192+ *
189193 * const client = await Encryption({
190194 * schemas,
191195 * config: {
192- * authStrategy: OidcFederationStrategy.create(workspaceCrn, () => getJwt()) ,
196+ * authStrategy: strategy.data ,
193197 * },
194198 * })
195199 *
You can’t perform that action at this time.
0 commit comments