KeyFromSecret

KeyFromSecret( secret )
KeyFromSecret( secret )
f.KeyFromSecret( secret )
KeyFromSecret( secret )
key_from_secret( secret )
key_from_secret  secret
KeyFromSecret secret )
KeyFromSecret( secret )

Description

The KeyFromSecret function retrieves a key instance given a key’s secret string.

Parameter

Argument Type Definition and Requirements

secret

String

The secret (i.e password) associated with a given key object.

Returns

An object containing data returned by KeyFromSecret operations.

Field Name Field Type Definition and Requirements

ref

Reference

The reference identifies the key instance that was retrieved.

ts

Long

The timestamp associated with the creation of the key instance.

database

Reference

A reference to the database the key is protecting.

role

String

The security role for this key.

hashed_secret

String

The hash of the secret.

Examples

The query below retrieves a key instance by providing a given secret.

curl https://db.fauna.com/ \
    -u fnAChGwBacACAEZtRZFDXpyjIvq-sln34m-va4Km: \
    -d '{ "key_from_secret": "fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL" }'
client.Query(
  KeyFromSecret("fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL"));
System.out.println(
    client.query(
      KeyFromSecret(
        Value("fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL")
      )
    ).get());
result, _ := client.Query(
    f.KeyFromSecret("fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL"),
)

fmt.Println(result)
client.query(
  KeyFromSecret("fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL"))
client.query(
  q.key_from_secret("fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL"))
$client.query do
  key_from_secret 'fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL'
end
client.query(
    KeyFromSecret(
        "fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL"
    )
)
client.query(q.KeyFromSecret("fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL"))
  .then((ret) => console.log(ret));
HTTP/1.1 200 OK
{
  "resource": {
    "ref": { "@ref": "keys/181388638431478272" },
    "class": { "@ref": "keys" },
    "ts": 1509244535744675,
    "database": { "@ref": "databases/prydain" },
    "role": "server",
    "hashed_secret": "$2a$05$4kVnCWuJuaJYXz4ISHk1ge32/Otwya6QUVu.SSO7SbOn.fzbXLKFu"
  }
}
{
  "ref": { "@ref": "keys/181388638431478272" },
  "class": { "@ref": "keys" },
  "ts": 1509244535744675,
  "database": { "@ref": "databases/prydain" },
  "role": "server",
  "hashed_secret": "$2a$05$4kVnCWuJuaJYXz4ISHk1ge32/Otwya6QUVu.SSO7SbOn.fzbXLKFu"
}
{
  ref: ref(id = "200886770939724288", class = ref(id = "keys")),
  ts: 1527839403941254,
  database: ref(id = "prydain", class = ref(id = "databases")),
  role: "server",
  hashed_secret: "$2a$05$Gi4GT2NU2LGjb7LuoNAvue/eScTIkaEk1xeBLDOZSCiX2seM/zgDS"
}
map[ref:{181388638431478272 0xc42023fc00 <nil>} ts:1509244535744675 database:{prydain 0xc42023fda0 <nil>} role:server hashed_secret:$2a$05$4kVnCWuJuaJYXz4ISHk1ge32/Otwya6QUVu.SSO7SbOn.fzbXLKFu]
{
  "ref": { "@ref": "keys/181388638431478272" },
  "class": { "@ref": "keys" },
  "ts": 1509244535744675,
  "database": { "@ref": "databases/prydain" },
  "role": "server",
  "hashed_secret": "$2a$05$4kVnCWuJuaJYXz4ISHk1ge32/Otwya6QUVu.SSO7SbOn.fzbXLKFu"
}
{
  "ref": { "@ref": "keys/181388638431478272" },
  "class": { "@ref": "keys" },
  "ts": 1509244535744675,
  "database": { "@ref": "databases/prydain" },
  "role": "server",
  "hashed_secret": "$2a$05$4kVnCWuJuaJYXz4ISHk1ge32/Otwya6QUVu.SSO7SbOn.fzbXLKFu"
}
{
  "ref": { "@ref": "keys/181388638431478272" },
  "class": { "@ref": "keys" },
  "ts": 1509244535744675,
  "database": { "@ref": "databases/prydain" },
  "role": "server",
  "hashed_secret": "$2a$05$4kVnCWuJuaJYXz4ISHk1ge32/Otwya6QUVu.SSO7SbOn.fzbXLKFu"
}
{
  "ref": { "@ref": "keys/181388638431478272" },
  "class": { "@ref": "keys" },
  "ts": 1509244535744675,
  "database": { "@ref": "databases/prydain" },
  "role": "server",
  "hashed_secret": "$2a$05$4kVnCWuJuaJYXz4ISHk1ge32/Otwya6QUVu.SSO7SbOn.fzbXLKFu"
}
{ ref: Ref(id=181388638431478272, class=Ref(id=keys)),
  ts: 1509244535744675,
  database: Ref(id=prydain, class=Ref(id=databases)),
  role: "server",
  hashed_secret: "$2a$05$4kVnCWuJuaJYXz4ISHk1ge32/Otwya6QUVu.SSO7SbOn.fzbXLKFu" }