@doflo/flow-interfaces
Advanced tools
Comparing version 1.16.8 to 1.16.9
@@ -0,1 +1,2 @@ | ||
import { ICredentialPointer } from '../..'; | ||
import { ICredential } from '../../..'; | ||
@@ -10,2 +11,3 @@ /** | ||
export interface credentialAPI { | ||
create(credentialPointer: ICredentialPointer): Promise<string | undefined>; | ||
/** | ||
@@ -20,2 +22,10 @@ *  | ||
create(FERN: string, teamId: string, data: JSON): Promise<string | undefined>; | ||
/** | ||
*  | ||
* | ||
* ### Create (Credential) | ||
* | ||
* Create a credential, creates a credential and returns the id of the new credential | ||
* | ||
*/ | ||
create(FERN: string, teamId: string, id: string): Promise<string | undefined>; | ||
@@ -34,2 +44,64 @@ /** | ||
/** | ||
*  | ||
* | ||
* ### Decode State (Credential) | ||
* | ||
* The state object is stored as a JWT, it is encoded and signed (by us) you can use it's content and you can add to it using appendToState | ||
* you can also check with us and we will tell you if it is still valid so you know if it has been tampered with prior to sending it back to us | ||
* (we'll check it again before creating a credential) | ||
* | ||
* This function is useful for two purposes | ||
* 1. you are able to access the values encoded into the state object | ||
* 2. you are able to pre-validate that the state has not been tampered with during the oAuth dance | ||
* | ||
* @param state encoded JWT string value | ||
* @returns array of elements dependent upon this credential | ||
*/ | ||
decodeState(state: string): Promise<{ | ||
serial: bigint; | ||
teamId: string; | ||
isValid: boolean; | ||
} & { | ||
[key: string]: string; | ||
}>; | ||
/** | ||
*  | ||
* | ||
* ### Append to State (Credential) | ||
* | ||
* The state object is stored as a JWT, it is encoded and signed (by us) you can use it's content and you can add to it you can | ||
* also check with us and we will tell you if it is still valid so you know if it has been tampered with prior to sending it back to us | ||
* (we'll check it again before creating a credential) | ||
* | ||
* ### __What do I do if I can't pass state:__ | ||
* Not all oAuth flows support a state variable, in this case we recommend you append the state as a querystring parameter of the RETURN_URL | ||
* which should in most cases be supported. If you are stuck please reach out to us ... we are here to help developers@doflo.com or join our | ||
* slack developer community | ||
* | ||
* ### __IMPORTANT:__ | ||
* you *should* only use this function before a hard redirect, if you must use it after a hard redirect you are responsible for sending | ||
* us our original state object, which we will validate prior to appending your new properties. | ||
* | ||
* ### __Implementation Details:__ | ||
* internally, to avoid collisions and systematic abuse, all keys are prepended with a random state specific value that will automatically | ||
* be removed by the decode state method | ||
* | ||
* ### __Example:__ | ||
* ```typescript | ||
* | ||
* // Passive | ||
* let newState = api.elements.credentials.appendToState({ valueA: 'test1', valueB: 'test2' }) | ||
* | ||
* // Active | ||
* let newState = api.elements.credentials.appendToState({ valueA: 'test1', valueB: 'test2' }, state) | ||
* | ||
* ``` | ||
* | ||
* @param parameters the map of parameters to add to the state | ||
* @param state the map of parameters to add to the state | ||
* @returns encoded JWT of the state which can be passed into oAuth flows | ||
*/ | ||
appendToState(parameters: Record<string, string>): Promise<string>; | ||
appendToState(parameters: Record<string, string>, state: string): Promise<string>; | ||
/** | ||
*  | ||
@@ -36,0 +108,0 @@ * |
@@ -128,7 +128,7 @@ /// <reference types="node" /> | ||
/** | ||
*  | ||
*  | ||
* | ||
* **credentialType** this is the FERN of the credential Type | ||
* **FERN** this is the (F)low (E)nterprise (R)esource (N)ame of the credential Type | ||
*/ | ||
credentialType: string; | ||
FERN: string; | ||
/** | ||
@@ -135,0 +135,0 @@ *  |
{ | ||
"name": "@doflo/flow-interfaces", | ||
"version": "1.16.8", | ||
"version": "1.16.9", | ||
"description": "Public Interfaces, Schemas, & GRPC Signatures for doFlo developers", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
311082
5020