Class LinkSession
java.lang.Object
lol.trq.alts.vault.LinkSession
Owner device linking (AVP SPEC 11.6): how a second owner device gets the
OwnerIdentity without the
phrase being typed. No host takes part; the request and the grant travel out of band.
- The new device calls
start()and showsrequest()andconfirmationCode(). - The existing owner device reads the request and calls
approve(OwnerIdentity, LinkRequest, Predicate), which shows the code it computes and continues only if the owner confirms it matches the one on the new device. - The new device passes the grant to
finish(LinkGrant)and has the owner identity.
A session holds an ephemeral private key until it finishes; toString() shows nothing of it.
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic LinkGrantapprove(OwnerIdentity owner, LinkRequest request, Predicate<String> confirm) The existing owner device's side: handsconfirmthe code this device computes for the request and, only if it answers true (the owner confirmed it matches the code on the new device), wraps the owner's entropy to the request's key underavp/owner-link/v1.The 6-digit code to show on this device; the existing device shows the same one.Opens the grant with this session's ephemeral key, which is then destroyed.request()The request to carry to the existing owner device.static LinkSessionstart()Starts a session on the new device, with a fresh ephemeral key.toString()Names the type and the 6-digitconfirmationCode(), which this device shows anyway and which is no secret; never the ephemeral private key and never the request.
-
Method Details
-
start
Starts a session on the new device, with a fresh ephemeral key.- Returns:
- the session
- Since:
- 1.0.0
-
request
The request to carry to the existing owner device.- Returns:
- the request
- Since:
- 1.0.0
-
confirmationCode
The 6-digit code to show on this device; the existing device shows the same one.- Returns:
- the code
- Since:
- 1.0.0
-
finish
Opens the grant with this session's ephemeral key, which is then destroyed. A session finishes once.- Parameters:
grant- the grant from the existing owner device- Returns:
- the owner identity
- Throws:
AltsException- of kindCRYPTOif the grant was not made for this session's request, andINVALID_INPUTif the session already finished- Since:
- 1.0.0
-
approve
public static LinkGrant approve(OwnerIdentity owner, LinkRequest request, Predicate<String> confirm) The existing owner device's side: handsconfirmthe code this device computes for the request and, only if it answers true (the owner confirmed it matches the code on the new device), wraps the owner's entropy to the request's key underavp/owner-link/v1.- Parameters:
owner- the owner identity on this devicerequest- the new device's requestconfirm- shows the code to the owner and answers whether they confirmed the two match- Returns:
- the grant to carry back
- Throws:
AltsException- of kindDECLINEDif the owner did not confirm; nothing is wrapped. Aconfirmthat throws is not caught: its exception reaches the caller as it is, and nothing is wrapped- Since:
- 1.0.0
-
toString
Names the type and the 6-digitconfirmationCode(), which this device shows anyway and which is no secret; never the ephemeral private key and never the request.
-