mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 14:39:28 -07:00
Change enum values to strings
This commit is contained in:
parent
56b2722ce0
commit
e9fdeb0bf8
2 changed files with 13 additions and 16 deletions
24
src/enums.js
24
src/enums.js
|
@ -61,17 +61,17 @@ Object.freeze(Fetcher)
|
||||||
/**
|
/**
|
||||||
* Levels of access restriction for proof fetching
|
* Levels of access restriction for proof fetching
|
||||||
* @readonly
|
* @readonly
|
||||||
* @enum {number}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
const ProofAccess = {
|
const ProofAccess = {
|
||||||
/** Any HTTP request will work */
|
/** Any HTTP request will work */
|
||||||
GENERIC: 0,
|
GENERIC: 'generic',
|
||||||
/** CORS requests are denied */
|
/** CORS requests are denied */
|
||||||
NOCORS: 1,
|
NOCORS: 'nocors',
|
||||||
/** HTTP requests must contain API or access tokens */
|
/** HTTP requests must contain API or access tokens */
|
||||||
GRANTED: 2,
|
GRANTED: 'granted',
|
||||||
/** Not accessible by HTTP request, needs server software */
|
/** Not accessible by HTTP request, needs server software */
|
||||||
SERVER: 3
|
SERVER: 'server'
|
||||||
}
|
}
|
||||||
Object.freeze(ProofAccess)
|
Object.freeze(ProofAccess)
|
||||||
|
|
||||||
|
@ -91,28 +91,28 @@ Object.freeze(ProofFormat)
|
||||||
/**
|
/**
|
||||||
* Format of claim
|
* Format of claim
|
||||||
* @readonly
|
* @readonly
|
||||||
* @enum {number}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
const ClaimFormat = {
|
const ClaimFormat = {
|
||||||
/** `openpgp4fpr:123123123` */
|
/** `openpgp4fpr:123123123` */
|
||||||
URI: 0,
|
URI: 'uri',
|
||||||
/** `123123123` */
|
/** `123123123` */
|
||||||
FINGERPRINT: 1
|
FINGERPRINT: 'fingerprint'
|
||||||
}
|
}
|
||||||
Object.freeze(ClaimFormat)
|
Object.freeze(ClaimFormat)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How to find the claim inside the proof's JSON data
|
* How to find the claim inside the proof's JSON data
|
||||||
* @readonly
|
* @readonly
|
||||||
* @enum {number}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
const ClaimRelation = {
|
const ClaimRelation = {
|
||||||
/** Claim is somewhere in the JSON field's textual content */
|
/** Claim is somewhere in the JSON field's textual content */
|
||||||
CONTAINS: 0,
|
CONTAINS: 'contains',
|
||||||
/** Claim is equal to the JSON field's textual content */
|
/** Claim is equal to the JSON field's textual content */
|
||||||
EQUALS: 1,
|
EQUALS: 'equals',
|
||||||
/** Claim is equal to an element of the JSON field's array of strings */
|
/** Claim is equal to an element of the JSON field's array of strings */
|
||||||
ONEOF: 2
|
ONEOF: 'oneof'
|
||||||
}
|
}
|
||||||
Object.freeze(ClaimRelation)
|
Object.freeze(ClaimRelation)
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ const pattern = {
|
||||||
},
|
},
|
||||||
request: {
|
request: {
|
||||||
fetcher: _.isString,
|
fetcher: _.isString,
|
||||||
access: _.isInteger,
|
access: _.isString,
|
||||||
format: _.isString,
|
format: _.isString,
|
||||||
data: _.isObject,
|
data: _.isObject,
|
||||||
},
|
},
|
||||||
|
@ -52,9 +52,6 @@ const pattern = {
|
||||||
claim: (x) => {
|
claim: (x) => {
|
||||||
return _.isObject(x) || _.isArray(x)
|
return _.isObject(x) || _.isArray(x)
|
||||||
},
|
},
|
||||||
functions: (x) => {
|
|
||||||
return _.isObject(x) || _.isUndefined(x)
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
doipjs.claimDefinitions.list.forEach((claimDefName, i) => {
|
doipjs.claimDefinitions.list.forEach((claimDefName, i) => {
|
||||||
|
|
Loading…
Reference in a new issue