Skip to content
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

RFC: Definition of Challenge / Verification structure #34

Open
coolaj86 opened this issue Aug 25, 2021 · 0 comments
Open

RFC: Definition of Challenge / Verification structure #34

coolaj86 opened this issue Aug 25, 2021 · 0 comments

Comments

@coolaj86
Copy link
Contributor

coolaj86 commented Aug 25, 2021

This is for the structure that keeps the state for verification challenges - such as sending a code via email or phone.

I would prefer to define the challenge structure as "opaque, just call JSON.stringify and save it as a string"... but since this will go in databases and whatnot, it seems prudent to be more explicit than that.

/**
 * @typedef Challenge
 * @property {number} attempts
 * @property {string} secret // TODO rename to code
 * @property {string} ordered_at
 * @property {string} ordered_by // TODO rename _agent
 * @property {string} ordered_ip
 * @property {string} verified_at // RFC3339 / ISO Timestamp
 * @property {string} verified_by
 * @property {string} verified_ip
 * @property {string} exchanged_at
 * @property {string} exchanged_by
 * @property {string} exchanged_ip
 * @property {string} type // such as 'email' or 'tel'
 * @property {string} value // such as '[email protected]'
 * @property {string} deleted_at
 */
{
  "attempts": 3,
  "secret": "xxxxxx",
  "ordered_at": "2021-08-10T13:59:59.000",
  "ordered_by": "Mozilla Firefox 1.2.3 like Gecko Windows 1.2",
  "ordered_ip": "6.54.321.9",
  "verified_at": new Date().toISOString(),
  "verified_by": "Mozilla Firefox 1.2.3 like Gecko Windows 1.2",
  "verified_ip": "6.54.321.9",
  "exchanged_at": "",
  "exchanged_by": "",
  "exchanged_ip": "",
  "type": "email", // or "tel",
  "value": "[email protected]"
}

This may also need an expires_at and ordered_ could be instead created_.

@coolaj86 coolaj86 changed the title document store.set JSON RFC: Challenge structure, defined Aug 25, 2021
@coolaj86 coolaj86 changed the title RFC: Challenge structure, defined RFC: Definition of Challenge / Verification structure Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant