KeyFromSecret
KeyFromSecret( secret )
Description
The KeyFromSecret
function retrieves a key document given a key’s
secret string, or a token document given a token’s secret string.
Parameter
Argument | Type | Definition and Requirements |
---|---|---|
|
String |
The secret identifying a given key or token object. |
Returns
An object containing data returned by KeyFromSecret
operations. When
the secret string identifies a key, the object has the following fields:
Field Name | Field Type | Definition and Requirements |
---|---|---|
|
Reference |
The reference identifies the key that was retrieved. |
|
Long |
The timestamp associated with the most recent modification of the key. |
|
Reference |
A reference to the database the key is protecting. |
|
String |
The security role for this key. |
|
String |
The hash of the secret. |
When the secret string identifies a token, the object has the following fields:
Field Name | Field Type | Definition and Requirements |
---|---|---|
|
Reference |
The reference identifies the token instance that was retrieved. |
|
Long |
The timestamp associated with the most recent modification of the token instance. |
|
Reference |
A reference to the document representing the logged-in user (the one
passed to the |
|
String |
The hash of the secret. |
Examples
The query below retrieves a key by providing a given secret:
client.query(
q.KeyFromSecret('fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL')
)
.then((ret) => console.log(ret))
{ ref: Ref(id=181388638431478272, collection=Ref(id=keys)),
ts: 1509244535744675,
database: Ref(id=prydain, collection=Ref(id=databases)),
role: "server",
hashed_secret: "$2a$05$4kVnCWuJuaJYXz4ISHk1ge32/Otwya6QUVu.SSO7SbOn.fzbXLKFu" }
Was this article helpful?
We're sorry to hear that.
Tell us how we can improve!
documentation@fauna.com
Thank you for your feedback!