İstemci Kütüphaneleri
Github sayfası onetime-ruby Delano tarafından (güncelleme 2024-06-09)
Kullanım Örneği
Section titled “Kullanım Örneği”require 'onetime/api'
api = Onetime::API.new('YOUR_EMAIL', 'YOUR_OTS_APIKEY')options = { secret: 'Jazz, jazz and more jazz.', recipient: 'example@onetimesecret.com', ttl: 7200}
ret = api.post('/share', options)puts ret['secret_key']Python
Section titled “Python”Github sayfası - onetimesecret-cli slashpass tarafından (eklendi 2021-07-08)
Kullanım Örneği
Section titled “Kullanım Örneği”from onetimesecret import OneTimeSecretCli
cli = OneTimeSecretCli(ONETIMESECRET_USER, ONETIMESECRET_KEY)cli.create_link("secret") # https://onetimesecret.com/secret/xxxxxxxxxxx gibi bir bağlantı döndürürGithub sayfası - py_onetimesecret Vladislav Stepanov tarafından (eklendi 2012-06-26)
Kullanım Örneği
Section titled “Kullanım Örneği”from onetimesecret import OneTimeSecret
o = OneTimeSecret("YOUR_EMAIL", "YOUR_OTS_APIKEY")secret = o.share(u"test")
print o.retrieve_secret(secret["secret_key"])# {u'secret_key': u'dtr7ixukiolpx1i4i87kahmhyoy2q65',# u'value': u'test'}CPAN’da Net::OneTimeSecret Kyle Dawkins tarafından (eklendi 2012-01-06)
Kullanım Örneği
Section titled “Kullanım Örneği”#!/usr/bin/env perl
use Net::OneTimeSecret;
# Not: bunun çalışması için bunları kendinizinkilerle değiştirin!my $customerId = 'YOUR_EMAIL';my $testApiKey = 'YOUR_OTS_APIKEY';
my $api = Net::OneTimeSecret->new( $customerId, $testApiKey );my $result = $api->shareSecret( 'Jazz, jazz and more jazz.', passphrase => 'thepassword', recipient => 'kyle@shoffle.com', ttl => 7200, );printf( "%s\n", $result->{secret_key} );
my $secret = $api->retrieveSecret( $result->{secret_key}, passphrase => "thepassword" );printf( "%s\n", $secret->{value} );Github sayfası - onetime-java Marcin Pawlowski tarafından (eklendi 2014-05-22)
Kullanım Örneği
Section titled “Kullanım Örneği”OneTimeSecret ots = new OneTimeSecretRestImpl( "https://path/to/ots/instance", "ots-username", "ots-apikey");
GenerateResponse generateResponse = ots.generate( new GenerateRequest.Builder() .withPassphrase("supersecret") .build());
RetrieveResponse retrieveResponse = ots.retrieve( new RetrieveRequest.Builder() .withSecretKey(shareResponse.getSecretKey()) .withPassphrase("supersecret") .build());
assertEquals(generateResponse.getValue(), retrieveResponse.getValue());Github sayfası - OneTimeSharp Vladislav Stepanov tarafından (eklendi 2014-05-29)
Kullanım Örneği
Section titled “Kullanım Örneği”# OneTimeSharp'ı .NET (4.0+) veya Mono (2.10.8+) ile uyumlu projelerinizde kullanabilirsiniz.using VStepanov.OneTimeSharp;
class Test{ static void Main(string[] args) { var ots = new OneTimeSecret("YOUR_EMAIL", "YOUR_OTS_APIKEY");
var generated = ots.GenerateSecret();
Console.WriteLine(generated.Value); // LR*?us*A(UT*
Console.WriteLine(generated.SecretKey); // ikzx3m77j5by8411cg5lk5fvfylvl0i Console.WriteLine(ots.GetSecretLink(generated)); // https://onetimesecret.com/secret/ikzx3m77j5by8411cg5lk5fvfylvl0i
var shared = ots.ShareSecret("Hello, OTS!");
Console.WriteLine(shared.MetadataKey); // kd6rgsucl98qbgu9eavjq4k5sdxsom0 Console.WriteLine(ots.GetMetadataLink(shared)); // https://onetimesecret.com/private/kd6rgsucl98qbgu9eavjq4k5sdxsom0 }}Github sayfası - onetimesecret Corbalt tarafından (eklendi 2021-12-10)
Kullanım Örneği
Section titled “Kullanım Örneği”import ots "github.com/corbaltcode/go-onetimesecret"
client := ots.Client{ Username: "user@example.com", Key: "my api key",}
metadata, err := client.Put("the launch codes", "passphrase", 0, "")if err != nil { // hatayı işle}
secret, err := client.Get(metadata.SecretKey, "passphrase")if err != nil { // hatayı işle}
// "the launch codes" yazdırırprint(secret)CLI Olarak Kullanım Örneği
Section titled “CLI Olarak Kullanım Örneği”$ go install github.com/corbaltcode/go-onetimesecret/cmd/ots@latest
$ ots put 'what is essential is invisible to the eye'hdjk6p0ozf61o7n6pbaxy4in8zuq7sm ifipvdpeo8oy6r8ryjbu8y7rhm9kty9
$ ots get hdjk6p0ozf61o7n6pbaxy4in8zuq7smwhat is essential is invisible to the eye
$ ots genrVjbS$twCJkS 4nwhy7v4fnabayqc5auv4ogh0nfr20 flsdlaun6hwczqu9utmc0vts5xj9xu1
$ ots burn flsdlaun6hwczqu9utmc0vts5xj9xu1flsdlaun6hwczqu9utmc0vts5xj9xu1Go (lib)
Section titled “Go (lib)”Github sayfası Emídio Neto tarafından (eklendi 2024-06-09)
Kullanım Örneği
Section titled “Kullanım Örneği”// Yeni bir istemci oluşturclient := ots.NewClient( WithUsername("otsuser@domain.com"), WithApiKey("xxxxxxxx"),)
// Context ile istek gönderctx := context.Background()response, err := client.GetStatus(ctx)if err != nil { panic(err)}
fmt.Println(response.Status)PowerShell
Section titled “PowerShell”Github sayfası - OneTimeSecret Craig Gumbley tarafından (güncelleme 2017-04-28)
Kullanım Örneği
Section titled “Kullanım Örneği”# PowerShell galerisinden yükleInstall-Module -Name OneTimeSecret -Scope CurrentUser
# Bağlantı bilgilerini ayarlaSet-OTSAuthorizationToken -Username user@mail.com -APIKey xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# Yeni bir paylaşılan gizli mesaj oluşturNew-OTSSharedSecret -Secret "Very Secret" -Passphrase 1234 -Recipient user@mail.com
# Bir gizli mesaj alGet-OTSSecret -SecretKey qqevnp70b4uoiax4knzhwlhros6ne7x -Passphrase 1234
# Mevcut tüm fonksiyonları görüntüleGet-Command -Module OneTimeSecret | Select NameGithub sayfası - OneTimeSecret-bash Eric Engstrom tarafından (güncelleme 2018-12-19)
Betik API Olarak Kullanım Örneği
Section titled “Betik API Olarak Kullanım Örneği”# anonim kullanım için kaynak (anonim oluşturulan gizli mesajlar)source ots.bash
# veya, belirli kimlik doğrulama kimlik bilgileriyle kaynakAPIUSER="USERNAME"APIKEY="APIKEY"source ots.bash -u $APIUSER -k $APIKEY
# sunucu durumunu kontrol etots_status
# bir gizli mesaj oluştur ve URL'yi geri alURL=$(echo "secret" | ots_share)
# HEREDOC aracılığıyla çok satırlı bir gizli mesaj paylaş.URL=$(ots_share <<-EOF This is a Secret ... on multiple linesEOF)
# paylaş veya oluştur'a seçenekler geçir.URL=$(ots_share ttl=600 \ passphrase="shared-secret" \ recipient="someone@somewhere.com" <<< "SECRET")
# gizli mesaj verilerini getirlocal DATA="$(ots_retrieve "$URL")"
# yeni bir gizli mesaj paylaş/oluştur ve özel meta veri anahtarını geri allocal KEY=$(ots_metashare <<< "SECRET")local KEY=$(ots_metagenerate)
# yakın zamanda oluşturulan özel meta veri anahtarlarının bir listesini al.# bunun geçerli kimlik doğrulama kimlik bilgileri gerektirdiğini unutmayınlocal -a RECENT=( $(ots_recent) )
# özel anahtarı verilen bir gizli mesajın mevcut durumunu kontrol etots_state $KEY
# özel anahtarı verilen bir gizli mesajı yakots_burn $KEYCLI Olarak Kullanım Örneği
Section titled “CLI Olarak Kullanım Örneği”# Bir gizli mesaj paylaş (stdin'den)./ots shareSECRET^D
# Bir gizli mesaj paylaş (HEREDOC aracılığıyla)./ots share <<-EOF This is a multi-line secret via HEREDOC. Something else goes here.EOF
# Bir gizli mesaj al/al:./ots get <key|url>./ots retrieve <key|url>
### CLI Olarak Kullanım Örneği
```bash$ ots burn flsdlaun6hwczqu9utmc0vts5xj9xu1flsdlaun6hwczqu9utmc0vts5xj9xu1